Merge ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/bionic

Proposed by Marco Trevisan (Treviño) on 2019-01-15
Status: Merged
Merged at revision: 69e968c412d5559cfb9e04ac7ded0841bce64517
Proposed branch: ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic
Merge into: ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/bionic
Prerequisite: ~3v1n0/ubuntu/+source/mutter:upstream/3.28.x
Diff against target: 1691 lines (+672/-63)
8 files modified
debian/changelog (+27/-0)
debian/libmutter-2-0.symbols (+7/-0)
debian/patches/bgo768531_workaround-startup-notifications.patch (+2/-2)
debian/patches/clutter-Fix-offscreen-effect-painting-of-clones.patch (+629/-0)
debian/patches/debian/skip-failing-tests-325.patch (+3/-3)
debian/patches/debian/skip-failing-tests.patch (+3/-3)
debian/patches/series (+1/-11)
dev/null (+0/-44)
Reviewer Review Type Date Requested Status
Iain Lane 2019-01-15 Needs Fixing on 2019-01-16
Review via email: mp+361811@code.launchpad.net

This proposal supersedes a proposal from 2019-01-15.

To post a comment you must log in.
Iain Lane (laney) wrote :

Thanks.

I haven't reviewed fully, but the version is not right - we need a "-" in there somewhere otherwise this is treated as a native package, which it isn't. I suggest "3.28.3+git20181011-0ubuntu18.04.1".

review: Needs Fixing
Daniel van Vugt (vanvugt) wrote :

Also, the fix for bug 1767648 (and hence bug 1779615) is not in disco or cosmic yet(?)

Marco Trevisan (Treviño) (3v1n0) wrote :

> Also, the fix for bug 1767648 (and hence bug 1779615) is not in disco or
> cosmic yet(?)

