[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#578416: compiz disallows binding commands to Ctrl+Escape, or <Any>+Escape, and Return



Package: compiz
Version: 0.8.4-3
Severity: normal
Tags: patch

Escape and Return keys in compiz are special. Even if it is possible
to create keybindings for, say, Ctrl+Escape (quite common key
shortcut for "Main Menu"), it will be ignored.  This is because the
two keys mentioned are checked and catched before everything else,
regardless of any modifiers.

The attached patch fixes this by treating the keys specially (it's
"cancel" and "commit" functions) only _without_ usual modifiers, if
key were hit together with at least some modifier it is not treated
as special (and performing the special function too).

This way, we lose, say, "Ctrl+Escape" or "Shift+Return" built-in 
functionality -- before, such combinations were worked just like plain 
Escape and Return.  I'm not sure it's any useful.  But at least we're
now able to assign some commands to them.

Thanks!

/mjt

-- System Information:
Debian Release: 5.0.4
  APT prefers stable
  APT policy: (990, 'stable'), (60, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.33-amd64 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages compiz depends on:
ii  compiz-core                   0.8.4-3    OpenGL window and compositing mana
ii  compiz-gnome                  0.8.4-3    OpenGL window and compositing mana
ii  compiz-gtk                    0.8.4-3    OpenGL window and compositing mana
ii  compiz-plugins                0.8.4-3    OpenGL window and compositing mana

compiz recommends no packages.

Versions of packages compiz suggests:
ii  compizconfig-settings-manager 0.8.4-2    Compizconfig Settings Manager

-- no debconf information

**** compiz-0.8.4-enable-mod+escape-control-keys.diff ****
Currently, compiz treats two particular keyboard keys specially:
these are Escape and Return.  Regardless of any modifiers or any
commands/actions assigned to these keys, they always assigned
two particular actions: Cancel and Commit.  This disallows using
these keys (with or without any or all together modifiers) to
bind commands.  For example, quite frequent key combination to
bring up "Main Menu" is Ctrl+Escape, which does not work in
compiz.

The following trivial two-liner patch only treats them specially
without any modifier.  If there is some modifier key hit too, the
keys are treated normally as all other keys, thus allowing one to
assign a command to that key sequence.

Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>

--- compiz-0.8.4/src/event.c.orig	2010-04-19 17:25:36.677931239 +0000
+++ compiz-0.8.4/src/event.c	2010-04-19 17:27:06.004697317 +0000
@@ -376,9 +376,9 @@ triggerKeyPressBindings (CompDisplay *d,
     unsigned int    modMask = REAL_MOD_MASK & ~d->ignoredModMask;
     unsigned int    bindMods;
 
-    if (event->keycode == d->escapeKeyCode)
+    if (event->keycode == d->escapeKeyCode && !(event->state & modMask))
 	state = CompActionStateCancel;
-    else if (event->keycode == d->returnKeyCode)
+    else if (event->keycode == d->returnKeyCode && !(event->state & modMask))
 	state = CompActionStateCommit;
 
     if (state)



Reply to: