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

Bug #741869 reported by Matthew Ames on 2011-03-24
956
This bug affects 306 people
Affects Status Importance Assigned to Milestone
Ayatana Design
High
John Lea
Compiz
High
Unassigned
Compiz Core
High
Unassigned
OEM Priority Project
High
Unassigned
Precise
High
Unassigned
Unity
High
Marco Trevisan (Treviño)
7.2
High
Marco Trevisan (Treviño)
compiz (Ubuntu)
High
Unassigned
Trusty
Undecided
Unassigned
unity (Ubuntu)
High
Unassigned
Trusty
Undecided
Unassigned

Bug Description

[Impact]
After upgrading from Maverick to Natty, I can no longer use the Super (windows) key in Virtual Machine Manager. Previously, as long as I had the Virtual Machine Manager console window in the foreground, I could press the Super key and the start menu would pop up. Since upgrading to Natty, this no longer works, and the search box appears in the upper left.

Also see bug #934921

[Test Case]
(1) Install virtualbox or virt-manager and qemu-system, create and boot a virtual machine
(2) while in the virtual machine (and it should grab the keyboard), press the Super key
Expected Result: the super key acts inside the VM (check by install unity on it or using xev)
Buggy Result: the super key acts in the host and the Unity Dash is displayed

[regression Potential]This patch plays with key grabs and ungrabs: the most likely potential for regression is (a) the existing grabs continue and no fix obtains or (2) the grab is not resumed when returning control from the VM and the Super key does not invoke the Unity Dash.

Related branches

lp:~3v1n0/unity/overlays-grabs-handling
PS Jenkins bot: Approve (continuous-integration) on 2014-05-02
Brandon Schaefer: Approve on 2014-05-01
lp:~3v1n0/unity/grab-check-enforce
PS Jenkins bot: Approve (continuous-integration) on 2014-05-13
Brandon Schaefer: Approve on 2014-05-13
lp:~unity-team/unity/7.2.2
Marco Trevisan (Treviño): Approve on 2014-07-04
Superseded for merging into lp:unity
Unity Team: Pending requested 2014-07-01
Matthew Ames (supermatt) wrote :
Matthew Ames (supermatt) wrote :

Further information:
You will need virt-manager installed to replicate this.

I am also noting similar (though not *exactly* the same) behaviour in vinagre. If I press the Super key when connected to a vnc session, the key press is registered, however, if I then click on any application on my second desktop, and click on an application on my first desktop, the menu pops up again. Again, this is not something that was ever a problem before unity became my desktop.