For both I'm preparing a landing in disco, don't worry (that's why I'm delaying the fixes on this a bit), so they were planned to land in disco already in the coming upload.

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 360eba4..645be25 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,30 @@
1mutter (3.28.3+git20190124-0ubuntu18.04.1) UNRELEASED; urgency=medium
2
3 * New upstream git snapshot based on 3.28.3 plus commits up to 4af8d9d47
4 (LP: #1811900)
5 - Fix crash in dual monitor setup and gdm activation (LP: #1790525,
6 LP: #1795774)
7 - Make possible to launch gnome-shell in wayland using nvidia and EGLDevice
8 backend (LP: #1805444)
9 * debian/libmutter-2-0.symbols: Add new symbols
10 * d/p/gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch,
11 d/p/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch,
12 d/p/monitor-manager-Filter-out-low-screen-resolutions.patch,
13 d/p/window-wayland-Always-update-monitor-for-non-user-ops.patch,
14 d/p/window-Don-t-refuse-to-move-focus-to-the-grab-window.patch,
15 d/p/window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch,
16 d/p/monitor-Use-current-monitor-mode-to-check-whether-active.patch,
17 d/p/core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch,
18 d/p/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch,
19 d/p/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch,
20 d/p/clutter-Do-not-latch-modifiers-on-modifier-keys.patch:
21 - Removed as applied upstream
22 * d/p/clutter-Fix-offscreen-effect-painting-of-clones.patch:
23 - Fix offscreen-effect painting of clones in zoom mode (LP: #1767648,
24 LP: #1779615)
25
26 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 24 Jan 2019 18:05:12 +0000
27
1mutter (3.28.3-2~ubuntu18.04.2) bionic; urgency=medium28mutter (3.28.3-2~ubuntu18.04.2) bionic; urgency=medium
229
3 * d/p/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch:30 * d/p/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch:
diff --git a/debian/libmutter-2-0.symbols b/debian/libmutter-2-0.symbols
index e4203ad..1489074 100644
--- a/debian/libmutter-2-0.symbols
+++ b/debian/libmutter-2-0.symbols
@@ -545,7 +545,9 @@ libmutter-2.so.0 libmutter-2-0 #MINVER#
545 meta_gpu_get_type@Base 3.28.2545 meta_gpu_get_type@Base 3.28.2
546 meta_gpu_has_hotplug_mode_update@Base 3.28.2546 meta_gpu_has_hotplug_mode_update@Base 3.28.2
547 meta_gpu_kms_apply_crtc_mode@Base 3.28.2547 meta_gpu_kms_apply_crtc_mode@Base 3.28.2
548 meta_gpu_kms_can_have_outputs@Base 3.28.3+git20190124
548 meta_gpu_kms_error_quark@Base 3.28.2549 meta_gpu_kms_error_quark@Base 3.28.2
550 meta_gpu_kms_flip_closure_container_free@Base 3.28.3+git20190124
549 meta_gpu_kms_flip_crtc@Base 3.28.2551 meta_gpu_kms_flip_crtc@Base 3.28.2
550 meta_gpu_kms_get_fd@Base 3.28.2552 meta_gpu_kms_get_fd@Base 3.28.2
551 meta_gpu_kms_get_file_path@Base 3.28.2553 meta_gpu_kms_get_file_path@Base 3.28.2
@@ -556,6 +558,7 @@ libmutter-2.so.0 libmutter-2-0 #MINVER#
556 meta_gpu_kms_new@Base 3.28.2558 meta_gpu_kms_new@Base 3.28.2
557 meta_gpu_kms_set_power_save_mode@Base 3.28.2559 meta_gpu_kms_set_power_save_mode@Base 3.28.2
558 meta_gpu_kms_wait_for_flip@Base 3.28.2560 meta_gpu_kms_wait_for_flip@Base 3.28.2
561 meta_gpu_kms_wrap_flip_closure@Base 3.28.3+git20190124
559 meta_gpu_read_current@Base 3.28.2562 meta_gpu_read_current@Base 3.28.2
560 meta_gpu_take_crtcs@Base 3.28.2563 meta_gpu_take_crtcs@Base 3.28.2
561 meta_gpu_take_modes@Base 3.28.2564 meta_gpu_take_modes@Base 3.28.2
@@ -1238,14 +1241,17 @@ libmutter-2.so.0 libmutter-2-0 #MINVER#
1238 meta_warning@Base 3.28.21241 meta_warning@Base 3.28.2
1239 meta_wayland_actor_surface_calculate_scale@Base 3.28.21242 meta_wayland_actor_surface_calculate_scale@Base 3.28.2
1240 meta_wayland_actor_surface_get_type@Base 3.28.21243 meta_wayland_actor_surface_get_type@Base 3.28.2
1244 meta_wayland_actor_surface_queue_frame_callbacks@Base 3.28.3+git20190124
1241 meta_wayland_actor_surface_sync_actor_state@Base 3.28.21245 meta_wayland_actor_surface_sync_actor_state@Base 3.28.2
1242 meta_wayland_buffer_attach@Base 3.28.21246 meta_wayland_buffer_attach@Base 3.28.2
1243 meta_wayland_buffer_create_snippet@Base 3.28.21247 meta_wayland_buffer_create_snippet@Base 3.28.2
1244 meta_wayland_buffer_from_resource@Base 3.28.21248 meta_wayland_buffer_from_resource@Base 3.28.2
1245 meta_wayland_buffer_get_texture@Base 3.28.21249 meta_wayland_buffer_get_texture@Base 3.28.2
1246 meta_wayland_buffer_get_type@Base 3.28.21250 meta_wayland_buffer_get_type@Base 3.28.2
1251 meta_wayland_buffer_is_realized@Base 3.28.3+git20190124
1247 meta_wayland_buffer_is_y_inverted@Base 3.28.21252 meta_wayland_buffer_is_y_inverted@Base 3.28.2
1248 meta_wayland_buffer_process_damage@Base 3.28.21253 meta_wayland_buffer_process_damage@Base 3.28.2
1254 meta_wayland_buffer_realize@Base 3.28.3+git20190124
1249 meta_wayland_compositor_destroy_frame_callbacks@Base 3.28.21255 meta_wayland_compositor_destroy_frame_callbacks@Base 3.28.2
1250 meta_wayland_compositor_flush_clients@Base 3.28.21256 meta_wayland_compositor_flush_clients@Base 3.28.2
1251 meta_wayland_compositor_get_default@Base 3.28.21257 meta_wayland_compositor_get_default@Base 3.28.2
@@ -1397,6 +1403,7 @@ libmutter-2.so.0 libmutter-2-0 #MINVER#
1397 meta_wayland_surface_apply_pending_state@Base 3.28.21403 meta_wayland_surface_apply_pending_state@Base 3.28.2
1398 meta_wayland_surface_assign_role@Base 3.28.21404 meta_wayland_surface_assign_role@Base 3.28.2
1399 meta_wayland_surface_begin_grab_op@Base 3.28.21405 meta_wayland_surface_begin_grab_op@Base 3.28.2
1406 meta_wayland_surface_cache_pending_frame_callbacks@Base 3.28.3+git20190124
1400 meta_wayland_surface_calculate_input_region@Base 3.28.21407 meta_wayland_surface_calculate_input_region@Base 3.28.2
1401 meta_wayland_surface_cancel_inhibit_shortcuts_dialog@Base 3.28.21408 meta_wayland_surface_cancel_inhibit_shortcuts_dialog@Base 3.28.2
1402 meta_wayland_surface_clear_surface_actor@Base 3.28.21409 meta_wayland_surface_clear_surface_actor@Base 3.28.2
diff --git a/debian/patches/bgo768531_workaround-startup-notifications.patch b/debian/patches/bgo768531_workaround-startup-notifications.patch
index bc6b697..26ac823 100644
--- a/debian/patches/bgo768531_workaround-startup-notifications.patch
+++ b/debian/patches/bgo768531_workaround-startup-notifications.patch
@@ -16,10 +16,10 @@ Applied-upstream: no
16 1 file changed, 10 insertions(+)16 1 file changed, 10 insertions(+)
1717
18diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c18diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
19index 0ef9b83..891109a 10064419index 474595b..5837567 100644
20--- a/src/wayland/meta-wayland-gtk-shell.c20--- a/src/wayland/meta-wayland-gtk-shell.c
21+++ b/src/wayland/meta-wayland-gtk-shell.c21+++ b/src/wayland/meta-wayland-gtk-shell.c
22@@ -312,11 +312,21 @@ gtk_shell_set_startup_id (struct wl_client *client,22@@ -321,11 +321,21 @@ gtk_shell_set_startup_id (struct wl_client *client,
23 struct wl_resource *resource,23 struct wl_resource *resource,
24 const char *startup_id)24 const char *startup_id)
25 {25 {
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
26deleted file mode 10064426deleted file mode 100644
index 120171f..0000000
--- a/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch
+++ /dev/null
@@ -1,43 +0,0 @@
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-Fix-offscreen-effect-painting-of-clones.patch b/debian/patches/clutter-Fix-offscreen-effect-painting-of-clones.patch
44new file mode 1006440new file mode 100644
index 0000000..faa2d7a
--- /dev/null
+++ b/debian/patches/clutter-Fix-offscreen-effect-painting-of-clones.patch
@@ -0,0 +1,629 @@
1From: Daniel van Vugt <daniel.van.vugt@canonical.com>
2Date: Thu, 24 May 2018 11:51:22 +0200
3Subject: clutter: Fix offscreen-effect painting of clones
4
5`ClutterOffscreenEffect` had been getting the wrong bounding box in the
6case of clones and descendents of clones, causing visibly incorrect
7clipping. This was due to `clutter_actor_get_paint_box` only ever being
8given the source actor during a paint (which is correct) and not the clone.
9Even if we weren't painting a clone but an offscreened descendent of a
10clone (like in gnome-shell's desktop zoom), we would get the wrong result.
11
12Fortunately we don't need to know the actual clone/actor being painted so
13don't need to call the problematic `clutter_actor_get_paint_box` at all.
14The solution is to only keep untransformed rendering in the FBO and leave
15the correct transformation for later. The correct clone/actor's
16transformation is already set for us as the current cogl modelview matrix
17by `clutter_actor_paint`.
18
19Bonus optimization: This all means we don't need to keep `last_matrix_drawn`
20or force a full repaint every time some part of the transformation changes.
21Because the FBO contents are no longer affected by transformations. As it
22should be. In other words, offscreen-effected actors can now move around
23on screen without themselves being repainted.
24
25Special thanks to Mai Lavelle for identifying the cause of the problem.
26
27Fixes:
28https://bugzilla.gnome.org/show_bug.cgi?id=789050,
29https://bugzilla.gnome.org/show_bug.cgi?id=659523#c9,
30https://gitlab.gnome.org/GNOME/mutter/issues/196,
31https://gitlab.gnome.org/GNOME/mutter/issues/282,
32https://gitlab.gnome.org/GNOME/gnome-shell/issues/387,
33https://launchpad.net/bugs/1767648,
34https://launchpad.net/bugs/1779615
35
36Origin: https://gitlab.gnome.org/GNOME/mutter/commit/8655bc5d8d
37Bug-Ubuntu: https://launchpad.net/bugs/1767648, https://launchpad.net/bugs/1779615
38Applied-Upstream: yes
39---
40 clutter/clutter/clutter-actor-box-private.h | 12 ++
41 clutter/clutter/clutter-actor-box.c | 52 +++++++
42 clutter/clutter/clutter-offscreen-effect.c | 172 +++++++++------------
43 clutter/clutter/clutter-paint-volume.c | 48 +-----
44 clutter/tests/conform/Makefile.am | 1 -
45 .../tests/conform/actor-offscreen-limit-max-size.c | 119 --------------
46 clutter/tests/conform/actor-offscreen-redirect.c | 7 +-
47 7 files changed, 146 insertions(+), 265 deletions(-)
48 create mode 100644 clutter/clutter/clutter-actor-box-private.h
49 delete mode 100644 clutter/tests/conform/actor-offscreen-limit-max-size.c
50
51diff --git a/clutter/clutter/clutter-actor-box-private.h b/clutter/clutter/clutter-actor-box-private.h
52new file mode 100644
53index 0000000..e7aeb88
54--- /dev/null
55+++ b/clutter/clutter/clutter-actor-box-private.h
56@@ -0,0 +1,12 @@
57+#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__
58+#define __CLUTTER_ACTOR_BOX_PRIVATE_H__
59+
60+#include <clutter/clutter-types.h>
61+
62+G_BEGIN_DECLS
63+
64+void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box);
65+
66+G_END_DECLS
67+
68+#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */
69diff --git a/clutter/clutter/clutter-actor-box.c b/clutter/clutter/clutter-actor-box.c
70index 2991066..319eec3 100644
71--- a/clutter/clutter/clutter-actor-box.c
72+++ b/clutter/clutter/clutter-actor-box.c
73@@ -7,6 +7,7 @@
74 #include "clutter-types.h"
75 #include "clutter-interval.h"
76 #include "clutter-private.h"
77+#include "clutter-actor-box-private.h"
78
79 /**
80 * clutter_actor_box_new:
81@@ -544,6 +545,57 @@ clutter_actor_box_set_size (ClutterActorBox *box,
82 box->y2 = box->y1 + height;
83 }
84
85+void
86+_clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
87+{
88+ float width, height;
89+
90+ /* The aim here is that for a given rectangle defined with floating point
91+ * coordinates we want to determine a stable quantized size in pixels
92+ * that doesn't vary due to the original box's sub-pixel position.
93+ *
94+ * The reason this is important is because effects will use this
95+ * API to determine the size of offscreen framebuffers and so for
96+ * a fixed-size object that may be animated accross the screen we
97+ * want to make sure that the stage paint-box has an equally stable
98+ * size so that effects aren't made to continuously re-allocate
99+ * a corresponding fbo.
100+ *
101+ * The other thing we consider is that the calculation of this box is
102+ * subject to floating point precision issues that might be slightly
103+ * different to the precision issues involved with actually painting the
104+ * actor, which might result in painting slightly leaking outside the
105+ * user's calculated paint-volume. For this we simply aim to pad out the
106+ * paint-volume by at least half a pixel all the way around.
107+ */
108+ width = box->x2 - box->x1;
109+ height = box->y2 - box->y1;
110+ width = CLUTTER_NEARBYINT (width);
111+ height = CLUTTER_NEARBYINT (height);
112+ /* XXX: NB the width/height may now be up to 0.5px too small so we
113+ * must also pad by 0.25px all around to account for this. In total we
114+ * must padd by at least 0.75px around all sides. */
115+
116+ /* XXX: The furthest that we can overshoot the bottom right corner by
117+ * here is 1.75px in total if you consider that the 0.75 padding could
118+ * just cross an integer boundary and so ceil will effectively add 1.
119+ */
120+ box->x2 = ceilf (box->x2 + 0.75);
121+ box->y2 = ceilf (box->y2 + 0.75);
122+
123+ /* Now we redefine the top-left relative to the bottom right based on the
124+ * rounded width/height determined above + a constant so that the overall
125+ * size of the box will be stable and not dependant on the box's
126+ * position.
127+ *
128+ * Adding 3px to the width/height will ensure we cover the maximum of
129+ * 1.75px padding on the bottom/right and still ensure we have > 0.75px
130+ * padding on the top/left.
131+ */
132+ box->x1 = box->x2 - width - 3;
133+ box->y1 = box->y2 - height - 3;
134+}
135+
136 G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
137 clutter_actor_box_copy,
138 clutter_actor_box_free,
139diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
140index 5db40b7..a26275e 100644
141--- a/clutter/clutter/clutter-offscreen-effect.c
142+++ b/clutter/clutter/clutter-offscreen-effect.c
143@@ -74,6 +74,8 @@
144 #include "clutter-debug.h"
145 #include "clutter-private.h"
146 #include "clutter-stage-private.h"
147+#include "clutter-paint-volume-private.h"
148+#include "clutter-actor-box-private.h"
149
150 struct _ClutterOffscreenEffectPrivate
151 {
152@@ -84,8 +86,10 @@ struct _ClutterOffscreenEffectPrivate
153 ClutterActor *actor;
154 ClutterActor *stage;
155
156- gfloat x_offset;
157- gfloat y_offset;
158+ ClutterVertex position;
159+
160+ int fbo_offset_x;
161+ int fbo_offset_y;
162
163 /* This is the calculated size of the fbo before being passed
164 through create_texture(). This needs to be tracked separately so
165@@ -95,16 +99,6 @@ struct _ClutterOffscreenEffectPrivate
166 int fbo_height;
167
168 gint old_opacity_override;
169-
170- /* The matrix that was current the last time the fbo was updated. We
171- need to keep track of this to detect when we can reuse the
172- contents of the fbo without redrawing the actor. We need the
173- actual matrix rather than just detecting queued redraws on the
174- actor because any change in the parent hierarchy (even just a
175- translation) could cause the actor to look completely different
176- and it won't cause a redraw to be queued on the parent's
177- children. */
178- CoglMatrix last_matrix_drawn;
179 };
180
181 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
182@@ -224,15 +218,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
183 {
184 ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
185 ClutterOffscreenEffectPrivate *priv = self->priv;
186- ClutterActorBox box;
187+ ClutterActorBox raw_box, box;
188 ClutterActor *stage;
189- CoglMatrix projection;
190+ CoglMatrix projection, old_modelview, modelview;
191+ const ClutterPaintVolume *volume;
192 CoglColor transparent;
193 gfloat stage_width, stage_height;
194 gfloat fbo_width = -1, fbo_height = -1;
195- gfloat width, height;
196- gfloat xexpand, yexpand;
197- int texture_width, texture_height;
198+ ClutterVertex local_offset = { 0.f, 0.f, 0.f };
199+ gfloat old_viewport[4];
200
201 if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
202 return FALSE;
203@@ -243,92 +237,82 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
204 stage = _clutter_actor_get_stage_internal (priv->actor);
205 clutter_actor_get_size (stage, &stage_width, &stage_height);
206
207- /* The paint box is the bounding box of the actor's paint volume in
208- * stage coordinates. This will give us the size for the framebuffer
209- * we need to redirect its rendering offscreen and its position will
210- * be used to setup an offset viewport */
211- if (clutter_actor_get_paint_box (priv->actor, &box))
212+ /* Get the minimal bounding box for what we want to paint, relative to the
213+ * parent of priv->actor. Note that we may actually be painting a clone of
214+ * priv->actor so we need to be careful to avoid querying the transformation
215+ * of priv->actor (like clutter_actor_get_paint_box would). Just stay in
216+ * local coordinates for now...
217+ */
218+ volume = clutter_actor_get_paint_volume (priv->actor);
219+ if (volume)
220 {
221- clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
222- clutter_actor_box_get_origin (&box, &priv->x_offset, &priv->y_offset);
223+ ClutterPaintVolume mutable_volume;
224
225- fbo_width = MIN (fbo_width, stage_width);
226- fbo_height = MIN (fbo_height, stage_height);
227+ _clutter_paint_volume_copy_static (volume, &mutable_volume);
228+ _clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
229+ clutter_paint_volume_free (&mutable_volume);
230 }
231 else
232 {
233- fbo_width = stage_width;
234- fbo_height = stage_height;
235+ clutter_actor_get_allocation_box (priv->actor, &raw_box);
236 }
237
238- if (fbo_width == stage_width)
239- priv->x_offset = 0.0f;
240- if (fbo_height == stage_height)
241- priv->y_offset = 0.0f;
242+ box = raw_box;
243+ _clutter_actor_box_enlarge_for_effects (&box);
244+
245+ priv->fbo_offset_x = box.x1 - raw_box.x1;
246+ priv->fbo_offset_y = box.y1 - raw_box.y1;
247+
248+ clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
249
250 /* First assert that the framebuffer is the right size... */
251 if (!update_fbo (effect, fbo_width, fbo_height))
252 return FALSE;
253
254- texture_width = cogl_texture_get_width (priv->texture);
255- texture_height = cogl_texture_get_height (priv->texture);
256-
257- /* get the current modelview matrix so that we can copy it to the
258- * framebuffer. We also store the matrix that was last used when we
259- * updated the FBO so that we can detect when we don't need to
260- * update the FBO to paint a second time */
261- cogl_get_modelview_matrix (&priv->last_matrix_drawn);
262+ cogl_get_modelview_matrix (&old_modelview);
263
264 /* let's draw offscreen */
265 cogl_push_framebuffer (priv->offscreen);
266
267- /* Copy the modelview that would have been used if rendering onscreen */
268- cogl_set_modelview_matrix (&priv->last_matrix_drawn);
269+ /* We don't want the FBO contents to be transformed. That could waste memory
270+ * (e.g. during zoom), or result in something that's not rectangular (clipped
271+ * incorrectly). So drop the modelview matrix of the current paint chain.
272+ * This is fine since paint_texture runs with the same modelview matrix,
273+ * so it will come out correctly whenever that is used to put the FBO
274+ * contents on screen...
275+ */
276+ clutter_actor_get_transform (priv->stage, &modelview);
277+ cogl_set_modelview_matrix (&modelview);
278
279- /* Set up the viewport so that it has the same size as the stage,
280- * but offset it so that the actor of interest lands on our
281- * framebuffer. */
282- clutter_actor_get_size (priv->stage, &width, &height);
283+ /* Save the original viewport for calculating priv->position */
284+ _clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
285+ &old_viewport[0],
286+ &old_viewport[1],
287+ &old_viewport[2],
288+ &old_viewport[3]);
289
290- /* Expand the viewport if the actor is partially off-stage,
291- * otherwise the actor will end up clipped to the stage viewport
292+ /* Set up the viewport so that it has the same size as the stage (avoid
293+ * distortion), but translated to account for the FBO offset...
294 */
295- xexpand = 0.f;
296- if (priv->x_offset < 0.f)
297- xexpand = -priv->x_offset;
298- if (priv->x_offset + texture_width > width)
299- xexpand = MAX (xexpand, (priv->x_offset + texture_width) - width);
300-
301- yexpand = 0.f;
302- if (priv->y_offset < 0.f)
303- yexpand = -priv->y_offset;
304- if (priv->y_offset + texture_height > height)
305- yexpand = MAX (yexpand, (priv->y_offset + texture_height) - height);
306-
307- /* Set the viewport */
308- cogl_set_viewport (-(priv->x_offset + xexpand), -(priv->y_offset + yexpand),
309- width + (2 * xexpand), height + (2 * yexpand));
310+ cogl_set_viewport (-priv->fbo_offset_x,
311+ -priv->fbo_offset_y,
312+ stage_width,
313+ stage_height);
314
315 /* Copy the stage's projection matrix across to the framebuffer */
316 _clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
317 &projection);
318
319- /* If we've expanded the viewport, make sure to scale the projection
320- * matrix accordingly (as it's been initialised to work with the
321- * original viewport and not our expanded one).
322+ /* Now save the global position of the effect (not just of the actor).
323+ * It doesn't appear anyone actually uses this yet, but get_target_rect is
324+ * documented as returning it. So we should...
325 */
326- if (xexpand > 0.f || yexpand > 0.f)
327- {
328- gfloat new_width, new_height;
329-
330- new_width = width + (2 * xexpand);
331- new_height = height + (2 * yexpand);
332-
333- cogl_matrix_scale (&projection,
334- width / new_width,
335- height / new_height,
336- 1);
337- }
338+ _clutter_util_fully_transform_vertices (&old_modelview,
339+ &projection,
340+ old_viewport,
341+ &local_offset,
342+ &priv->position,
343+ 1);
344
345 cogl_set_projection_matrix (&projection);
346
347@@ -385,13 +369,14 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
348
349 cogl_push_matrix ();
350
351- /* Now reset the modelview to put us in stage coordinates so
352- * we can drawn the result of our offscreen render as a textured
353- * quad... */
354-
355- cogl_matrix_init_identity (&modelview);
356- _clutter_actor_apply_modelview_transform (priv->stage, &modelview);
357- cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.0f);
358+ /* The current modelview matrix is *almost* perfect already. It's only
359+ * missing a correction for the expanded FBO and offset rendering within...
360+ */
361+ cogl_get_modelview_matrix (&modelview);
362+ cogl_matrix_translate (&modelview,
363+ priv->fbo_offset_x,
364+ priv->fbo_offset_y,
365+ 0.0f);
366 cogl_set_modelview_matrix (&modelview);
367
368 /* paint the target material; this is virtualized for
369@@ -428,16 +413,11 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
370 {
371 ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
372 ClutterOffscreenEffectPrivate *priv = self->priv;
373- CoglMatrix matrix;
374-
375- cogl_get_modelview_matrix (&matrix);
376
377- /* If we've already got a cached image for the same matrix and the
378- actor hasn't been redrawn then we can just use the cached image
379- in the fbo */
380- if (priv->offscreen == NULL ||
381- (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) ||
382- !cogl_matrix_equal (&matrix, &priv->last_matrix_drawn))
383+ /* If we've already got a cached image and the actor hasn't been redrawn
384+ * then we can just use the cached image in the FBO.
385+ */
386+ if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
387 {
388 /* Chain up to the parent paint method which will call the pre and
389 post paint functions to update the image */
390@@ -663,8 +643,8 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
391 return FALSE;
392
393 clutter_rect_init (rect,
394- priv->x_offset,
395- priv->y_offset,
396+ priv->position.x,
397+ priv->position.y,
398 cogl_texture_get_width (priv->texture),
399 cogl_texture_get_height (priv->texture));
400
401diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c
402index f340513..836812b 100644
403--- a/clutter/clutter/clutter-paint-volume.c
404+++ b/clutter/clutter/clutter-paint-volume.c
405@@ -37,6 +37,7 @@
406 #include "clutter-paint-volume-private.h"
407 #include "clutter-private.h"
408 #include "clutter-stage-private.h"
409+#include "clutter-actor-box-private.h"
410
411 G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume,
412 clutter_paint_volume_copy,
413@@ -1140,8 +1141,6 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
414 CoglMatrix modelview;
415 CoglMatrix projection;
416 float viewport[4];
417- float width;
418- float height;
419
420 _clutter_paint_volume_copy_static (pv, &projected_pv);
421
422@@ -1181,50 +1180,7 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
423 return;
424 }
425
426- /* The aim here is that for a given rectangle defined with floating point
427- * coordinates we want to determine a stable quantized size in pixels
428- * that doesn't vary due to the original box's sub-pixel position.
429- *
430- * The reason this is important is because effects will use this
431- * API to determine the size of offscreen framebuffers and so for
432- * a fixed-size object that may be animated accross the screen we
433- * want to make sure that the stage paint-box has an equally stable
434- * size so that effects aren't made to continuously re-allocate
435- * a corresponding fbo.
436- *
437- * The other thing we consider is that the calculation of this box is
438- * subject to floating point precision issues that might be slightly
439- * different to the precision issues involved with actually painting the
440- * actor, which might result in painting slightly leaking outside the
441- * user's calculated paint-volume. For this we simply aim to pad out the
442- * paint-volume by at least half a pixel all the way around.
443- */
444- width = box->x2 - box->x1;
445- height = box->y2 - box->y1;
446- width = CLUTTER_NEARBYINT (width);
447- height = CLUTTER_NEARBYINT (height);
448- /* XXX: NB the width/height may now be up to 0.5px too small so we
449- * must also pad by 0.25px all around to account for this. In total we
450- * must padd by at least 0.75px around all sides. */
451-
452- /* XXX: The furthest that we can overshoot the bottom right corner by
453- * here is 1.75px in total if you consider that the 0.75 padding could
454- * just cross an integer boundary and so ceil will effectively add 1.
455- */
456- box->x2 = ceilf (box->x2 + 0.75);
457- box->y2 = ceilf (box->y2 + 0.75);
458-
459- /* Now we redefine the top-left relative to the bottom right based on the
460- * rounded width/height determined above + a constant so that the overall
461- * size of the box will be stable and not dependant on the box's
462- * position.
463- *
464- * Adding 3px to the width/height will ensure we cover the maximum of
465- * 1.75px padding on the bottom/right and still ensure we have > 0.75px
466- * padding on the top/left.
467- */
468- box->x1 = box->x2 - width - 3;
469- box->y1 = box->y2 - height - 3;
470+ _clutter_actor_box_enlarge_for_effects (box);
471
472 clutter_paint_volume_free (&projected_pv);
473 }
474diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am
475index 9cef08b..afa9dad 100644
476--- a/clutter/tests/conform/Makefile.am
477+++ b/clutter/tests/conform/Makefile.am
478@@ -25,7 +25,6 @@ actor_tests = \
479 actor-iter \
480 actor-layout \
481 actor-meta \
482- actor-offscreen-limit-max-size \
483 actor-offscreen-redirect \
484 actor-paint-opacity \
485 actor-pick \
486diff --git a/clutter/tests/conform/actor-offscreen-limit-max-size.c b/clutter/tests/conform/actor-offscreen-limit-max-size.c
487deleted file mode 100644
488index 943c7d8..0000000
489--- a/clutter/tests/conform/actor-offscreen-limit-max-size.c
490+++ /dev/null
491@@ -1,119 +0,0 @@
492-#define CLUTTER_ENABLE_EXPERIMENTAL_API
493-#include <clutter/clutter.h>
494-
495-#define STAGE_WIDTH (300)
496-#define STAGE_HEIGHT (300)
497-
498-typedef struct
499-{
500- ClutterActor *stage;
501-
502- ClutterActor *actor_group1;
503- ClutterEffect *blur_effect1;
504-
505- ClutterActor *actor_group2;
506- ClutterEffect *blur_effect2;
507-} Data;
508-
509-static void
510-check_results (ClutterStage *stage, gpointer user_data)
511-{
512- Data *data = user_data;
513- gfloat width, height;
514- ClutterRect rect;
515-
516- clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect1),
517- &rect);
518-
519- width = clutter_rect_get_width (&rect);
520- height = clutter_rect_get_height (&rect);
521-
522- if (g_test_verbose ())
523- g_print ("Checking effect1 size: %.2f x %.2f\n",
524- clutter_rect_get_width (&rect),
525- clutter_rect_get_height (&rect));
526-
527- g_assert_cmpint (width, <, STAGE_WIDTH);
528- g_assert_cmpint (height, <, STAGE_HEIGHT);
529-
530- clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect2),
531- &rect);
532-
533- width = clutter_rect_get_width (&rect);
534- height = clutter_rect_get_height (&rect);
535-
536- if (g_test_verbose ())
537- g_print ("Checking effect2 size: %.2f x %.2f\n", width, height);
538-
539- g_assert_cmpint (width, ==, STAGE_WIDTH);
540- g_assert_cmpint (height, ==, STAGE_HEIGHT);
541-
542-
543- clutter_main_quit ();
544-}
545-
546-static ClutterActor *
547-create_actor (gfloat x, gfloat y,
548- gfloat width, gfloat height,
549- const ClutterColor *color)
550-{
551- return g_object_new (CLUTTER_TYPE_ACTOR,
552- "x", x,
553- "y", y,
554- "width", width,
555- "height", height,
556- "background-color", color,
557- NULL);
558-}
559-
560-static void
561-actor_offscreen_limit_max_size (void)
562-{
563- Data data;
564-
565- if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
566- return;
567-
568- data.stage = clutter_test_get_stage ();
569- g_signal_connect (data.stage, "after-paint",
570- G_CALLBACK (check_results), &data);
571- clutter_actor_set_size (data.stage, STAGE_WIDTH, STAGE_HEIGHT);
572-
573- data.actor_group1 = clutter_actor_new ();
574- clutter_actor_add_child (data.stage, data.actor_group1);
575- data.blur_effect1 = clutter_blur_effect_new ();
576- clutter_actor_add_effect (data.actor_group1, data.blur_effect1);
577- clutter_actor_add_child (data.actor_group1,
578- create_actor (10, 10,
579- 100, 100,
580- CLUTTER_COLOR_Blue));
581- clutter_actor_add_child (data.actor_group1,
582- create_actor (100, 100,
583- 100, 100,
584- CLUTTER_COLOR_Gray));
585-
586- data.actor_group2 = clutter_actor_new ();
587- clutter_actor_add_child (data.stage, data.actor_group2);
588- data.blur_effect2 = clutter_blur_effect_new ();
589- clutter_actor_add_effect (data.actor_group2, data.blur_effect2);
590- clutter_actor_add_child (data.actor_group2,
591- create_actor (-10, -10,
592- 100, 100,
593- CLUTTER_COLOR_Yellow));
594- clutter_actor_add_child (data.actor_group2,
595- create_actor (250, 10,
596- 100, 100,
597- CLUTTER_COLOR_ScarletRed));
598- clutter_actor_add_child (data.actor_group2,
599- create_actor (10, 250,
600- 100, 100,
601- CLUTTER_COLOR_Yellow));
602-
603- clutter_actor_show (data.stage);
604-
605- clutter_main ();
606-}
607-
608-CLUTTER_TEST_SUITE (
609- CLUTTER_TEST_UNIT ("/actor/offscreen/limit-max-size", actor_offscreen_limit_max_size)
610-)
611diff --git a/clutter/tests/conform/actor-offscreen-redirect.c b/clutter/tests/conform/actor-offscreen-redirect.c
612index 63d5e6c..9dbb7d2 100644
613--- a/clutter/tests/conform/actor-offscreen-redirect.c
614+++ b/clutter/tests/conform/actor-offscreen-redirect.c
615@@ -189,10 +189,11 @@ verify_redraws (gpointer user_data)
616 clutter_actor_queue_redraw (data->child);
617 verify_redraw (data, 1);
618
619- /* Modifying the transformation on the parent should cause a
620- redraw */
621+ /* Modifying the transformation on the parent should not cause a redraw,
622+ since the FBO stores pre-transformed rendering that can be reused with
623+ any transformation. */
624 clutter_actor_set_anchor_point (data->parent_container, 0, 1);
625- verify_redraw (data, 1);
626+ verify_redraw (data, 0);
627
628 /* Redrawing an unrelated actor shouldn't cause a redraw */
629 clutter_actor_set_position (data->unrelated_actor, 0, 1);
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
0deleted file mode 100644630deleted file mode 100644
index ccb4263..0000000
--- a/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch
+++ /dev/null
@@ -1,316 +0,0 @@
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/core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch b/debian/patches/core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch
317deleted file mode 1006440deleted file mode 100644
index 171c91a..0000000
--- a/debian/patches/core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From: Sam Spilsbury <sam@endlessm.com>
2Date: Tue, 10 Oct 2017 11:39:40 -0500
3Subject: core: Return -1 if meta_window_get_monitor is called on an unmanaged
4 window
5
6As opposed to crashing. In this case, letting the caller deal with
7it is the best policy, since this is public API.
8
9Fixes #78834
10
11Forwarded: yes
12Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788834
13Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/bionic/+source/gnome-shell/+bug/1724439
14---
15 src/core/window.c | 7 ++++++-
16 1 file changed, 6 insertions(+), 1 deletion(-)
17
18diff --git a/src/core/window.c b/src/core/window.c
19index cc0813a..f9094a3 100644
20--- a/src/core/window.c
21+++ b/src/core/window.c
22@@ -3752,11 +3752,16 @@ maybe_move_attached_dialog (MetaWindow *window,
23 *
24 * Gets index of the monitor that this window is on.
25 *
26- * Return Value: The index of the monitor in the screens monitor list
27+ * Return Value: The index of the monitor in the screens monitor list, or -1
28+ * if the window has been recently unmanaged and does not have
29+ * a monitor.
30 */
31 int
32 meta_window_get_monitor (MetaWindow *window)
33 {
34+ if (!window->monitor)
35+ return -1;
36+
37 return window->monitor->number;
38 }
39
diff --git a/debian/patches/debian/skip-failing-tests-325.patch b/debian/patches/debian/skip-failing-tests-325.patch
index a443ddf..54d8f62 100644
--- a/debian/patches/debian/skip-failing-tests-325.patch
+++ b/debian/patches/debian/skip-failing-tests-325.patch
@@ -11,13 +11,13 @@ Applied-upstream: no
11 1 file changed, 1 deletion(-)11 1 file changed, 1 deletion(-)
1212
13diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am13diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am
14index bca10dc..a2b7bee 10064414index 840e120..2bd7f4d 100644
15--- a/clutter/tests/conform/Makefile.am15--- a/clutter/tests/conform/Makefile.am
16+++ b/clutter/tests/conform/Makefile.am16+++ b/clutter/tests/conform/Makefile.am
17@@ -26,7 +26,6 @@ actor_tests = \17@@ -25,7 +25,6 @@ actor_tests = \
18 actor-iter \
18 actor-layout \19 actor-layout \
19 actor-meta \20 actor-meta \
20 actor-offscreen-limit-max-size \
21- actor-offscreen-redirect \21- actor-offscreen-redirect \
22 actor-paint-opacity \22 actor-paint-opacity \
23 actor-size \23 actor-size \
diff --git a/debian/patches/debian/skip-failing-tests.patch b/debian/patches/debian/skip-failing-tests.patch
index 68cdca6..205962c 100644
--- a/debian/patches/debian/skip-failing-tests.patch
+++ b/debian/patches/debian/skip-failing-tests.patch
@@ -12,11 +12,11 @@ Applied-upstream: no
12 1 file changed, 2 deletions(-)12 1 file changed, 2 deletions(-)
1313
14diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am14diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am
15index 9cef08b..bca10dc 10064415index afa9dad..840e120 100644
16--- a/clutter/tests/conform/Makefile.am16--- a/clutter/tests/conform/Makefile.am
17+++ b/clutter/tests/conform/Makefile.am17+++ b/clutter/tests/conform/Makefile.am
18@@ -28,8 +28,6 @@ actor_tests = \18@@ -27,8 +27,6 @@ actor_tests = \
19 actor-offscreen-limit-max-size \19 actor-meta \
20 actor-offscreen-redirect \20 actor-offscreen-redirect \
21 actor-paint-opacity \21 actor-paint-opacity \
22- actor-pick \22- actor-pick \
diff --git a/debian/patches/gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch b/debian/patches/gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch
23deleted file mode 10064423deleted file mode 100644
index 9bc47f9..0000000
--- a/debian/patches/gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From: Aaron Plattner <aplattner@nvidia.com>
2Date: Thu, 19 Jul 2018 10:51:34 -0700
3Subject: gpu-kms: Don't crash if drmModeGetResources returns NULL
4
5DRM drivers can be opened by meta_launcher_open_restricted() even if they don't
6implement modesetting. However, drmModeGetResources() will return NULL.
7
8Check whether that happened in meta_gpu_kms_new() and return with an error
9instead of crashing.
10
11Fixes #223.
12
13Applied-Upstream: https://gitlab.gnome.org/GNOME/mutter/commit/62660bbd15
14Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/223
15Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1767956
16---
17 src/backends/native/meta-gpu-kms.c | 7 +++++++
18 1 file changed, 7 insertions(+)
19
20diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
21index 613a607..259cd71 100644
22--- a/src/backends/native/meta-gpu-kms.c
23+++ b/src/backends/native/meta-gpu-kms.c
24@@ -801,6 +801,13 @@ meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
25 */
26 drm_resources = drmModeGetResources (kms_fd);
27
28+ if (!drm_resources)
29+ {
30+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "No resources");
31+ meta_launcher_close_restricted (launcher, kms_fd);
32+ return NULL;
33+ }
34+
35 n_connectors = drm_resources->count_connectors;
36
37 drmModeFreeResources (drm_resources);
diff --git a/debian/patches/monitor-Use-current-monitor-mode-to-check-whether-active.patch b/debian/patches/monitor-Use-current-monitor-mode-to-check-whether-active.patch
38deleted file mode 1006440deleted file mode 100644
index 9badb76..0000000
--- a/debian/patches/monitor-Use-current-monitor-mode-to-check-whether-active.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com>
2Date: Tue, 31 Jul 2018 13:18:51 +0200
3Subject: monitor: Use current monitor mode to check whether active
4
5For historical reasons meta_monitor_is_active() checked whether it is
6active by checking whether the main output have a CRTC assigned and
7whether that CRTC has a current mode. At a later point, the MetaMonitor
8got its own mode abstraction (MetaMonitorMode), but
9meta_monitor_is_active() was never updated to use this.
10
11An issue with checking the main output's CRTC state is that, if there is
12some CRTC mode combination that for some reason isn't properly detected
13by the MetaMonitorMode abstraction (e.g. some tiling configuration not
14yet handled), meta_monitor_is_active() would return TRUE, even though no
15(abstracted) mode was set. This would cause confusion here and there,
16leading to NULL pointer dereferences due to the assumption that if a
17monitor is active, it has an active mode.
18
19Instead, change meta_monitor_is_active() to directly check the current
20monitor mode, and log a warning if the main output still happen to have
21a CRTC with a mode assigned to it. This way, when an not undrestood CRTC
22mode combination is encountered, instead of dereferencing NULL pointers,
23simply assume the monitor is not active, which means that it will not be
24managed or rendered by mutter at all.
25
26https://gitlab.gnome.org/GNOME/mutter/issues/130
27
28(cherry picked from commit 4d465eac0806eb1ead375e2852d4a9d6bc24524f)
29
30Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/130
31Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1723615
32Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/d0d80780
33---
34 src/backends/meta-monitor.c | 22 ++++++++++++++++------
35 1 file changed, 16 insertions(+), 6 deletions(-)
36
37diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
38index 92c61c0..60f3674 100644
39--- a/src/backends/meta-monitor.c
40+++ b/src/backends/meta-monitor.c
41@@ -203,13 +203,9 @@ meta_monitor_get_main_output (MetaMonitor *monitor)
42 gboolean
43 meta_monitor_is_active (MetaMonitor *monitor)
44 {
45- MetaOutput *output;
46- MetaCrtc *crtc;
47-
48- output = meta_monitor_get_main_output (monitor);
49- crtc = meta_output_get_assigned_crtc (output);
50+ MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
51
52- return crtc && crtc->current_mode;
53+ return !!priv->current_mode;
54 }
55
56 gboolean
57@@ -1411,6 +1407,18 @@ meta_monitor_get_current_mode (MetaMonitor *monitor)
58 return priv->current_mode;
59 }
60
61+static gboolean
62+is_current_mode_known (MetaMonitor *monitor)
63+{
64+ MetaOutput *output;
65+ MetaCrtc *crtc;
66+
67+ output = meta_monitor_get_main_output (monitor);
68+ crtc = meta_output_get_assigned_crtc (output);
69+
70+ return meta_monitor_is_active (monitor) == (crtc && crtc->current_mode);
71+}
72+
73 void
74 meta_monitor_derive_current_mode (MetaMonitor *monitor)
75 {
76@@ -1430,6 +1438,8 @@ meta_monitor_derive_current_mode (MetaMonitor *monitor)
77 }
78
79 priv->current_mode = current_mode;
80+
81+ g_warn_if_fail (is_current_mode_known (monitor));
82 }
83
84 void
diff --git a/debian/patches/monitor-manager-Filter-out-low-screen-resolutions.patch b/debian/patches/monitor-manager-Filter-out-low-screen-resolutions.patch
85deleted file mode 1006440deleted file mode 100644
index f1ae69c..0000000
--- a/debian/patches/monitor-manager-Filter-out-low-screen-resolutions.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1From: Andrea Azzarone <azzaronea@gmail.com>
2Date: Mon, 16 Jul 2018 18:09:40 +0200
3Subject: monitor-manager: Filter out low screen resolutions
4
5Avoid exporting through org.gnome.Mutter.DisplayConfig.GetCurrentState
6excessively-low screen resolutions setting both a minimum width and a minimum
7height. GetCurrentState is e.g. used by Gnome Control Center to build a list of
8selectable resolutions.
9
10Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=793223
11
12(cherry picked from commit 649c26e05a67c52a4f5acf6b4aa3b1217e9bc9c0)
13
14Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1772831
15Bug-GNOME: https://bugzilla.gnome.org/show_bug.cgi?id=793223
16Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/0c5e61a2a
17---
18 src/backends/meta-monitor-manager.c | 4 ++++
19 src/backends/meta-monitor.c | 19 +++++++++++++++++--
20 src/backends/meta-monitor.h | 2 ++
21 3 files changed, 23 insertions(+), 2 deletions(-)
22
23diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
24index 5bd34ad..c4c1db5 100644
25--- a/src/backends/meta-monitor-manager.c
26+++ b/src/backends/meta-monitor-manager.c
27@@ -1323,9 +1323,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
28 GVariantBuilder mode_properties_builder;
29 MetaCrtcModeFlag mode_flags;
30
31+ if (!meta_monitor_mode_should_be_advertised (monitor_mode))
32+ continue;
33+
34 mode_id = meta_monitor_mode_get_id (monitor_mode);
35 meta_monitor_mode_get_resolution (monitor_mode,
36 &mode_width, &mode_height);
37+
38 refresh_rate = meta_monitor_mode_get_refresh_rate (monitor_mode);
39
40 preferred_scale =
41diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
42index 9833066..92c61c0 100644
43--- a/src/backends/meta-monitor.c
44+++ b/src/backends/meta-monitor.c
45@@ -1553,6 +1553,22 @@ meta_monitor_calculate_mode_scale (MetaMonitor *monitor,
46 return calculate_scale (monitor, monitor_mode);
47 }
48
49+static gboolean
50+is_logical_size_large_enough (gint width, gint height)
51+{
52+ return width >= MINIMUM_LOGICAL_WIDTH &&
53+ height >= MINIMUM_LOGICAL_HEIGHT;
54+}
55+
56+gboolean
57+meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode)
58+{
59+ g_return_val_if_fail (monitor_mode != NULL, FALSE);
60+
61+ return is_logical_size_large_enough (monitor_mode->spec.width,
62+ monitor_mode->spec.height);
63+}
64+
65 static float
66 get_closest_scale_factor_for_resolution (float width,
67 float height,
68@@ -1573,8 +1589,7 @@ get_closest_scale_factor_for_resolution (float width,
69
70 if (scale < MINIMUM_SCALE_FACTOR ||
71 scale > MAXIMUM_SCALE_FACTOR ||
72- floorf (scaled_w) < MINIMUM_LOGICAL_WIDTH ||
73- floorf (scaled_h) < MINIMUM_LOGICAL_HEIGHT)
74+ !is_logical_size_large_enough (floorf (scaled_w), floorf (scaled_h)))
75 goto out;
76
77 if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h)
78diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h
79index bc79778..213ff2c 100644
80--- a/src/backends/meta-monitor.h
81+++ b/src/backends/meta-monitor.h
82@@ -219,6 +219,8 @@ gboolean meta_monitor_mode_foreach_output (MetaMonitor *monitor,
83 gpointer user_data,
84 GError **error);
85
86+gboolean meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode);
87+
88 MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
89
90 gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
diff --git a/debian/patches/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch b/debian/patches/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch
91deleted file mode 1006440deleted file mode 100644
index 650a2d8..0000000
--- a/debian/patches/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com>
2Date: Tue, 24 Apr 2018 09:26:33 +0000
3Subject: native/gpu: Handle drmModeSetCrtc() failing gracefully
4
5If drmModeSetCrtc() is called with no fb, mode or connectors for some
6CRTC it may still fail, and we should handle that gracefully instead of
7assuming it failed to set a non-disabled state.
8
9Closes https://gitlab.gnome.org/GNOME/mutter/issues/70
10
11
12(cherry picked from commit 6e953e2725d5d5b10d14c7bd479bd99f6853addc)
13
14Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/70
15Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1754949
16Applied-Upstream: https://gitlab.gnome.org/GNOME/mutter/commit/44682a2cc555
17---
18 src/backends/native/meta-gpu-kms.c | 5 ++++-
19 1 file changed, 4 insertions(+), 1 deletion(-)
20
21diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
22index 259cd71..1d1c288 100644
23--- a/src/backends/native/meta-gpu-kms.c
24+++ b/src/backends/native/meta-gpu-kms.c
25@@ -143,7 +143,10 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
26 connectors, n_connectors,
27 mode) != 0)
28 {
29- g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
30+ if (mode)
31+ g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
32+ else
33+ g_warning ("Failed to disable CRTC");
34 g_free (connectors);
35 return FALSE;
36 }
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
37deleted file mode 1006440deleted file mode 100644
index a25fca3..0000000
--- a/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch
+++ /dev/null
@@ -1,63 +0,0 @@
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 5bd9ae6..198db5a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,18 +1,8 @@
1gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch
2native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch
3monitor-manager-Filter-out-low-screen-resolutions.patch
4window-wayland-Always-update-monitor-for-non-user-ops.patch
5window-Don-t-refuse-to-move-focus-to-the-grab-window.patch
6window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch
7monitor-Use-current-monitor-mode-to-check-whether-active.patch
8theme-use-gtk_render_icon_suface-to-paint-button-icon.patch1theme-use-gtk_render_icon_suface-to-paint-button-icon.patch
9theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch2theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch
10clutter-Smooth-out-master-clock-to-smooth-visuals.patch3clutter-Smooth-out-master-clock-to-smooth-visuals.patch
11core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch4clutter-Fix-offscreen-effect-painting-of-clones.patch
12bgo768531_workaround-startup-notifications.patch5bgo768531_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
16debian/synaptics-support.patch6debian/synaptics-support.patch
17debian/skip-failing-tests.patch7debian/skip-failing-tests.patch
18debian/skip-failing-tests-325.patch8debian/skip-failing-tests-325.patch
diff --git a/debian/patches/window-Don-t-refuse-to-move-focus-to-the-grab-window.patch b/debian/patches/window-Don-t-refuse-to-move-focus-to-the-grab-window.patch
19deleted file mode 1006449deleted file mode 100644
index ec37087..0000000
--- a/debian/patches/window-Don-t-refuse-to-move-focus-to-the-grab-window.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From: =?utf-8?q?Florian_M=C3=BCllner?= <fmuellner@gnome.org>
2Date: Fri, 25 May 2018 18:18:23 +0000
3Subject: window: Don't refuse to move focus to the grab window
4
5We refuse to move focus while a grab operation is in place. While this
6generally makes sense, there's no reason why the window that owns the
7grab shouldn't be given the regular input focus as well - we pretty
8much assume that the grab window is also the focus window anyway.
9
10In fact there's a strong reason for allowing the focus change here:
11If the grab window isn't the focus window, it probably has a modal
12transient that is focused instead, and a likely reason for the focus
13request is that the transient is being unmanaged and we must move
14the focus elsewhere.
15
16https://gitlab.gnome.org/GNOME/mutter/issues/15
17
18
19(cherry picked from commit 148da24f9510ebd23d750b8224aa0ab3a549e69e)
20
21Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/15
22Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1422253
23Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/513cc535
24---
25 src/core/window.c | 1 +
26 1 file changed, 1 insertion(+)
27
28diff --git a/src/core/window.c b/src/core/window.c
29index 743326c..5b1eb5b 100644
30--- a/src/core/window.c
31+++ b/src/core/window.c
32@@ -4620,6 +4620,7 @@ meta_window_focus (MetaWindow *window,
33 window->desc, window->input, window->take_focus);
34
35 if (window->display->grab_window &&
36+ window->display->grab_window != window &&
37 window->display->grab_window->all_keys_grabbed &&
38 !window->display->grab_window->unmanaging)
39 {
diff --git a/debian/patches/window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch b/debian/patches/window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch
40deleted file mode 1006440deleted file mode 100644
index fa98757..0000000
--- a/debian/patches/window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From: =?utf-8?q?Florian_M=C3=BCllner?= <fmuellner@gnome.org>
2Date: Fri, 25 May 2018 21:24:17 +0200
3Subject: window: Explicitly exclude unmanaging window from focus again
4
5Since commit b3b9d9e16 we no longer have to pass the unmanaging window
6to make sure we don't try to focus it again, however the parameter also
7influences the focus policy by giving ancestors preference over the normal
8stack order.
9
10https://gitlab.gnome.org/GNOME/mutter/issues/15
11
12(cherry picked from commit d99442d6e6b7c9b383863cc754db609398d4e65b)
13
14Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/15
15Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1422253
16Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/137f2223
17---
18 src/core/window.c | 4 +++-
19 1 file changed, 3 insertions(+), 1 deletion(-)
20
21diff --git a/src/core/window.c b/src/core/window.c
22index 5b1eb5b..cc0813a 100644
23--- a/src/core/window.c
24+++ b/src/core/window.c
25@@ -1469,7 +1469,9 @@ meta_window_unmanage (MetaWindow *window,
26 meta_topic (META_DEBUG_FOCUS,
27 "Focusing default window since we're unmanaging %s\n",
28 window->desc);
29- meta_workspace_focus_default_window (window->screen->active_workspace, NULL, timestamp);
30+ meta_workspace_focus_default_window (window->screen->active_workspace,
31+ window,
32+ timestamp);
33 }
34 else
35 {
diff --git a/debian/patches/window-wayland-Always-update-monitor-for-non-user-ops.patch b/debian/patches/window-wayland-Always-update-monitor-for-non-user-ops.patch
36deleted file mode 1006440deleted file mode 100644
index ce279ed..0000000
--- a/debian/patches/window-wayland-Always-update-monitor-for-non-user-ops.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From: Olivier Fourdan <ofourdan@redhat.com>
2Date: Mon, 18 Jun 2018 12:39:11 +0200
3Subject: window/wayland: Always update monitor for non-user ops
4
5meta_window_wayland_update_main_monitor() would skip the monitor update
6if the difference in scale between the old and the new monitor would
7cause another monitor change.
8
9While this is suitable when the monitor change results from a user
10interactively moving the surface between monitors of different scales,
11this can leave dangling pointers to freed monitors when this is
12triggered by a change of monitor configuration.
13
14Make sure we update the monitor unconditionally if not from a user
15operation.
16
17Closes: https://gitlab.gnome.org/GNOME/mutter/issues/189
18
19(cherry picked from commit a3da4b8d5bd217c0262fd9361036877d155a300f)
20
21Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/189
22Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1784398
23Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/d74a04606
24---
25 src/wayland/meta-window-wayland.c | 6 ++++++
26 1 file changed, 6 insertions(+)
27
28diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
29index 705bc49..8bafb25 100644
30--- a/src/wayland/meta-window-wayland.c
31+++ b/src/wayland/meta-window-wayland.c
32@@ -413,6 +413,12 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
33 return;
34 }
35
36+ if (!user_op)
37+ {
38+ window->monitor = to;
39+ return;
40+ }
41+
42 from_scale = meta_logical_monitor_get_scale (from);
43 to_scale = meta_logical_monitor_get_scale (to);
44

Subscribers

People subscribed via source and target branches