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

Proposed by William Hua
Status: Rejected
Rejected by: Sebastien Bacher
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 Disapprove
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

ocd

430. By William Hua

Merge trunk.

Revision history for this message
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.

Revision history for this message
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

Merge trunk.

429. By William Hua

ocd

428. By William Hua

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

Subscribers

People subscribed via source and target branches

to all changes: