Skip to content

Commit

Permalink
#566:
Browse files Browse the repository at this point in the history
* pass command line options to all "ClientExtras"
* add --no-swap-keys command line option for osx

git-svn-id: https://xpra.org/svn/Xpra/trunk@6427 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 9, 2014
1 parent 73c2f12 commit 3ff88eb
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def show_tray(*args):
log("failed to set pulseaudio audio tagging: %s", e)

if ClientExtras is not None:
self.client_extras = ClientExtras(self)
self.client_extras = ClientExtras(self, opts)

if opts.border:
self.parse_border(opts.border)
Expand Down
10 changes: 8 additions & 2 deletions src/xpra/platform/darwin/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,16 @@ def handleWakeNotification_(self, aNotification):


class ClientExtras(object):
def __init__(self, client, blocking=False):
def __init__(self, client, opts, blocking=False):
log("ClientExtras.__init__(%s, %s, %s) swap_keys=%s", client, opts, blocking, opts.swap_keys)
self.client = client
self.blocking = blocking
self.setup_event_loop()
if opts and client:
log("setting swap_keys=%s using %s", opts.swap_keys, client.keyboard_helper)
if client.keyboard_helper and client.keyboard_helper.keyboard:
log("%s.swap_keys=%s", client.keyboard_helper.keyboard, opts.swap_keys)
client.keyboard_helper.keyboard.swap_keys = opts.swap_keys

def cleanup(self):
self.client = None
Expand Down Expand Up @@ -139,7 +145,7 @@ def setup_event_loop(self):
def main():
from xpra.platform import init
init("OSX Extras")
ClientExtras(None, True)
ClientExtras(None, None, True)


if __name__ == "__main__":
Expand Down
10 changes: 7 additions & 3 deletions src/xpra/platform/darwin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

def add_client_options(parser):
#NONE!
pass
def add_client_options(parser, defaults):
parser.add_option("--swap-keys", action="store_true",
dest="swap_keys", default=defaults.swap_keys,
help="Swaps the 'Command' and 'Control' keys (default: '%default')")
parser.add_option("--no-swap-keys", action="store_false",
dest="swap_keys",
help="Disables the swapping of the 'Command' and 'Control' keys")
4 changes: 2 additions & 2 deletions src/xpra/platform/win32/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_native_system_tray_classes(*args):


class ClientExtras(object):
def __init__(self, client):
def __init__(self, client, opts):
self.client = client
self._kh_warning = False
self.setup_console_event_listener()
Expand Down Expand Up @@ -132,7 +132,7 @@ def resume():
fake_client.suspend = suspend
fake_client.resume = resume
fake_client.keyboard_helper = None
ClientExtras(fake_client)
ClientExtras(fake_client, None)

import gobject
gobject.threads_init()
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/platform/win32/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

def add_client_options(parser):
def add_client_options(parser, defaults):
from xpra.platform.options_util import add_notray_option
add_notray_option(parser, ", this will also disable notifications!")
2 changes: 1 addition & 1 deletion src/xpra/platform/xposix/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def x11_bell():


class ClientExtras(object):
def __init__(self, client):
def __init__(self, client, opts):
self.client = client
self._xsettings_watcher = None
self._root_props_watcher = None
Expand Down
2 changes: 2 additions & 0 deletions src/xpra/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def read_xpra_defaults():
"exit-ssh" : bool,
"opengl" : bool,
"mdns" : bool,
"swap_keys" : bool,
#arrays of strings (default value, allowed options):
"video-encoders" : list,
"csc-modules" : list,
Expand Down Expand Up @@ -366,6 +367,7 @@ def get_defaults():
"exit-ssh" : True,
"opengl" : OPENGL_DEFAULT,
"mdns" : os.name=="posix" and not sys.platform.startswith("darwin"),
"swap_keys" : sys.platform.startswith("darwin"), #only used on osx
"video-encoders" : [],
"csc-modules" : [],
"speaker-codec" : [],
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def parse_cmdline(cmdline):
help="Path to the default image which will be used for all windows (the application may override this)")
# let the platform specific code add its own options:
# adds "--no-tray" for platforms that support it
add_client_options(group)
add_client_options(group, defaults)
hidden_options["tray"] = True
hidden_options["delay_tray"] = False
group.add_option("--tray-icon", action="store",
Expand Down

0 comments on commit 3ff88eb

Please sign in to comment.