xpra icon
Bug tracker and wiki

Changeset 1262 in xpra


Ignore:
Timestamp:
08/03/12 09:59:28 (11 months ago)
Author:
antoine
Message:

#163:

  • add a new --dpi=VALUE command line option
  • server defines the default value
  • client can override this
  • global default is 96
  • remove --dpi from Xorg examples (since it doesn't work)
  • when we apply the client's resource-manager values, we set/override the dpi
  • when the client connects, we fake a "resource-manager" settings update as some clients never send this
Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/etc/xpra/xpra.conf

    r1257 r1262  
    3333encoding = png 
    3434 
     35# Default DPI: 
     36dpi = 96 
     37 
    3538# Client window title: 
    3639title=@title@ on @client-machine@ 
     
    5053# Virtual display command: 
    5154# Old Xvfb option: 
    52 # xvfb=Xvfb -dpi 96 +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY 
     55# xvfb=Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY 
    5356# With Xorg 1.12 or newer and the dummy driver: 
    54 # xvfb=/usr/bin/Xorg-nosuid -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xorg.conf 
     57# xvfb=/usr/bin/Xorg-nosuid -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xorg.conf 
     58xvfb=/usr/bin/Xorg-nosuid -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xorg.conf 
  • trunk/src/etc/xpra/xpra.conf.template

    r1256 r1262  
    3333encoding = png 
    3434 
     35# Default DPI: 
     36dpi = 96 
     37 
    3538# Client window title: 
    3639title=@title@ on @client-machine@ 
     
    5053# Virtual display command: 
    5154# Old Xvfb option: 
    52 # xvfb=Xvfb -dpi 96 +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY 
     55# xvfb=Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY 
    5356# With Xorg 1.12 or newer and the dummy driver: 
    54 # xvfb=/usr/bin/Xorg-nosuid -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xorg.conf 
     57# xvfb=/usr/bin/Xorg-nosuid -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xorg.conf 
  • trunk/src/setup.py

    r1256 r1262  
    265265                print("enabling Xdummy in config file") 
    266266                f = open("etc/xpra/xpra.conf", mode='a') 
    267                 f.write("xvfb=/usr/bin/Xorg-nosuid -dpi 96 -noreset -nolisten tcp "+ 
     267                f.write("xvfb=/usr/bin/Xorg-nosuid -noreset -nolisten tcp "+ 
    268268                        "+extension GLX +extension RANDR +extension RENDER "+ 
    269269                        "-logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xorg.conf") 
  • trunk/src/tests/wimpiggy/test_prop.py

    r912 r1262  
    66#@PydevCodeAnalysisIgnore 
    77 
    8 from wimpiggy.test import * 
     8from tests.wimpiggy import * 
    99import struct 
    1010import gtk 
  • trunk/src/xpra.1

    r1182 r1262  
    2424[\fB\-\-bind\-tcp=[HOST]:PORT\fP] 
    2525[\fB\-\-password\-file=filename\fP] 
     26[\fB\-\-dpi=VALUE\fP] 
    2627[\fB\-\-socket\-dir=DIR\fP] 
    2728.HP 
     
    4647[\fB\-\-ssh=CMD\fP] [\fB\-\-remote\-xpra=CMD\fP] 
    4748[\fB\-\-password\-file=filename\fP] 
     49[\fB\-\-dpi=VALUE\fP] 
    4850[\fB\-\-socket\-dir=DIR\fP] 
    4951[\fB\-\-mmap\-group\fP] 
     
    348350Use it only if you have special needs, and understand the consequences 
    349351of your actions. 
     352 
     353.SS Options for start, upgrade and attach 
    350354.TP 
    351355\fB\-\-password\-file\fP=\fIFILENAME\fP 
     
    354358If this is used on the server, it will reject any client connections 
    355359that do not provide the same password value. 
     360[\fB\-\-dpi=VALUE\fP] 
     361The 'dots per inch' value that client applications should try to honour. 
     362This numeric value should be in the range 10 to 500 to be useful. 
     363Many applications will only read this value when starting up, 
     364so connecting to an existing session started with a different DPI 
     365value may not have the desired effect. 
    356366 
    357367.SS Options for attach 
  • trunk/src/xpra/client.py

    r1258 r1262  
    9696            self.jpegquality = 50 
    9797 
     98        self.dpi = int(opts.dpi) 
    9899        self.mmap_enabled = False 
    99100        self.server_start_time = -1 
     
    513514        capabilities["randr_notify"] = True 
    514515        capabilities["compressible_cursors"] = True 
     516        capabilities["dpi"] = self.dpi 
    515517        #these should be turned into options: 
    516518        capabilities["cursors"] = True 
  • trunk/src/xpra/scripts/client_launcher.py

    r1253 r1262  
    174174xpra_opts.compression_level = default_int("compression", 3) 
    175175xpra_opts.send_pings = default_bool("pings", False) 
     176xpra_opts.dpi = default_int("dpi", 96) 
    176177#these would need testing/work: 
    177178xpra_opts.auto_refresh_delay = 0.0 
     
    419420                opts.keyboard_sync = xpra_opts.keyboard_sync 
    420421                opts.send_pings = xpra_opts.send_pings 
     422                opts.dpi = xpra_opts.dpi 
    421423 
    422424                import logging 
  • trunk/src/xpra/scripts/main.py

    r1253 r1262  
    153153        print("invalid value for '%s': %s, using default value %s instead" % (varname, v, default_value)) 
    154154        return default_value 
     155    def int_default(varname, default_value): 
     156        v = defaults.get(varname) 
     157        if not v: 
     158            return default_value 
     159        try: 
     160            return int(v) 
     161        except: 
     162            return default_value 
    155163 
    156164    if XPRA_LOCAL_SERVERS_SUPPORTED: 
     
    292300                      dest="password_file", default=None, 
    293301                      help="The file containing the password required to connect (useful to secure TCP mode)") 
     302    group.add_option("--dpi", action="store", 
     303                      dest="dpi", default=int_default("dpi", 96), 
     304                      help="The 'dots per inch' value that client applications should try to honour (default: %s)") 
    294305    default_socket_dir = defaults.get("socket-dir") 
    295306    default_socket_dir_str = default_socket_dir or "$XPRA_SOCKET_DIR or '~/.xpra'" 
     
    328339        options.jpegquality = 80 
    329340        options.max_bandwidth = 0 
     341    try: 
     342        int(options.dpi) 
     343    except Exception, e: 
     344        parser.error("invalid dpi: %s" % e) 
    330345 
    331346    if not args: 
  • trunk/src/xpra/server.py

    r1259 r1262  
    199199                            xpra.__version__) 
    200200        add_event_receiver(root, self) 
     201 
     202        self.default_dpi = int(opts.dpi) 
     203        self.dpi = self.default_dpi 
    201204 
    202205        # This must happen early, before loading in windows at least: 
     
    10951098        self.encodings = capabilities.get("encodings", []) 
    10961099        self._set_encoding(capabilities.get("encoding", None), None) 
     1100        self.dpi = capabilities.get("dpi", self.default_dpi) 
     1101        if self.dpi>0: 
     1102            #some non-posix clients never send us 'resource-manager' settings 
     1103            #so just use a fake one to ensure the dpi gets applied: 
     1104            self.update_server_settings({'resource-manager' : ""}) 
    10971105        #mmap: 
    10981106        self.close_mmap() 
     
    13691377 
    13701378    def _process_server_settings(self, proto, packet): 
    1371         settings = packet[1] 
     1379        self.update_server_settings(packet[1]) 
     1380 
     1381    def update_server_settings(self, settings): 
    13721382        old_settings = dict(self._settings) 
     1383        log("server_settings: old=%s, updating with=%s", old_settings, settings) 
    13731384        self._settings.update(settings) 
     1385        root = gtk.gdk.get_default_root_window() 
    13741386        for k, v in settings.items(): 
     1387            #cook the "resource-manager" value to add the DPI: 
     1388            if k == "resource-manager" and self.dpi>0: 
     1389                value = v.decode("utf-8") 
     1390                #parse the resources into a dict: 
     1391                values={} 
     1392                options = value.split("\n") 
     1393                for option in options: 
     1394                    if not option: 
     1395                        continue 
     1396                    parts = option.split(":\t") 
     1397                    if len(parts)!=2: 
     1398                        continue 
     1399                    values[parts[0]] = parts[1] 
     1400                values["Xft.dpi"] = self.dpi 
     1401                log("server_settings: resource-manager values=%s", values) 
     1402                #convert the dict back into a resource string: 
     1403                value = u'' 
     1404                for vk, vv in values.items(): 
     1405                    value += "%s:\t%s\n" % (vk, vv) 
     1406                value += '\n' 
     1407                #record the actual value used 
     1408                self._settings["resource-manager"] = value 
     1409                v = value.encode("utf-8") 
     1410 
    13751411            if k not in old_settings or v != old_settings[k]: 
    13761412                def root_set(p): 
    1377                     prop_set(gtk.gdk.get_default_root_window(), 
    1378                             p, "latin1", v.decode("utf-8")) 
     1413                    log("server_settings: setting %s to %s", p, v) 
     1414                    prop_set(root, p, "latin1", v.decode("utf-8")) 
    13791415                if k == "xsettings-blob": 
    13801416                    self._xsettings_manager = XSettingsManager(v) 
  • trunk/src/xpra/xposix/xsettings.py

    r1217 r1262  
     1# This file is part of Parti. 
     2# Copyright (C) 2010-2012 Antoine Martin <antoine@devloop.org.uk> 
     3# Copyright (C) 2008 Nathaniel Smith <njs@pobox.com> 
     4# Parti is released under the terms of the GNU GPL v2, or, at your option, any 
     5# later version. See the file COPYING for details. 
     6 
    17import gobject 
    28import gtk 
     
    1319from wimpiggy.log import Logger 
    1420log = Logger() 
     21 
    1522 
    1623class XSettingsManager(object): 
Note: See TracChangeset for help on using the changeset viewer.