Skip to content

Commit

Permalink
#1838: hide calls to clear_keys_pressed behind the more generic reset…
Browse files Browse the repository at this point in the history
…_focus stub method on the server mixins - so we can run the focus code without having the InputServer mixin

git-svn-id: https://xpra.org/svn/Xpra/trunk@19724 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 26, 2018
1 parent e74cfec commit a76ebe1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/xpra/server/mixins/input_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def cleanup(self):
self.clear_keys_pressed()
self.keyboard_config = None

def reset_focus(self):
self.clear_keys_pressed()

def reset_state(self):
self.clear_keys_pressed()

Expand Down
7 changes: 7 additions & 0 deletions src/xpra/server/mixins/stub_server_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def init(self, _opts):
def init_state(self):
pass


"""
Called when we reset the focus.
"""
def reset_focus(self):
pass

"""
Called when the last client has exited,
so we can reset things to their original state.
Expand Down
6 changes: 6 additions & 0 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,12 @@ def set_ui_driver(self, source):
c.set_session_driver(self, source)


def reset_focus(self):
for c in SERVER_BASES:
if c!=ServerCore:
c.reset_focus(self)


def get_all_protocols(self):
return list(self._potential_protocols) + list(self._server_sources.keys())

Expand Down
3 changes: 2 additions & 1 deletion src/xpra/x11/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,8 @@ def reset_focus():
if self._wm:
toplevel = self._wm.get_property("toplevel")
focuslog("reset_focus() %s / %s had focus (toplevel=%s)", self._has_focus, had_focus, toplevel)
self.clear_keys_pressed()
#this will call clear_keys_pressed() if the server is an InputServer:
self.reset_focus()
# FIXME: kind of a hack:
self._has_focus = 0
#toplevel may be None during cleanup!
Expand Down

0 comments on commit a76ebe1

Please sign in to comment.