[compiz] [PATCH] Unbound modifiers and CompNoMask

Andy Hefner ahefner at gmail.com
Sun Aug 5 02:21:09 PDT 2007


This patch fixes an undesirable behavior in the comparison of modifier
bits necessary to initiate an action - if the modifier is not configured
on the user's X server (thus having CompNoMask in its position in
d->modMask), the comparison always behaves as though the modifier were
pressed, due to CompNoMask falling outside the REAL_MOD_MASK &
~d->ignoredModMask bitmask. This causes actions to be invoked
inappropriately (for instance, if the user has no keysyms assigned for
the Super modifier, the zoom plugin can be triggered on unmodified
scroll wheel events, interfering with normal scrolling).

(hopefully pasting a git patch email directly into gmail works as expected)

---
 src/event.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/event.c b/src/event.c
index 3cd7435..1710c43 100644
--- a/src/event.c
+++ b/src/event.c
@@ -262,7 +262,8 @@ triggerButtonPressBindings (CompDisplay *d,
 {
     CompActionState state = CompActionStateInitButton;
     CompAction     *action;
-    unsigned int    modMask = REAL_MOD_MASK & ~d->ignoredModMask;
+    unsigned int    modMask = (REAL_MOD_MASK & ~d->ignoredModMask)
+                              | CompNoMask;
     unsigned int    bindMods;
     unsigned int    edge = 0;

@@ -368,7 +369,8 @@ triggerKeyPressBindings (CompDisplay *d,
 {
     CompActionState state = 0;
     CompAction     *action;
-    unsigned int    modMask = REAL_MOD_MASK & ~d->ignoredModMask;
+    unsigned int    modMask = (REAL_MOD_MASK & ~d->ignoredModMask)
+                              | CompNoMask;
     unsigned int    bindMods;

     if (event->xkey.keycode == d->escapeKeyCode)
@@ -438,7 +440,8 @@ triggerKeyReleaseBindings (CompDisplay *d,
     {
        CompActionState state = CompActionStateTermKey;
        CompAction      *action;
-       unsigned int    modMask = REAL_MOD_MASK & ~d->ignoredModMask;
+       unsigned int    modMask = (REAL_MOD_MASK & ~d->ignoredModMask)
+                                 | CompNoMask;
        unsigned int    bindMods;
        unsigned int    mods;

@@ -477,7 +480,8 @@ triggerStateNotifyBindings (CompDisplay             *d,
 {
     CompActionState state;
     CompAction      *action;
-    unsigned int    modMask = REAL_MOD_MASK & ~d->ignoredModMask;
+    unsigned int    modMask = (REAL_MOD_MASK & ~d->ignoredModMask)
+                              | CompNoMask;
     unsigned int    bindMods;

     if (event->event_type == KeyPress)
-- 
1.5.2.4


More information about the compiz mailing list