Alex Launi (alexlauni) on 2011-03-31
Changed in unity:
status: New → Confirmed
importance: Undecided → Low
Changed in unity (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Tyler Morgan (digismack) wrote :

Holy moly this one is annoying. Not being able to user super key shortcuts in Virtualbox is a show-stopper. I feel this one should be a bit higher than low priority.

I am unable to send the Super key across Vinagre at all. Sometimes it pops up the dash on the client machine, and sometimes it does nothing at all. It never pops up the dash on the server machine--not even when Vinagre is in fullscreen mode. Using Oneiric with Unity 3D on the client and Unity 2D on the server.

Aaron C. de Bruyn (darkpixel) wrote :

It's not just in VMM. It happens in rdesktop and remmina too. Unity is grabbing the super key when it shouldn't. One of the primary benefits of Ubuntu on my desktop used to be all the rdesktop windows I would have opened to various windows machines that would all respond appropriately to ALT+TAB and SUPER+whatever. Unity blows this away.

Retitling since the consensus is that this affects all apps that forward keystrokes.

summary: - Pressing the Super (windows) key while in Virtual Machine Manager no
- longer works
+ Pressing the Super (windows) key while in full screen virtual machine or
+ remoting apps no longer works
Daniel van Vugt (vanvugt) wrote :

As mentioned in duplicate bug 806255:
---
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."
[http://www.x.org/releases/X11R7.6/doc/libX11/specs/XKB/xkblib.html]
---
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. :(
---

summary: - Pressing the Super (windows) key while in full screen virtual machine or
- remoting apps no longer works
+ Unity/compiz intercepts Super and Alt keypresses from grabbed windows
+ like VMs.
affects: unity → compiz
affects: unity (Ubuntu) → compiz (Ubuntu)
Changed in compiz-core:
status: New → Confirmed
Changed in compiz:
importance: Low → Medium
Changed in compiz-core:
importance: Undecided → Medium
Changed in compiz (Ubuntu):
importance: Low → Medium
Changed in compiz:
milestone: none → 0.9.8.0
Andrew Flegg (aflegg) wrote :

Given bug 806255 was "High" and the use of super & alt keys in VMs/Synergy is quite popular; shouldn't this be higher than "Medium"?!

zee (zeefreak) wrote :

ugh. this is driving me insane. i have a virtual machine that i use to connect to vpn to do all my corporate work. so i'm in the vm all day, alt-tabbing between windows. or at least i was. now its alt-tab esc esc esc click stab stab stab /skull.

my esc button can't take much more of this.

My workaround is to change the shortcut from the left alt to the right menu key.

snowguy (snowguy) wrote :

Alexander, did you change the shorcut on the host or the VM?

On the host which is Ubuntu 12.04 64bit.

Changed in compiz:
milestone: 0.9.8.0 → 0.9.8.1

Anyone come up with a fix or a workaround? Using a VM my whole workday this is driving me nuts..

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. You can use the left one in your VMs.

For Super, you can run CCSM and go:
Desktop > Ubuntu Unity Plugin > Key to show the launcher = (something other than Super)

zee (zeefreak) wrote :

another workaround [which is idiotic, but it works for me.]

i'm constantly having this issue when i try to alt-tab around in my windows vm. i've found that if i alt-tab s l o w l y, it works. alt-tab at normal uber geek speeds bring up the search window.

e.g. alt ... tab vs alttab.

Changed in compiz:
milestone: 0.9.8.2 → 0.9.8.4
Hao-Ran Liu (hzliu123) on 2012-09-14
tags: added: rls-q-incoming
Hao-Ran Liu (hzliu123) on 2012-09-14
Changed in oem-priority:
importance: Undecided → High
Hao-Ran Liu (hzliu123) wrote :

This bug is the main cause for bug 950160.

Super+P is the only way to tell Windows 8 to toggle external display. It's expected that on new laptops come with Windows 8, BIOS will only sends out Super+P for the hot key to switch external display, and this key will not work in Ubuntu.

Super key should not be consumed by Compiz/Unity, if this key is used in combination with other keys. Compiz/Unity is not the only user of the super key. gnome-settings-daemon also uses this key for toggling external display.

This is a design conflict between Compiz/Unity and g-s-d. I would like to see a real solution worked out. Otherwise, we should let Unity to handle video-out keycodes, as proposed in https://bugs.launchpad.net/unity/+bug/632632/comments/5

Daniel van Vugt (vanvugt) wrote :

See comment #7 for a "real solution". Volunteers welcome.

Changed in oem-priority:
status: New → Incomplete
Changed in compiz:
milestone: 0.9.8.4 → 0.9.9.0
Changed in oem-priority:
status: Incomplete → Confirmed
Daniel van Vugt (vanvugt) wrote :

This is not a duplicate of bug 950160. It might sound similar though.

This bug is about Compiz/Unity not honouring keyboard grabs as described in comment #7 (mostly seen with Super and Alt). Bug 950160 however is about other programs not being able to bind Super+any key to a global action.

John Lea (johnlea) on 2012-11-27
description: updated
tags: added: udp
Changed in ayatana-design:
assignee: nobody → John Lea (johnlea)
importance: Undecided → High
Changed in compiz:
importance: Medium → High
Changed in compiz-core:
importance: Medium → High
Changed in compiz (Ubuntu):
importance: Medium → High
status: Confirmed → Triaged
Changed in compiz:
status: Confirmed → Triaged
Changed in compiz-core:
status: Confirmed → Triaged
Changed in ayatana-design:
status: New → Fix Committed
Mr. Blonde (mr.blonde) wrote :

My workaround for now is to install a minimal window manager like awesome and use that when I'm working with virtual machines (you can select your window manager from the login screen). It'll only need a few extra MB and that way you don't have to bother with bad workarounds in Unity.

Changed in compiz:
milestone: 0.9.9.0 → 0.9.9.2
Changed in compiz:
milestone: 0.9.9.2 → 0.9.10.0
Fabio Rafael Rosa (rafaelfdr) wrote :

I'm running raring, and this problem still happens with current version of unity.
Was the fix mentioned here already released ?
If not, where can I get it ?
I do like unity, but, this problem _really_ gets in my way

Steve Magoun (smagoun) wrote :

This issue still exists. The OEM is shipping a workaround. Due to lack of progress upstream and the workaround, we're closing the escalation. it would still be good to have the bug fixed upstream; it's frustrating in the general case.

Changed in oem-priority:
status: Confirmed → Won't Fix
Changed in compiz:
milestone: 0.9.10.0 → 0.9.10.2
MC Return (mc-return) on 2013-07-24
Changed in compiz:
milestone: 0.9.10.2 → 0.9.11.0
Oibaf (oibaf) on 2013-09-03
Changed in ayatana-design:
status: Fix Committed → Fix Released
John Lea (johnlea) on 2013-09-03
Changed in ayatana-design:
status: Fix Released → Fix Committed
dimovnike (dimovnike) wrote :

how can we test this? where do we download APK or install a repo?
Thanks.

pieterjanvu (pieterjanvu) wrote :

Is a fix being committed to any release? I've disabled the HUD shortcut key in Raring since install given this issue.

Péter Trombitás (trombipeti) wrote :

Will this pretty annoying issue ever be solved? Still experiencing it in 13.10 and 12.04 as well.

Alan Bell (alanbell) wrote :

based on the comment at #7 it almost certainly is going to remain broken in compiz - however with Mir the input handlers are utterly different so there might be an opportunity to have Ubuntu work with virtualisation and remote desktops without grabbing keys from the guest.

estanislao bulián (estani-b) wrote :

It drives my crazy, where is this fix? Can i download it from somewhere? I guess i'll be back to xubuntu sooner than excpected.

Julian Alarcon (alarconj) wrote :

Ok, is almost imposible to work with Remmina, VM managers and similars... Do you have any new about this?

Paul Howie (paulhowie) wrote :

It really looks like a fix is not coming for this. I've remapped the ubuntu menu key from "super" to "ctrl-super" in compizconfig-settings-manager so that I can use the windows key in my VMs without it triggering the overlay.

It's not ideal, but it's enough to allow me to get on with my work for now.

Changed in unity:
importance: Undecided → High
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
milestone: none → 7.2.1
status: New → In Progress
Stephen M. Webb (bregma) on 2014-05-07
description: updated
Stephen M. Webb (bregma) on 2014-05-07
Changed in unity:
milestone: 7.2.1 → 7.3.0
Alan Bell (alanbell) on 2014-05-08
description: updated
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.2.0+14.10.20140512.4-0ubuntu1

---------------
unity (7.2.0+14.10.20140512.4-0ubuntu1) utopic; urgency=low

  [ Stephen M. Webb ]
  * lockscreen/LockScreenAccelerators.h: added required header for
    std:vector definition
  * disabled precompiled headers on arm64 Ubuntu package builds (LP:
    #1317276)

  [ Brandon Schaefer ]
  * Set the max width, so our static text wraps. So we don't end up
    rendering text out of the view area. (LP: #1312749)

  [ Marco Trevisan (Treviño) ]
  * UnityScreen: toggle activation of all the unity compiz actions when
    locking the screen Also, make sure that the lockscreen views are
    treated as "always-on-front" windows by nux (and this applies to
    both visibility and events).
  * PanelService: emit an invalid EntryActivated signal if the menu
    hasn't actually been shown In addition, if the menu is not visible
    after the first popup call, try to show a menu without keyboard
    focus. This will make possible to see menus also when there's a key-
    grab (although they will be without keyboard support). Finally,
    reset the menu state, if that failed.
  * UnityScreen: always paint the lockscreen above, just add menu and
    onboard as exceptions Some code cleanup, factorizing similar code.
    (LP: #1313280)
  * UnityScreen: don't try to show Dash/Hud if the screen is grabbed
    Also move the dash opening out from LauncherController, and get rid
    of UBus as first initialization source, as it can only slow things
    down here. (LP: #741869)
  * PluginAdapter: make sure we don't try to call an invalid
    initiate/terminate callback function (LP: #1221673)
  * DebugDBusInterface: match properties if they are in the AP array
    form [<type>, <value>] (LP: #1307748)

  [ William Hua ]
  * Add proper support for modifier-only shortcuts on the lock screen.
    (LP: #1291461)

  [ Jinkyu Yi ]
  * Dash: Fix problem at checking blacklisted unicode range (LP:
    #1251193)

  [ Andrea Azzarone ]
  * Add a warning in the session dialog if other sessions are still
    open. (LP: #1281058)
 -- Ubuntu daily release <email address hidden> Mon, 12 May 2014 22:03:27 +0000

Changed in unity (Ubuntu):
status: New → Fix Released
Stephen M. Webb (bregma) on 2014-05-14
Changed in unity (Ubuntu):
importance: Undecided → High
Alan Bell (alanbell) wrote :

cool, any chance of a backport of this fix into trusty?

> cool, any chance of a backport of this fix into trusty?
>

Sure, a SRU will be prepared soon.

--
Treviño's World - Life and Linux
http://www.3v1n0.net

Khalid Zubair (kzubair) wrote :

Confirmed on trusty as well.

Yanpas (yanpaso) wrote :

I've understood that SRU will be released in month or two. And when this update will be in trusty-proposed?

Yanpas, no hopefully the SRU will arrive soon.

Changed in unity:
status: In Progress → Fix Committed
Stephen M. Webb (bregma) on 2014-06-20
Changed in unity:
status: Fix Committed → Fix Released
Yanpas (yanpaso) wrote :

Don't know why, but there seems to be Tab button problem too. Playing "Valiant Hearts" under Wine I noticed that pressing Tab doesn't perform anything. But if I run this game on another X server - the Tab button opens inventory as it supposed to be.

description: updated
description: updated
description: updated
description: updated

The trusty-proposed packages with suposedly contain fix for this bug didn't actually fix it. The Super key is still intercepted in windowed mode and Dash opens in both VirtualBox (tested with 12.04.4 and 14.04) and in regular session. When running VirtualBox in fullscreen the Dash opens only in virtual machine.

Also in virt-manager the Super key isn't intercepted when you open Dash but is intercepted when you hold the Super key to display shortcuts overlay.

tags: added: verification-failed

> The trusty-proposed packages with suposedly contain fix for this bug
> didn't actually fix it. The Super key is still intercepted in windowed
> mode and Dash opens in both VirtualBox (tested with 12.04.4 and 14.04)

That's the correct behavior for now (see the test case, a prerequisite it
full screen), since when VirtualBox doesn't grab the keyboard, the unity
host gets the event and it will display the dash if needed.

> and in regular session. When running VirtualBox in fullscreen the Dash
> opens only in virtual machine.

Fine

> Also in virt-manager the Super key isn't intercepted when you open Dash
> but is intercepted when you hold the Super key to display shortcuts
> overlay.

Mh right... I actually think this is sane since the overlay should alway be
available when requested, since it doesn't need input and thus it doesn't
create any trouble.

Well VirtualBox grabs the keyboard even in widowed mode. At least the Alt+F2 , Ctrl+Alt+T, Super+S and Super+W shortcuts are properly grabbed.

My opinion is that even though this fix doesn't fix every use case, it does fix many behaviors and it really is the best we can do in Unity. That said, I think we should mark this back to verification-needed with the caveat that not all cases will be fixed. I think having the solution as-is is much better than having no solution at all, which is what we will have to do if this stays verification-failed.

tags: added: verification-needed
removed: verification-failed

Yes this is much better than having no solution at all and if this is the best that can be done then it should land in main archives.

tags: added: verification-done
removed: verification-needed
pabouk (pabouk) wrote :

So do I understand it correctly that the remaining problems have to be resolved in Compiz?

@pabouk:

It depends: I think that virtualbox should actually grab the keyboard (when focused) even when additions are installed if they want to get all the key bindings without making the WM to interact with them (as virt-manager or citrix do); while yes, to make the super key not to be always handled by unity, compiz needs to change (quite a lot) and actually I think this is out of our scope, since it would be a too big refactor and it might break other assumptions we have.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.2.2+14.04.20140714-0ubuntu1

---------------
unity (7.2.2+14.04.20140714-0ubuntu1) trusty; urgency=medium

  [ Alfred Neumayer ]
  * Restore the launcher position by reversing the animation and
    unsetting the DND_PUSHED_OFF quirk. (LP: #1304882)

  [ Brandon Schaefer ]
  * TextInput: move the warning icon inside the input field, render it
    white (LP: #1307738)
  * ShutdownView: Scale up the Buttons and Text plus Borders of the
    UnityWindowView. (LP: #1308323)
  * Lockscreen warning icon needs a tooltip to say what the warning is
    about! (LP: #1308288)

  [ Marco Trevisan (Treviño) ]
  * UnityScreen: always paint the lockscreen above, just add menu and
    onboard as exceptions Some code cleanup, factorizing similar code.
    (LP: #1313280)
  * ApplicationLauncherIcon: Focus and, in case, Spread the windows on
    DnD After 1 second that an user is over an icon, that icon should
    focus the relative application and Spread its windows if it has more
    than one opened. Correctly handle the DnD scale in launcher, and
    apply glow to the icon under pointer. (LP: #607796)
  * ShutdownView: Scale up the Buttons and Text plus Borders of the
    UnityWindowView. (LP: #1308323)
  * SwitcherView: use RawPixel's for the size values and convert them to
    match current scaling (LP: #1317348)
  * PluginAdapter: try to grab the screen to make sure that the screen
    is not grabbed FocusIn event with NotifyGrab mode is not always
    triggered by X when a window takes the grab, then we need to ensure
    that there's no grab by trying to get one. We only care about
    keyboard here, since pointer grabs don't affect us in general.
    (LP: #741869)
  * ShortcutView: use RawPixel's for the size values and convert them to
    match current scaling Plus dinamically allocate horizontal space,
    not to cut the text. (LP: #924840)

  [ Chris Townsend ]
  * Fix issue where scaling the edge illumination up and down with the
    size of the Launcher icons would cause the illumination border to be
    offset and smaller than the icon. (LP: #1309739)
  * Fix issue where the number of Launcher icon pips are not always
    properly updated when a new window of an already running application
    is opened. (LP: #1283775)
  * Fix issue where the Panel shadow would get drawn over drop down
    windows in full screen windows. (LP: #1316005)
  * Bump upstream release to 7.2.2.

  [ Andrea Azzarone ]
  * Clear the clipboard when locking the screen. (LP: #1308911)
  * Disable switcher gestures if screen is locked. Fixed a regression.
    (LP: #1321043)
  * Pass the correct options to showLauncherKeyTerminate in
    UnityScreen::OnLockScreen (LP: #1320438)
  * Fix skype indicator blinking. (LP: #1310200)
  * Add a warning in the session dialog if other sessions are still
    open. (LP: #1281058)

  [ Ubuntu daily release ]
  * New rebuild forced
 -- Ubuntu daily release <email address hidden> Mon, 14 Jul 2014 14:31:00 +0000

Changed in unity (Ubuntu Trusty):
status: New → Fix Released
Oibaf (oibaf) wrote :

It still doesn't work with the 0ad game. For example ALT+F should show framerate. I still have to redefine keys I need. I am on an updated trusty.

Launchpad Janitor (janitor) wrote :

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

Changed in compiz (Ubuntu Trusty):
status: New → Confirmed
DiegoRivera (diego-rivera) wrote :

This bug needs to be fixed for those of us that don't use unity and only rely on gnome-shell. The problem seems to have been diagnosed to compiz, and thus the fix should be focused there so that it's not unnecessarily tied to unrelated packages (i.e. unity, as was the fix mentioned above).

pabouk (pabouk) wrote :

The behaviour is much better after patching but for example in VMware Workstation (or Player) some problems persist:

When the keyboard is grabbed (mouse is in the window of a VM with VMware Tools) and the keys (Super or Alt) are pressed nothing happens in Unity as expected. But when the keyboard is ungrabbed (mouse leaves the window) shortly after the keypress Unity behaves as if the key was pressed again.

Test case:
1. In VMware Workstation (or Player) start a VM with VMware Tools installed.
2. Move the mouse cursor inside the window of the VM.
3. Press Super or Alt.
4. In less than 2 seconds move the mouse cursor outside of the window.
5. Nothing should happen in Unity but Unity actually behaves as if the key (Super or Alt) was pressed again.

It seems that there is a timeout for this behaviour. When the keyboard is ungrabbed after more than approximately 3 seconds then nothing happens in Unity as expected.

Alternative test case (does not require VMware Tools but is not so annoying.):
1. In VMware Workstation (or Player) start a VM.
2. Grab the keyboard in the VM (Ctrl+G or mouse click).
3. Press Alt. (Super does not demonstrate this problem completely in this variant.)
4. In less than 2 seconds ungrab the kyboard by pressing Ctrl+Alt.
5. Nothing should happen in Unity but Unity actually behaves as if the key (Alt) was pressed again. (With Super Dash only flashes shortly.)

...but since this problem does not show up when the VM is in full screen mode then it seems that the bugfix in Unity behaves correctly as described in this case.

@pabouk:

Mh, yeah... We actually have a timeout of 2 seconds during which we wait for an ungrab event to happen in order to try to open a view. This is actually a kind of a "feature" in order to make sure that if a menu is open and quickly closed or an ungrab event happens quickly enough, we can still open again the requested overlay.

We might probably reduce that timeout to a different value, though.
Feel free to open a new bug, and we can discuss further.

Oibaf (oibaf) wrote :

It works fine with 0 A.D. game on 14.10.

Can this bug be closed for compiz also? The Milestone of this bug for Compiz is 0.9.11.0 and 0.9.11 is indeed provided in trusty, while 0.9.12 is provided in utopic.

Nikita Tsukanov (keks9n) wrote :

Now compiz intercepts KeyRelease event (at least in xfreerdp). So, once pressed it will still be pressed. Forever.

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

Other bug subscribers