HUD gets activated by Thinkpad USB Keyboard's back and forward buttons

Bug #968840 reported by James Henstridge on 2012-03-30
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
unity-2d
Medium
Albert Astals Cid
unity-2d (Ubuntu)
Undecided
Unassigned
Precise
Undecided
Unassigned

Bug Description

Test case:
1. Download attachment foo.c (https://bugs.launchpad.net/ubuntu/+source/unity-2d/+bug/968840/+attachment/3088438/+files/foo.c)
2. Install xtst:
   sudo apt-get install libxtst-dev
3. Compile the code with
   g++ foo.c -o XFakeKey `pkg-config --libs --cflags x11 xtst`
4. Run ./XFakeKey Alt_L Left
   -> The HUD should not appear

===

This is on Ubuntu 12.04 beta using unity-2d 5.8.0-0ubuntu1.

I use a Thinkpad USB Keyboard on my desktop, which has "back" and "forward" buttons just above the arrow keys (as found on Thinkpad laptops). They seem to act a bit differently to the keyboards found on laptops though, since instead of generating their own scan codes, they generate "Alt+Left" and "Alt+Right" key presses.

For instance, pressing the "back" button in xev results in the following events:

    KeyPress event, serial 30, synthetic NO, window 0x3a00001,
        root 0x15f, subw 0x0, time 434986370, (445,143), root:(512,231),
        state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes:
        XmbLookupString gives 0 bytes:
        XFilterEvent returns: False

    KeyPress event, serial 30, synthetic NO, window 0x3a00001,
        root 0x15f, subw 0x0, time 434986370, (445,143), root:(512,231),
        state 0x8, keycode 113 (keysym 0xff51, Left), same_screen YES,
        XLookupString gives 0 bytes:
        XmbLookupString gives 0 bytes:
        XFilterEvent returns: False

And releasing the key results in:

    KeyRelease event, serial 33, synthetic NO, window 0x3a00001,
        root 0x15f, subw 0x0, time 434986498, (445,143), root:(512,231),
        state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes:
        XFilterEvent returns: False

    KeyRelease event, serial 33, synthetic NO, window 0x3a00001,
        root 0x15f, subw 0x0, time 434986498, (445,143), root:(512,231),
        state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
        XLookupString gives 0 bytes:
        XFilterEvent returns: False

If I press and release the key quick enough, this often has the effect of bringing up the HUD as well as causing my web browser to navigate to the previous page.

This behaviour is surprising to me: there is clearly a second key press in the event stream between the "Alt" key press and release, which I would have thought would be enough to inhibit the HUD from popping up.

Related branches

Michał Sawicz (saviq) wrote :

Here's my try to reproduce, exactly the same sequence... and no HUD :/

KeyPress event, serial 33, synthetic NO, window 0x4c00001,
    root 0xaf, subw 0x0, time 72005151, (1022,585), root:(1023,637),
    state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4c00001,
    root 0xaf, subw 0x0, time 72005311, (1022,585), root:(1023,637),
    state 0x8, keycode 113 (keysym 0xff51, Left), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4c00001,
    root 0xaf, subw 0x0, time 72005510, (1022,585), root:(1023,637),
    state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4c00001,
    root 0xaf, subw 0x0, time 72005730, (1022,585), root:(1023,637),
    state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

James Henstridge (jamesh) wrote :

Could the timestamps make a difference. Note that the two key presses (or releases respectively) have identical timestamps in my log.

Albert Astals Cid (aacid) wrote :

Confirmed, I'm attaching a way to repro the bug in a sec

Changed in unity-2d:
status: New → Triaged
importance: Undecided → Medium
Albert Astals Cid (aacid) wrote :

Compile the code with
   g++ foo.c -o XFakeKey `pkg-config --libs --cflags x11 xtst`
then start xev, switch to another terminal, run
sleep 5; ./XFakeKey Alt_L Left
switch back to xev and you'll get

KeyPress event, serial 30, synthetic NO, window 0x9e00001,
    root 0xb7, subw 0x0, time 11060756, (620,384), root:(686,436),
    state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x9e00001,
    root 0xb7, subw 0x0, time 11060758, (620,384), root:(686,436),
    state 0x8, keycode 113 (keysym 0xff51, Left), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x9e00001,
    root 0xb7, subw 0x0, time 11060758, (620,384), root:(686,436),
    state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x9e00001,
    root 0xb7, subw 0x0, time 11060758, (620,384), root:(686,436),
    state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

and the hud will trigger

Changed in unity-2d:
assignee: nobody → Albert Astals Cid (aacid)
status: Triaged → In Progress
Changed in unity-2d:
milestone: none → 5.12
status: In Progress → Fix Committed
description: updated
Didier Roche (didrocks) on 2012-04-27
Changed in unity-2d:
status: Fix Committed → Fix Released

Hello James, or anyone else affected,

Accepted unity-2d into precise-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in unity-2d (Ubuntu Precise):
status: New → Fix Committed
tags: added: verification-needed
description: updated
Bartosz Kosiorek (gang65) wrote :

After entering:
a@a:~/Downloads$ ./XFakeKey Alt_L Left
a@a:~/Downloads$ D

No more HUD

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-2d - 5.12.0-0ubuntu1

---------------
unity-2d (5.12.0-0ubuntu1) precise-proposed; urgency=low

  * New upstream release:
    - unity-2d-shell crashed with SIGSEGV in ref() (LP: #968046)
    - [hud] First entry always activated with keyboard navigation
      (LP: #980899)
    - unity-2d-shell crashes on autoscrolling on launcher tile removal
      (LP: #988239)
    - unity-2d-shell crashes when using with a NX server (LP: #983942)
    - Dash - update Dash keyboard shortcuts so the 'CTRL + TAB' switches
      between Lenses and 'TAB' by itself moves the focus between categories
      (LP: #891648)
    - [spread] When multiple windows of an app are open, clicking on one
      doesn't bring it to the foreground (LP: #917334)
    - [HUD][multi-monitor] HUD should be expanded to the left if used on a
      screen without launcher (LP: #979927)
    - unity-2d scope un-url-escapes values from its model (LP: #986175)
    - [places] tab key does nothing (LP: #891565)
    - HUD is silent to screen readers (LP: #949445)
    - launcher background coloring does not get reset when using enter to
      activate/start a program (LP: #965079)
    - [multi-monitor] [launcher] Drag & drop application to launcher on
      primary screen, other launchers not updated (LP: #966239)
    - HUD gets activated by Thinkpad USB Keyboard's back and forward buttons
      (LP: #968840)
    - Unity 2D doesn't load 24 bit icons (LP: #977262)
    - Four finger tap does not open the Dash (LP: #978659)
    - No icon in launcher entry, after installing software (LP: #980640)
    - Menu items displayed incorrectly when window streched over multiples
      monitors (LP: #987215)
    - [unity-2d-panel] The close button (potentially the others too) can
      toggled even when they are not visible anymore (LP: #924264)
    - When closing the Dash with the [x] panel button the last windows is not
      focused and doesn't allow to use window controls. (LP: #945459)
    - [launcher] item hint flickers when hovering between launcher edge and
      item (LP: #948383)
    - Missaligned progress bar (LP: #980609)
    - Launcher tile tooltip appears in wrong screen in RTL multimonitor setups
      (LP: #984080)
 -- Didier Roche <email address hidden> Fri, 27 Apr 2012 09:32:40 +0200

Changed in unity-2d (Ubuntu):
status: New → Fix Released
Changed in unity-2d (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments