Skip to content

Commit

Permalink
get rid of actual-size, use geometry instead and ensure we keep it up…
Browse files Browse the repository at this point in the history
… to date

git-svn-id: https://xpra.org/svn/Xpra/trunk@11031 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 26, 2015
1 parent a615986 commit 3bed3a0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/xpra/x11/gtk2/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ def do_get_property_geometry(self, pspec=None):


def get_dimensions(self):
#just extracts the size from the geometry:
return self.do_get_property_geometry()[2:4]


Expand Down
25 changes: 8 additions & 17 deletions src/xpra/x11/gtk2/models/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ class WindowModel(BaseWindowModel):
gobject.PARAM_READABLE),
# Interesting properties of the client window, that will be
# automatically kept up to date:
"actual-size": (gobject.TYPE_PYOBJECT,
"Size of client window (actual (width,height))", "",
gobject.PARAM_READABLE),
"requested-position": (gobject.TYPE_PYOBJECT,
"Client-requested position on screen", "",
gobject.PARAM_READABLE),
Expand Down Expand Up @@ -193,21 +190,21 @@ def setup(self):
self.client_reparented = True

log("setup() geometry")
w,h = X11Window.getGeometry(self.xid)[2:4]
w, h, border = X11Window.geometry_with_border(self.xid)[2:5]
hints = self.get_property("size-hints")
log("setup() hints=%s size=%ix%i", hints, w, h)
nw, nh = calc_constrained_size(w, h, hints)
if nw>=MAX_WINDOW_SIZE or nh>=MAX_WINDOW_SIZE:
#we can't handle windows that big!
raise Unmanageable("window constrained size is too large: %sx%s (from client geometry: %s,%s with size hints=%s)" % (nw, nh, w, h, hints))
self._geometry = x, y, nw, nh, border
log("setup() resizing windows to %sx%s", nw, nh)
self.corral_window.resize(nw, nh)
self.client_window.resize(nw, nh)
self.client_window.show_unraised()
#this is here to trigger X11 errors if any are pending
#or if the window is deleted already:
self.client_window.get_geometry()
self._internal_set_property("actual-size", (nw, nh))


def _read_initial_X11_properties(self):
Expand Down Expand Up @@ -278,9 +275,6 @@ def do_unmanaged(self, wm_exiting):
def raise_window(self):
self.corral_window.raise_()

def get_dimensions(self):
return self.get_property("actual-size")

def unmap(self):
with xsync:
if X11Window.is_mapped(self.xid):
Expand Down Expand Up @@ -405,7 +399,8 @@ def _do_update_client_geometry(self, window_size_cb, window_position_cb):
x, y = window_position_cb(w, h)
geomlog("_do_update_client_geometry: position=%ix%i", x, y)
self.corral_window.move_resize(x, y, w, h)
self._internal_set_property("actual-size", (w, h))
border = self._geometry[4]
self._geometry = (x, y, w, h, border)
with xswallow:
X11Window.configureAndNotify(self.xid, 0, 0, w, h)

Expand Down Expand Up @@ -439,14 +434,12 @@ def resize_corral_window(self, x, y, w, h, border):
#the client window may have been resized or moved (generally programmatically)
#so we may need to update the corral_window to match
cox, coy, cow, coh = self.corral_window.get_geometry()[:4]
modded = False
if self._geometry[4]!=border:
modded = True
#size changes (and position if any):
hints = self.get_property("size-hints")
w, h = calc_constrained_size(w, h, hints)
geomlog("resize_corral_window() new constrained size=%ix%i", w, h)
if cow!=w or coh!=h:
#at least resized, check for move:
if (x, y) != (0, 0):
geomlog("resize_corral_window() move and resize from %s to %s", (cox, coy, cow, coh), (x, y, w, h))
self.corral_window.move_resize(x, y, w, h)
Expand All @@ -465,11 +458,9 @@ def resize_corral_window(self, x, y, w, h, border):
self.client_window.move(0, 0)
cox, coy = x, y
modded = True

#these two should be using geometry rather than duplicating it?
if self.get_property("actual-size")!=(w, h):
self._internal_set_property("actual-size", (w, h))
modded = True
else:
#no position or size change, maybe border?
modded = self._geometry[4]!=border

if modded:
self._geometry = (cox, coy, cow, coh, border)
Expand Down
6 changes: 3 additions & 3 deletions src/xpra/x11/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,10 @@ def _add_new_window(self, window):


def _window_resized_signaled(self, window, *args):
nw, nh = window.get_property("actual-size")
x, y = window.get_property("geometry")[:2]
geometry = window.get_property("geometry")
x, y, nw, nh = geometry[:4]
geom = self._desktop_manager.window_geometry(window)
geomlog("XpraServer._window_resized_signaled(%s,%s) position=%sx%s, actual-size=%sx%s, current geometry=%s", window, args, x, y, nw, nh, geom)
geomlog("XpraServer._window_resized_signaled(%s,%s) geometry=%s, desktop manager geometry=%s", window, args, geometry, geom)
if geom[:4]==[x, y, nw, nh]:
geomlog("XpraServer._window_resized_signaled: unchanged")
#unchanged
Expand Down

0 comments on commit 3bed3a0

Please sign in to comment.