Unity/compiz intercepts Super and Alt keypresses from grabbed windows like VMs.

Bug #806255 reported by Micah Gersten on 2011-07-06
This bug affects 69 people
Affects Status Importance Assigned to Milestone
Daniel van Vugt
Compiz Core
Daniel van Vugt
compiz (Ubuntu)

Bug Description

The two main scenarios where this bug is seen are:

1. Running a VM and pressing the Super key in the VM. This causes the host's Unity dash to open as well as Super being sent to the guest.

2. When the screen is locked (Ctrl+Alt+L), press Super before unlocking the screen with your password. Once unlocked you will notice the Super keypress was received by Unity and the dash was opened before you had even unlocked the screen.

When I use the super key while I'm in kvm with unity 2d and all other actions, including alt + tab, are processed in the vm, when I press the super key, I get the host launcher showing up instead of having the option of using the launcher in the vm.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: unity 3.8.16-0ubuntu1~natty1
ProcVersionSignature: Ubuntu 2.6.38-10.44-generic
Uname: Linux 2.6.38-10-generic x86_64
NonfreeKernelModules: nvidia
Architecture: amd64
CompizPlugins: [core,bailer,detection,composite,opengl,decor,mousepoll,vpswitch,regex,animation,snap,expo,move,compiztoolbox,place,grid,imgpng,gnomecompat,wall,ezoom,workarounds,staticswitcher,resize,fade,unitymtgrabhandles,scale,session,unityshell]
Date: Tue Jul 5 18:59:17 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007)
 PATH=(custom, no user)
SourcePackage: unity
UpgradeStatus: Upgraded to natty on 2011-04-08 (88 days ago)

Related branches

Micah Gersten (micahg) wrote :

Hi Micah,

Which VM are you using? Is it VirtualBox? I doubt this is really an issue in Unity - it's probably just the VM is not receiving the Super key. If it's VirtualBox I can do a bit of investigation myself, so let me know.


Ubuntu Bug Squad volunteer triager

Micah Gersten (micahg) wrote :

I'm using kvm/libvirt, the VM catches it, but the host is also catching it.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu):
status: New → Confirmed
Chris Morgan (chris.morgan) wrote :

See also https://bugs.launchpad.net/ubuntu/natty/+source/unity/+bug/704231 and http://askubuntu.com/questions/70177/unity-vmware-workstation-and-the-super-windows-key

I experience this problem in Ubuntu 11.10 and with VirtualBox, the Ask Ubuntu post is to do with VMware Workstation. It's a pest.

Didier Roche (didrocks) on 2011-10-25
Changed in unity:
status: New → Confirmed
Daniel van Vugt (vanvugt) wrote :

On paper this bug appears to be a duplicate of bug 704231. However, 704231 is marked as fix released in oneiric, and this bug is still present in oneiric. So it's not a duplicate.

Daniel van Vugt (vanvugt) wrote :

A proper fix should be simple in theory: If any X keyboard grabs exist then Unity shouldn't be responding to any keys.

Daniel van Vugt (vanvugt) wrote :

Now the status of bug 704231 has been corrected, I still can't say for sure that this is a duplicate of that one. Because the proposed fix for bug 704231 does not seem to solve this bug.

summary: - Unity host launcher grabs super key when keyboard + mouse control in kvm
+ Unity host launcher responds to super key when keyboard is grabbed by a
+ VM.

Any news / ideas or workaround to this problem ?

I must use gnome fallback now to even be able to use my vmware workstation.

summary: - Unity host launcher responds to super key when keyboard is grabbed by a
- VM.
+ Unity/compiz intercepts keystrokes from grabbed windows.
Changed in compiz-core:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Daniel van Vugt (vanvugt)
affects: unity (Ubuntu) → compiz (Ubuntu)
Changed in unity:
status: Confirmed → Invalid
description: updated
Changed in compiz-core:
status: Triaged → In Progress
Changed in compiz-core:
milestone: none →

Fix committed into lp:compiz-core at revision 3045

Changed in compiz-core:
status: In Progress → Fix Committed
Daniel van Vugt (vanvugt) wrote :

FYI, the root cause of this bug appears to be because compiz uses XkbStateNotify, which is part of the X Keyboard Extension. Using this extension has the unfortunate side-effect (by design) of ignoring grabs held by other clients and still giving you key events even when you shouldn't be receiving them. This is documented is the spec:

"As with all Xkb events, XkbStateNotify events are reported to all interested clients without regard to the current keyboard input focus or grab state."

Daniel van Vugt (vanvugt) wrote :

Linked a more recent branch in which the fix for this bug was redesigned. The latest fix for this bug is committed to lp:compiz-core at revision 3048.

Karol Bryd (karolbe) wrote :

Daniel, would it be possible to backport this fix to compiz 0.9.6 in Ubuntu 11.10?

Daniel van Vugt (vanvugt) wrote :

I was thinking it might be easy. I will try to look at backporting the fix this week.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:

