xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #349: fake-scaled-screen-size.patch

File fake-scaled-screen-size.patch, 3.2 KB (added by Antoine Martin, 7 years ago)

allows me to temporarily test different client screen sizes without actually changing anything

  • xpra/client/gtk_base/gtk_client_base.py

     
    3131from xpra.platform.gui import system_bell, get_workarea
    3232
    3333missing_cursor_names = set()
     34#FAKE_SCREEN_SCALE = 2.0/3.0
     35FAKE_SCREEN_SCALE = 1
    3436
    3537
    3638class GTKXpraClient(UIXpraClient, GObjectXpraClient):
     
    229231
    230232
    231233    def get_screen_sizes(self):
     234        def scalelist(*l):
     235            return [int(x*FAKE_SCREEN_SCALE) for x in l]
    232236        display = display_get_default()
    233237        i=0
    234238        screen_sizes = []
     
    247251                hmm = -1
    248252                if hasattr(screen, "get_monitor_height_mm"):
    249253                    hmm = screen.get_monitor_height_mm(j)
    250                 monitor = plug_name, geom.x, geom.y, geom.width, geom.height, wmm, hmm
    251                 monitors.append(monitor)
     254                monitor_geom = scalelist(geom.x, geom.y, geom.width, geom.height, wmm, hmm)
     255                monitors.append(tuple([plug_name]+monitor_geom))
    252256                j += 1
    253             work_x, work_y = 0, 0
    254             work_width, work_height = screen.get_width(), screen.get_height()
    255257            workarea = get_workarea()
    256258            if workarea:
    257259                work_x, work_y, work_width, work_height = workarea
    258             item = (screen.make_display_name(), screen.get_width(), screen.get_height(),
    259                         screen.get_width_mm(), screen.get_height_mm(),
    260                         monitors,
    261                         work_x, work_y, work_width, work_height)
    262             screen_sizes.append(item)
     260            else:
     261                work_x, work_y, work_width, work_height = 0, 0, screen.get_width(), screen.get_height()
     262            work_geom = scalelist(work_x, work_y, work_width, work_height)
     263            screen_geom = scalelist(screen.get_width(), screen.get_height(), screen.get_width_mm(), screen.get_height_mm())
     264            item = [screen.make_display_name()] + screen_geom + [monitors] + work_geom
     265            screen_sizes.append(tuple(item))
    263266            i += 1
     267        log.info("screen_sizes=%s", screen_sizes)
    264268        return screen_sizes
    265269
    266270    def set_windows_cursor(self, windows, cursor_data):
  • xpra/client/gtk2/client.py

     
    2222UI_watcher = get_UI_watcher(gobject.timeout_add)
    2323
    2424from xpra.gtk_common.gtk_util import gtk_main
    25 from xpra.client.gtk_base.gtk_client_base import GTKXpraClient
     25from xpra.client.gtk_base.gtk_client_base import GTKXpraClient, FAKE_SCREEN_SCALE
    2626from xpra.client.gtk2.tray_menu import GTK2TrayMenu
    2727from xpra.client.window_border import WindowBorder
    2828from xpra.net.compression import Uncompressed
     
    326326        return gdk.get_default_root_window()
    327327
    328328    def get_root_size(self):
    329         return gdk.get_default_root_window().get_size()
     329        w, h = gdk.get_default_root_window().get_size()
     330        return int(w*FAKE_SCREEN_SCALE), int(h*FAKE_SCREEN_SCALE)
    330331
    331332
    332333    def _process_raise_window(self, packet):