Skip to content

Commit

Permalink
#907: move _NET_MOVERESIZE_WINDOW to WindowModel since it requires a …
Browse files Browse the repository at this point in the history
…corral window (at least for now), uncomment redundant X11 properties and let the initialisation code remove the duplicate handlers

git-svn-id: https://xpra.org/svn/Xpra/trunk@10989 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 23, 2015
1 parent 54c1b3b commit 3ea03ff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 28 deletions.
40 changes: 12 additions & 28 deletions src/xpra/x11/gtk2/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from xpra.util import WORKSPACE_UNSET, WORKSPACE_ALL
from xpra.x11.gtk_x11.prop import prop_set, prop_get
from xpra.x11.gtk2.models.core import CoreX11WindowModel, gobject, xswallow, gdk
from xpra.x11.bindings.window_bindings import X11WindowBindings, constants #@UnresolvedImport
from xpra.x11.gtk2.gdk_bindings import get_pywindow, get_pyatom, calc_constrained_size #@UnresolvedImport
from xpra.x11.bindings.window_bindings import X11WindowBindings, constants #@UnresolvedImport
from xpra.x11.gtk2.gdk_bindings import get_pywindow, get_pyatom #@UnresolvedImport
from xpra.x11.gtk2.models.size_hints_util import sanitize_size_hints

from xpra.log import Logger
Expand Down Expand Up @@ -185,17 +185,17 @@ class BaseWindowModel(CoreX11WindowModel):
"_NET_WM_FULLSCREEN_MONITORS",
"_NET_WM_BYPASS_COMPOSITOR",
"_NET_WM_STRUT",
#redundant as it uses the same function as _NET_WM_STRUT:
#"_NET_WM_STRUT_PARTIAL",
"_NET_WM_STRUT_PARTIAL", #redundant as it uses the same handler as _NET_WM_STRUT
"_NET_WM_WINDOW_OPACITY",
"WM_HINTS",
"_GTK_APP_MENU_OBJECT_PATH",
#redundant as they use the same function as _GTK_APP_MENU_OBJECT_PATH:
#"_GTK_APPLICATION_ID",
#"_GTK_UNIQUE_BUS_NAME",
#"_GTK_APPLICATION_OBJECT_PATH",
#"_GTK_APP_MENU_OBJECT_PATH",
#"_GTK_WINDOW_OBJECT_PATH",
#(but the code will make sure we only call it once during setup)
"_GTK_APPLICATION_ID",
"_GTK_UNIQUE_BUS_NAME",
"_GTK_APPLICATION_OBJECT_PATH",
"_GTK_APP_MENU_OBJECT_PATH",
"_GTK_WINDOW_OBJECT_PATH",
]
_DEFAULT_NET_WM_ALLOWED_ACTIONS = ["_NET_WM_ACTION_%s" % x for x in (
"CLOSE", "MOVE", "RESIZE", "FULLSCREEN",
Expand Down Expand Up @@ -720,24 +720,8 @@ def update_wm_state(prop):
log("_NET_WM_FULLSCREEN_MONITORS: monitors=%s", monitors)
prop_set(self.client_window, "_NET_WM_FULLSCREEN_MONITORS", ["u32"], monitors)
return True
elif event.message_type=="_NET_MOVERESIZE_WINDOW":
#TODO: honour gravity, show source indication
geom = self.corral_window.get_geometry()
x, y, w, h, _ = geom
if event.data[0] & 0x100:
x = event.data[1]
if event.data[0] & 0x200:
y = event.data[2]
if event.data[0] & 0x400:
w = event.data[3]
if event.data[0] & 0x800:
h = event.data[4]
#honour hints:
hints = self.get_property("size-hints")
w, h, _, _ = calc_constrained_size(w, h, hints)
geomlog("_NET_MOVERESIZE_WINDOW on %s (data=%s, current geometry=%s, new geometry=%s)", self, event.data, geom, (x,y,w,h))
with xswallow:
X11Window.configureAndNotify(self.xid, x, y, w, h)
return True
#TODO: maybe we should process _NET_MOVERESIZE_WINDOW here?
# it may make sense to apply it to the client_window
# whereas the code in WindowModel assumes there is a corral window
#not handled:
return False
22 changes: 22 additions & 0 deletions src/xpra/x11/gtk2/models/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,28 @@ def do_child_configure_request_event(self, event):
# (In particular, I believe that a request to jump to the top is
# meaningful and should perhaps even be respected.)

def process_client_message_event(self, event):
if event.message_type=="_NET_MOVERESIZE_WINDOW":
#TODO: honour gravity, show source indication
geom = self.corral_window.get_geometry()
x, y, w, h, _ = geom
if event.data[0] & 0x100:
x = event.data[1]
if event.data[0] & 0x200:
y = event.data[2]
if event.data[0] & 0x400:
w = event.data[3]
if event.data[0] & 0x800:
h = event.data[4]
#honour hints:
hints = self.get_property("size-hints")
w, h, _, _ = calc_constrained_size(w, h, hints)
geomlog("_NET_MOVERESIZE_WINDOW on %s (data=%s, current geometry=%s, new geometry=%s)", self, event.data, geom, (x,y,w,h))
with xswallow:
X11Window.configureAndNotify(self.xid, x, y, w, h)
return True
return BaseWindowModel.process_client_message_event(self, event)


#########################################
# X11 properties synced to Python objects
Expand Down

0 comments on commit 3ea03ff

Please sign in to comment.