Merge lp:~attente/gnome-settings-daemon/non-latin-media-keys into lp:~ubuntu-desktop/gnome-settings-daemon/ubuntu

Proposed by William Hua on 2013-10-04
Status: Rejected
Rejected by: Sebastien Bacher on 2013-10-08
Proposed branch: lp:~attente/gnome-settings-daemon/non-latin-media-keys
Merge into: lp:~ubuntu-desktop/gnome-settings-daemon/ubuntu
Diff against target: 132 lines (+119/-1)
2 files modified
debian/patches/non-latin-media-keys.patch (+118/-0)
debian/patches/series (+1/-1)
To merge this branch: bzr merge lp:~attente/gnome-settings-daemon/non-latin-media-keys
Reviewer Review Type Date Requested Status
Sebastien Bacher 2013-10-04 Disapprove on 2013-10-08
Review via email: mp+189369@code.launchpad.net

Commit message

Also check shortcuts by key code. (LP: 1226962)

Description of the change

Also check shortcuts by key code. (LP: 1226962)

This branch only fixes one half of the problem, fixing gnome-settings-daemon's keyboard shortcuts on the root window.

The other half is dealing with the GTK+ side's accelerator shortcut handling for application windows more directly.

To post a comment you must log in.
429. By William Hua on 2013-10-04

ocd

430. By William Hua on 2013-10-04

Merge trunk.

Dmitry Shachnev (mitya57) wrote :

Thanks for taking care of this issue. FYI, there is some feedback in comments 25 and 28 of the linked bug.

Sebastien Bacher (seb128) wrote :

(setting as rejected, it was discussed/debugged on IRc and we find a better way to resolve the issue)

review: Disapprove

Unmerged revisions

430. By William Hua on 2013-10-04

Merge trunk.

429. By William Hua on 2013-10-04

ocd

428. By William Hua on 2013-10-04

Also check shortcuts by key code. (LP: 1226962)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'debian/patches/non-latin-media-keys.patch'
2--- debian/patches/non-latin-media-keys.patch 1970-01-01 00:00:00 +0000
3+++ debian/patches/non-latin-media-keys.patch 2013-10-04 17:01:30 +0000
4@@ -0,0 +1,118 @@
5+--- a/plugins/media-keys/gsd-media-keys-manager.c
6++++ b/plugins/media-keys/gsd-media-keys-manager.c
7+@@ -2618,6 +2618,46 @@
8+ }
9+ }
10+
11++ for (i = 0; i < manager->priv->keys->len; i++) {
12++ MediaKey *key;
13++
14++ key = g_ptr_array_index (manager->priv->keys, i);
15++
16++ if (match_xi2_key_fuzzily (key->key, xev)) {
17++ switch (key->key_type) {
18++ case VOLUME_DOWN_KEY:
19++ case VOLUME_UP_KEY:
20++ case VOLUME_DOWN_QUIET_KEY:
21++ case VOLUME_UP_QUIET_KEY:
22++ case SCREEN_BRIGHTNESS_UP_KEY:
23++ case SCREEN_BRIGHTNESS_DOWN_KEY:
24++ case KEYBOARD_BRIGHTNESS_UP_KEY:
25++ case KEYBOARD_BRIGHTNESS_DOWN_KEY:
26++ /* auto-repeatable keys */
27++ if (xiev->evtype != XI_KeyPress)
28++ return GDK_FILTER_CONTINUE;
29++ break;
30++ default:
31++ if (xiev->evtype != XI_KeyRelease) {
32++ return GDK_FILTER_CONTINUE;
33++ }
34++ }
35++
36++ manager->priv->current_screen = get_screen_from_root (manager, xev->root);
37++
38++ if (key->key_type == CUSTOM_KEY) {
39++ do_custom_action (manager, deviceid, key, xev->time);
40++ return GDK_FILTER_REMOVE;
41++ }
42++
43++ if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) {
44++ return GDK_FILTER_REMOVE;
45++ } else {
46++ return GDK_FILTER_CONTINUE;
47++ }
48++ }
49++ }
50++
51+ return GDK_FILTER_CONTINUE;
52+ }
53+
54+--- a/plugins/common/gsd-keygrab.c
55++++ b/plugins/common/gsd-keygrab.c
56+@@ -307,8 +307,8 @@
57+ return state;
58+ }
59+
60+-gboolean
61+-match_xi2_key (Key *key, XIDeviceEvent *event)
62++static gboolean
63++real_match_xi2_key (Key *key, XIDeviceEvent *event, gboolean fuzzily)
64+ {
65+ guint keyval;
66+ GdkModifierType consumed;
67+@@ -335,6 +335,7 @@
68+ &keyval, NULL, NULL, &consumed)) {
69+ guint lower, upper;
70+ guint mask;
71++ gboolean match;
72+
73+ /* HACK: we don't want to use SysRq as a keybinding, so we avoid
74+ * its translation from Alt+Print. */
75+@@ -358,8 +359,11 @@
76+ if (lower == key->keysym)
77+ consumed &= ~GDK_SHIFT_MASK;
78+
79+- return ((lower == key->keysym || upper == key->keysym)
80+- && (state & ~consumed & gsd_used_mods) == mask);
81++ match = (lower == key->keysym || upper == key->keysym)
82++ && (state & ~consumed & gsd_used_mods) == mask;
83++
84++ if (match || !fuzzily)
85++ return match;
86+ }
87+
88+ /* The key we passed doesn't have a keysym, so try with just the keycode */
89+@@ -368,6 +372,18 @@
90+ && key_uses_keycode (key, keycode));
91+ }
92+
93++gboolean
94++match_xi2_key (Key *key, XIDeviceEvent *event)
95++{
96++ return real_match_xi2_key (key, event, FALSE);
97++}
98++
99++gboolean
100++match_xi2_key_fuzzily (Key *key, XIDeviceEvent *event)
101++{
102++ return real_match_xi2_key (key, event, TRUE);
103++}
104++
105+ Key *
106+ parse_key (const char *str)
107+ {
108+--- a/plugins/common/gsd-keygrab.h
109++++ b/plugins/common/gsd-keygrab.h
110+@@ -45,8 +45,10 @@
111+ void ungrab_key_unsafe (Key *key,
112+ GSList *screens);
113+
114+-gboolean match_xi2_key (Key *key,
115+- XIDeviceEvent *event);
116++gboolean match_xi2_key (Key *key,
117++ XIDeviceEvent *event);
118++gboolean match_xi2_key_fuzzily (Key *key,
119++ XIDeviceEvent *event);
120+
121+ gboolean key_uses_keycode (const Key *key,
122+ guint keycode);
123
124=== modified file 'debian/patches/series'
125--- debian/patches/series 2013-10-04 16:21:40 +0000
126+++ debian/patches/series 2013-10-04 17:01:30 +0000
127@@ -26,4 +26,4 @@
128 ubuntu-fix-desktop-file.patch
129 ubuntu-lid-close-suspend.patch
130 git_thumbnail_cleaning_use_less_ios.patch
131-
132+non-latin-media-keys.patch

Subscribers

People subscribed via source and target branches

to all changes: