! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[PATCH] Keyboard shortcuts: <Shift> modifier not recognized correctly
Status:
RESOLVED: FIXED
Product:
Libxfce4ui
Component:
General

Comments

Description Harald Judt 2012-04-20 13:07:38 CEST
Since updating to the 4.10.0-pre2 release, the shift key is not recognized as a modifier anymore. Actually, this could be a problem in libxfce4ui-4.9.*, not xfce4-settings, but I'm not sure about this. While this could still be a configuration problem, other X apps like the compiz window manager work fine.

Steps to reproduce:
Add shortcut for a command using the shift key, e.g.: <Shift>-<c>

Expected results:
<Shift>-<c> assigned to command.

Actual Results:
<c> is assigned to the command.

You can assign only the shift key to a command, it will be recognized as <Shift_L> or <Shift_R>. Not very useful, though ;-)

Other modifiers are recognized and assigned correctly.

I'm using the system-wide settings for keyboard layout.

This bug is reproducible on two machines, having different keyboard layouts.


Further information/tests which may or may not be useful:
xev shows the following output when using the Shift key together with other keys:
KeyPress event, serial 40, synthetic NO, window 0x4e00001,
    root 0x156, subw 0x0, time 279001919, (370,452), root:(614,1501),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x4e00001,
    root 0x156, subw 0x0, time 279002111, (370,452), root:(614,1501),
    state 0x50, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x4e00001,
    root 0x156, subw 0x0, time 279002370, (370,452), root:(614,1501),
    state 0x51, keycode 30 (keysym 0x55, U), same_screen YES,
    XLookupString gives 1 bytes: (55) "U"
    XmbLookupString gives 1 bytes: (55) "U"
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4e00001,
    root 0x156, subw 0x0, time 279002449, (370,452), root:(614,1501),
    state 0x51, keycode 30 (keysym 0x55, U), same_screen YES,
    XLookupString gives 1 bytes: (55) "U"
    XFilterEvent returns: False 
(I decided to quit xev here, that's why the UP events for Shift_L and Super_L are missing). 


And here's xmodmap output:
xmodmap -v
!
! executing work queue
!
xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_L (0x42),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)
Comment 1 Harald Judt 2012-04-21 14:53:34 CEST
There is something confusing about the shortcuts representation anyway:

Key pressed: 1
Modifiers used: <Super>, <Shift>
(or level or whatever <Shift> is called)
xfce-4.8: <Super><Shift>exclam
xfce-4.9: <Super>exclam

I'd say that the result in xfce-4.8 is bad; It should be <Super><Shift>1, or match that of xfce-4.9.

Looking at the results, I decided to try <Super>exclam, and behold - the shortcut works! So this leads me to believe that there's something wrong with the representation code.

Pressing <Super>-<Shift>-<c> is translated into <Super>c. I guess it should be translated either into <Super><Shift>c, or into <Super>C.

Finally, I decided to try <Super><Shift_R>1, which made the entry vanish. It worked on the second try, resulting in <Super>exclam, as expected. This is reproducible (trying to replace the shortcut with an identical shortcut), I'll create a new bug report for this.
Comment 2 Harald Judt 2012-04-21 15:32:17 CEST
To sum it up:
The keyboard grabber seems to respect the levels aka the values in vertical direction printed on the key, but it does not translate properly the <Shift> key for keys that have only one level, like the typical a-z keys found on most western country keyboards. This is a regression.

The representation as stored by xfce-4.9, e.g. <Super>exclam, is correct according to the gdk specification, while that of xfce-4.8 is not.

For the second issue I created bug 8749 titled "Replacing a keyboard shortcut with an identical one removes the entry".
Comment 3 Harald Judt 2012-05-04 01:40:06 CEST
This is reproducible in the xfce-4.10 final release. I've rebuild Xorg Server-1.12 too, including X dependencies. Here is some more debugging output from libxfce4ui:

