Skip to content

Commit

Permalink
#1557: allow the desktop window to be resized in increments (same inc…
Browse files Browse the repository at this point in the history
…rements we have added to the dummy xorg.conf)

git-svn-id: https://xpra.org/svn/Xpra/trunk@16165 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 2, 2017
1 parent 8cdc006 commit 0149b01
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions src/xpra/x11/desktop_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
X11Window = X11WindowBindings()
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings #@UnresolvedImport
X11Keyboard = X11KeyboardBindings()
from xpra.x11.bindings.randr_bindings import RandRBindings #@UnresolvedImport
RandR = RandRBindings()

from xpra.gtk_common.error import xsync

from xpra.log import Logger
Expand Down Expand Up @@ -119,6 +122,19 @@ def get_property(self, prop):
else:
return gobject.GObject.get_property(self, prop)

def resize(self, w, h):
if not RandR.has_randr():
log.error("Error: cannot honour resize request,")
log.error(" not RandR support on display")
return
try:
with xsync:
RandR.set_screen_size(w, h)
except Exception as e:
log("resize(%i, %i)", w, h, exc_info=True)
log.error("Error: failed to resize desktop display to %ix%i:", w, h)
log.error(" %s", e)

def _screen_size_changed(self, screen):
w, h = screen.get_width(), screen.get_height()
screenlog("screen size changed: new size %ix%i", w, h)
Expand All @@ -130,12 +146,23 @@ def _screen_size_changed(self, screen):
def update_size_hints(self, screen):
w, h = screen.get_width(), screen.get_height()
screenlog("screen dimensions: %ix%i", w, h)
size = w, h
size_hints = {
"maximum-size" : size,
"minimum-size" : size,
"base-size" : size,
}
if RandR.has_randr():
#TODO: get this from randr:
size_hints = {
"maximum-size" : (8192, 4096),
"minimum-size" : (640, 640),
"base-size" : (640, 640),
"increment" : (128, 128),
"minimum-aspect-ratio" : (1, 3),
"maximum-aspect-ratio" : (3, 1),
}
else:
size = w, h
size_hints = {
"maximum-size" : size,
"minimum-size" : size,
"base-size" : size,
}
self._updateprop("size-hints", size_hints)


Expand Down Expand Up @@ -368,6 +395,7 @@ def _process_configure_window(self, proto, packet):
if not skip_geometry:
owx, owy, oww, owh = window.get_geometry()
geomlog("_process_configure_window(%s) old window geometry: %s", packet[1:], (owx, owy, oww, owh))
window.resize(w, h)
if len(packet)>=7:
cprops = packet[6]
if cprops:
Expand Down

0 comments on commit 0149b01

Please sign in to comment.