Skip to content

Commit

Permalink
#803:
Browse files Browse the repository at this point in the history
* add a timeout debug logging category
* reset timer on window focus
* reset timer when the mouse is moved over the window whilst it has focus

git-svn-id: https://xpra.org/svn/Xpra/trunk@8679 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 18, 2015
1 parent 5f2625d commit 2c84034
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/xpra/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def set_global_logging_handler(h):
"paint", "platform", "import",
"posix",
"keyboard", "pointer", "focus", "metadata", "state", "screen",
"server", "command",
"server", "command", "timeout",
"shadow",
"test",
"x11", "bindings", "core", "randr", "ximage", "focus", "tray", "xor"]
Expand Down
3 changes: 3 additions & 0 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,9 @@ def _process_focus(self, proto, packet):
ss = self._server_sources.get(proto)
if ss:
self._focus(ss, wid, modifiers)
#if the client focused one of our windows, count this as a user event:
if wid>0:
ss.user_event()

def _process_layout(self, proto, packet):
layout, variant = packet[1:3]
Expand Down
4 changes: 4 additions & 0 deletions src/xpra/server/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
cursorlog = Logger("cursor")
metalog = Logger("metadata")
printlog = Logger("printing")
timeoutlog = Logger("timeout")


from xpra.server import ClientException
Expand Down Expand Up @@ -442,17 +443,20 @@ def resume(self, ui, wd):


def user_event(self):
timeoutlog("user_event()")
self.last_user_event = time.time()
self.schedule_idle_timeout()

def schedule_idle_timeout(self):
timeoutlog("schedule_idle_timeout() idle_timer=%s, idle_timeout=%s", self.idle_timer, self.idle_timeout)
if self.idle_timer:
self.source_remove(self.idle_timer)
self.idle_timer = None
if self.idle_timeout>0:
self.idle_timer = self.timeout_add(self.idle_timeout*1000, self.idle_timedout)

def idle_timedout(self):
timeoutlog("idle_timedout() callback=%s", self.idle_timeout_cb)
self.idle_timeout_cb(self)
self.schedule_idle_timeout()

Expand Down
2 changes: 2 additions & 0 deletions src/xpra/x11/x11_server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ def _process_mouse_common(self, proto, wid, pointer, modifiers):
with xswallow:
self._move_pointer(wid, pointer)
ss.make_keymask_match(modifiers)
if wid==self.get_focus():
ss.user_event()

def _process_button_action(self, proto, packet):
ss = self._server_sources.get(proto)
Expand Down

0 comments on commit 2c84034

Please sign in to comment.