compiz (1: precise; urgency=low

  [ Łukasz 'sil2100' Zemczak ]
  * New upstream snapshot:
    - Fix gtk-window-decorator crash upon demaximizing a window (LP: #930071)
    - Fix core keybindings (LP: #930412)
    - Fixes compiz crash with SIGSEGV on shutdown (LP: #931283)
    - Plugins can't tell the difference between a key-tap and modifier
      key-release (LP: #925293)
    - compiz-core r3001 (and 3002) ftbfs (LP: #933226)
    - Semi-maximized windows have no shadow or frame (LP: #924736)
    - Untranslated strings in gtk-window-decorator (LP: #780505)
    - Initialize the _NET_WM_STATE_FOCUSED (LP: #932087)
    - [regression] Customized shortcuts don't work (LP: #931927)
    - Window stacking problem (LP: #936675)
    - Quickly demaximized windows can receive maximized window decorations if
      they were initially maximized (LP: #936778)
    - Maximized windows do not get shadows at all (LP: #936774)
    - [regression] Launcher, top panel and keyboard un-responsive after using
      any Super-x shortcut (LP: #934058)
    - No draggable border if mutter isn't installed (LP: #936781)
    - Fix compiz crash with SIGSEGV in XDefineCursor() (LP: #936487)
    - Fixes memory leak at DecorWindow::updateSwitcher() (LP: #940115)
    - Unresolved symbols in plugins cause compiz to exit (LP: #938478)
    - Fix compiz spending about 51% of its CPU time in CompRegion
      construction/destruction (LP: #940139)
    - Fix Conditional jump or move depends on uninitialised value(s) in
      decor_match_pixmap (LP: #940066)
    - Fix 'show desktop' behaviour (LP: #871801)
    - Tweak algorithm used to cast shadows on maximized windows (LP: #936784)
    - "Svg" and "Png" should be "SVG and "PNG" (LP: #942890)
    - Fix invalid memory usage after free() in DecorWindow (LP: #943116)
    - Fix alt + F10 (LP: #943223)
  * Removed cherry-picked patches
  * debian/patches/fix_944631.patch:
    - Always replay the keyboard if something was grabbed and didn't trigger
      an action and don't trigger actions which aren't added accidentally
      (LP: #943612) (LP: #944631)
  * debian/patches/fix_923683.patch:
    - Backports a patch which prevents the shift race condition

  [ Didier Roche ]
  * debian/patches/fix_alt_pressing.patch:
    - Patch from ddv to fix all the regressions with the alt key fix and other
      (LP: #943851, #945373)
    - Fix Quicklist are not showing if right-clicking a launcher icon in Expo
      mode if triggered by Super + S (LP: #944979)
  * debian/patches/fix_806255.patch:
    - Unity/compiz intercepts keystrokes from grabbed windows (LP: #806255)
  * debian/patches/fix_943194.patch:
    - second part for the alt key fix (LP: #943194)
  * debian/patches/additional_alt_tapping_fix.patch:
    - again another alt tapping related fix for some regressions from the
      previous branch. Taken from "tapping-panacea" upstream branch.
 -- Didier Roche <email address hidden> Mon, 12 Mar 2012 10:22:10 +0100

Changed in compiz (Ubuntu):
status: Confirmed → Fix Released
no longer affects: unity
fejes (anthony-fejes) wrote :

I think this update has caused another bug - right clicking anywhere when running compiz - 1: in kde 4.8.1 (running latest updates in 12.04) causes the window decorations and panels to disappear and the windows all become fixed on the desktop. I can't find a log that shows anything crashing, but disabling compiz and using the default kde window manager prevents this from occurring.

I also still have problems with <Primary> showing up when setting bindings in CCSM, and preventing the control key from being used, which makes me wonder if there may be something more going on, or if the fix described above might not work for everyone.

Please let me know if you need any more information, or if you'd prefer that I start a new bug report.

Daniel van Vugt (vanvugt) wrote :

fejes -
The right click issue is bug 954079. Please subscribe to that.
And please log a new bug for the <Primary> issue.

Changed in compiz-core:
status: Fix Committed → Fix Released
Daniel van Vugt (vanvugt) wrote :

Linked yet another more recent branch in which the fix for this bug was redesigned to avoid bug 953089.

Daniel van Vugt (vanvugt) wrote :

Looks like I need to revert the fix for this bug AGAIN because it has caused a regression for the third time: bug 963470.

The only remaining fix for this bug is to rewrite the modifier handling code in compiz to not use XkbStateNotify at all. Because that is the root cause of this bug. However that's a very large and risky change we can't afford to do for a while. :(

Daniel van Vugt (vanvugt) wrote :

All fixes for this bug are now removed from lp:compiz-core, as mentioned above.

Changed in compiz-core:
status: Fix Released → Triaged
milestone: → none
summary: - Unity/compiz intercepts keystrokes from grabbed windows.
+ Unity/compiz intercepts Super and Alt keypresses from grabbed windows
+ like VMs.
Changed in compiz (Ubuntu):
status: Fix Released → Triaged
Changed in compiz-core:
milestone: none →
Miguel Meléndez (miguelmmg) wrote :

I'm using VirtualBox. If you quickly press Super key, Dash open but VM doesn't receive keystroke.
Workaround: if you instead hold pressing Super key a little more (about half second), VM intercepts keystroke but Dash doesn't open.

Ryan Stewart (rds6235) wrote :

This is marked as fixed, but on upgrading from 11.10 to 12.04, I seem to have lost Super key functionality again. Is there some configuration item that I'm missing to make it play nice?

Ryan Stewart (rds6235) wrote :

Oops, sorry. I put added that last comment to the wrong Bug.

Changed in compiz:
assignee: nobody → Daniel van Vugt (vanvugt)
importance: Undecided → High
status: New → Triaged
Changed in compiz:
milestone: none →
Changed in compiz-core:
milestone: → none
JP (vectorpoem) wrote :

Note that this also affects applications not running in a VM. I have a simple PyGame (SDL-Python bindings) app that does not acknowledge any ALT key presses at all. Workaround was to disable ALT as the HUD shortcut key entirely.

Daniel van Vugt (vanvugt) wrote :

Try this as a workaround (for Alt only):
System Settings > Keyboard > Shortcuts > Launchers > Key to show the HUD
Click on it and tap just the right Alt key. Now (I find) the HUD only responds to the right Alt key and will ignore the left.

Daniel van Vugt (vanvugt) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 741869, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

Oibaf (oibaf) wrote :

So, is this a duplicate of bug #741869?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers