Skip to content

Commit

Permalink
minor tweaks:
Browse files Browse the repository at this point in the history
* use signal instead of empty method override (cleaner)
* device logging name cleanup
* add some win32 events we can ignore (screen related but undocumented?)

git-svn-id: https://xpra.org/svn/Xpra/trunk@11105 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 2, 2015
1 parent 94b5339 commit aa2dcf0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
13 changes: 6 additions & 7 deletions src/xpra/client/gtk_base/gtk_client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from xpra.os_util import memoryview_to_bytes
from xpra.util import AdHocStruct, bytestostr, typedict, WORKSPACE_UNSET, WORKSPACE_ALL, WORKSPACE_NAMES
from xpra.gtk_common.gobject_compat import import_gtk, import_gdk, import_cairo, import_pixbufloader, get_xid
from xpra.gtk_common.gobject_util import no_arg_signal
from xpra.gtk_common.gtk_util import get_pixbuf_from_data, get_default_root_window, is_realized, WINDOW_POPUP, WINDOW_TOPLEVEL
from xpra.gtk_common.keymap import KEY_TRANSLATIONS
from xpra.client.client_window_base import ClientWindowBase
Expand Down Expand Up @@ -114,6 +115,10 @@ class GTKKeyEvent(AdHocStruct):

class GTKClientWindowBase(ClientWindowBase, gtk.Window):

__gsignals__ = {
"state-updated" : no_arg_signal,
}

#maximum size of the actual window:
MAX_VIEWPORT_DIMS = 16*1024, 16*1024
#maximum size of the backing pixel buffer:
Expand Down Expand Up @@ -379,7 +384,7 @@ def tell_server():
self.timeout_add(delay, tell_server)
else:
self.process_map_event()
self.after_window_state_updated()
self.emit("state-updated")
#if we have state updates, send them back to the server using a configure window packet:
if not self._client.window_configure_skip_geometry:
#we can't do it: the server can't handle configure packets for OR windows!
Expand All @@ -391,12 +396,6 @@ def send_updated_window_state():
if self._window_state:
self.timeout_add(25, send_updated_window_state)

def after_window_state_updated(self):
#this is here to make it easier to hook some code
#after window_state_updated() has been called
#(used by the win32 platform workarounds)
pass


def set_command(self, command):
if not HAS_X11_BINDINGS:
Expand Down
5 changes: 2 additions & 3 deletions src/xpra/gtk_common/gtk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,10 @@ def get_setting(key):
for i, d in enumerate(devices):
info[dk+"[%s]" % i] = d.get_name()
else:
dk = "devices"
devices = display.list_devices()
info[dk] = len(devices)
info["devices"] = len(devices)
for i, d in enumerate(devices):
info[dk+"[%s]" % i] = d.get_name()
info["device[%s]" % i] = d.get_name()
return info


Expand Down
13 changes: 5 additions & 8 deletions src/xpra/platform/win32/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,10 @@ def set_decorated(self, decorated):
self.__set_decorated(decorated) #call the original saved method
self.fixup_window_style()

def after_window_state_updated(self, *args):
""" override method which ensures that we call
fixup_window_style whenever the window state changes """
log("after_window_state_updated%s", args)
self.__after_window_state_updated() #call the original saved method
self.fixup_window_style()
def window_state_updated(window):
""" fixup_window_style whenever the window state changes """
log("window_state_updated(%s)", window)
fixup_window_style(window)

def apply_maxsize_hints(window, hints):
""" extracts the max-size hints from the hints,
Expand Down Expand Up @@ -303,8 +301,7 @@ def add_window_hooks(window):
window.set_decorated = types.MethodType(set_decorated, window, type(window))
#override after_window_state_updated so we can re-add the missing style options
#(somehow doing it from on_realize which calls add_window_hooks is not enough)
window.__after_window_state_updated = window.after_window_state_updated
window.after_window_state_updated = types.MethodType(after_window_state_updated, window)
window.connect("state-updated", window_state_updated)
#call it at least once:
window.fixup_window_style()

Expand Down
2 changes: 2 additions & 0 deletions src/xpra/platform/win32/win32_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
WM_WTSSESSION_CHANGE : "WM_WTSSESSION_CHANGE",
WM_DWMNCRENDERINGCHANGED : "WM_DWMNCRENDERINGCHANGED",
800 : "screen background changed", #I can't find this definition anywhere
0xc1b8 : "something screen related", #no idea where this is defined, happens when we add or remove screens?
0xc0aa : "something screen related", #no idea where this is defined, happens when we add or remove screens?
}
LOG_EVENTS = {
win32con.WM_POWERBROADCAST : "WM_POWERBROADCAST: power management event",
Expand Down

0 comments on commit aa2dcf0

Please sign in to comment.