Merge ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/bionic
- Git
- lp:~3v1n0/ubuntu/+source/mutter
- ubuntu/bionic
- Merge into ubuntu/bionic
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Merged at revision: | 6fe31f8979b732f4ce692b37e68c0587ef9344d4 |
Proposed branch: | ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic |
Merge into: | ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/bionic |
Diff against target: |
472 lines (+435/-0) 5 files modified
debian/changelog (+10/-0) debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch (+43/-0) debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch (+316/-0) debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch (+63/-0) debian/patches/series (+3/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Iain Lane | Approve | ||
Review via email: mp+358007@code.launchpad.net |
This proposal supersedes a proposal from 2018-10-30.
Commit message
Fix already in cosmic, no need to port there.
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 9c9690f..3f8c8d8 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,13 @@ | |||
6 | 1 | mutter (3.28.3-2~ubuntu18.04.2) UNRELEASED; urgency=medium | ||
7 | 2 | |||
8 | 3 | * d/p/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch: | ||
9 | 4 | - Create back buffers in early intel GPU generations (LP: #1727356) | ||
10 | 5 | * d/p/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch, | ||
11 | 6 | d/p/clutter-Do-not-latch-modifiers-on-modifier-keys.patch | ||
12 | 7 | - Fix typing capital letters when using OSD keyboard (LP: #1730211) | ||
13 | 8 | |||
14 | 9 | -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 30 Oct 2018 12:25:42 +0100 | ||
15 | 10 | |||
16 | 1 | mutter (3.28.3-2~ubuntu18.04.1) bionic; urgency=medium | 11 | mutter (3.28.3-2~ubuntu18.04.1) bionic; urgency=medium |
17 | 2 | 12 | ||
18 | 3 | * No-change backport from unstable to bionic | 13 | * No-change backport from unstable to bionic |
19 | diff --git a/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch b/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch | |||
20 | 4 | new file mode 100644 | 14 | new file mode 100644 |
21 | index 0000000..120171f | |||
22 | --- /dev/null | |||
23 | +++ b/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch | |||
24 | @@ -0,0 +1,43 @@ | |||
25 | 1 | From: Carlos Garnacho <carlosg@gnome.org> | ||
26 | 2 | Date: Wed, 3 Oct 2018 22:43:21 +0200 | ||
27 | 3 | Subject: clutter: Do not latch modifiers on modifier keys | ||
28 | 4 | |||
29 | 5 | If the user maps eg. Alt+F2 to a pad button, the MetaInputSettings will | ||
30 | 6 | send the full Alt press, F2 press, F2 release, Alt release sequence. | ||
31 | 7 | However the keycode corresponding to Alt is found in level 1, so the | ||
32 | 8 | Shift modifier gets unintendedly latched in addition to the Alt key | ||
33 | 9 | press/release pair. | ||
34 | 10 | |||
35 | 11 | We could probably improve keycode lookup heuristics so level=0 (and | ||
36 | 12 | no modifier latching) is preferred, but we can do without it altogether | ||
37 | 13 | for modifier keys. | ||
38 | 14 | |||
39 | 15 | Ubuntu-Bug: https://bugs.launchpad.net/oem-priority/+bug/1730211 | ||
40 | 16 | Applied-Upstream: yes, 3.30.1 | ||
41 | 17 | --- | ||
42 | 18 | clutter/clutter/x11/clutter-virtual-input-device-x11.c | 6 ++++-- | ||
43 | 19 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
44 | 20 | |||
45 | 21 | diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.c b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
46 | 22 | index b86ded0..e16ba3f 100644 | ||
47 | 23 | --- a/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
48 | 24 | +++ b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
49 | 25 | @@ -147,14 +147,16 @@ clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtu | ||
50 | 26 | return; | ||
51 | 27 | } | ||
52 | 28 | |||
53 | 29 | - if (key_state == CLUTTER_KEY_STATE_PRESSED) | ||
54 | 30 | + if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) && | ||
55 | 31 | + key_state == CLUTTER_KEY_STATE_PRESSED) | ||
56 | 32 | clutter_keymap_x11_latch_modifiers (keymap, level, TRUE); | ||
57 | 33 | |||
58 | 34 | XTestFakeKeyEvent (clutter_x11_get_default_display (), | ||
59 | 35 | (KeyCode) keycode, | ||
60 | 36 | key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||
61 | 37 | |||
62 | 38 | - if (key_state == CLUTTER_KEY_STATE_RELEASED) | ||
63 | 39 | + if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) && | ||
64 | 40 | + key_state == CLUTTER_KEY_STATE_RELEASED) | ||
65 | 41 | clutter_keymap_x11_latch_modifiers (keymap, level, FALSE); | ||
66 | 42 | } | ||
67 | 43 | |||
68 | diff --git a/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch b/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch | |||
69 | 0 | new file mode 100644 | 44 | new file mode 100644 |
70 | index 0000000..ccb4263 | |||
71 | --- /dev/null | |||
72 | +++ b/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch | |||
73 | @@ -0,0 +1,316 @@ | |||
74 | 1 | From: Carlos Garnacho <carlosg@gnome.org> | ||
75 | 2 | Date: Fri, 29 Jun 2018 14:31:23 +0200 | ||
76 | 3 | Subject: clutter/x11: Implement keycode lookup from keysyms on virtual key | ||
77 | 4 | devices | ||
78 | 5 | |||
79 | 6 | Unfortunately XKeysymToKeycode() falls short in that it coalesces keysyms | ||
80 | 7 | into keycodes pertaining to the first level (i.e. lowercase). Add a | ||
81 | 8 | ClutterKeymapX11 method (much alike its GdkKeymap counterpart) to look up | ||
82 | 9 | all matches for the given keysym. | ||
83 | 10 | |||
84 | 11 | Two other helper methods have been added so the virtual device can fetch | ||
85 | 12 | the current keyboard group, and latch modifiers for key emission. Combining | ||
86 | 13 | all this, the virtual device is now able to handle keycodes in further | ||
87 | 14 | levels. | ||
88 | 15 | |||
89 | 16 | Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/135 | ||
90 | 17 | |||
91 | 18 | (cherry picked from commit 85284acb000ddc70afcf716b6c198b4b5bf5741e) | ||
92 | 19 | |||
93 | 20 | Ubuntu-Bug: https://bugs.launchpad.net/oem-priority/+bug/1730211 | ||
94 | 21 | Applied-Upstream: yes, 3.28.4 | ||
95 | 22 | --- | ||
96 | 23 | clutter/clutter/x11/clutter-keymap-x11.c | 178 ++++++++++++++++++++- | ||
97 | 24 | clutter/clutter/x11/clutter-keymap-x11.h | 8 + | ||
98 | 25 | .../clutter/x11/clutter-virtual-input-device-x11.c | 22 ++- | ||
99 | 26 | 3 files changed, 204 insertions(+), 4 deletions(-) | ||
100 | 27 | |||
101 | 28 | diff --git a/clutter/clutter/x11/clutter-keymap-x11.c b/clutter/clutter/x11/clutter-keymap-x11.c | ||
102 | 29 | index 914e314..c34e676 100644 | ||
103 | 30 | --- a/clutter/clutter/x11/clutter-keymap-x11.c | ||
104 | 31 | +++ b/clutter/clutter/x11/clutter-keymap-x11.c | ||
105 | 32 | @@ -38,6 +38,14 @@ | ||
106 | 33 | |||
107 | 34 | typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class; | ||
108 | 35 | typedef struct _DirectionCacheEntry DirectionCacheEntry; | ||
109 | 36 | +typedef struct _ClutterKeymapKey ClutterKeymapKey; | ||
110 | 37 | + | ||
111 | 38 | +struct _ClutterKeymapKey | ||
112 | 39 | +{ | ||
113 | 40 | + guint keycode; | ||
114 | 41 | + guint group; | ||
115 | 42 | + guint level; | ||
116 | 43 | +}; | ||
117 | 44 | |||
118 | 45 | struct _DirectionCacheEntry | ||
119 | 46 | { | ||
120 | 47 | @@ -59,6 +67,7 @@ struct _ClutterKeymapX11 | ||
121 | 48 | |||
122 | 49 | ClutterModifierType num_lock_mask; | ||
123 | 50 | ClutterModifierType scroll_lock_mask; | ||
124 | 51 | + ClutterModifierType level3_shift_mask; | ||
125 | 52 | |||
126 | 53 | PangoDirection current_direction; | ||
127 | 54 | |||
128 | 55 | @@ -69,6 +78,7 @@ struct _ClutterKeymapX11 | ||
129 | 56 | Atom current_group_atom; | ||
130 | 57 | guint current_cache_serial; | ||
131 | 58 | DirectionCacheEntry group_direction_cache[4]; | ||
132 | 59 | + int current_group; | ||
133 | 60 | #endif | ||
134 | 61 | |||
135 | 62 | guint caps_lock_state : 1; | ||
136 | 63 | @@ -198,6 +208,9 @@ get_xkb (ClutterKeymapX11 *keymap_x11) | ||
137 | 64 | if (keymap_x11->scroll_lock_mask == 0) | ||
138 | 65 | keymap_x11->scroll_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy, | ||
139 | 66 | XK_Scroll_Lock); | ||
140 | 67 | + if (keymap_x11->level3_shift_mask == 0) | ||
141 | 68 | + keymap_x11->level3_shift_mask = XkbKeysymToModifiers (backend_x11->xdpy, | ||
142 | 69 | + XK_ISO_Level3_Shift); | ||
143 | 70 | |||
144 | 71 | return keymap_x11->xkb_desc; | ||
145 | 72 | } | ||
146 | 73 | @@ -469,6 +482,7 @@ static void | ||
147 | 74 | clutter_keymap_x11_init (ClutterKeymapX11 *keymap) | ||
148 | 75 | { | ||
149 | 76 | keymap->current_direction = PANGO_DIRECTION_NEUTRAL; | ||
150 | 77 | + keymap->current_group = -1; | ||
151 | 78 | } | ||
152 | 79 | |||
153 | 80 | static ClutterTranslateReturn | ||
154 | 81 | @@ -498,7 +512,8 @@ clutter_keymap_x11_translate_event (ClutterEventTranslator *translator, | ||
155 | 82 | { | ||
156 | 83 | case XkbStateNotify: | ||
157 | 84 | CLUTTER_NOTE (EVENT, "Updating keyboard state"); | ||
158 | 85 | - update_direction (keymap_x11, XkbStateGroup (&xkb_event->state)); | ||
159 | 86 | + keymap_x11->current_group = XkbStateGroup (&xkb_event->state); | ||
160 | 87 | + update_direction (keymap_x11, keymap_x11->current_group); | ||
161 | 88 | update_locked_mods (keymap_x11, xkb_event->state.locked_mods); | ||
162 | 89 | retval = CLUTTER_TRANSLATE_REMOVE; | ||
163 | 90 | break; | ||
164 | 91 | @@ -665,3 +680,164 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap) | ||
165 | 92 | #endif | ||
166 | 93 | return PANGO_DIRECTION_NEUTRAL; | ||
167 | 94 | } | ||
168 | 95 | + | ||
169 | 96 | +static gboolean | ||
170 | 97 | +clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11, | ||
171 | 98 | + guint keyval, | ||
172 | 99 | + ClutterKeymapKey **keys, | ||
173 | 100 | + gint *n_keys) | ||
174 | 101 | +{ | ||
175 | 102 | +#ifdef HAVE_XKB | ||
176 | 103 | + if (CLUTTER_BACKEND_X11 (keymap_x11->backend)->use_xkb) | ||
177 | 104 | + { | ||
178 | 105 | + XkbDescRec *xkb = get_xkb (keymap_x11); | ||
179 | 106 | + GArray *retval; | ||
180 | 107 | + gint keycode; | ||
181 | 108 | + | ||
182 | 109 | + keycode = keymap_x11->min_keycode; | ||
183 | 110 | + retval = g_array_new (FALSE, FALSE, sizeof (ClutterKeymapKey)); | ||
184 | 111 | + | ||
185 | 112 | + while (keycode <= keymap_x11->max_keycode) | ||
186 | 113 | + { | ||
187 | 114 | + gint max_shift_levels = XkbKeyGroupsWidth (xkb, keycode); | ||
188 | 115 | + gint group = 0; | ||
189 | 116 | + gint level = 0; | ||
190 | 117 | + gint total_syms = XkbKeyNumSyms (xkb, keycode); | ||
191 | 118 | + gint i = 0; | ||
192 | 119 | + KeySym *entry; | ||
193 | 120 | + | ||
194 | 121 | + /* entry is an array with all syms for group 0, all | ||
195 | 122 | + * syms for group 1, etc. and for each group the | ||
196 | 123 | + * shift level syms are in order | ||
197 | 124 | + */ | ||
198 | 125 | + entry = XkbKeySymsPtr (xkb, keycode); | ||
199 | 126 | + | ||
200 | 127 | + while (i < total_syms) | ||
201 | 128 | + { | ||
202 | 129 | + g_assert (i == (group * max_shift_levels + level)); | ||
203 | 130 | + | ||
204 | 131 | + if (entry[i] == keyval) | ||
205 | 132 | + { | ||
206 | 133 | + ClutterKeymapKey key; | ||
207 | 134 | + | ||
208 | 135 | + key.keycode = keycode; | ||
209 | 136 | + key.group = group; | ||
210 | 137 | + key.level = level; | ||
211 | 138 | + | ||
212 | 139 | + g_array_append_val (retval, key); | ||
213 | 140 | + | ||
214 | 141 | + g_assert (XkbKeySymEntry (xkb, keycode, level, group) == | ||
215 | 142 | + keyval); | ||
216 | 143 | + } | ||
217 | 144 | + | ||
218 | 145 | + ++level; | ||
219 | 146 | + | ||
220 | 147 | + if (level == max_shift_levels) | ||
221 | 148 | + { | ||
222 | 149 | + level = 0; | ||
223 | 150 | + ++group; | ||
224 | 151 | + } | ||
225 | 152 | + | ||
226 | 153 | + ++i; | ||
227 | 154 | + } | ||
228 | 155 | + | ||
229 | 156 | + ++keycode; | ||
230 | 157 | + } | ||
231 | 158 | + | ||
232 | 159 | + if (retval->len > 0) | ||
233 | 160 | + { | ||
234 | 161 | + *keys = (ClutterKeymapKey*) retval->data; | ||
235 | 162 | + *n_keys = retval->len; | ||
236 | 163 | + } | ||
237 | 164 | + else | ||
238 | 165 | + { | ||
239 | 166 | + *keys = NULL; | ||
240 | 167 | + *n_keys = 0; | ||
241 | 168 | + } | ||
242 | 169 | + | ||
243 | 170 | + g_array_free (retval, retval->len > 0 ? FALSE : TRUE); | ||
244 | 171 | + | ||
245 | 172 | + return *n_keys > 0; | ||
246 | 173 | + } | ||
247 | 174 | + else | ||
248 | 175 | +#endif | ||
249 | 176 | + { | ||
250 | 177 | + return FALSE; | ||
251 | 178 | + } | ||
252 | 179 | +} | ||
253 | 180 | + | ||
254 | 181 | +void | ||
255 | 182 | +clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11, | ||
256 | 183 | + uint32_t level, | ||
257 | 184 | + gboolean enable) | ||
258 | 185 | +{ | ||
259 | 186 | +#ifdef HAVE_XKB | ||
260 | 187 | + ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); | ||
261 | 188 | + uint32_t modifiers[] = { | ||
262 | 189 | + 0, | ||
263 | 190 | + ShiftMask, | ||
264 | 191 | + keymap_x11->level3_shift_mask, | ||
265 | 192 | + keymap_x11->level3_shift_mask | ShiftMask, | ||
266 | 193 | + }; | ||
267 | 194 | + uint32_t value = 0; | ||
268 | 195 | + | ||
269 | 196 | + if (!backend_x11->use_xkb) | ||
270 | 197 | + return; | ||
271 | 198 | + | ||
272 | 199 | + level = CLAMP (level, 0, G_N_ELEMENTS (modifiers) - 1); | ||
273 | 200 | + | ||
274 | 201 | + if (enable) | ||
275 | 202 | + value = modifiers[level]; | ||
276 | 203 | + else | ||
277 | 204 | + value = 0; | ||
278 | 205 | + | ||
279 | 206 | + XkbLatchModifiers (clutter_x11_get_default_display (), | ||
280 | 207 | + XkbUseCoreKbd, modifiers[level], | ||
281 | 208 | + value); | ||
282 | 209 | +#endif | ||
283 | 210 | +} | ||
284 | 211 | + | ||
285 | 212 | +static uint32_t | ||
286 | 213 | +clutter_keymap_x11_get_current_group (ClutterKeymapX11 *keymap_x11) | ||
287 | 214 | +{ | ||
288 | 215 | + ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); | ||
289 | 216 | + XkbStateRec state_rec; | ||
290 | 217 | + | ||
291 | 218 | + if (keymap_x11->current_group >= 0) | ||
292 | 219 | + return keymap_x11->current_group; | ||
293 | 220 | + | ||
294 | 221 | + XkbGetState (backend_x11->xdpy, XkbUseCoreKbd, &state_rec); | ||
295 | 222 | + return XkbStateGroup (&state_rec); | ||
296 | 223 | +} | ||
297 | 224 | + | ||
298 | 225 | +gboolean | ||
299 | 226 | +clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11, | ||
300 | 227 | + guint keyval, | ||
301 | 228 | + guint *keycode_out, | ||
302 | 229 | + guint *level_out) | ||
303 | 230 | +{ | ||
304 | 231 | + ClutterKeymapKey *keys; | ||
305 | 232 | + gint i, n_keys, group; | ||
306 | 233 | + gboolean found = FALSE; | ||
307 | 234 | + | ||
308 | 235 | + g_return_val_if_fail (keycode_out != NULL, FALSE); | ||
309 | 236 | + g_return_val_if_fail (level_out != NULL, FALSE); | ||
310 | 237 | + | ||
311 | 238 | + group = clutter_keymap_x11_get_current_group (keymap_x11); | ||
312 | 239 | + | ||
313 | 240 | + if (!clutter_keymap_x11_get_entries_for_keyval (keymap_x11, keyval, &keys, &n_keys)) | ||
314 | 241 | + return FALSE; | ||
315 | 242 | + | ||
316 | 243 | + for (i = 0; i < n_keys && !found; i++) | ||
317 | 244 | + { | ||
318 | 245 | + if (keys[i].group == group) | ||
319 | 246 | + { | ||
320 | 247 | + *keycode_out = keys[i].keycode; | ||
321 | 248 | + *level_out = keys[i].level; | ||
322 | 249 | + found = TRUE; | ||
323 | 250 | + } | ||
324 | 251 | + } | ||
325 | 252 | + | ||
326 | 253 | + g_free (keys); | ||
327 | 254 | + return found; | ||
328 | 255 | +} | ||
329 | 256 | diff --git a/clutter/clutter/x11/clutter-keymap-x11.h b/clutter/clutter/x11/clutter-keymap-x11.h | ||
330 | 257 | index ad673a2..4b5b403 100644 | ||
331 | 258 | --- a/clutter/clutter/x11/clutter-keymap-x11.h | ||
332 | 259 | +++ b/clutter/clutter/x11/clutter-keymap-x11.h | ||
333 | 260 | @@ -51,6 +51,14 @@ gboolean _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap, | ||
334 | 261 | |||
335 | 262 | PangoDirection _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap); | ||
336 | 263 | |||
337 | 264 | +gboolean clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11, | ||
338 | 265 | + guint keyval, | ||
339 | 266 | + guint *keycode_out, | ||
340 | 267 | + guint *level_out); | ||
341 | 268 | +void clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11, | ||
342 | 269 | + uint32_t level, | ||
343 | 270 | + gboolean enable); | ||
344 | 271 | + | ||
345 | 272 | G_END_DECLS | ||
346 | 273 | |||
347 | 274 | #endif /* __CLUTTER_KEYMAP_X11_H__ */ | ||
348 | 275 | diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.c b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
349 | 276 | index 416c944..b86ded0 100644 | ||
350 | 277 | --- a/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
351 | 278 | +++ b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
352 | 279 | @@ -32,6 +32,8 @@ | ||
353 | 280 | |||
354 | 281 | #include "clutter-virtual-input-device.h" | ||
355 | 282 | #include "x11/clutter-virtual-input-device-x11.h" | ||
356 | 283 | +#include "x11/clutter-backend-x11.h" | ||
357 | 284 | +#include "x11/clutter-keymap-x11.h" | ||
358 | 285 | |||
359 | 286 | struct _ClutterVirtualInputDeviceX11 | ||
360 | 287 | { | ||
361 | 288 | @@ -135,11 +137,25 @@ clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtu | ||
362 | 289 | uint32_t keyval, | ||
363 | 290 | ClutterKeyState key_state) | ||
364 | 291 | { | ||
365 | 292 | - KeyCode keycode; | ||
366 | 293 | + ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ()); | ||
367 | 294 | + ClutterKeymapX11 *keymap = backend_x11->keymap; | ||
368 | 295 | + uint32_t keycode, level; | ||
369 | 296 | + | ||
370 | 297 | + if (!clutter_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level)) | ||
371 | 298 | + { | ||
372 | 299 | + g_warning ("No keycode found for keyval %x in current group", keyval); | ||
373 | 300 | + return; | ||
374 | 301 | + } | ||
375 | 302 | + | ||
376 | 303 | + if (key_state == CLUTTER_KEY_STATE_PRESSED) | ||
377 | 304 | + clutter_keymap_x11_latch_modifiers (keymap, level, TRUE); | ||
378 | 305 | |||
379 | 306 | - keycode = XKeysymToKeycode (clutter_x11_get_default_display (), keyval); | ||
380 | 307 | XTestFakeKeyEvent (clutter_x11_get_default_display (), | ||
381 | 308 | - keycode, key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||
382 | 309 | + (KeyCode) keycode, | ||
383 | 310 | + key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||
384 | 311 | + | ||
385 | 312 | + if (key_state == CLUTTER_KEY_STATE_RELEASED) | ||
386 | 313 | + clutter_keymap_x11_latch_modifiers (keymap, level, FALSE); | ||
387 | 314 | } | ||
388 | 315 | |||
389 | 316 | static void | ||
390 | diff --git a/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch b/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch | |||
391 | 0 | new file mode 100644 | 317 | new file mode 100644 |
392 | index 0000000..a25fca3 | |||
393 | --- /dev/null | |||
394 | +++ b/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch | |||
395 | @@ -0,0 +1,63 @@ | |||
396 | 1 | From: =?utf-8?q?Alex_Villac=C3=ADs_Lasso?= <a_villacis@palosanto.com> | ||
397 | 2 | Date: Fri, 27 Jul 2018 16:08:52 +0000 | ||
398 | 3 | Subject: renderer/native: Fallback to non-planar API if | ||
399 | 4 | gbm_bo_get_handle_for_plane fails | ||
400 | 5 | |||
401 | 6 | Commit c0d9b08ef9bf2be865aad9bf1bc74ba24c655d9f replaced the old GBM API calls | ||
402 | 7 | with the multi-plane GBM API. However, the call to gbm_bo_get_handle_for_plane | ||
403 | 8 | fails for some DRI drivers (in particular i915). Due to missing error checks, | ||
404 | 9 | the subsequent call to drmModeAddFB[2] fails and the screen output locks up. | ||
405 | 10 | |||
406 | 11 | This commit adds the missing error checks and falls back to the old GBM API | ||
407 | 12 | (non-planar) if necessary. | ||
408 | 13 | |||
409 | 14 | v5: test success of gbm_bo_get_handle_for_plane instead of errno | ||
410 | 15 | |||
411 | 16 | This commit adopts solution proposed by Daniel van Vugt to check the return | ||
412 | 17 | value of gbm_bo_get_handle_for_plane on plane 0 and fall back to old | ||
413 | 18 | non-planar method if the call fails. This removes the errno check (for | ||
414 | 19 | ENOSYS) that could abort if mesa ever sets a different value. | ||
415 | 20 | |||
416 | 21 | Related to: https://gitlab.gnome.org/GNOME/mutter/issues/127 | ||
417 | 22 | |||
418 | 23 | (cherry picked from commit f7af32a3eaefabbea3ebbda3a93eff98dd105ab9) | ||
419 | 24 | |||
420 | 25 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1727356 | ||
421 | 26 | Applied-Upstream: yes, 3.28.4 | ||
422 | 27 | --- | ||
423 | 28 | src/backends/native/meta-renderer-native.c | 21 ++++++++++++++++----- | ||
424 | 29 | 1 file changed, 16 insertions(+), 5 deletions(-) | ||
425 | 30 | |||
426 | 31 | diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c | ||
427 | 32 | index fc6b223..59003b3 100644 | ||
428 | 33 | --- a/src/backends/native/meta-renderer-native.c | ||
429 | 34 | +++ b/src/backends/native/meta-renderer-native.c | ||
430 | 35 | @@ -1607,12 +1607,23 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms, | ||
431 | 36 | return FALSE; | ||
432 | 37 | } | ||
433 | 38 | |||
434 | 39 | - for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++) | ||
435 | 40 | + if (gbm_bo_get_handle_for_plane (next_bo, 0).s32 == -1) | ||
436 | 41 | { | ||
437 | 42 | - strides[i] = gbm_bo_get_stride_for_plane (next_bo, i); | ||
438 | 43 | - handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32; | ||
439 | 44 | - offsets[i] = gbm_bo_get_offset (next_bo, i); | ||
440 | 45 | - modifiers[i] = gbm_bo_get_modifier (next_bo); | ||
441 | 46 | + /* Failed to fetch handle to plane, falling back to old method */ | ||
442 | 47 | + strides[0] = gbm_bo_get_stride (next_bo); | ||
443 | 48 | + handles[0] = gbm_bo_get_handle (next_bo).u32; | ||
444 | 49 | + offsets[0] = 0; | ||
445 | 50 | + modifiers[0] = DRM_FORMAT_MOD_INVALID; | ||
446 | 51 | + } | ||
447 | 52 | + else | ||
448 | 53 | + { | ||
449 | 54 | + for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++) | ||
450 | 55 | + { | ||
451 | 56 | + strides[i] = gbm_bo_get_stride_for_plane (next_bo, i); | ||
452 | 57 | + handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32; | ||
453 | 58 | + offsets[i] = gbm_bo_get_offset (next_bo, i); | ||
454 | 59 | + modifiers[i] = gbm_bo_get_modifier (next_bo); | ||
455 | 60 | + } | ||
456 | 61 | } | ||
457 | 62 | |||
458 | 63 | kms_fd = meta_gpu_kms_get_fd (gpu_kms); | ||
459 | diff --git a/debian/patches/series b/debian/patches/series | |||
460 | index 860ee4c..5bd9ae6 100644 | |||
461 | --- a/debian/patches/series | |||
462 | +++ b/debian/patches/series | |||
463 | @@ -10,6 +10,9 @@ theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch | |||
464 | 10 | clutter-Smooth-out-master-clock-to-smooth-visuals.patch | 10 | clutter-Smooth-out-master-clock-to-smooth-visuals.patch |
465 | 11 | core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch | 11 | core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch |
466 | 12 | bgo768531_workaround-startup-notifications.patch | 12 | bgo768531_workaround-startup-notifications.patch |
467 | 13 | renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch | ||
468 | 14 | clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch | ||
469 | 15 | clutter-Do-not-latch-modifiers-on-modifier-keys.patch | ||
470 | 13 | debian/synaptics-support.patch | 16 | debian/synaptics-support.patch |
471 | 14 | debian/skip-failing-tests.patch | 17 | debian/skip-failing-tests.patch |
472 | 15 | debian/skip-failing-tests-325.patch | 18 | debian/skip-failing-tests-325.patch |
thanks!