Grabbing <Mod4><Super>4
Keyval: 52
Modifiers: 0x4000000
Keycode: 13
Grabbing <Mod4><Super>r
Keyval: 114
Modifiers: 0x4000000
Keycode: 27
Grabbing <Shift>XF86AudioMute
Keyval: 269025042
Modifiers: 0x1
Keycode: 121
Failed to grab
Grabbing <Mod4><Super>t
Keyval: 116
Modifiers: 0x4000000
Keycode: 28
Grabbing <Mod4><Super>u
Keyval: 117
Modifiers: 0x4000000
Keycode: 30
Grabbing <Mod4><Super>v
Keyval: 118
Modifiers: 0x4000000
Keycode: 55
Grabbing <Primary><Mod4><Super>XF86Sleep
Keyval: 269025071
Modifiers: 0x4000004
Keycode: 150
Grabbing <Primary>XF86AudioLowerVolume
Keyval: 269025041
Modifiers: 0x4
Keycode: 122
Grabbing <Primary><Alt>Delete
Keyval: 65535
Modifiers: 0xc
Keycode: 119
Grabbing <Primary>XF86Sleep
Keyval: 269025071
Modifiers: 0x4
Keycode: 150
Failed to grab
Grabbing <Shift><Mod4><Super>p
Keyval: 112
Modifiers: 0x4000001
Keycode: 33
Grabbing XF86AudioMute
Keyval: 269025042
Modifiers: 0x0
Keycode: 121
Grabbing XF86AudioNext
Keyval: 269025047
Modifiers: 0x0
Keycode: 171
Failed to grab
Grabbing XF86AudioRaiseVolume
Keyval: 269025043
Modifiers: 0x0
Keycode: 123
Grabbing <Mod4><Super>XF86AudioMute
Keyval: 269025042
Modifiers: 0x4000000
Keycode: 121
Grabbing <Primary>XF86Favorites
Keyval: 269025072
Modifiers: 0x4
Keycode: 164
Grabbing <Primary>XF86Eject
Keyval: 269025068
Modifiers: 0x4
Keycode: 169
Keycode: 170
Keycode: 170
Keycode: 174
Grabbing <Mod4><Super>XF86Sleep
Keyval: 269025071
Modifiers: 0x4000000
Keycode: 150
Grabbing <Shift>XF86AudioPause
Keyval: 269025073
Modifiers: 0x1
Keycode: 172
Keycode: 209
Grabbing <Shift><Mod4><Super>v
Keyval: 118
Modifiers: 0x4000001
Keycode: 55
Grabbing <Shift>XF86Eject
Keyval: 269025068
Modifiers: 0x1
Keycode: 169
Keycode: 170
Keycode: 170
Keycode: 174
Grabbing <Shift>XF86AudioRaiseVolume
Keyval: 269025043
Modifiers: 0x1
Keycode: 123
Grabbing <Shift>XF86Sleep
Keyval: 269025071
Modifiers: 0x1
Keycode: 150
Grabbing <Mod4><Super>p
Keyval: 112
Modifiers: 0x4000000
Keycode: 33
Grabbing <Shift><Mod4><Super>l
Keyval: 108
Modifiers: 0x4000001
Keycode: 46
Grabbing XF86Sleep
Keyval: 269025071
Modifiers: 0x0
Keycode: 150
Grabbing XF86Search
Keyval: 269025051
Modifiers: 0x0
Keycode: 225
Grabbing XF86AudioLowerVolume
Keyval: 269025041
Modifiers: 0x0
Keycode: 122
Grabbing <Mod4><Super>f
Keyval: 102
Modifiers: 0x4000000
Keycode: 41
Grabbing <Mod4><Super>g
Keyval: 103
Modifiers: 0x4000000
Keycode: 42
Grabbing <Shift>XF86Search
Keyval: 269025051
Modifiers: 0x1
Keycode: 225
Grabbing XF86Eject
Keyval: 269025068
Modifiers: 0x0
Keycode: 169
Keycode: 170
Keycode: 170
Keycode: 174
Grabbing XF86WWW
Keyval: 269025070
Modifiers: 0x0
Keycode: 158
Grabbing <Mod4><Super>o
Keyval: 111
Modifiers: 0x4000000
Keycode: 32
Grabbing <Mod4><Super>n
Keyval: 110
Modifiers: 0x4000000
Keycode: 57
Grabbing <Shift><Mod4><Super>c
Keyval: 99
Modifiers: 0x4000001
Keycode: 54
Grabbing <Shift><Mod4><Super>d
Keyval: 100
Modifiers: 0x4000001
Keycode: 40
Grabbing <Shift>XF86AudioLowerVolume
Keyval: 269025041
Modifiers: 0x1
Keycode: 122
Grabbing XF86AudioPlay
Keyval: 269025044
Modifiers: 0x0
Keycode: 172
Keycode: 208
Keycode: 215
Grabbing <Shift>XF86AudioNext
Keyval: 269025047
Modifiers: 0x1
Keycode: 171
Grabbing <Mod4><Super>a
Keyval: 97
Modifiers: 0x4000000
Keycode: 38
Grabbing <Primary>XF86AudioRaiseVolume
Keyval: 269025043
Modifiers: 0x4
Keycode: 123
Grabbing <Primary><Alt>Escape
Keyval: 65307
Modifiers: 0xc
Keycode: 9
Grabbing Print
Keyval: 65377
Modifiers: 0x0
Keycode: 107
Keycode: 218
Grabbing <Mod4><Super>c
Keyval: 99
Modifiers: 0x4000000
Keycode: 54
Grabbing <Shift>XF86AudioPrev
Keyval: 269025046
Modifiers: 0x1
Keycode: 173
Grabbing <Mod4><Super>h
Keyval: 104
Modifiers: 0x4000000
Keycode: 43
Grabbing <Mod4><Super>i
Keyval: 105
Modifiers: 0x4000000
Keycode: 31
Grabbing XF86AudioPrev
Keyval: 269025046
Modifiers: 0x0
Keycode: 173
Grabbing <Mod4><Super>e
Keyval: 101
Modifiers: 0x4000000
Keycode: 26
Grabbing <Mod4><Super>l
Keyval: 108
Modifiers: 0x4000000
Keycode: 46
Grabbing <Mod4><Super>0
Keyval: 48
Modifiers: 0x4000000
Keycode: 19
Grabbing <Mod4><Super>1
Keyval: 49
Modifiers: 0x4000000
Keycode: 10
Grabbing <Mod4><Super>2
Keyval: 50
Modifiers: 0x4000000
Keycode: 11
Grabbing <Mod4><Super>3
Keyval: 51
Modifiers: 0x4000000
Keycode: 12
Grabbing <Shift><Mod4><Super>i
Keyval: 105
Modifiers: 0x4000001
Keycode: 31
Grabbing <Shift><Mod4><Super>o
Keyval: 111
Modifiers: 0x4000001
Keycode: 32
Grabbing <Shift><Mod4><Super>t
Keyval: 116
Modifiers: 0x4000001
Keycode: 28


