[orca] Fix for bgo#616585 - Numpad 0 can't work after launch and quit orca
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bgo#616585 - Numpad 0 can't work after launch and quit orca
- Date: Mon, 12 Jul 2010 07:59:07 +0000 (UTC)
commit 85204b679357ce354dd0d8c53a2815b728179ab9
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Sun Jul 11 04:03:03 2010 -0400
Fix for bgo#616585 - Numpad 0 can't work after launch and quit orca
src/orca/orca.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 76b0892..e1b28f2 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -118,6 +118,11 @@ _debugSwitch = False
#
_debugFile = None
+# A subset of the original Xmodmap info prior to our stomping on it.
+# Right now, this is just for the user's chosen Orca modifier(s).
+#
+_originalXmodmap = ""
+
########################################################################
# #
# METHODS FOR HANDLING PRESENTATION MANAGERS #
@@ -1001,6 +1006,39 @@ def toggleSilenceSpeech(script=None, inputEvent=None):
settings.silenceSpeech = True
return True
+def _storeXmodmap(keyList):
+ """Save the original xmodmap for the keys in keyList before we alter it.
+
+ Arguments:
+ - keyList: A list of named keys to look for.
+ """
+
+ global _originalXmodmap
+
+ items = "|".join(keyList)
+ cmd = "xmodmap -pke | grep -E '(%s)'" % items
+ filehandle = os.popen(cmd)
+ _originalXmodmap = filehandle.read()
+ filehandle.close()
+
+def _restoreXmodmap(keyList=[]):
+ """Restore the original xmodmap values for the keys in keyList.
+
+ Arguments:
+ - keyList: A list of named keys to look for. An empty list means
+ to restore the entire saved xmodmap.
+ """
+
+ toRestore = []
+ lines = _originalXmodmap.split("\n")
+ if not keyList:
+ toRestore = lines
+
+ for key in keyList:
+ line = filter(lambda k: " %s" % key in k, lines)
+ toRestore.extend(line)
+ os.system("echo '%s' | xmodmap - > /dev/null 2>&1" % "\n".join(toRestore))
+
def loadUserSettings(script=None, inputEvent=None):
"""Loads (and reloads) the user settings module, reinitializing
things such as speech if necessary.
@@ -1103,6 +1141,8 @@ def loadUserSettings(script=None, inputEvent=None):
except NameError:
pass
+ _storeXmodmap(settings.orcaModifierKeys)
+
# We don't want the Caps_Lock modifier to act as a locking
# modifier if it used as the Orca modifier key. In addition, if
# the KP_Insert key is used as the Orca modifier key, we want to
@@ -1668,6 +1708,10 @@ def shutdown(script=None, inputEvent=None):
#
restoreXmodmapMods()
+ # TODO - JD: See if this can be expanded to take over the above.
+ #
+ _restoreXmodmap(settings.orcaModifierKeys)
+
return True
exitCount = 0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]