[Bug 244290] x11-wm/xfce4 does not see up arrow after reinstall

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Mar 22 04:04:13 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244290

--- Comment #18 from Jethro Nederhof <jethro at jethron.id.au> ---
OK so I've dug into this a bit further and I think there is a relevant bug in
XFCE.

For port x11/libxfce4menu, in libxfce4kbd-private/xfce-shortcuts-grabber.c and
the xfce_shortcuts_grabber_keys_changed function. This function is called
whenever the X11 keymap is updated, it 'ungrabs' all the current shortcut keys,
then loops through again and 'grabs' them again. Grabs are implemented against
the keycode value provided by the keymap, but the problem is the removal
ungrabs with the current updated value from the keymap (keys[i].keycode),
rather than the old one.

So the problem manifests as:
XFCE loads with a keymap
XFCE registers shortcuts that use keys in that keymap
The keymap updates
The changes in the keymap update involve keys used in shortcuts
XFCE ungrabs the shortcuts using the 'new' keymap codes
The 'old' keymap codes never get ungrabbed, but the new keycodes are grabbed

So for me when XFCE starts, gdk_keymap_get_entires_for_keyval() tells XFCE that
"keycode 111 (Up) maps to keyval 65377 (Print)" (for whatever reason), XFCE
maps the shortcut to it, then shortly after the keymap updates and says that
"actually keycode 107 (Print) maps to keyval 65377 (Print)" and XFCE then
ungrabs keycode 107, then grabs it again, and the grab against 111 just stays
there forever without being cleaned up. 

I don't know much about X programming, but guess 'up' itself fails since even
when it matches the grab, the keyval doesn't match keyval 65377 (Print) so it
never tries to launch the associated shortcut in
xfce_shortcuts_grabber_event_filter(), then the 'flash' is the keypress event
getting sent to the root_window and unfocusing/refocusing the child window
which never receives the event due to XGrabKey's owner_events being false.

The setxkbmap workaround works by racing XFCE and updating the keymap so it's
correct the first time and nothing needs to be cleaned up, but the problem
would arise again if the keymap got updated mid-session (though why this
happens every session for me I haven't discovered).

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-xfce mailing list