And here is some output when pressing <Super><Shift><c>:

Looking for <Hyper><Super>c
Comparing to <Primary>XF86Eject
Comparing to XF86AudioMute
Comparing to <Shift>XF86AudioLowerVolume
Comparing to <Shift>XF86Search
Comparing to <Primary><Alt>Delete
Comparing to <Super>l
Ignoring Hyper Mask
Comparing to <Super>n
Ignoring Hyper Mask
Comparing to <Primary><Super>XF86Sleep
Ignoring Hyper Mask
Comparing to <Super>p
Ignoring Hyper Mask
Comparing to <Super>4
Ignoring Hyper Mask
Comparing to <Super>r
Ignoring Hyper Mask
Comparing to XF86Sleep
Comparing to <Super>t
Ignoring Hyper Mask
Comparing to <Super>u
Ignoring Hyper Mask
Comparing to <Super>v
Ignoring Hyper Mask
Comparing to XF86AudioRaiseVolume
Comparing to <Shift><Super>c
Ignoring Hyper Mask
Comparing to <Primary>XF86AudioLowerVolume
Comparing to <Super>3
Ignoring Hyper Mask
Comparing to <Shift><Super>l
Ignoring Hyper Mask
Comparing to <Super>XF86AudioMute
Ignoring Hyper Mask
Comparing to <Shift><Super>d
Ignoring Hyper Mask
Comparing to XF86Eject
Comparing to <Shift><Super>p
Ignoring Hyper Mask
Comparing to <Shift>XF86Sleep
Comparing to <Shift><Super>o
Ignoring Hyper Mask
Comparing to XF86AudioLowerVolume
Comparing to <Primary>XF86Favorites
Comparing to <Super>XF86Sleep
Ignoring Hyper Mask
Comparing to <Shift><Super>v
Ignoring Hyper Mask
Comparing to <Shift><Super>t
Ignoring Hyper Mask
Comparing to <Shift>XF86AudioPause
Comparing to <Shift>XF86Eject
Comparing to <Super>0
Ignoring Hyper Mask
Comparing to <Super>1
Ignoring Hyper Mask
Comparing to <Super>o
Ignoring Hyper Mask
Comparing to <Super>h
Ignoring Hyper Mask
Comparing to <Super>c
Ignoring Hyper Mask
Comparing to <Shift>XF86AudioRaiseVolume
Comparing to <Shift>XF86AudioNext
Comparing to <Super>2
Ignoring Hyper Mask
Comparing to <Primary><Alt>Escape
Comparing to XF86AudioPrev
Comparing to <Super>i
Ignoring Hyper Mask
Comparing to <Shift>XF86AudioMute
Comparing to XF86AudioPlay
Comparing to <Shift>XF86AudioPrev
Comparing to <Shift><Super>i
Ignoring Hyper Mask
Comparing to <Primary>XF86Sleep
Comparing to <Super>a
Ignoring Hyper Mask
Comparing to XF86AudioNext
Comparing to XF86Search
Comparing to <Primary>XF86AudioRaiseVolume
Comparing to <Super>e
Ignoring Hyper Mask
Comparing to <Super>f
Ignoring Hyper Mask
Comparing to <Super>g
Ignoring Hyper Mask
Comparing to XF86WWW
Comparing to Print


