Skip to content

Commit

Permalink
#980: listen for WM_MOVE events and trigger the window reinit from th…
Browse files Browse the repository at this point in the history
…ere too

git-svn-id: https://xpra.org/svn/Xpra/trunk@10614 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 11, 2015
1 parent f58dd92 commit 1cb192a
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/xpra/platform/win32/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ def __init__(self, client, opts):
if el:
el.add_event_callback(win32con.WM_ACTIVATEAPP, self.activateapp)
el.add_event_callback(win32con.WM_POWERBROADCAST, self.power_broadcast_event)
el.add_event_callback(win32con.WM_MOVE, self.wm_move)
except Exception as e:
log.error("cannot register focus and power callbacks: %s", e)

Expand All @@ -541,21 +542,31 @@ def cleanup(self):
log("ClientExtras.cleanup() ended")
#self.client = None

def wm_move(self, wParam, lParam):
c = self.client
log("WM_MOVE: %s/%s client=%s", wParam, lParam, c)
if c:
#this is not really a screen size change event,
#but we do want to process it as such (see window reinit code)
c.screen_size_changed()

def activateapp(self, wParam, lParam):
log("WM_ACTIVATEAPP: %s/%s client=%s", wParam, lParam, self.client)
if wParam==0 and self.client:
c = self.client
log("WM_ACTIVATEAPP: %s/%s client=%s", wParam, lParam, c)
if wParam==0 and c:
#our app has lost focus
self.client.update_focus(0, False)
c.update_focus(0, False)

def power_broadcast_event(self, wParam, lParam):
log("WM_POWERBROADCAST: %s/%s client=%s", POWER_EVENTS.get(wParam, wParam), lParam, self.client)
c = self.client
log("WM_POWERBROADCAST: %s/%s client=%s", POWER_EVENTS.get(wParam, wParam), lParam, c)
#maybe also "PBT_APMQUERYSUSPEND" and "PBT_APMQUERYSTANDBY"?
if wParam==win32con.PBT_APMSUSPEND and self.client:
self.client.suspend()
if wParam==win32con.PBT_APMSUSPEND and c:
c.suspend()
#According to the documentation:
#The system always sends a PBT_APMRESUMEAUTOMATIC message whenever the system resumes.
elif wParam==win32con.PBT_APMRESUMEAUTOMATIC and self.client:
self.client.resume()
elif wParam==win32con.PBT_APMRESUMEAUTOMATIC and c:
c.resume()

def setup_console_event_listener(self, enable=True):
try:
Expand Down

0 comments on commit 1cb192a

Please sign in to comment.