allow_remote_control should be per window not per child

This commit is contained in:
Kovid Goyal 2022-08-15 21:32:14 +05:30
parent 1619687d1d
commit 814dd8a275
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 7 deletions

View File

@ -223,10 +223,8 @@ class Child:
stdin: Optional[bytes] = None, stdin: Optional[bytes] = None,
env: Optional[Dict[str, str]] = None, env: Optional[Dict[str, str]] = None,
cwd_from: Optional['CwdRequest'] = None, cwd_from: Optional['CwdRequest'] = None,
allow_remote_control: bool = False,
is_clone_launch: str = '', is_clone_launch: str = '',
): ):
self.allow_remote_control = allow_remote_control
self.is_clone_launch = is_clone_launch self.is_clone_launch = is_clone_launch
self.argv = list(argv) self.argv = list(argv)
if cwd_from: if cwd_from:

View File

@ -366,7 +366,6 @@ class Tab: # {{{
cwd_from: Optional[CwdRequest] = None, cwd_from: Optional[CwdRequest] = None,
cwd: Optional[str] = None, cwd: Optional[str] = None,
env: Optional[Dict[str, str]] = None, env: Optional[Dict[str, str]] = None,
allow_remote_control: bool = False,
is_clone_launch: str = '', is_clone_launch: str = '',
) -> Child: ) -> Child:
check_for_suitability = True check_for_suitability = True
@ -416,7 +415,7 @@ class Tab: # {{{
pwid = platform_window_id(self.os_window_id) pwid = platform_window_id(self.os_window_id)
if pwid is not None: if pwid is not None:
fenv['WINDOWID'] = str(pwid) fenv['WINDOWID'] = str(pwid)
ans = Child(cmd, cwd or self.cwd, stdin, fenv, cwd_from, allow_remote_control=allow_remote_control, is_clone_launch=is_clone_launch) ans = Child(cmd, cwd or self.cwd, stdin, fenv, cwd_from, is_clone_launch=is_clone_launch)
ans.fork() ans.fork()
return ans return ans
@ -444,13 +443,14 @@ class Tab: # {{{
is_clone_launch: str = '', is_clone_launch: str = '',
) -> Window: ) -> Window:
child = self.launch_child( child = self.launch_child(
use_shell=use_shell, cmd=cmd, stdin=stdin, cwd_from=cwd_from, cwd=cwd, env=env, allow_remote_control=allow_remote_control, use_shell=use_shell, cmd=cmd, stdin=stdin, cwd_from=cwd_from, cwd=cwd, env=env,
is_clone_launch=is_clone_launch is_clone_launch=is_clone_launch
) )
window = Window( window = Window(
self, child, self.args, override_title=override_title, self, child, self.args, override_title=override_title,
copy_colors_from=copy_colors_from, watchers=watchers copy_colors_from=copy_colors_from, watchers=watchers,
) )
window.allow_remote_control = allow_remote_control
# Must add child before laying out so that resize_pty succeeds # Must add child before laying out so that resize_pty succeeds
get_boss().add_child(window) get_boss().add_child(window)
self._add_window(window, location=location, overlay_for=overlay_for, overlay_behind=overlay_behind) self._add_window(window, location=location, overlay_for=overlay_for, overlay_behind=overlay_behind)

View File

@ -462,6 +462,7 @@ global_watchers = GlobalWatchers()
class Window: class Window:
window_custom_type: str = '' window_custom_type: str = ''
allow_remote_control: bool = False
def __init__( def __init__(
self, self,
@ -495,7 +496,6 @@ class Window:
self.default_title = os.path.basename(child.argv[0] or appname) self.default_title = os.path.basename(child.argv[0] or appname)
self.child_title = self.default_title self.child_title = self.default_title
self.title_stack: Deque[str] = deque(maxlen=10) self.title_stack: Deque[str] = deque(maxlen=10)
self.allow_remote_control = child.allow_remote_control
self.id: int = add_window(tab.os_window_id, tab.id, self.title) self.id: int = add_window(tab.os_window_id, tab.id, self.title)
self.margin = EdgeWidths() self.margin = EdgeWidths()
self.padding = EdgeWidths() self.padding = EdgeWidths()