Output for replacing the existing <Super><Shift><c> with <Super><Shift><1>:
DBG[xfce-shortcuts-provider.c:288] xfce_shortcuts_provider_property_changed(): property = /commands/custom/<Shift><Super>c
Ungrabbing <Shift><Mod4><Super>c
Keyval: 99
Modifiers: 0x4000001
Keycode: 54
DBG[xfce-shortcuts-provider.c:288] xfce_shortcuts_provider_property_changed(): property = /commands/custom/<Super>exclam
Grabbing <Mod4><Super>exclam
Keyval: 33
Modifiers: 0x4000000
Keycode: 10

With modifiers=0x4000001, I guess the "1" represents the Shift key, while with modifiers=0x4000000, no Shift modifier is detected.

DBG[xfce-shortcuts-provider.c:288] xfce_shortcuts_provider_property_changed(): property = /commands/custom/<Super>c
Grabbing <Mod4><Super>c
Keyval: 99
Modifiers: 0x4000000
Keycode: 54

DBG[xfce-shortcuts-provider.c:288] xfce_shortcuts_provider_property_changed(): property = /commands/custom/<Alt><Super>c
Grabbing <Alt><Mod4><Super>c
Keyval: 99
Modifiers: 0x4000008
Keycode: 54
Comment 4 Harald Judt 2012-05-04 22:59:14 CEST
I've moved this to libxfce4ui, as the settings manager doesn't have anything to do with it. I was able to track this issue down to the key grabbing process in both the shortcuts dialog and the shortcuts grabber, and I could restore the functionality of the shift key as a modifier.

I'm not quite sure my method here is the right one, or if there actually is a correct method. The problem is this:

1) The shift modifier is being consumed when not used as a single key (aka Shift_L or Shift_R).
2) While it should then be restored by applying the consumed modifiers (and I'm not sure it is being properly restored), it seems gtk_accelerator_name does not return the correct shortcut name.
  Example where gtk_accelerator_name returns the correct value: <Shift>1 becomes Exclam
  Example where gtk_accelerator_name fails: <Shift>a should become A, but becomes a
3) Additionally, there is a problem with the values returned by gtk_accelerator_name and gtk_parse_accelerator. See http://mail.gnome.org/archives/gtk-app-devel-list/2007-August/msg00053.html for example code.

