Skip to content

Commit

Permalink
ensure we get a reference to the keyboard instance (when setting up t…
Browse files Browse the repository at this point in the history
…he client reference) so that we can use the keyboard menu entries (swapkeys and numlock)

git-svn-id: https://xpra.org/svn/Xpra/trunk@4897 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Dec 9, 2013
1 parent bc2e9d5 commit 00fbcef
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/xpra/platform/darwin/osx_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def getOSXMenuHelper(client=None):
if _OSXMenuHelper is None:
_OSXMenuHelper = OSXMenuHelper(client)
elif client is not None:
_OSXMenuHelper.client = client
_OSXMenuHelper.set_client(client)
return _OSXMenuHelper


Expand All @@ -44,6 +44,12 @@ def __init__(self, client=None):
self.hidden_window = None
self.keyboard = None
self.menus = {}
self.set_client(client)

def set_client(self, client):
self.client = client
if client and client.keyboard_helper:
self.keyboard = client.keyboard_helper.keyboard

def build(self):
debug("OSXMenuHelper.build()")
Expand Down Expand Up @@ -130,7 +136,11 @@ def numlock_toggled(*args):
self.numlock_menuitem.set_active(True)
def set_numlock_menuitem(*args):
if self.keyboard:
debug("set_numlock_menuitem(%s) num_lock_state=%s", args, self.keyboard.num_lock_state)
self.numlock_menuitem.set_active(self.keyboard.num_lock_state)
else:
debug("set_numlock_menuitem(%s) no keyboard!", args)
self.swapkeys_menuitem.set_sensitive(False)
self.client.connect("handshake-complete", set_numlock_menuitem)
return self.numlock_menuitem

Expand Down

0 comments on commit 00fbcef

Please sign in to comment.