After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 530356 - Pressing "Stop" send Eject
Pressing "Stop" send Eject
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: plugins
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2008-04-28 13:28 UTC by Bastien Nocera
Modified: 2008-04-29 08:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gsd-handle-keysyms.patch (1019 bytes, patch)
2008-04-28 13:31 UTC, Bastien Nocera
needs-work Details | Review
gsd-handle-keysyms-2.patch (1.82 KB, patch)
2008-04-28 16:02 UTC, Bastien Nocera
accepted-commit_now Details | Review
gsd-handle-keysyms-3.patch (1.84 KB, patch)
2008-04-29 08:41 UTC, Bastien Nocera
none Details | Review

Description Bastien Nocera 2008-04-28 13:28:23 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=346201 for details

Reproducer:
1. Disable the media-keys plugin
/apps/gnome_settings_daemon/plugins/media-keys/active false
2. Restart gnome-settings-daemon (a good ol' killall will do)
3. Bind F12 to that key:
xmodmap -e "keycode 96 = XF86AudioStop XF86Eject"
4. Run test-media-keys in the gnome-settings-daemon sources
5. Press F12, the Eject popup will show up, instead of sending stop

The problem is in match_key matching only on keycode, and ignoring the "Shift" state. As Eject is listed before Stop in the list of supported keys, it will be matched first.

Patch below (with a FIXME)
Comment 1 Bastien Nocera 2008-04-28 13:31:20 UTC
Created attachment 110038 [details] [review]
gsd-handle-keysyms.patch

Just the "keyboard group" problem to fix.
Comment 2 Bastien Nocera 2008-04-28 16:02:04 UTC
Created attachment 110048 [details] [review]
gsd-handle-keysyms-2.patch

Handle XKB mode switch
Comment 3 Bastien Nocera 2008-04-28 17:40:01 UTC
I forgot an ifdef HAVE_X11_EXTENSIONS_XKB_H around have_xkb(), but you see the point...
Comment 4 Jens Granseuer 2008-04-28 19:20:30 UTC
I'd also change the

+		if (keyval == key->keysym
+		    && (key->state & ~consumed & GSD_USED_MODS) == key->state) {
+		    	return TRUE;
+		}
+		return FALSE;

to

return (keyval == key->keysym
        && (key->state & ~consumed & GSD_USED_MODS) == key->state);

Otherwise, please commit.
Comment 5 Bastien Nocera 2008-04-29 08:41:25 UTC
Created attachment 110096 [details] [review]
gsd-handle-keysyms-3.patch

Update with the changes mentioned above, and also check whether the pressed key matches either the upper or lower keyval with that keysym (otherwise Ctrl+Alt+O wouldn't work with CapsLock or Shift on).
Comment 6 Bastien Nocera 2008-04-29 08:45:28 UTC
Bugger, obviously, my patch wasn't as updated as it should have been. Patch:
http://svn.gnome.org/viewvc/gnome-settings-daemon/trunk/plugins/common/gsd-keygrab.c?r1=306&r2=326

Committed to trunk

2008-04-29  Bastien Nocera  <hadess@hadess.net>

	* plugins/common/gsd-keygrab.c (have_xkb), (match_key):
	When checking whether a key matches our key event, check
	the keysym from the key event, to avoid triggering another
	keybindings with the same keycode, but different keysym,
	Fixes Eject being triggered when pressing the Stop key with the
	default inet keymap (Closes: #530356)