My patches try to work around these issues:
1) They restore the GDK_SHIFT_MASK in the shortcut dialog and the shortcut grabber when Shift is detected in both the state and the consumed variables.
2) They reparse the accelerator name to get consistent key values.

I did not notice any negative effects caused by these patches. However, I did only test the application shortcut functionality. Since this is a core library, xfwm4 and other applications using libxfce4ui could be affected too. This should be relatively easy to test, though.
Comment 5 Harald Judt 2012-05-04 23:00:04 CEST
Created attachment 4395 
enable-shift-modifier-in-shortcut-dialog.patch

Enable grabbing with shift modifier in the application shortcut dialog.
Comment 6 Harald Judt 2012-05-04 23:00:55 CEST
Created attachment 4396 
enable-shift-modifier-in-shortcut-grabber.patch

Enable grabbing with shift modifier.
Comment 7 AndresC 2012-11-09 13:22:02 CET
Something similar happens with the right Alt key ( or Alt-Gr key )

I used to use the right Alt key plus the up & down button for volume management.

<Mod5>up & <Mod5>down, but now it gets recognised as ISO_Level3_Shift and I just can combine it with "normal" keys as "e" but it recognises "Euro", in a similar fashion to the "<Super>exclam".
Comment 8 AndresC 2012-11-09 13:26:08 CET
I've just forgot to mention that  <Super><Shift>Up works fine ( moves my window up to another workspace ) & <Super>Up works also fine ( Volumen Up ), as <Super><Alt> does.

But <Super><Shift>f is the same a <Super>f, but that is already commented in the bug.
Comment 9 Jérôme Guelfucci editbugs 2012-11-27 23:14:19 CET
*** Bug 8889 has been marked as a duplicate of this bug. ***
Comment 10 Jérôme Guelfucci editbugs 2012-11-27 23:15:33 CET
*** Bug 9550 has been marked as a duplicate of this bug. ***
Comment 11 Jérôme Guelfucci editbugs 2012-12-18 09:10:44 CET
*** Bug 8554 has been marked as a duplicate of this bug. ***
Comment 12 Jérôme Guelfucci editbugs 2012-12-18 09:35:13 CET
*** Bug 8043 has been marked as a duplicate of this bug. ***
Comment 13 Jérôme Guelfucci editbugs 2012-12-18 22:00:53 CET
*** Bug 9415 has been marked as a duplicate of this bug. ***
Comment 14 Jérôme Guelfucci editbugs 2012-12-20 00:12:37 CET
*** Bug 8519 has been marked as a duplicate of this bug. ***
Comment 15 Jérôme Guelfucci editbugs 2012-12-30 15:45:34 CET
Thanks, applied in git master 9dfbc906f89601f145557fe6846e9ad44a8e9e22.
Comment 16 Jérôme Guelfucci editbugs 2013-05-01 11:11:15 CEST
*** Bug 9891 has been marked as a duplicate of this bug. ***
Comment 17 Yves-Alexis Perez editbugs 2013-09-22 21:01:18 CEST
(In reply to Jérôme Guelfucci from comment #15)
> Thanks, applied in git master 9dfbc906f89601f145557fe6846e9ad44a8e9e22.

Maybe this could be backported to 4.10 and a bugfix release could be done?

Bug #8744

Reported by:
Harald Judt
Reported on: 2012-04-20
Last modified on: 2013-09-22
Duplicates (7):
  • 8043 Unable to map 1 to a Application using Application Shortcuts
  • 8519 Keyboard shortcuts involving and a number
  • 8554 Keyboard application shortcuts - Invalid recorded interpretations for some special characters
  • 8889 can't make keyboard sequences with Shift for the window manager
  • 9415 Keyboard Shortcuts not triggered when CAPS LOCK enabled
  • 9550 When entering keyboard shortcut combinations including Shift ignore the Shift key.
  • 9891 Cannot set keyboard shortcut to Control+Shift+xxx where xxx in [a-z]

People

Assignee:
Jérôme Guelfucci
CC List:
17 users

Version

Version:
4.10.0

Attachments

Additional information