Merge ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/mutter: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)
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.

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

thanks!

review: Approve

Preview Diff

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

Subscribers

People subscribed via source and target branches