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)
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Iain Lane | Needs Fixing | ||
Review via email: mp+361811@code.launchpad.net |
This proposal supersedes a proposal from 2019-01-15.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : | # |
Also, the fix for bug 1767648 (and hence bug 1779615) is not in disco or cosmic yet(?)
Revision history for this message
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
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 360eba4..645be25 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,30 @@ | |||
6 | 1 | mutter (3.28.3+git20190124-0ubuntu18.04.1) UNRELEASED; urgency=medium | ||
7 | 2 | |||
8 | 3 | * New upstream git snapshot based on 3.28.3 plus commits up to 4af8d9d47 | ||
9 | 4 | (LP: #1811900) | ||
10 | 5 | - Fix crash in dual monitor setup and gdm activation (LP: #1790525, | ||
11 | 6 | LP: #1795774) | ||
12 | 7 | - Make possible to launch gnome-shell in wayland using nvidia and EGLDevice | ||
13 | 8 | backend (LP: #1805444) | ||
14 | 9 | * debian/libmutter-2-0.symbols: Add new symbols | ||
15 | 10 | * d/p/gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch, | ||
16 | 11 | d/p/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch, | ||
17 | 12 | d/p/monitor-manager-Filter-out-low-screen-resolutions.patch, | ||
18 | 13 | d/p/window-wayland-Always-update-monitor-for-non-user-ops.patch, | ||
19 | 14 | d/p/window-Don-t-refuse-to-move-focus-to-the-grab-window.patch, | ||
20 | 15 | d/p/window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch, | ||
21 | 16 | d/p/monitor-Use-current-monitor-mode-to-check-whether-active.patch, | ||
22 | 17 | d/p/core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch, | ||
23 | 18 | d/p/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch, | ||
24 | 19 | d/p/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch, | ||
25 | 20 | d/p/clutter-Do-not-latch-modifiers-on-modifier-keys.patch: | ||
26 | 21 | - Removed as applied upstream | ||
27 | 22 | * d/p/clutter-Fix-offscreen-effect-painting-of-clones.patch: | ||
28 | 23 | - Fix offscreen-effect painting of clones in zoom mode (LP: #1767648, | ||
29 | 24 | LP: #1779615) | ||
30 | 25 | |||
31 | 26 | -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 24 Jan 2019 18:05:12 +0000 | ||
32 | 27 | |||
33 | 1 | mutter (3.28.3-2~ubuntu18.04.2) bionic; urgency=medium | 28 | mutter (3.28.3-2~ubuntu18.04.2) bionic; urgency=medium |
34 | 2 | 29 | ||
35 | 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: |
36 | diff --git a/debian/libmutter-2-0.symbols b/debian/libmutter-2-0.symbols | |||
37 | index e4203ad..1489074 100644 | |||
38 | --- a/debian/libmutter-2-0.symbols | |||
39 | +++ b/debian/libmutter-2-0.symbols | |||
40 | @@ -545,7 +545,9 @@ libmutter-2.so.0 libmutter-2-0 #MINVER# | |||
41 | 545 | meta_gpu_get_type@Base 3.28.2 | 545 | meta_gpu_get_type@Base 3.28.2 |
42 | 546 | meta_gpu_has_hotplug_mode_update@Base 3.28.2 | 546 | meta_gpu_has_hotplug_mode_update@Base 3.28.2 |
43 | 547 | meta_gpu_kms_apply_crtc_mode@Base 3.28.2 | 547 | meta_gpu_kms_apply_crtc_mode@Base 3.28.2 |
44 | 548 | meta_gpu_kms_can_have_outputs@Base 3.28.3+git20190124 | ||
45 | 548 | meta_gpu_kms_error_quark@Base 3.28.2 | 549 | meta_gpu_kms_error_quark@Base 3.28.2 |
46 | 550 | meta_gpu_kms_flip_closure_container_free@Base 3.28.3+git20190124 | ||
47 | 549 | meta_gpu_kms_flip_crtc@Base 3.28.2 | 551 | meta_gpu_kms_flip_crtc@Base 3.28.2 |
48 | 550 | meta_gpu_kms_get_fd@Base 3.28.2 | 552 | meta_gpu_kms_get_fd@Base 3.28.2 |
49 | 551 | meta_gpu_kms_get_file_path@Base 3.28.2 | 553 | meta_gpu_kms_get_file_path@Base 3.28.2 |
50 | @@ -556,6 +558,7 @@ libmutter-2.so.0 libmutter-2-0 #MINVER# | |||
51 | 556 | meta_gpu_kms_new@Base 3.28.2 | 558 | meta_gpu_kms_new@Base 3.28.2 |
52 | 557 | meta_gpu_kms_set_power_save_mode@Base 3.28.2 | 559 | meta_gpu_kms_set_power_save_mode@Base 3.28.2 |
53 | 558 | meta_gpu_kms_wait_for_flip@Base 3.28.2 | 560 | meta_gpu_kms_wait_for_flip@Base 3.28.2 |
54 | 561 | meta_gpu_kms_wrap_flip_closure@Base 3.28.3+git20190124 | ||
55 | 559 | meta_gpu_read_current@Base 3.28.2 | 562 | meta_gpu_read_current@Base 3.28.2 |
56 | 560 | meta_gpu_take_crtcs@Base 3.28.2 | 563 | meta_gpu_take_crtcs@Base 3.28.2 |
57 | 561 | meta_gpu_take_modes@Base 3.28.2 | 564 | meta_gpu_take_modes@Base 3.28.2 |
58 | @@ -1238,14 +1241,17 @@ libmutter-2.so.0 libmutter-2-0 #MINVER# | |||
59 | 1238 | meta_warning@Base 3.28.2 | 1241 | meta_warning@Base 3.28.2 |
60 | 1239 | meta_wayland_actor_surface_calculate_scale@Base 3.28.2 | 1242 | meta_wayland_actor_surface_calculate_scale@Base 3.28.2 |
61 | 1240 | meta_wayland_actor_surface_get_type@Base 3.28.2 | 1243 | meta_wayland_actor_surface_get_type@Base 3.28.2 |
62 | 1244 | meta_wayland_actor_surface_queue_frame_callbacks@Base 3.28.3+git20190124 | ||
63 | 1241 | meta_wayland_actor_surface_sync_actor_state@Base 3.28.2 | 1245 | meta_wayland_actor_surface_sync_actor_state@Base 3.28.2 |
64 | 1242 | meta_wayland_buffer_attach@Base 3.28.2 | 1246 | meta_wayland_buffer_attach@Base 3.28.2 |
65 | 1243 | meta_wayland_buffer_create_snippet@Base 3.28.2 | 1247 | meta_wayland_buffer_create_snippet@Base 3.28.2 |
66 | 1244 | meta_wayland_buffer_from_resource@Base 3.28.2 | 1248 | meta_wayland_buffer_from_resource@Base 3.28.2 |
67 | 1245 | meta_wayland_buffer_get_texture@Base 3.28.2 | 1249 | meta_wayland_buffer_get_texture@Base 3.28.2 |
68 | 1246 | meta_wayland_buffer_get_type@Base 3.28.2 | 1250 | meta_wayland_buffer_get_type@Base 3.28.2 |
69 | 1251 | meta_wayland_buffer_is_realized@Base 3.28.3+git20190124 | ||
70 | 1247 | meta_wayland_buffer_is_y_inverted@Base 3.28.2 | 1252 | meta_wayland_buffer_is_y_inverted@Base 3.28.2 |
71 | 1248 | meta_wayland_buffer_process_damage@Base 3.28.2 | 1253 | meta_wayland_buffer_process_damage@Base 3.28.2 |
72 | 1254 | meta_wayland_buffer_realize@Base 3.28.3+git20190124 | ||
73 | 1249 | meta_wayland_compositor_destroy_frame_callbacks@Base 3.28.2 | 1255 | meta_wayland_compositor_destroy_frame_callbacks@Base 3.28.2 |
74 | 1250 | meta_wayland_compositor_flush_clients@Base 3.28.2 | 1256 | meta_wayland_compositor_flush_clients@Base 3.28.2 |
75 | 1251 | meta_wayland_compositor_get_default@Base 3.28.2 | 1257 | meta_wayland_compositor_get_default@Base 3.28.2 |
76 | @@ -1397,6 +1403,7 @@ libmutter-2.so.0 libmutter-2-0 #MINVER# | |||
77 | 1397 | meta_wayland_surface_apply_pending_state@Base 3.28.2 | 1403 | meta_wayland_surface_apply_pending_state@Base 3.28.2 |
78 | 1398 | meta_wayland_surface_assign_role@Base 3.28.2 | 1404 | meta_wayland_surface_assign_role@Base 3.28.2 |
79 | 1399 | meta_wayland_surface_begin_grab_op@Base 3.28.2 | 1405 | meta_wayland_surface_begin_grab_op@Base 3.28.2 |
80 | 1406 | meta_wayland_surface_cache_pending_frame_callbacks@Base 3.28.3+git20190124 | ||
81 | 1400 | meta_wayland_surface_calculate_input_region@Base 3.28.2 | 1407 | meta_wayland_surface_calculate_input_region@Base 3.28.2 |
82 | 1401 | meta_wayland_surface_cancel_inhibit_shortcuts_dialog@Base 3.28.2 | 1408 | meta_wayland_surface_cancel_inhibit_shortcuts_dialog@Base 3.28.2 |
83 | 1402 | meta_wayland_surface_clear_surface_actor@Base 3.28.2 | 1409 | meta_wayland_surface_clear_surface_actor@Base 3.28.2 |
84 | diff --git a/debian/patches/bgo768531_workaround-startup-notifications.patch b/debian/patches/bgo768531_workaround-startup-notifications.patch | |||
85 | index bc6b697..26ac823 100644 | |||
86 | --- a/debian/patches/bgo768531_workaround-startup-notifications.patch | |||
87 | +++ b/debian/patches/bgo768531_workaround-startup-notifications.patch | |||
88 | @@ -16,10 +16,10 @@ Applied-upstream: no | |||
89 | 16 | 1 file changed, 10 insertions(+) | 16 | 1 file changed, 10 insertions(+) |
90 | 17 | 17 | ||
91 | 18 | diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c | 18 | diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c |
93 | 19 | index 0ef9b83..891109a 100644 | 19 | index 474595b..5837567 100644 |
94 | 20 | --- a/src/wayland/meta-wayland-gtk-shell.c | 20 | --- a/src/wayland/meta-wayland-gtk-shell.c |
95 | 21 | +++ b/src/wayland/meta-wayland-gtk-shell.c | 21 | +++ b/src/wayland/meta-wayland-gtk-shell.c |
97 | 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, |
98 | 23 | struct wl_resource *resource, | 23 | struct wl_resource *resource, |
99 | 24 | const char *startup_id) | 24 | const char *startup_id) |
100 | 25 | { | 25 | { |
101 | 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 | |||
102 | 26 | deleted file mode 100644 | 26 | deleted file mode 100644 |
103 | index 120171f..0000000 | |||
104 | --- a/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch | |||
105 | +++ /dev/null | |||
106 | @@ -1,43 +0,0 @@ | |||
107 | 1 | From: Carlos Garnacho <carlosg@gnome.org> | ||
108 | 2 | Date: Wed, 3 Oct 2018 22:43:21 +0200 | ||
109 | 3 | Subject: clutter: Do not latch modifiers on modifier keys | ||
110 | 4 | |||
111 | 5 | If the user maps eg. Alt+F2 to a pad button, the MetaInputSettings will | ||
112 | 6 | send the full Alt press, F2 press, F2 release, Alt release sequence. | ||
113 | 7 | However the keycode corresponding to Alt is found in level 1, so the | ||
114 | 8 | Shift modifier gets unintendedly latched in addition to the Alt key | ||
115 | 9 | press/release pair. | ||
116 | 10 | |||
117 | 11 | We could probably improve keycode lookup heuristics so level=0 (and | ||
118 | 12 | no modifier latching) is preferred, but we can do without it altogether | ||
119 | 13 | for modifier keys. | ||
120 | 14 | |||
121 | 15 | Ubuntu-Bug: https://bugs.launchpad.net/oem-priority/+bug/1730211 | ||
122 | 16 | Applied-Upstream: yes, 3.30.1 | ||
123 | 17 | --- | ||
124 | 18 | clutter/clutter/x11/clutter-virtual-input-device-x11.c | 6 ++++-- | ||
125 | 19 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
126 | 20 | |||
127 | 21 | diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.c b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
128 | 22 | index b86ded0..e16ba3f 100644 | ||
129 | 23 | --- a/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
130 | 24 | +++ b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
131 | 25 | @@ -147,14 +147,16 @@ clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtu | ||
132 | 26 | return; | ||
133 | 27 | } | ||
134 | 28 | |||
135 | 29 | - if (key_state == CLUTTER_KEY_STATE_PRESSED) | ||
136 | 30 | + if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) && | ||
137 | 31 | + key_state == CLUTTER_KEY_STATE_PRESSED) | ||
138 | 32 | clutter_keymap_x11_latch_modifiers (keymap, level, TRUE); | ||
139 | 33 | |||
140 | 34 | XTestFakeKeyEvent (clutter_x11_get_default_display (), | ||
141 | 35 | (KeyCode) keycode, | ||
142 | 36 | key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||
143 | 37 | |||
144 | 38 | - if (key_state == CLUTTER_KEY_STATE_RELEASED) | ||
145 | 39 | + if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) && | ||
146 | 40 | + key_state == CLUTTER_KEY_STATE_RELEASED) | ||
147 | 41 | clutter_keymap_x11_latch_modifiers (keymap, level, FALSE); | ||
148 | 42 | } | ||
149 | 43 | |||
150 | diff --git a/debian/patches/clutter-Fix-offscreen-effect-painting-of-clones.patch b/debian/patches/clutter-Fix-offscreen-effect-painting-of-clones.patch | |||
151 | 44 | new file mode 100644 | 0 | new file mode 100644 |
152 | index 0000000..faa2d7a | |||
153 | --- /dev/null | |||
154 | +++ b/debian/patches/clutter-Fix-offscreen-effect-painting-of-clones.patch | |||
155 | @@ -0,0 +1,629 @@ | |||
156 | 1 | From: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
157 | 2 | Date: Thu, 24 May 2018 11:51:22 +0200 | ||
158 | 3 | Subject: clutter: Fix offscreen-effect painting of clones | ||
159 | 4 | |||
160 | 5 | `ClutterOffscreenEffect` had been getting the wrong bounding box in the | ||
161 | 6 | case of clones and descendents of clones, causing visibly incorrect | ||
162 | 7 | clipping. This was due to `clutter_actor_get_paint_box` only ever being | ||
163 | 8 | given the source actor during a paint (which is correct) and not the clone. | ||
164 | 9 | Even if we weren't painting a clone but an offscreened descendent of a | ||
165 | 10 | clone (like in gnome-shell's desktop zoom), we would get the wrong result. | ||
166 | 11 | |||
167 | 12 | Fortunately we don't need to know the actual clone/actor being painted so | ||
168 | 13 | don't need to call the problematic `clutter_actor_get_paint_box` at all. | ||
169 | 14 | The solution is to only keep untransformed rendering in the FBO and leave | ||
170 | 15 | the correct transformation for later. The correct clone/actor's | ||
171 | 16 | transformation is already set for us as the current cogl modelview matrix | ||
172 | 17 | by `clutter_actor_paint`. | ||
173 | 18 | |||
174 | 19 | Bonus optimization: This all means we don't need to keep `last_matrix_drawn` | ||
175 | 20 | or force a full repaint every time some part of the transformation changes. | ||
176 | 21 | Because the FBO contents are no longer affected by transformations. As it | ||
177 | 22 | should be. In other words, offscreen-effected actors can now move around | ||
178 | 23 | on screen without themselves being repainted. | ||
179 | 24 | |||
180 | 25 | Special thanks to Mai Lavelle for identifying the cause of the problem. | ||
181 | 26 | |||
182 | 27 | Fixes: | ||
183 | 28 | https://bugzilla.gnome.org/show_bug.cgi?id=789050, | ||
184 | 29 | https://bugzilla.gnome.org/show_bug.cgi?id=659523#c9, | ||
185 | 30 | https://gitlab.gnome.org/GNOME/mutter/issues/196, | ||
186 | 31 | https://gitlab.gnome.org/GNOME/mutter/issues/282, | ||
187 | 32 | https://gitlab.gnome.org/GNOME/gnome-shell/issues/387, | ||
188 | 33 | https://launchpad.net/bugs/1767648, | ||
189 | 34 | https://launchpad.net/bugs/1779615 | ||
190 | 35 | |||
191 | 36 | Origin: https://gitlab.gnome.org/GNOME/mutter/commit/8655bc5d8d | ||
192 | 37 | Bug-Ubuntu: https://launchpad.net/bugs/1767648, https://launchpad.net/bugs/1779615 | ||
193 | 38 | Applied-Upstream: yes | ||
194 | 39 | --- | ||
195 | 40 | clutter/clutter/clutter-actor-box-private.h | 12 ++ | ||
196 | 41 | clutter/clutter/clutter-actor-box.c | 52 +++++++ | ||
197 | 42 | clutter/clutter/clutter-offscreen-effect.c | 172 +++++++++------------ | ||
198 | 43 | clutter/clutter/clutter-paint-volume.c | 48 +----- | ||
199 | 44 | clutter/tests/conform/Makefile.am | 1 - | ||
200 | 45 | .../tests/conform/actor-offscreen-limit-max-size.c | 119 -------------- | ||
201 | 46 | clutter/tests/conform/actor-offscreen-redirect.c | 7 +- | ||
202 | 47 | 7 files changed, 146 insertions(+), 265 deletions(-) | ||
203 | 48 | create mode 100644 clutter/clutter/clutter-actor-box-private.h | ||
204 | 49 | delete mode 100644 clutter/tests/conform/actor-offscreen-limit-max-size.c | ||
205 | 50 | |||
206 | 51 | diff --git a/clutter/clutter/clutter-actor-box-private.h b/clutter/clutter/clutter-actor-box-private.h | ||
207 | 52 | new file mode 100644 | ||
208 | 53 | index 0000000..e7aeb88 | ||
209 | 54 | --- /dev/null | ||
210 | 55 | +++ b/clutter/clutter/clutter-actor-box-private.h | ||
211 | 56 | @@ -0,0 +1,12 @@ | ||
212 | 57 | +#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__ | ||
213 | 58 | +#define __CLUTTER_ACTOR_BOX_PRIVATE_H__ | ||
214 | 59 | + | ||
215 | 60 | +#include <clutter/clutter-types.h> | ||
216 | 61 | + | ||
217 | 62 | +G_BEGIN_DECLS | ||
218 | 63 | + | ||
219 | 64 | +void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box); | ||
220 | 65 | + | ||
221 | 66 | +G_END_DECLS | ||
222 | 67 | + | ||
223 | 68 | +#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */ | ||
224 | 69 | diff --git a/clutter/clutter/clutter-actor-box.c b/clutter/clutter/clutter-actor-box.c | ||
225 | 70 | index 2991066..319eec3 100644 | ||
226 | 71 | --- a/clutter/clutter/clutter-actor-box.c | ||
227 | 72 | +++ b/clutter/clutter/clutter-actor-box.c | ||
228 | 73 | @@ -7,6 +7,7 @@ | ||
229 | 74 | #include "clutter-types.h" | ||
230 | 75 | #include "clutter-interval.h" | ||
231 | 76 | #include "clutter-private.h" | ||
232 | 77 | +#include "clutter-actor-box-private.h" | ||
233 | 78 | |||
234 | 79 | /** | ||
235 | 80 | * clutter_actor_box_new: | ||
236 | 81 | @@ -544,6 +545,57 @@ clutter_actor_box_set_size (ClutterActorBox *box, | ||
237 | 82 | box->y2 = box->y1 + height; | ||
238 | 83 | } | ||
239 | 84 | |||
240 | 85 | +void | ||
241 | 86 | +_clutter_actor_box_enlarge_for_effects (ClutterActorBox *box) | ||
242 | 87 | +{ | ||
243 | 88 | + float width, height; | ||
244 | 89 | + | ||
245 | 90 | + /* The aim here is that for a given rectangle defined with floating point | ||
246 | 91 | + * coordinates we want to determine a stable quantized size in pixels | ||
247 | 92 | + * that doesn't vary due to the original box's sub-pixel position. | ||
248 | 93 | + * | ||
249 | 94 | + * The reason this is important is because effects will use this | ||
250 | 95 | + * API to determine the size of offscreen framebuffers and so for | ||
251 | 96 | + * a fixed-size object that may be animated accross the screen we | ||
252 | 97 | + * want to make sure that the stage paint-box has an equally stable | ||
253 | 98 | + * size so that effects aren't made to continuously re-allocate | ||
254 | 99 | + * a corresponding fbo. | ||
255 | 100 | + * | ||
256 | 101 | + * The other thing we consider is that the calculation of this box is | ||
257 | 102 | + * subject to floating point precision issues that might be slightly | ||
258 | 103 | + * different to the precision issues involved with actually painting the | ||
259 | 104 | + * actor, which might result in painting slightly leaking outside the | ||
260 | 105 | + * user's calculated paint-volume. For this we simply aim to pad out the | ||
261 | 106 | + * paint-volume by at least half a pixel all the way around. | ||
262 | 107 | + */ | ||
263 | 108 | + width = box->x2 - box->x1; | ||
264 | 109 | + height = box->y2 - box->y1; | ||
265 | 110 | + width = CLUTTER_NEARBYINT (width); | ||
266 | 111 | + height = CLUTTER_NEARBYINT (height); | ||
267 | 112 | + /* XXX: NB the width/height may now be up to 0.5px too small so we | ||
268 | 113 | + * must also pad by 0.25px all around to account for this. In total we | ||
269 | 114 | + * must padd by at least 0.75px around all sides. */ | ||
270 | 115 | + | ||
271 | 116 | + /* XXX: The furthest that we can overshoot the bottom right corner by | ||
272 | 117 | + * here is 1.75px in total if you consider that the 0.75 padding could | ||
273 | 118 | + * just cross an integer boundary and so ceil will effectively add 1. | ||
274 | 119 | + */ | ||
275 | 120 | + box->x2 = ceilf (box->x2 + 0.75); | ||
276 | 121 | + box->y2 = ceilf (box->y2 + 0.75); | ||
277 | 122 | + | ||
278 | 123 | + /* Now we redefine the top-left relative to the bottom right based on the | ||
279 | 124 | + * rounded width/height determined above + a constant so that the overall | ||
280 | 125 | + * size of the box will be stable and not dependant on the box's | ||
281 | 126 | + * position. | ||
282 | 127 | + * | ||
283 | 128 | + * Adding 3px to the width/height will ensure we cover the maximum of | ||
284 | 129 | + * 1.75px padding on the bottom/right and still ensure we have > 0.75px | ||
285 | 130 | + * padding on the top/left. | ||
286 | 131 | + */ | ||
287 | 132 | + box->x1 = box->x2 - width - 3; | ||
288 | 133 | + box->y1 = box->y2 - height - 3; | ||
289 | 134 | +} | ||
290 | 135 | + | ||
291 | 136 | G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box, | ||
292 | 137 | clutter_actor_box_copy, | ||
293 | 138 | clutter_actor_box_free, | ||
294 | 139 | diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c | ||
295 | 140 | index 5db40b7..a26275e 100644 | ||
296 | 141 | --- a/clutter/clutter/clutter-offscreen-effect.c | ||
297 | 142 | +++ b/clutter/clutter/clutter-offscreen-effect.c | ||
298 | 143 | @@ -74,6 +74,8 @@ | ||
299 | 144 | #include "clutter-debug.h" | ||
300 | 145 | #include "clutter-private.h" | ||
301 | 146 | #include "clutter-stage-private.h" | ||
302 | 147 | +#include "clutter-paint-volume-private.h" | ||
303 | 148 | +#include "clutter-actor-box-private.h" | ||
304 | 149 | |||
305 | 150 | struct _ClutterOffscreenEffectPrivate | ||
306 | 151 | { | ||
307 | 152 | @@ -84,8 +86,10 @@ struct _ClutterOffscreenEffectPrivate | ||
308 | 153 | ClutterActor *actor; | ||
309 | 154 | ClutterActor *stage; | ||
310 | 155 | |||
311 | 156 | - gfloat x_offset; | ||
312 | 157 | - gfloat y_offset; | ||
313 | 158 | + ClutterVertex position; | ||
314 | 159 | + | ||
315 | 160 | + int fbo_offset_x; | ||
316 | 161 | + int fbo_offset_y; | ||
317 | 162 | |||
318 | 163 | /* This is the calculated size of the fbo before being passed | ||
319 | 164 | through create_texture(). This needs to be tracked separately so | ||
320 | 165 | @@ -95,16 +99,6 @@ struct _ClutterOffscreenEffectPrivate | ||
321 | 166 | int fbo_height; | ||
322 | 167 | |||
323 | 168 | gint old_opacity_override; | ||
324 | 169 | - | ||
325 | 170 | - /* The matrix that was current the last time the fbo was updated. We | ||
326 | 171 | - need to keep track of this to detect when we can reuse the | ||
327 | 172 | - contents of the fbo without redrawing the actor. We need the | ||
328 | 173 | - actual matrix rather than just detecting queued redraws on the | ||
329 | 174 | - actor because any change in the parent hierarchy (even just a | ||
330 | 175 | - translation) could cause the actor to look completely different | ||
331 | 176 | - and it won't cause a redraw to be queued on the parent's | ||
332 | 177 | - children. */ | ||
333 | 178 | - CoglMatrix last_matrix_drawn; | ||
334 | 179 | }; | ||
335 | 180 | |||
336 | 181 | G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect, | ||
337 | 182 | @@ -224,15 +218,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect) | ||
338 | 183 | { | ||
339 | 184 | ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect); | ||
340 | 185 | ClutterOffscreenEffectPrivate *priv = self->priv; | ||
341 | 186 | - ClutterActorBox box; | ||
342 | 187 | + ClutterActorBox raw_box, box; | ||
343 | 188 | ClutterActor *stage; | ||
344 | 189 | - CoglMatrix projection; | ||
345 | 190 | + CoglMatrix projection, old_modelview, modelview; | ||
346 | 191 | + const ClutterPaintVolume *volume; | ||
347 | 192 | CoglColor transparent; | ||
348 | 193 | gfloat stage_width, stage_height; | ||
349 | 194 | gfloat fbo_width = -1, fbo_height = -1; | ||
350 | 195 | - gfloat width, height; | ||
351 | 196 | - gfloat xexpand, yexpand; | ||
352 | 197 | - int texture_width, texture_height; | ||
353 | 198 | + ClutterVertex local_offset = { 0.f, 0.f, 0.f }; | ||
354 | 199 | + gfloat old_viewport[4]; | ||
355 | 200 | |||
356 | 201 | if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect))) | ||
357 | 202 | return FALSE; | ||
358 | 203 | @@ -243,92 +237,82 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect) | ||
359 | 204 | stage = _clutter_actor_get_stage_internal (priv->actor); | ||
360 | 205 | clutter_actor_get_size (stage, &stage_width, &stage_height); | ||
361 | 206 | |||
362 | 207 | - /* The paint box is the bounding box of the actor's paint volume in | ||
363 | 208 | - * stage coordinates. This will give us the size for the framebuffer | ||
364 | 209 | - * we need to redirect its rendering offscreen and its position will | ||
365 | 210 | - * be used to setup an offset viewport */ | ||
366 | 211 | - if (clutter_actor_get_paint_box (priv->actor, &box)) | ||
367 | 212 | + /* Get the minimal bounding box for what we want to paint, relative to the | ||
368 | 213 | + * parent of priv->actor. Note that we may actually be painting a clone of | ||
369 | 214 | + * priv->actor so we need to be careful to avoid querying the transformation | ||
370 | 215 | + * of priv->actor (like clutter_actor_get_paint_box would). Just stay in | ||
371 | 216 | + * local coordinates for now... | ||
372 | 217 | + */ | ||
373 | 218 | + volume = clutter_actor_get_paint_volume (priv->actor); | ||
374 | 219 | + if (volume) | ||
375 | 220 | { | ||
376 | 221 | - clutter_actor_box_get_size (&box, &fbo_width, &fbo_height); | ||
377 | 222 | - clutter_actor_box_get_origin (&box, &priv->x_offset, &priv->y_offset); | ||
378 | 223 | + ClutterPaintVolume mutable_volume; | ||
379 | 224 | |||
380 | 225 | - fbo_width = MIN (fbo_width, stage_width); | ||
381 | 226 | - fbo_height = MIN (fbo_height, stage_height); | ||
382 | 227 | + _clutter_paint_volume_copy_static (volume, &mutable_volume); | ||
383 | 228 | + _clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box); | ||
384 | 229 | + clutter_paint_volume_free (&mutable_volume); | ||
385 | 230 | } | ||
386 | 231 | else | ||
387 | 232 | { | ||
388 | 233 | - fbo_width = stage_width; | ||
389 | 234 | - fbo_height = stage_height; | ||
390 | 235 | + clutter_actor_get_allocation_box (priv->actor, &raw_box); | ||
391 | 236 | } | ||
392 | 237 | |||
393 | 238 | - if (fbo_width == stage_width) | ||
394 | 239 | - priv->x_offset = 0.0f; | ||
395 | 240 | - if (fbo_height == stage_height) | ||
396 | 241 | - priv->y_offset = 0.0f; | ||
397 | 242 | + box = raw_box; | ||
398 | 243 | + _clutter_actor_box_enlarge_for_effects (&box); | ||
399 | 244 | + | ||
400 | 245 | + priv->fbo_offset_x = box.x1 - raw_box.x1; | ||
401 | 246 | + priv->fbo_offset_y = box.y1 - raw_box.y1; | ||
402 | 247 | + | ||
403 | 248 | + clutter_actor_box_get_size (&box, &fbo_width, &fbo_height); | ||
404 | 249 | |||
405 | 250 | /* First assert that the framebuffer is the right size... */ | ||
406 | 251 | if (!update_fbo (effect, fbo_width, fbo_height)) | ||
407 | 252 | return FALSE; | ||
408 | 253 | |||
409 | 254 | - texture_width = cogl_texture_get_width (priv->texture); | ||
410 | 255 | - texture_height = cogl_texture_get_height (priv->texture); | ||
411 | 256 | - | ||
412 | 257 | - /* get the current modelview matrix so that we can copy it to the | ||
413 | 258 | - * framebuffer. We also store the matrix that was last used when we | ||
414 | 259 | - * updated the FBO so that we can detect when we don't need to | ||
415 | 260 | - * update the FBO to paint a second time */ | ||
416 | 261 | - cogl_get_modelview_matrix (&priv->last_matrix_drawn); | ||
417 | 262 | + cogl_get_modelview_matrix (&old_modelview); | ||
418 | 263 | |||
419 | 264 | /* let's draw offscreen */ | ||
420 | 265 | cogl_push_framebuffer (priv->offscreen); | ||
421 | 266 | |||
422 | 267 | - /* Copy the modelview that would have been used if rendering onscreen */ | ||
423 | 268 | - cogl_set_modelview_matrix (&priv->last_matrix_drawn); | ||
424 | 269 | + /* We don't want the FBO contents to be transformed. That could waste memory | ||
425 | 270 | + * (e.g. during zoom), or result in something that's not rectangular (clipped | ||
426 | 271 | + * incorrectly). So drop the modelview matrix of the current paint chain. | ||
427 | 272 | + * This is fine since paint_texture runs with the same modelview matrix, | ||
428 | 273 | + * so it will come out correctly whenever that is used to put the FBO | ||
429 | 274 | + * contents on screen... | ||
430 | 275 | + */ | ||
431 | 276 | + clutter_actor_get_transform (priv->stage, &modelview); | ||
432 | 277 | + cogl_set_modelview_matrix (&modelview); | ||
433 | 278 | |||
434 | 279 | - /* Set up the viewport so that it has the same size as the stage, | ||
435 | 280 | - * but offset it so that the actor of interest lands on our | ||
436 | 281 | - * framebuffer. */ | ||
437 | 282 | - clutter_actor_get_size (priv->stage, &width, &height); | ||
438 | 283 | + /* Save the original viewport for calculating priv->position */ | ||
439 | 284 | + _clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage), | ||
440 | 285 | + &old_viewport[0], | ||
441 | 286 | + &old_viewport[1], | ||
442 | 287 | + &old_viewport[2], | ||
443 | 288 | + &old_viewport[3]); | ||
444 | 289 | |||
445 | 290 | - /* Expand the viewport if the actor is partially off-stage, | ||
446 | 291 | - * otherwise the actor will end up clipped to the stage viewport | ||
447 | 292 | + /* Set up the viewport so that it has the same size as the stage (avoid | ||
448 | 293 | + * distortion), but translated to account for the FBO offset... | ||
449 | 294 | */ | ||
450 | 295 | - xexpand = 0.f; | ||
451 | 296 | - if (priv->x_offset < 0.f) | ||
452 | 297 | - xexpand = -priv->x_offset; | ||
453 | 298 | - if (priv->x_offset + texture_width > width) | ||
454 | 299 | - xexpand = MAX (xexpand, (priv->x_offset + texture_width) - width); | ||
455 | 300 | - | ||
456 | 301 | - yexpand = 0.f; | ||
457 | 302 | - if (priv->y_offset < 0.f) | ||
458 | 303 | - yexpand = -priv->y_offset; | ||
459 | 304 | - if (priv->y_offset + texture_height > height) | ||
460 | 305 | - yexpand = MAX (yexpand, (priv->y_offset + texture_height) - height); | ||
461 | 306 | - | ||
462 | 307 | - /* Set the viewport */ | ||
463 | 308 | - cogl_set_viewport (-(priv->x_offset + xexpand), -(priv->y_offset + yexpand), | ||
464 | 309 | - width + (2 * xexpand), height + (2 * yexpand)); | ||
465 | 310 | + cogl_set_viewport (-priv->fbo_offset_x, | ||
466 | 311 | + -priv->fbo_offset_y, | ||
467 | 312 | + stage_width, | ||
468 | 313 | + stage_height); | ||
469 | 314 | |||
470 | 315 | /* Copy the stage's projection matrix across to the framebuffer */ | ||
471 | 316 | _clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage), | ||
472 | 317 | &projection); | ||
473 | 318 | |||
474 | 319 | - /* If we've expanded the viewport, make sure to scale the projection | ||
475 | 320 | - * matrix accordingly (as it's been initialised to work with the | ||
476 | 321 | - * original viewport and not our expanded one). | ||
477 | 322 | + /* Now save the global position of the effect (not just of the actor). | ||
478 | 323 | + * It doesn't appear anyone actually uses this yet, but get_target_rect is | ||
479 | 324 | + * documented as returning it. So we should... | ||
480 | 325 | */ | ||
481 | 326 | - if (xexpand > 0.f || yexpand > 0.f) | ||
482 | 327 | - { | ||
483 | 328 | - gfloat new_width, new_height; | ||
484 | 329 | - | ||
485 | 330 | - new_width = width + (2 * xexpand); | ||
486 | 331 | - new_height = height + (2 * yexpand); | ||
487 | 332 | - | ||
488 | 333 | - cogl_matrix_scale (&projection, | ||
489 | 334 | - width / new_width, | ||
490 | 335 | - height / new_height, | ||
491 | 336 | - 1); | ||
492 | 337 | - } | ||
493 | 338 | + _clutter_util_fully_transform_vertices (&old_modelview, | ||
494 | 339 | + &projection, | ||
495 | 340 | + old_viewport, | ||
496 | 341 | + &local_offset, | ||
497 | 342 | + &priv->position, | ||
498 | 343 | + 1); | ||
499 | 344 | |||
500 | 345 | cogl_set_projection_matrix (&projection); | ||
501 | 346 | |||
502 | 347 | @@ -385,13 +369,14 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect) | ||
503 | 348 | |||
504 | 349 | cogl_push_matrix (); | ||
505 | 350 | |||
506 | 351 | - /* Now reset the modelview to put us in stage coordinates so | ||
507 | 352 | - * we can drawn the result of our offscreen render as a textured | ||
508 | 353 | - * quad... */ | ||
509 | 354 | - | ||
510 | 355 | - cogl_matrix_init_identity (&modelview); | ||
511 | 356 | - _clutter_actor_apply_modelview_transform (priv->stage, &modelview); | ||
512 | 357 | - cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.0f); | ||
513 | 358 | + /* The current modelview matrix is *almost* perfect already. It's only | ||
514 | 359 | + * missing a correction for the expanded FBO and offset rendering within... | ||
515 | 360 | + */ | ||
516 | 361 | + cogl_get_modelview_matrix (&modelview); | ||
517 | 362 | + cogl_matrix_translate (&modelview, | ||
518 | 363 | + priv->fbo_offset_x, | ||
519 | 364 | + priv->fbo_offset_y, | ||
520 | 365 | + 0.0f); | ||
521 | 366 | cogl_set_modelview_matrix (&modelview); | ||
522 | 367 | |||
523 | 368 | /* paint the target material; this is virtualized for | ||
524 | 369 | @@ -428,16 +413,11 @@ clutter_offscreen_effect_paint (ClutterEffect *effect, | ||
525 | 370 | { | ||
526 | 371 | ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect); | ||
527 | 372 | ClutterOffscreenEffectPrivate *priv = self->priv; | ||
528 | 373 | - CoglMatrix matrix; | ||
529 | 374 | - | ||
530 | 375 | - cogl_get_modelview_matrix (&matrix); | ||
531 | 376 | |||
532 | 377 | - /* If we've already got a cached image for the same matrix and the | ||
533 | 378 | - actor hasn't been redrawn then we can just use the cached image | ||
534 | 379 | - in the fbo */ | ||
535 | 380 | - if (priv->offscreen == NULL || | ||
536 | 381 | - (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) || | ||
537 | 382 | - !cogl_matrix_equal (&matrix, &priv->last_matrix_drawn)) | ||
538 | 383 | + /* If we've already got a cached image and the actor hasn't been redrawn | ||
539 | 384 | + * then we can just use the cached image in the FBO. | ||
540 | 385 | + */ | ||
541 | 386 | + if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY)) | ||
542 | 387 | { | ||
543 | 388 | /* Chain up to the parent paint method which will call the pre and | ||
544 | 389 | post paint functions to update the image */ | ||
545 | 390 | @@ -663,8 +643,8 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect, | ||
546 | 391 | return FALSE; | ||
547 | 392 | |||
548 | 393 | clutter_rect_init (rect, | ||
549 | 394 | - priv->x_offset, | ||
550 | 395 | - priv->y_offset, | ||
551 | 396 | + priv->position.x, | ||
552 | 397 | + priv->position.y, | ||
553 | 398 | cogl_texture_get_width (priv->texture), | ||
554 | 399 | cogl_texture_get_height (priv->texture)); | ||
555 | 400 | |||
556 | 401 | diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c | ||
557 | 402 | index f340513..836812b 100644 | ||
558 | 403 | --- a/clutter/clutter/clutter-paint-volume.c | ||
559 | 404 | +++ b/clutter/clutter/clutter-paint-volume.c | ||
560 | 405 | @@ -37,6 +37,7 @@ | ||
561 | 406 | #include "clutter-paint-volume-private.h" | ||
562 | 407 | #include "clutter-private.h" | ||
563 | 408 | #include "clutter-stage-private.h" | ||
564 | 409 | +#include "clutter-actor-box-private.h" | ||
565 | 410 | |||
566 | 411 | G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume, | ||
567 | 412 | clutter_paint_volume_copy, | ||
568 | 413 | @@ -1140,8 +1141,6 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv, | ||
569 | 414 | CoglMatrix modelview; | ||
570 | 415 | CoglMatrix projection; | ||
571 | 416 | float viewport[4]; | ||
572 | 417 | - float width; | ||
573 | 418 | - float height; | ||
574 | 419 | |||
575 | 420 | _clutter_paint_volume_copy_static (pv, &projected_pv); | ||
576 | 421 | |||
577 | 422 | @@ -1181,50 +1180,7 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv, | ||
578 | 423 | return; | ||
579 | 424 | } | ||
580 | 425 | |||
581 | 426 | - /* The aim here is that for a given rectangle defined with floating point | ||
582 | 427 | - * coordinates we want to determine a stable quantized size in pixels | ||
583 | 428 | - * that doesn't vary due to the original box's sub-pixel position. | ||
584 | 429 | - * | ||
585 | 430 | - * The reason this is important is because effects will use this | ||
586 | 431 | - * API to determine the size of offscreen framebuffers and so for | ||
587 | 432 | - * a fixed-size object that may be animated accross the screen we | ||
588 | 433 | - * want to make sure that the stage paint-box has an equally stable | ||
589 | 434 | - * size so that effects aren't made to continuously re-allocate | ||
590 | 435 | - * a corresponding fbo. | ||
591 | 436 | - * | ||
592 | 437 | - * The other thing we consider is that the calculation of this box is | ||
593 | 438 | - * subject to floating point precision issues that might be slightly | ||
594 | 439 | - * different to the precision issues involved with actually painting the | ||
595 | 440 | - * actor, which might result in painting slightly leaking outside the | ||
596 | 441 | - * user's calculated paint-volume. For this we simply aim to pad out the | ||
597 | 442 | - * paint-volume by at least half a pixel all the way around. | ||
598 | 443 | - */ | ||
599 | 444 | - width = box->x2 - box->x1; | ||
600 | 445 | - height = box->y2 - box->y1; | ||
601 | 446 | - width = CLUTTER_NEARBYINT (width); | ||
602 | 447 | - height = CLUTTER_NEARBYINT (height); | ||
603 | 448 | - /* XXX: NB the width/height may now be up to 0.5px too small so we | ||
604 | 449 | - * must also pad by 0.25px all around to account for this. In total we | ||
605 | 450 | - * must padd by at least 0.75px around all sides. */ | ||
606 | 451 | - | ||
607 | 452 | - /* XXX: The furthest that we can overshoot the bottom right corner by | ||
608 | 453 | - * here is 1.75px in total if you consider that the 0.75 padding could | ||
609 | 454 | - * just cross an integer boundary and so ceil will effectively add 1. | ||
610 | 455 | - */ | ||
611 | 456 | - box->x2 = ceilf (box->x2 + 0.75); | ||
612 | 457 | - box->y2 = ceilf (box->y2 + 0.75); | ||
613 | 458 | - | ||
614 | 459 | - /* Now we redefine the top-left relative to the bottom right based on the | ||
615 | 460 | - * rounded width/height determined above + a constant so that the overall | ||
616 | 461 | - * size of the box will be stable and not dependant on the box's | ||
617 | 462 | - * position. | ||
618 | 463 | - * | ||
619 | 464 | - * Adding 3px to the width/height will ensure we cover the maximum of | ||
620 | 465 | - * 1.75px padding on the bottom/right and still ensure we have > 0.75px | ||
621 | 466 | - * padding on the top/left. | ||
622 | 467 | - */ | ||
623 | 468 | - box->x1 = box->x2 - width - 3; | ||
624 | 469 | - box->y1 = box->y2 - height - 3; | ||
625 | 470 | + _clutter_actor_box_enlarge_for_effects (box); | ||
626 | 471 | |||
627 | 472 | clutter_paint_volume_free (&projected_pv); | ||
628 | 473 | } | ||
629 | 474 | diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am | ||
630 | 475 | index 9cef08b..afa9dad 100644 | ||
631 | 476 | --- a/clutter/tests/conform/Makefile.am | ||
632 | 477 | +++ b/clutter/tests/conform/Makefile.am | ||
633 | 478 | @@ -25,7 +25,6 @@ actor_tests = \ | ||
634 | 479 | actor-iter \ | ||
635 | 480 | actor-layout \ | ||
636 | 481 | actor-meta \ | ||
637 | 482 | - actor-offscreen-limit-max-size \ | ||
638 | 483 | actor-offscreen-redirect \ | ||
639 | 484 | actor-paint-opacity \ | ||
640 | 485 | actor-pick \ | ||
641 | 486 | diff --git a/clutter/tests/conform/actor-offscreen-limit-max-size.c b/clutter/tests/conform/actor-offscreen-limit-max-size.c | ||
642 | 487 | deleted file mode 100644 | ||
643 | 488 | index 943c7d8..0000000 | ||
644 | 489 | --- a/clutter/tests/conform/actor-offscreen-limit-max-size.c | ||
645 | 490 | +++ /dev/null | ||
646 | 491 | @@ -1,119 +0,0 @@ | ||
647 | 492 | -#define CLUTTER_ENABLE_EXPERIMENTAL_API | ||
648 | 493 | -#include <clutter/clutter.h> | ||
649 | 494 | - | ||
650 | 495 | -#define STAGE_WIDTH (300) | ||
651 | 496 | -#define STAGE_HEIGHT (300) | ||
652 | 497 | - | ||
653 | 498 | -typedef struct | ||
654 | 499 | -{ | ||
655 | 500 | - ClutterActor *stage; | ||
656 | 501 | - | ||
657 | 502 | - ClutterActor *actor_group1; | ||
658 | 503 | - ClutterEffect *blur_effect1; | ||
659 | 504 | - | ||
660 | 505 | - ClutterActor *actor_group2; | ||
661 | 506 | - ClutterEffect *blur_effect2; | ||
662 | 507 | -} Data; | ||
663 | 508 | - | ||
664 | 509 | -static void | ||
665 | 510 | -check_results (ClutterStage *stage, gpointer user_data) | ||
666 | 511 | -{ | ||
667 | 512 | - Data *data = user_data; | ||
668 | 513 | - gfloat width, height; | ||
669 | 514 | - ClutterRect rect; | ||
670 | 515 | - | ||
671 | 516 | - clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect1), | ||
672 | 517 | - &rect); | ||
673 | 518 | - | ||
674 | 519 | - width = clutter_rect_get_width (&rect); | ||
675 | 520 | - height = clutter_rect_get_height (&rect); | ||
676 | 521 | - | ||
677 | 522 | - if (g_test_verbose ()) | ||
678 | 523 | - g_print ("Checking effect1 size: %.2f x %.2f\n", | ||
679 | 524 | - clutter_rect_get_width (&rect), | ||
680 | 525 | - clutter_rect_get_height (&rect)); | ||
681 | 526 | - | ||
682 | 527 | - g_assert_cmpint (width, <, STAGE_WIDTH); | ||
683 | 528 | - g_assert_cmpint (height, <, STAGE_HEIGHT); | ||
684 | 529 | - | ||
685 | 530 | - clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect2), | ||
686 | 531 | - &rect); | ||
687 | 532 | - | ||
688 | 533 | - width = clutter_rect_get_width (&rect); | ||
689 | 534 | - height = clutter_rect_get_height (&rect); | ||
690 | 535 | - | ||
691 | 536 | - if (g_test_verbose ()) | ||
692 | 537 | - g_print ("Checking effect2 size: %.2f x %.2f\n", width, height); | ||
693 | 538 | - | ||
694 | 539 | - g_assert_cmpint (width, ==, STAGE_WIDTH); | ||
695 | 540 | - g_assert_cmpint (height, ==, STAGE_HEIGHT); | ||
696 | 541 | - | ||
697 | 542 | - | ||
698 | 543 | - clutter_main_quit (); | ||
699 | 544 | -} | ||
700 | 545 | - | ||
701 | 546 | -static ClutterActor * | ||
702 | 547 | -create_actor (gfloat x, gfloat y, | ||
703 | 548 | - gfloat width, gfloat height, | ||
704 | 549 | - const ClutterColor *color) | ||
705 | 550 | -{ | ||
706 | 551 | - return g_object_new (CLUTTER_TYPE_ACTOR, | ||
707 | 552 | - "x", x, | ||
708 | 553 | - "y", y, | ||
709 | 554 | - "width", width, | ||
710 | 555 | - "height", height, | ||
711 | 556 | - "background-color", color, | ||
712 | 557 | - NULL); | ||
713 | 558 | -} | ||
714 | 559 | - | ||
715 | 560 | -static void | ||
716 | 561 | -actor_offscreen_limit_max_size (void) | ||
717 | 562 | -{ | ||
718 | 563 | - Data data; | ||
719 | 564 | - | ||
720 | 565 | - if (!cogl_features_available (COGL_FEATURE_OFFSCREEN)) | ||
721 | 566 | - return; | ||
722 | 567 | - | ||
723 | 568 | - data.stage = clutter_test_get_stage (); | ||
724 | 569 | - g_signal_connect (data.stage, "after-paint", | ||
725 | 570 | - G_CALLBACK (check_results), &data); | ||
726 | 571 | - clutter_actor_set_size (data.stage, STAGE_WIDTH, STAGE_HEIGHT); | ||
727 | 572 | - | ||
728 | 573 | - data.actor_group1 = clutter_actor_new (); | ||
729 | 574 | - clutter_actor_add_child (data.stage, data.actor_group1); | ||
730 | 575 | - data.blur_effect1 = clutter_blur_effect_new (); | ||
731 | 576 | - clutter_actor_add_effect (data.actor_group1, data.blur_effect1); | ||
732 | 577 | - clutter_actor_add_child (data.actor_group1, | ||
733 | 578 | - create_actor (10, 10, | ||
734 | 579 | - 100, 100, | ||
735 | 580 | - CLUTTER_COLOR_Blue)); | ||
736 | 581 | - clutter_actor_add_child (data.actor_group1, | ||
737 | 582 | - create_actor (100, 100, | ||
738 | 583 | - 100, 100, | ||
739 | 584 | - CLUTTER_COLOR_Gray)); | ||
740 | 585 | - | ||
741 | 586 | - data.actor_group2 = clutter_actor_new (); | ||
742 | 587 | - clutter_actor_add_child (data.stage, data.actor_group2); | ||
743 | 588 | - data.blur_effect2 = clutter_blur_effect_new (); | ||
744 | 589 | - clutter_actor_add_effect (data.actor_group2, data.blur_effect2); | ||
745 | 590 | - clutter_actor_add_child (data.actor_group2, | ||
746 | 591 | - create_actor (-10, -10, | ||
747 | 592 | - 100, 100, | ||
748 | 593 | - CLUTTER_COLOR_Yellow)); | ||
749 | 594 | - clutter_actor_add_child (data.actor_group2, | ||
750 | 595 | - create_actor (250, 10, | ||
751 | 596 | - 100, 100, | ||
752 | 597 | - CLUTTER_COLOR_ScarletRed)); | ||
753 | 598 | - clutter_actor_add_child (data.actor_group2, | ||
754 | 599 | - create_actor (10, 250, | ||
755 | 600 | - 100, 100, | ||
756 | 601 | - CLUTTER_COLOR_Yellow)); | ||
757 | 602 | - | ||
758 | 603 | - clutter_actor_show (data.stage); | ||
759 | 604 | - | ||
760 | 605 | - clutter_main (); | ||
761 | 606 | -} | ||
762 | 607 | - | ||
763 | 608 | -CLUTTER_TEST_SUITE ( | ||
764 | 609 | - CLUTTER_TEST_UNIT ("/actor/offscreen/limit-max-size", actor_offscreen_limit_max_size) | ||
765 | 610 | -) | ||
766 | 611 | diff --git a/clutter/tests/conform/actor-offscreen-redirect.c b/clutter/tests/conform/actor-offscreen-redirect.c | ||
767 | 612 | index 63d5e6c..9dbb7d2 100644 | ||
768 | 613 | --- a/clutter/tests/conform/actor-offscreen-redirect.c | ||
769 | 614 | +++ b/clutter/tests/conform/actor-offscreen-redirect.c | ||
770 | 615 | @@ -189,10 +189,11 @@ verify_redraws (gpointer user_data) | ||
771 | 616 | clutter_actor_queue_redraw (data->child); | ||
772 | 617 | verify_redraw (data, 1); | ||
773 | 618 | |||
774 | 619 | - /* Modifying the transformation on the parent should cause a | ||
775 | 620 | - redraw */ | ||
776 | 621 | + /* Modifying the transformation on the parent should not cause a redraw, | ||
777 | 622 | + since the FBO stores pre-transformed rendering that can be reused with | ||
778 | 623 | + any transformation. */ | ||
779 | 624 | clutter_actor_set_anchor_point (data->parent_container, 0, 1); | ||
780 | 625 | - verify_redraw (data, 1); | ||
781 | 626 | + verify_redraw (data, 0); | ||
782 | 627 | |||
783 | 628 | /* Redrawing an unrelated actor shouldn't cause a redraw */ | ||
784 | 629 | clutter_actor_set_position (data->unrelated_actor, 0, 1); | ||
785 | 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 | |||
786 | 0 | deleted file mode 100644 | 630 | deleted file mode 100644 |
787 | index ccb4263..0000000 | |||
788 | --- a/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch | |||
789 | +++ /dev/null | |||
790 | @@ -1,316 +0,0 @@ | |||
791 | 1 | From: Carlos Garnacho <carlosg@gnome.org> | ||
792 | 2 | Date: Fri, 29 Jun 2018 14:31:23 +0200 | ||
793 | 3 | Subject: clutter/x11: Implement keycode lookup from keysyms on virtual key | ||
794 | 4 | devices | ||
795 | 5 | |||
796 | 6 | Unfortunately XKeysymToKeycode() falls short in that it coalesces keysyms | ||
797 | 7 | into keycodes pertaining to the first level (i.e. lowercase). Add a | ||
798 | 8 | ClutterKeymapX11 method (much alike its GdkKeymap counterpart) to look up | ||
799 | 9 | all matches for the given keysym. | ||
800 | 10 | |||
801 | 11 | Two other helper methods have been added so the virtual device can fetch | ||
802 | 12 | the current keyboard group, and latch modifiers for key emission. Combining | ||
803 | 13 | all this, the virtual device is now able to handle keycodes in further | ||
804 | 14 | levels. | ||
805 | 15 | |||
806 | 16 | Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/135 | ||
807 | 17 | |||
808 | 18 | (cherry picked from commit 85284acb000ddc70afcf716b6c198b4b5bf5741e) | ||
809 | 19 | |||
810 | 20 | Ubuntu-Bug: https://bugs.launchpad.net/oem-priority/+bug/1730211 | ||
811 | 21 | Applied-Upstream: yes, 3.28.4 | ||
812 | 22 | --- | ||
813 | 23 | clutter/clutter/x11/clutter-keymap-x11.c | 178 ++++++++++++++++++++- | ||
814 | 24 | clutter/clutter/x11/clutter-keymap-x11.h | 8 + | ||
815 | 25 | .../clutter/x11/clutter-virtual-input-device-x11.c | 22 ++- | ||
816 | 26 | 3 files changed, 204 insertions(+), 4 deletions(-) | ||
817 | 27 | |||
818 | 28 | diff --git a/clutter/clutter/x11/clutter-keymap-x11.c b/clutter/clutter/x11/clutter-keymap-x11.c | ||
819 | 29 | index 914e314..c34e676 100644 | ||
820 | 30 | --- a/clutter/clutter/x11/clutter-keymap-x11.c | ||
821 | 31 | +++ b/clutter/clutter/x11/clutter-keymap-x11.c | ||
822 | 32 | @@ -38,6 +38,14 @@ | ||
823 | 33 | |||
824 | 34 | typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class; | ||
825 | 35 | typedef struct _DirectionCacheEntry DirectionCacheEntry; | ||
826 | 36 | +typedef struct _ClutterKeymapKey ClutterKeymapKey; | ||
827 | 37 | + | ||
828 | 38 | +struct _ClutterKeymapKey | ||
829 | 39 | +{ | ||
830 | 40 | + guint keycode; | ||
831 | 41 | + guint group; | ||
832 | 42 | + guint level; | ||
833 | 43 | +}; | ||
834 | 44 | |||
835 | 45 | struct _DirectionCacheEntry | ||
836 | 46 | { | ||
837 | 47 | @@ -59,6 +67,7 @@ struct _ClutterKeymapX11 | ||
838 | 48 | |||
839 | 49 | ClutterModifierType num_lock_mask; | ||
840 | 50 | ClutterModifierType scroll_lock_mask; | ||
841 | 51 | + ClutterModifierType level3_shift_mask; | ||
842 | 52 | |||
843 | 53 | PangoDirection current_direction; | ||
844 | 54 | |||
845 | 55 | @@ -69,6 +78,7 @@ struct _ClutterKeymapX11 | ||
846 | 56 | Atom current_group_atom; | ||
847 | 57 | guint current_cache_serial; | ||
848 | 58 | DirectionCacheEntry group_direction_cache[4]; | ||
849 | 59 | + int current_group; | ||
850 | 60 | #endif | ||
851 | 61 | |||
852 | 62 | guint caps_lock_state : 1; | ||
853 | 63 | @@ -198,6 +208,9 @@ get_xkb (ClutterKeymapX11 *keymap_x11) | ||
854 | 64 | if (keymap_x11->scroll_lock_mask == 0) | ||
855 | 65 | keymap_x11->scroll_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy, | ||
856 | 66 | XK_Scroll_Lock); | ||
857 | 67 | + if (keymap_x11->level3_shift_mask == 0) | ||
858 | 68 | + keymap_x11->level3_shift_mask = XkbKeysymToModifiers (backend_x11->xdpy, | ||
859 | 69 | + XK_ISO_Level3_Shift); | ||
860 | 70 | |||
861 | 71 | return keymap_x11->xkb_desc; | ||
862 | 72 | } | ||
863 | 73 | @@ -469,6 +482,7 @@ static void | ||
864 | 74 | clutter_keymap_x11_init (ClutterKeymapX11 *keymap) | ||
865 | 75 | { | ||
866 | 76 | keymap->current_direction = PANGO_DIRECTION_NEUTRAL; | ||
867 | 77 | + keymap->current_group = -1; | ||
868 | 78 | } | ||
869 | 79 | |||
870 | 80 | static ClutterTranslateReturn | ||
871 | 81 | @@ -498,7 +512,8 @@ clutter_keymap_x11_translate_event (ClutterEventTranslator *translator, | ||
872 | 82 | { | ||
873 | 83 | case XkbStateNotify: | ||
874 | 84 | CLUTTER_NOTE (EVENT, "Updating keyboard state"); | ||
875 | 85 | - update_direction (keymap_x11, XkbStateGroup (&xkb_event->state)); | ||
876 | 86 | + keymap_x11->current_group = XkbStateGroup (&xkb_event->state); | ||
877 | 87 | + update_direction (keymap_x11, keymap_x11->current_group); | ||
878 | 88 | update_locked_mods (keymap_x11, xkb_event->state.locked_mods); | ||
879 | 89 | retval = CLUTTER_TRANSLATE_REMOVE; | ||
880 | 90 | break; | ||
881 | 91 | @@ -665,3 +680,164 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap) | ||
882 | 92 | #endif | ||
883 | 93 | return PANGO_DIRECTION_NEUTRAL; | ||
884 | 94 | } | ||
885 | 95 | + | ||
886 | 96 | +static gboolean | ||
887 | 97 | +clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11, | ||
888 | 98 | + guint keyval, | ||
889 | 99 | + ClutterKeymapKey **keys, | ||
890 | 100 | + gint *n_keys) | ||
891 | 101 | +{ | ||
892 | 102 | +#ifdef HAVE_XKB | ||
893 | 103 | + if (CLUTTER_BACKEND_X11 (keymap_x11->backend)->use_xkb) | ||
894 | 104 | + { | ||
895 | 105 | + XkbDescRec *xkb = get_xkb (keymap_x11); | ||
896 | 106 | + GArray *retval; | ||
897 | 107 | + gint keycode; | ||
898 | 108 | + | ||
899 | 109 | + keycode = keymap_x11->min_keycode; | ||
900 | 110 | + retval = g_array_new (FALSE, FALSE, sizeof (ClutterKeymapKey)); | ||
901 | 111 | + | ||
902 | 112 | + while (keycode <= keymap_x11->max_keycode) | ||
903 | 113 | + { | ||
904 | 114 | + gint max_shift_levels = XkbKeyGroupsWidth (xkb, keycode); | ||
905 | 115 | + gint group = 0; | ||
906 | 116 | + gint level = 0; | ||
907 | 117 | + gint total_syms = XkbKeyNumSyms (xkb, keycode); | ||
908 | 118 | + gint i = 0; | ||
909 | 119 | + KeySym *entry; | ||
910 | 120 | + | ||
911 | 121 | + /* entry is an array with all syms for group 0, all | ||
912 | 122 | + * syms for group 1, etc. and for each group the | ||
913 | 123 | + * shift level syms are in order | ||
914 | 124 | + */ | ||
915 | 125 | + entry = XkbKeySymsPtr (xkb, keycode); | ||
916 | 126 | + | ||
917 | 127 | + while (i < total_syms) | ||
918 | 128 | + { | ||
919 | 129 | + g_assert (i == (group * max_shift_levels + level)); | ||
920 | 130 | + | ||
921 | 131 | + if (entry[i] == keyval) | ||
922 | 132 | + { | ||
923 | 133 | + ClutterKeymapKey key; | ||
924 | 134 | + | ||
925 | 135 | + key.keycode = keycode; | ||
926 | 136 | + key.group = group; | ||
927 | 137 | + key.level = level; | ||
928 | 138 | + | ||
929 | 139 | + g_array_append_val (retval, key); | ||
930 | 140 | + | ||
931 | 141 | + g_assert (XkbKeySymEntry (xkb, keycode, level, group) == | ||
932 | 142 | + keyval); | ||
933 | 143 | + } | ||
934 | 144 | + | ||
935 | 145 | + ++level; | ||
936 | 146 | + | ||
937 | 147 | + if (level == max_shift_levels) | ||
938 | 148 | + { | ||
939 | 149 | + level = 0; | ||
940 | 150 | + ++group; | ||
941 | 151 | + } | ||
942 | 152 | + | ||
943 | 153 | + ++i; | ||
944 | 154 | + } | ||
945 | 155 | + | ||
946 | 156 | + ++keycode; | ||
947 | 157 | + } | ||
948 | 158 | + | ||
949 | 159 | + if (retval->len > 0) | ||
950 | 160 | + { | ||
951 | 161 | + *keys = (ClutterKeymapKey*) retval->data; | ||
952 | 162 | + *n_keys = retval->len; | ||
953 | 163 | + } | ||
954 | 164 | + else | ||
955 | 165 | + { | ||
956 | 166 | + *keys = NULL; | ||
957 | 167 | + *n_keys = 0; | ||
958 | 168 | + } | ||
959 | 169 | + | ||
960 | 170 | + g_array_free (retval, retval->len > 0 ? FALSE : TRUE); | ||
961 | 171 | + | ||
962 | 172 | + return *n_keys > 0; | ||
963 | 173 | + } | ||
964 | 174 | + else | ||
965 | 175 | +#endif | ||
966 | 176 | + { | ||
967 | 177 | + return FALSE; | ||
968 | 178 | + } | ||
969 | 179 | +} | ||
970 | 180 | + | ||
971 | 181 | +void | ||
972 | 182 | +clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11, | ||
973 | 183 | + uint32_t level, | ||
974 | 184 | + gboolean enable) | ||
975 | 185 | +{ | ||
976 | 186 | +#ifdef HAVE_XKB | ||
977 | 187 | + ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); | ||
978 | 188 | + uint32_t modifiers[] = { | ||
979 | 189 | + 0, | ||
980 | 190 | + ShiftMask, | ||
981 | 191 | + keymap_x11->level3_shift_mask, | ||
982 | 192 | + keymap_x11->level3_shift_mask | ShiftMask, | ||
983 | 193 | + }; | ||
984 | 194 | + uint32_t value = 0; | ||
985 | 195 | + | ||
986 | 196 | + if (!backend_x11->use_xkb) | ||
987 | 197 | + return; | ||
988 | 198 | + | ||
989 | 199 | + level = CLAMP (level, 0, G_N_ELEMENTS (modifiers) - 1); | ||
990 | 200 | + | ||
991 | 201 | + if (enable) | ||
992 | 202 | + value = modifiers[level]; | ||
993 | 203 | + else | ||
994 | 204 | + value = 0; | ||
995 | 205 | + | ||
996 | 206 | + XkbLatchModifiers (clutter_x11_get_default_display (), | ||
997 | 207 | + XkbUseCoreKbd, modifiers[level], | ||
998 | 208 | + value); | ||
999 | 209 | +#endif | ||
1000 | 210 | +} | ||
1001 | 211 | + | ||
1002 | 212 | +static uint32_t | ||
1003 | 213 | +clutter_keymap_x11_get_current_group (ClutterKeymapX11 *keymap_x11) | ||
1004 | 214 | +{ | ||
1005 | 215 | + ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend); | ||
1006 | 216 | + XkbStateRec state_rec; | ||
1007 | 217 | + | ||
1008 | 218 | + if (keymap_x11->current_group >= 0) | ||
1009 | 219 | + return keymap_x11->current_group; | ||
1010 | 220 | + | ||
1011 | 221 | + XkbGetState (backend_x11->xdpy, XkbUseCoreKbd, &state_rec); | ||
1012 | 222 | + return XkbStateGroup (&state_rec); | ||
1013 | 223 | +} | ||
1014 | 224 | + | ||
1015 | 225 | +gboolean | ||
1016 | 226 | +clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11, | ||
1017 | 227 | + guint keyval, | ||
1018 | 228 | + guint *keycode_out, | ||
1019 | 229 | + guint *level_out) | ||
1020 | 230 | +{ | ||
1021 | 231 | + ClutterKeymapKey *keys; | ||
1022 | 232 | + gint i, n_keys, group; | ||
1023 | 233 | + gboolean found = FALSE; | ||
1024 | 234 | + | ||
1025 | 235 | + g_return_val_if_fail (keycode_out != NULL, FALSE); | ||
1026 | 236 | + g_return_val_if_fail (level_out != NULL, FALSE); | ||
1027 | 237 | + | ||
1028 | 238 | + group = clutter_keymap_x11_get_current_group (keymap_x11); | ||
1029 | 239 | + | ||
1030 | 240 | + if (!clutter_keymap_x11_get_entries_for_keyval (keymap_x11, keyval, &keys, &n_keys)) | ||
1031 | 241 | + return FALSE; | ||
1032 | 242 | + | ||
1033 | 243 | + for (i = 0; i < n_keys && !found; i++) | ||
1034 | 244 | + { | ||
1035 | 245 | + if (keys[i].group == group) | ||
1036 | 246 | + { | ||
1037 | 247 | + *keycode_out = keys[i].keycode; | ||
1038 | 248 | + *level_out = keys[i].level; | ||
1039 | 249 | + found = TRUE; | ||
1040 | 250 | + } | ||
1041 | 251 | + } | ||
1042 | 252 | + | ||
1043 | 253 | + g_free (keys); | ||
1044 | 254 | + return found; | ||
1045 | 255 | +} | ||
1046 | 256 | diff --git a/clutter/clutter/x11/clutter-keymap-x11.h b/clutter/clutter/x11/clutter-keymap-x11.h | ||
1047 | 257 | index ad673a2..4b5b403 100644 | ||
1048 | 258 | --- a/clutter/clutter/x11/clutter-keymap-x11.h | ||
1049 | 259 | +++ b/clutter/clutter/x11/clutter-keymap-x11.h | ||
1050 | 260 | @@ -51,6 +51,14 @@ gboolean _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap, | ||
1051 | 261 | |||
1052 | 262 | PangoDirection _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap); | ||
1053 | 263 | |||
1054 | 264 | +gboolean clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11, | ||
1055 | 265 | + guint keyval, | ||
1056 | 266 | + guint *keycode_out, | ||
1057 | 267 | + guint *level_out); | ||
1058 | 268 | +void clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11, | ||
1059 | 269 | + uint32_t level, | ||
1060 | 270 | + gboolean enable); | ||
1061 | 271 | + | ||
1062 | 272 | G_END_DECLS | ||
1063 | 273 | |||
1064 | 274 | #endif /* __CLUTTER_KEYMAP_X11_H__ */ | ||
1065 | 275 | diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.c b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
1066 | 276 | index 416c944..b86ded0 100644 | ||
1067 | 277 | --- a/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
1068 | 278 | +++ b/clutter/clutter/x11/clutter-virtual-input-device-x11.c | ||
1069 | 279 | @@ -32,6 +32,8 @@ | ||
1070 | 280 | |||
1071 | 281 | #include "clutter-virtual-input-device.h" | ||
1072 | 282 | #include "x11/clutter-virtual-input-device-x11.h" | ||
1073 | 283 | +#include "x11/clutter-backend-x11.h" | ||
1074 | 284 | +#include "x11/clutter-keymap-x11.h" | ||
1075 | 285 | |||
1076 | 286 | struct _ClutterVirtualInputDeviceX11 | ||
1077 | 287 | { | ||
1078 | 288 | @@ -135,11 +137,25 @@ clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtu | ||
1079 | 289 | uint32_t keyval, | ||
1080 | 290 | ClutterKeyState key_state) | ||
1081 | 291 | { | ||
1082 | 292 | - KeyCode keycode; | ||
1083 | 293 | + ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ()); | ||
1084 | 294 | + ClutterKeymapX11 *keymap = backend_x11->keymap; | ||
1085 | 295 | + uint32_t keycode, level; | ||
1086 | 296 | + | ||
1087 | 297 | + if (!clutter_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level)) | ||
1088 | 298 | + { | ||
1089 | 299 | + g_warning ("No keycode found for keyval %x in current group", keyval); | ||
1090 | 300 | + return; | ||
1091 | 301 | + } | ||
1092 | 302 | + | ||
1093 | 303 | + if (key_state == CLUTTER_KEY_STATE_PRESSED) | ||
1094 | 304 | + clutter_keymap_x11_latch_modifiers (keymap, level, TRUE); | ||
1095 | 305 | |||
1096 | 306 | - keycode = XKeysymToKeycode (clutter_x11_get_default_display (), keyval); | ||
1097 | 307 | XTestFakeKeyEvent (clutter_x11_get_default_display (), | ||
1098 | 308 | - keycode, key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||
1099 | 309 | + (KeyCode) keycode, | ||
1100 | 310 | + key_state == CLUTTER_KEY_STATE_PRESSED, 0); | ||
1101 | 311 | + | ||
1102 | 312 | + if (key_state == CLUTTER_KEY_STATE_RELEASED) | ||
1103 | 313 | + clutter_keymap_x11_latch_modifiers (keymap, level, FALSE); | ||
1104 | 314 | } | ||
1105 | 315 | |||
1106 | 316 | static void | ||
1107 | 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 | |||
1108 | 317 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1109 | index 171c91a..0000000 | |||
1110 | --- a/debian/patches/core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch | |||
1111 | +++ /dev/null | |||
1112 | @@ -1,39 +0,0 @@ | |||
1113 | 1 | From: Sam Spilsbury <sam@endlessm.com> | ||
1114 | 2 | Date: Tue, 10 Oct 2017 11:39:40 -0500 | ||
1115 | 3 | Subject: core: Return -1 if meta_window_get_monitor is called on an unmanaged | ||
1116 | 4 | window | ||
1117 | 5 | |||
1118 | 6 | As opposed to crashing. In this case, letting the caller deal with | ||
1119 | 7 | it is the best policy, since this is public API. | ||
1120 | 8 | |||
1121 | 9 | Fixes #78834 | ||
1122 | 10 | |||
1123 | 11 | Forwarded: yes | ||
1124 | 12 | Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788834 | ||
1125 | 13 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/bionic/+source/gnome-shell/+bug/1724439 | ||
1126 | 14 | --- | ||
1127 | 15 | src/core/window.c | 7 ++++++- | ||
1128 | 16 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
1129 | 17 | |||
1130 | 18 | diff --git a/src/core/window.c b/src/core/window.c | ||
1131 | 19 | index cc0813a..f9094a3 100644 | ||
1132 | 20 | --- a/src/core/window.c | ||
1133 | 21 | +++ b/src/core/window.c | ||
1134 | 22 | @@ -3752,11 +3752,16 @@ maybe_move_attached_dialog (MetaWindow *window, | ||
1135 | 23 | * | ||
1136 | 24 | * Gets index of the monitor that this window is on. | ||
1137 | 25 | * | ||
1138 | 26 | - * Return Value: The index of the monitor in the screens monitor list | ||
1139 | 27 | + * Return Value: The index of the monitor in the screens monitor list, or -1 | ||
1140 | 28 | + * if the window has been recently unmanaged and does not have | ||
1141 | 29 | + * a monitor. | ||
1142 | 30 | */ | ||
1143 | 31 | int | ||
1144 | 32 | meta_window_get_monitor (MetaWindow *window) | ||
1145 | 33 | { | ||
1146 | 34 | + if (!window->monitor) | ||
1147 | 35 | + return -1; | ||
1148 | 36 | + | ||
1149 | 37 | return window->monitor->number; | ||
1150 | 38 | } | ||
1151 | 39 | |||
1152 | diff --git a/debian/patches/debian/skip-failing-tests-325.patch b/debian/patches/debian/skip-failing-tests-325.patch | |||
1153 | index a443ddf..54d8f62 100644 | |||
1154 | --- a/debian/patches/debian/skip-failing-tests-325.patch | |||
1155 | +++ b/debian/patches/debian/skip-failing-tests-325.patch | |||
1156 | @@ -11,13 +11,13 @@ Applied-upstream: no | |||
1157 | 11 | 1 file changed, 1 deletion(-) | 11 | 1 file changed, 1 deletion(-) |
1158 | 12 | 12 | ||
1159 | 13 | diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am | 13 | diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am |
1161 | 14 | index bca10dc..a2b7bee 100644 | 14 | index 840e120..2bd7f4d 100644 |
1162 | 15 | --- a/clutter/tests/conform/Makefile.am | 15 | --- a/clutter/tests/conform/Makefile.am |
1163 | 16 | +++ b/clutter/tests/conform/Makefile.am | 16 | +++ b/clutter/tests/conform/Makefile.am |
1165 | 17 | @@ -26,7 +26,6 @@ actor_tests = \ | 17 | @@ -25,7 +25,6 @@ actor_tests = \ |
1166 | 18 | actor-iter \ | ||
1167 | 18 | actor-layout \ | 19 | actor-layout \ |
1168 | 19 | actor-meta \ | 20 | actor-meta \ |
1169 | 20 | actor-offscreen-limit-max-size \ | ||
1170 | 21 | - actor-offscreen-redirect \ | 21 | - actor-offscreen-redirect \ |
1171 | 22 | actor-paint-opacity \ | 22 | actor-paint-opacity \ |
1172 | 23 | actor-size \ | 23 | actor-size \ |
1173 | diff --git a/debian/patches/debian/skip-failing-tests.patch b/debian/patches/debian/skip-failing-tests.patch | |||
1174 | index 68cdca6..205962c 100644 | |||
1175 | --- a/debian/patches/debian/skip-failing-tests.patch | |||
1176 | +++ b/debian/patches/debian/skip-failing-tests.patch | |||
1177 | @@ -12,11 +12,11 @@ Applied-upstream: no | |||
1178 | 12 | 1 file changed, 2 deletions(-) | 12 | 1 file changed, 2 deletions(-) |
1179 | 13 | 13 | ||
1180 | 14 | diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am | 14 | diff --git a/clutter/tests/conform/Makefile.am b/clutter/tests/conform/Makefile.am |
1182 | 15 | index 9cef08b..bca10dc 100644 | 15 | index afa9dad..840e120 100644 |
1183 | 16 | --- a/clutter/tests/conform/Makefile.am | 16 | --- a/clutter/tests/conform/Makefile.am |
1184 | 17 | +++ b/clutter/tests/conform/Makefile.am | 17 | +++ b/clutter/tests/conform/Makefile.am |
1187 | 18 | @@ -28,8 +28,6 @@ actor_tests = \ | 18 | @@ -27,8 +27,6 @@ actor_tests = \ |
1188 | 19 | actor-offscreen-limit-max-size \ | 19 | actor-meta \ |
1189 | 20 | actor-offscreen-redirect \ | 20 | actor-offscreen-redirect \ |
1190 | 21 | actor-paint-opacity \ | 21 | actor-paint-opacity \ |
1191 | 22 | - actor-pick \ | 22 | - actor-pick \ |
1192 | 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 | |||
1193 | 23 | deleted file mode 100644 | 23 | deleted file mode 100644 |
1194 | index 9bc47f9..0000000 | |||
1195 | --- a/debian/patches/gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch | |||
1196 | +++ /dev/null | |||
1197 | @@ -1,37 +0,0 @@ | |||
1198 | 1 | From: Aaron Plattner <aplattner@nvidia.com> | ||
1199 | 2 | Date: Thu, 19 Jul 2018 10:51:34 -0700 | ||
1200 | 3 | Subject: gpu-kms: Don't crash if drmModeGetResources returns NULL | ||
1201 | 4 | |||
1202 | 5 | DRM drivers can be opened by meta_launcher_open_restricted() even if they don't | ||
1203 | 6 | implement modesetting. However, drmModeGetResources() will return NULL. | ||
1204 | 7 | |||
1205 | 8 | Check whether that happened in meta_gpu_kms_new() and return with an error | ||
1206 | 9 | instead of crashing. | ||
1207 | 10 | |||
1208 | 11 | Fixes #223. | ||
1209 | 12 | |||
1210 | 13 | Applied-Upstream: https://gitlab.gnome.org/GNOME/mutter/commit/62660bbd15 | ||
1211 | 14 | Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/223 | ||
1212 | 15 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1767956 | ||
1213 | 16 | --- | ||
1214 | 17 | src/backends/native/meta-gpu-kms.c | 7 +++++++ | ||
1215 | 18 | 1 file changed, 7 insertions(+) | ||
1216 | 19 | |||
1217 | 20 | diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c | ||
1218 | 21 | index 613a607..259cd71 100644 | ||
1219 | 22 | --- a/src/backends/native/meta-gpu-kms.c | ||
1220 | 23 | +++ b/src/backends/native/meta-gpu-kms.c | ||
1221 | 24 | @@ -801,6 +801,13 @@ meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms, | ||
1222 | 25 | */ | ||
1223 | 26 | drm_resources = drmModeGetResources (kms_fd); | ||
1224 | 27 | |||
1225 | 28 | + if (!drm_resources) | ||
1226 | 29 | + { | ||
1227 | 30 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "No resources"); | ||
1228 | 31 | + meta_launcher_close_restricted (launcher, kms_fd); | ||
1229 | 32 | + return NULL; | ||
1230 | 33 | + } | ||
1231 | 34 | + | ||
1232 | 35 | n_connectors = drm_resources->count_connectors; | ||
1233 | 36 | |||
1234 | 37 | drmModeFreeResources (drm_resources); | ||
1235 | 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 | |||
1236 | 38 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1237 | index 9badb76..0000000 | |||
1238 | --- a/debian/patches/monitor-Use-current-monitor-mode-to-check-whether-active.patch | |||
1239 | +++ /dev/null | |||
1240 | @@ -1,84 +0,0 @@ | |||
1241 | 1 | From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com> | ||
1242 | 2 | Date: Tue, 31 Jul 2018 13:18:51 +0200 | ||
1243 | 3 | Subject: monitor: Use current monitor mode to check whether active | ||
1244 | 4 | |||
1245 | 5 | For historical reasons meta_monitor_is_active() checked whether it is | ||
1246 | 6 | active by checking whether the main output have a CRTC assigned and | ||
1247 | 7 | whether that CRTC has a current mode. At a later point, the MetaMonitor | ||
1248 | 8 | got its own mode abstraction (MetaMonitorMode), but | ||
1249 | 9 | meta_monitor_is_active() was never updated to use this. | ||
1250 | 10 | |||
1251 | 11 | An issue with checking the main output's CRTC state is that, if there is | ||
1252 | 12 | some CRTC mode combination that for some reason isn't properly detected | ||
1253 | 13 | by the MetaMonitorMode abstraction (e.g. some tiling configuration not | ||
1254 | 14 | yet handled), meta_monitor_is_active() would return TRUE, even though no | ||
1255 | 15 | (abstracted) mode was set. This would cause confusion here and there, | ||
1256 | 16 | leading to NULL pointer dereferences due to the assumption that if a | ||
1257 | 17 | monitor is active, it has an active mode. | ||
1258 | 18 | |||
1259 | 19 | Instead, change meta_monitor_is_active() to directly check the current | ||
1260 | 20 | monitor mode, and log a warning if the main output still happen to have | ||
1261 | 21 | a CRTC with a mode assigned to it. This way, when an not undrestood CRTC | ||
1262 | 22 | mode combination is encountered, instead of dereferencing NULL pointers, | ||
1263 | 23 | simply assume the monitor is not active, which means that it will not be | ||
1264 | 24 | managed or rendered by mutter at all. | ||
1265 | 25 | |||
1266 | 26 | https://gitlab.gnome.org/GNOME/mutter/issues/130 | ||
1267 | 27 | |||
1268 | 28 | (cherry picked from commit 4d465eac0806eb1ead375e2852d4a9d6bc24524f) | ||
1269 | 29 | |||
1270 | 30 | Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/130 | ||
1271 | 31 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1723615 | ||
1272 | 32 | Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/d0d80780 | ||
1273 | 33 | --- | ||
1274 | 34 | src/backends/meta-monitor.c | 22 ++++++++++++++++------ | ||
1275 | 35 | 1 file changed, 16 insertions(+), 6 deletions(-) | ||
1276 | 36 | |||
1277 | 37 | diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c | ||
1278 | 38 | index 92c61c0..60f3674 100644 | ||
1279 | 39 | --- a/src/backends/meta-monitor.c | ||
1280 | 40 | +++ b/src/backends/meta-monitor.c | ||
1281 | 41 | @@ -203,13 +203,9 @@ meta_monitor_get_main_output (MetaMonitor *monitor) | ||
1282 | 42 | gboolean | ||
1283 | 43 | meta_monitor_is_active (MetaMonitor *monitor) | ||
1284 | 44 | { | ||
1285 | 45 | - MetaOutput *output; | ||
1286 | 46 | - MetaCrtc *crtc; | ||
1287 | 47 | - | ||
1288 | 48 | - output = meta_monitor_get_main_output (monitor); | ||
1289 | 49 | - crtc = meta_output_get_assigned_crtc (output); | ||
1290 | 50 | + MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor); | ||
1291 | 51 | |||
1292 | 52 | - return crtc && crtc->current_mode; | ||
1293 | 53 | + return !!priv->current_mode; | ||
1294 | 54 | } | ||
1295 | 55 | |||
1296 | 56 | gboolean | ||
1297 | 57 | @@ -1411,6 +1407,18 @@ meta_monitor_get_current_mode (MetaMonitor *monitor) | ||
1298 | 58 | return priv->current_mode; | ||
1299 | 59 | } | ||
1300 | 60 | |||
1301 | 61 | +static gboolean | ||
1302 | 62 | +is_current_mode_known (MetaMonitor *monitor) | ||
1303 | 63 | +{ | ||
1304 | 64 | + MetaOutput *output; | ||
1305 | 65 | + MetaCrtc *crtc; | ||
1306 | 66 | + | ||
1307 | 67 | + output = meta_monitor_get_main_output (monitor); | ||
1308 | 68 | + crtc = meta_output_get_assigned_crtc (output); | ||
1309 | 69 | + | ||
1310 | 70 | + return meta_monitor_is_active (monitor) == (crtc && crtc->current_mode); | ||
1311 | 71 | +} | ||
1312 | 72 | + | ||
1313 | 73 | void | ||
1314 | 74 | meta_monitor_derive_current_mode (MetaMonitor *monitor) | ||
1315 | 75 | { | ||
1316 | 76 | @@ -1430,6 +1438,8 @@ meta_monitor_derive_current_mode (MetaMonitor *monitor) | ||
1317 | 77 | } | ||
1318 | 78 | |||
1319 | 79 | priv->current_mode = current_mode; | ||
1320 | 80 | + | ||
1321 | 81 | + g_warn_if_fail (is_current_mode_known (monitor)); | ||
1322 | 82 | } | ||
1323 | 83 | |||
1324 | 84 | void | ||
1325 | diff --git a/debian/patches/monitor-manager-Filter-out-low-screen-resolutions.patch b/debian/patches/monitor-manager-Filter-out-low-screen-resolutions.patch | |||
1326 | 85 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1327 | index f1ae69c..0000000 | |||
1328 | --- a/debian/patches/monitor-manager-Filter-out-low-screen-resolutions.patch | |||
1329 | +++ /dev/null | |||
1330 | @@ -1,90 +0,0 @@ | |||
1331 | 1 | From: Andrea Azzarone <azzaronea@gmail.com> | ||
1332 | 2 | Date: Mon, 16 Jul 2018 18:09:40 +0200 | ||
1333 | 3 | Subject: monitor-manager: Filter out low screen resolutions | ||
1334 | 4 | |||
1335 | 5 | Avoid exporting through org.gnome.Mutter.DisplayConfig.GetCurrentState | ||
1336 | 6 | excessively-low screen resolutions setting both a minimum width and a minimum | ||
1337 | 7 | height. GetCurrentState is e.g. used by Gnome Control Center to build a list of | ||
1338 | 8 | selectable resolutions. | ||
1339 | 9 | |||
1340 | 10 | Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=793223 | ||
1341 | 11 | |||
1342 | 12 | (cherry picked from commit 649c26e05a67c52a4f5acf6b4aa3b1217e9bc9c0) | ||
1343 | 13 | |||
1344 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1772831 | ||
1345 | 15 | Bug-GNOME: https://bugzilla.gnome.org/show_bug.cgi?id=793223 | ||
1346 | 16 | Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/0c5e61a2a | ||
1347 | 17 | --- | ||
1348 | 18 | src/backends/meta-monitor-manager.c | 4 ++++ | ||
1349 | 19 | src/backends/meta-monitor.c | 19 +++++++++++++++++-- | ||
1350 | 20 | src/backends/meta-monitor.h | 2 ++ | ||
1351 | 21 | 3 files changed, 23 insertions(+), 2 deletions(-) | ||
1352 | 22 | |||
1353 | 23 | diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c | ||
1354 | 24 | index 5bd34ad..c4c1db5 100644 | ||
1355 | 25 | --- a/src/backends/meta-monitor-manager.c | ||
1356 | 26 | +++ b/src/backends/meta-monitor-manager.c | ||
1357 | 27 | @@ -1323,9 +1323,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton, | ||
1358 | 28 | GVariantBuilder mode_properties_builder; | ||
1359 | 29 | MetaCrtcModeFlag mode_flags; | ||
1360 | 30 | |||
1361 | 31 | + if (!meta_monitor_mode_should_be_advertised (monitor_mode)) | ||
1362 | 32 | + continue; | ||
1363 | 33 | + | ||
1364 | 34 | mode_id = meta_monitor_mode_get_id (monitor_mode); | ||
1365 | 35 | meta_monitor_mode_get_resolution (monitor_mode, | ||
1366 | 36 | &mode_width, &mode_height); | ||
1367 | 37 | + | ||
1368 | 38 | refresh_rate = meta_monitor_mode_get_refresh_rate (monitor_mode); | ||
1369 | 39 | |||
1370 | 40 | preferred_scale = | ||
1371 | 41 | diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c | ||
1372 | 42 | index 9833066..92c61c0 100644 | ||
1373 | 43 | --- a/src/backends/meta-monitor.c | ||
1374 | 44 | +++ b/src/backends/meta-monitor.c | ||
1375 | 45 | @@ -1553,6 +1553,22 @@ meta_monitor_calculate_mode_scale (MetaMonitor *monitor, | ||
1376 | 46 | return calculate_scale (monitor, monitor_mode); | ||
1377 | 47 | } | ||
1378 | 48 | |||
1379 | 49 | +static gboolean | ||
1380 | 50 | +is_logical_size_large_enough (gint width, gint height) | ||
1381 | 51 | +{ | ||
1382 | 52 | + return width >= MINIMUM_LOGICAL_WIDTH && | ||
1383 | 53 | + height >= MINIMUM_LOGICAL_HEIGHT; | ||
1384 | 54 | +} | ||
1385 | 55 | + | ||
1386 | 56 | +gboolean | ||
1387 | 57 | +meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode) | ||
1388 | 58 | +{ | ||
1389 | 59 | + g_return_val_if_fail (monitor_mode != NULL, FALSE); | ||
1390 | 60 | + | ||
1391 | 61 | + return is_logical_size_large_enough (monitor_mode->spec.width, | ||
1392 | 62 | + monitor_mode->spec.height); | ||
1393 | 63 | +} | ||
1394 | 64 | + | ||
1395 | 65 | static float | ||
1396 | 66 | get_closest_scale_factor_for_resolution (float width, | ||
1397 | 67 | float height, | ||
1398 | 68 | @@ -1573,8 +1589,7 @@ get_closest_scale_factor_for_resolution (float width, | ||
1399 | 69 | |||
1400 | 70 | if (scale < MINIMUM_SCALE_FACTOR || | ||
1401 | 71 | scale > MAXIMUM_SCALE_FACTOR || | ||
1402 | 72 | - floorf (scaled_w) < MINIMUM_LOGICAL_WIDTH || | ||
1403 | 73 | - floorf (scaled_h) < MINIMUM_LOGICAL_HEIGHT) | ||
1404 | 74 | + !is_logical_size_large_enough (floorf (scaled_w), floorf (scaled_h))) | ||
1405 | 75 | goto out; | ||
1406 | 76 | |||
1407 | 77 | if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h) | ||
1408 | 78 | diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h | ||
1409 | 79 | index bc79778..213ff2c 100644 | ||
1410 | 80 | --- a/src/backends/meta-monitor.h | ||
1411 | 81 | +++ b/src/backends/meta-monitor.h | ||
1412 | 82 | @@ -219,6 +219,8 @@ gboolean meta_monitor_mode_foreach_output (MetaMonitor *monitor, | ||
1413 | 83 | gpointer user_data, | ||
1414 | 84 | GError **error); | ||
1415 | 85 | |||
1416 | 86 | +gboolean meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode); | ||
1417 | 87 | + | ||
1418 | 88 | MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id); | ||
1419 | 89 | |||
1420 | 90 | gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id, | ||
1421 | diff --git a/debian/patches/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch b/debian/patches/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch | |||
1422 | 91 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1423 | index 650a2d8..0000000 | |||
1424 | --- a/debian/patches/native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch | |||
1425 | +++ /dev/null | |||
1426 | @@ -1,36 +0,0 @@ | |||
1427 | 1 | From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com> | ||
1428 | 2 | Date: Tue, 24 Apr 2018 09:26:33 +0000 | ||
1429 | 3 | Subject: native/gpu: Handle drmModeSetCrtc() failing gracefully | ||
1430 | 4 | |||
1431 | 5 | If drmModeSetCrtc() is called with no fb, mode or connectors for some | ||
1432 | 6 | CRTC it may still fail, and we should handle that gracefully instead of | ||
1433 | 7 | assuming it failed to set a non-disabled state. | ||
1434 | 8 | |||
1435 | 9 | Closes https://gitlab.gnome.org/GNOME/mutter/issues/70 | ||
1436 | 10 | |||
1437 | 11 | |||
1438 | 12 | (cherry picked from commit 6e953e2725d5d5b10d14c7bd479bd99f6853addc) | ||
1439 | 13 | |||
1440 | 14 | Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/70 | ||
1441 | 15 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1754949 | ||
1442 | 16 | Applied-Upstream: https://gitlab.gnome.org/GNOME/mutter/commit/44682a2cc555 | ||
1443 | 17 | --- | ||
1444 | 18 | src/backends/native/meta-gpu-kms.c | 5 ++++- | ||
1445 | 19 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
1446 | 20 | |||
1447 | 21 | diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c | ||
1448 | 22 | index 259cd71..1d1c288 100644 | ||
1449 | 23 | --- a/src/backends/native/meta-gpu-kms.c | ||
1450 | 24 | +++ b/src/backends/native/meta-gpu-kms.c | ||
1451 | 25 | @@ -143,7 +143,10 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms, | ||
1452 | 26 | connectors, n_connectors, | ||
1453 | 27 | mode) != 0) | ||
1454 | 28 | { | ||
1455 | 29 | - g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name); | ||
1456 | 30 | + if (mode) | ||
1457 | 31 | + g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name); | ||
1458 | 32 | + else | ||
1459 | 33 | + g_warning ("Failed to disable CRTC"); | ||
1460 | 34 | g_free (connectors); | ||
1461 | 35 | return FALSE; | ||
1462 | 36 | } | ||
1463 | 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 | |||
1464 | 37 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1465 | index a25fca3..0000000 | |||
1466 | --- a/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch | |||
1467 | +++ /dev/null | |||
1468 | @@ -1,63 +0,0 @@ | |||
1469 | 1 | From: =?utf-8?q?Alex_Villac=C3=ADs_Lasso?= <a_villacis@palosanto.com> | ||
1470 | 2 | Date: Fri, 27 Jul 2018 16:08:52 +0000 | ||
1471 | 3 | Subject: renderer/native: Fallback to non-planar API if | ||
1472 | 4 | gbm_bo_get_handle_for_plane fails | ||
1473 | 5 | |||
1474 | 6 | Commit c0d9b08ef9bf2be865aad9bf1bc74ba24c655d9f replaced the old GBM API calls | ||
1475 | 7 | with the multi-plane GBM API. However, the call to gbm_bo_get_handle_for_plane | ||
1476 | 8 | fails for some DRI drivers (in particular i915). Due to missing error checks, | ||
1477 | 9 | the subsequent call to drmModeAddFB[2] fails and the screen output locks up. | ||
1478 | 10 | |||
1479 | 11 | This commit adds the missing error checks and falls back to the old GBM API | ||
1480 | 12 | (non-planar) if necessary. | ||
1481 | 13 | |||
1482 | 14 | v5: test success of gbm_bo_get_handle_for_plane instead of errno | ||
1483 | 15 | |||
1484 | 16 | This commit adopts solution proposed by Daniel van Vugt to check the return | ||
1485 | 17 | value of gbm_bo_get_handle_for_plane on plane 0 and fall back to old | ||
1486 | 18 | non-planar method if the call fails. This removes the errno check (for | ||
1487 | 19 | ENOSYS) that could abort if mesa ever sets a different value. | ||
1488 | 20 | |||
1489 | 21 | Related to: https://gitlab.gnome.org/GNOME/mutter/issues/127 | ||
1490 | 22 | |||
1491 | 23 | (cherry picked from commit f7af32a3eaefabbea3ebbda3a93eff98dd105ab9) | ||
1492 | 24 | |||
1493 | 25 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1727356 | ||
1494 | 26 | Applied-Upstream: yes, 3.28.4 | ||
1495 | 27 | --- | ||
1496 | 28 | src/backends/native/meta-renderer-native.c | 21 ++++++++++++++++----- | ||
1497 | 29 | 1 file changed, 16 insertions(+), 5 deletions(-) | ||
1498 | 30 | |||
1499 | 31 | diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c | ||
1500 | 32 | index fc6b223..59003b3 100644 | ||
1501 | 33 | --- a/src/backends/native/meta-renderer-native.c | ||
1502 | 34 | +++ b/src/backends/native/meta-renderer-native.c | ||
1503 | 35 | @@ -1607,12 +1607,23 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms, | ||
1504 | 36 | return FALSE; | ||
1505 | 37 | } | ||
1506 | 38 | |||
1507 | 39 | - for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++) | ||
1508 | 40 | + if (gbm_bo_get_handle_for_plane (next_bo, 0).s32 == -1) | ||
1509 | 41 | { | ||
1510 | 42 | - strides[i] = gbm_bo_get_stride_for_plane (next_bo, i); | ||
1511 | 43 | - handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32; | ||
1512 | 44 | - offsets[i] = gbm_bo_get_offset (next_bo, i); | ||
1513 | 45 | - modifiers[i] = gbm_bo_get_modifier (next_bo); | ||
1514 | 46 | + /* Failed to fetch handle to plane, falling back to old method */ | ||
1515 | 47 | + strides[0] = gbm_bo_get_stride (next_bo); | ||
1516 | 48 | + handles[0] = gbm_bo_get_handle (next_bo).u32; | ||
1517 | 49 | + offsets[0] = 0; | ||
1518 | 50 | + modifiers[0] = DRM_FORMAT_MOD_INVALID; | ||
1519 | 51 | + } | ||
1520 | 52 | + else | ||
1521 | 53 | + { | ||
1522 | 54 | + for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++) | ||
1523 | 55 | + { | ||
1524 | 56 | + strides[i] = gbm_bo_get_stride_for_plane (next_bo, i); | ||
1525 | 57 | + handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32; | ||
1526 | 58 | + offsets[i] = gbm_bo_get_offset (next_bo, i); | ||
1527 | 59 | + modifiers[i] = gbm_bo_get_modifier (next_bo); | ||
1528 | 60 | + } | ||
1529 | 61 | } | ||
1530 | 62 | |||
1531 | 63 | kms_fd = meta_gpu_kms_get_fd (gpu_kms); | ||
1532 | diff --git a/debian/patches/series b/debian/patches/series | |||
1533 | index 5bd9ae6..198db5a 100644 | |||
1534 | --- a/debian/patches/series | |||
1535 | +++ b/debian/patches/series | |||
1536 | @@ -1,18 +1,8 @@ | |||
1537 | 1 | gpu-kms-Don-t-crash-if-drmModeGetResources-returns-N.patch | ||
1538 | 2 | native-gpu-Handle-drmModeSetCrtc-failing-gracefully.patch | ||
1539 | 3 | monitor-manager-Filter-out-low-screen-resolutions.patch | ||
1540 | 4 | window-wayland-Always-update-monitor-for-non-user-ops.patch | ||
1541 | 5 | window-Don-t-refuse-to-move-focus-to-the-grab-window.patch | ||
1542 | 6 | window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch | ||
1543 | 7 | monitor-Use-current-monitor-mode-to-check-whether-active.patch | ||
1544 | 8 | theme-use-gtk_render_icon_suface-to-paint-button-icon.patch | 1 | theme-use-gtk_render_icon_suface-to-paint-button-icon.patch |
1545 | 9 | theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch | 2 | theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch |
1546 | 10 | clutter-Smooth-out-master-clock-to-smooth-visuals.patch | 3 | clutter-Smooth-out-master-clock-to-smooth-visuals.patch |
1548 | 11 | core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch | 4 | clutter-Fix-offscreen-effect-painting-of-clones.patch |
1549 | 12 | bgo768531_workaround-startup-notifications.patch | 5 | bgo768531_workaround-startup-notifications.patch |
1550 | 13 | renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch | ||
1551 | 14 | clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch | ||
1552 | 15 | clutter-Do-not-latch-modifiers-on-modifier-keys.patch | ||
1553 | 16 | debian/synaptics-support.patch | 6 | debian/synaptics-support.patch |
1554 | 17 | debian/skip-failing-tests.patch | 7 | debian/skip-failing-tests.patch |
1555 | 18 | debian/skip-failing-tests-325.patch | 8 | debian/skip-failing-tests-325.patch |
1556 | 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 | |||
1557 | 19 | deleted file mode 100644 | 9 | deleted file mode 100644 |
1558 | index ec37087..0000000 | |||
1559 | --- a/debian/patches/window-Don-t-refuse-to-move-focus-to-the-grab-window.patch | |||
1560 | +++ /dev/null | |||
1561 | @@ -1,39 +0,0 @@ | |||
1562 | 1 | From: =?utf-8?q?Florian_M=C3=BCllner?= <fmuellner@gnome.org> | ||
1563 | 2 | Date: Fri, 25 May 2018 18:18:23 +0000 | ||
1564 | 3 | Subject: window: Don't refuse to move focus to the grab window | ||
1565 | 4 | |||
1566 | 5 | We refuse to move focus while a grab operation is in place. While this | ||
1567 | 6 | generally makes sense, there's no reason why the window that owns the | ||
1568 | 7 | grab shouldn't be given the regular input focus as well - we pretty | ||
1569 | 8 | much assume that the grab window is also the focus window anyway. | ||
1570 | 9 | |||
1571 | 10 | In fact there's a strong reason for allowing the focus change here: | ||
1572 | 11 | If the grab window isn't the focus window, it probably has a modal | ||
1573 | 12 | transient that is focused instead, and a likely reason for the focus | ||
1574 | 13 | request is that the transient is being unmanaged and we must move | ||
1575 | 14 | the focus elsewhere. | ||
1576 | 15 | |||
1577 | 16 | https://gitlab.gnome.org/GNOME/mutter/issues/15 | ||
1578 | 17 | |||
1579 | 18 | |||
1580 | 19 | (cherry picked from commit 148da24f9510ebd23d750b8224aa0ab3a549e69e) | ||
1581 | 20 | |||
1582 | 21 | Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/15 | ||
1583 | 22 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1422253 | ||
1584 | 23 | Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/513cc535 | ||
1585 | 24 | --- | ||
1586 | 25 | src/core/window.c | 1 + | ||
1587 | 26 | 1 file changed, 1 insertion(+) | ||
1588 | 27 | |||
1589 | 28 | diff --git a/src/core/window.c b/src/core/window.c | ||
1590 | 29 | index 743326c..5b1eb5b 100644 | ||
1591 | 30 | --- a/src/core/window.c | ||
1592 | 31 | +++ b/src/core/window.c | ||
1593 | 32 | @@ -4620,6 +4620,7 @@ meta_window_focus (MetaWindow *window, | ||
1594 | 33 | window->desc, window->input, window->take_focus); | ||
1595 | 34 | |||
1596 | 35 | if (window->display->grab_window && | ||
1597 | 36 | + window->display->grab_window != window && | ||
1598 | 37 | window->display->grab_window->all_keys_grabbed && | ||
1599 | 38 | !window->display->grab_window->unmanaging) | ||
1600 | 39 | { | ||
1601 | 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 | |||
1602 | 40 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1603 | index fa98757..0000000 | |||
1604 | --- a/debian/patches/window-Explicitly-exclude-unmanaging-window-from-focus-ag.patch | |||
1605 | +++ /dev/null | |||
1606 | @@ -1,35 +0,0 @@ | |||
1607 | 1 | From: =?utf-8?q?Florian_M=C3=BCllner?= <fmuellner@gnome.org> | ||
1608 | 2 | Date: Fri, 25 May 2018 21:24:17 +0200 | ||
1609 | 3 | Subject: window: Explicitly exclude unmanaging window from focus again | ||
1610 | 4 | |||
1611 | 5 | Since commit b3b9d9e16 we no longer have to pass the unmanaging window | ||
1612 | 6 | to make sure we don't try to focus it again, however the parameter also | ||
1613 | 7 | influences the focus policy by giving ancestors preference over the normal | ||
1614 | 8 | stack order. | ||
1615 | 9 | |||
1616 | 10 | https://gitlab.gnome.org/GNOME/mutter/issues/15 | ||
1617 | 11 | |||
1618 | 12 | (cherry picked from commit d99442d6e6b7c9b383863cc754db609398d4e65b) | ||
1619 | 13 | |||
1620 | 14 | Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/15 | ||
1621 | 15 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1422253 | ||
1622 | 16 | Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/137f2223 | ||
1623 | 17 | --- | ||
1624 | 18 | src/core/window.c | 4 +++- | ||
1625 | 19 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
1626 | 20 | |||
1627 | 21 | diff --git a/src/core/window.c b/src/core/window.c | ||
1628 | 22 | index 5b1eb5b..cc0813a 100644 | ||
1629 | 23 | --- a/src/core/window.c | ||
1630 | 24 | +++ b/src/core/window.c | ||
1631 | 25 | @@ -1469,7 +1469,9 @@ meta_window_unmanage (MetaWindow *window, | ||
1632 | 26 | meta_topic (META_DEBUG_FOCUS, | ||
1633 | 27 | "Focusing default window since we're unmanaging %s\n", | ||
1634 | 28 | window->desc); | ||
1635 | 29 | - meta_workspace_focus_default_window (window->screen->active_workspace, NULL, timestamp); | ||
1636 | 30 | + meta_workspace_focus_default_window (window->screen->active_workspace, | ||
1637 | 31 | + window, | ||
1638 | 32 | + timestamp); | ||
1639 | 33 | } | ||
1640 | 34 | else | ||
1641 | 35 | { | ||
1642 | 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 | |||
1643 | 36 | deleted file mode 100644 | 0 | deleted file mode 100644 |
1644 | index ce279ed..0000000 | |||
1645 | --- a/debian/patches/window-wayland-Always-update-monitor-for-non-user-ops.patch | |||
1646 | +++ /dev/null | |||
1647 | @@ -1,44 +0,0 @@ | |||
1648 | 1 | From: Olivier Fourdan <ofourdan@redhat.com> | ||
1649 | 2 | Date: Mon, 18 Jun 2018 12:39:11 +0200 | ||
1650 | 3 | Subject: window/wayland: Always update monitor for non-user ops | ||
1651 | 4 | |||
1652 | 5 | meta_window_wayland_update_main_monitor() would skip the monitor update | ||
1653 | 6 | if the difference in scale between the old and the new monitor would | ||
1654 | 7 | cause another monitor change. | ||
1655 | 8 | |||
1656 | 9 | While this is suitable when the monitor change results from a user | ||
1657 | 10 | interactively moving the surface between monitors of different scales, | ||
1658 | 11 | this can leave dangling pointers to freed monitors when this is | ||
1659 | 12 | triggered by a change of monitor configuration. | ||
1660 | 13 | |||
1661 | 14 | Make sure we update the monitor unconditionally if not from a user | ||
1662 | 15 | operation. | ||
1663 | 16 | |||
1664 | 17 | Closes: https://gitlab.gnome.org/GNOME/mutter/issues/189 | ||
1665 | 18 | |||
1666 | 19 | (cherry picked from commit a3da4b8d5bd217c0262fd9361036877d155a300f) | ||
1667 | 20 | |||
1668 | 21 | Bug-GNOME: https://gitlab.gnome.org/GNOME/mutter/issues/189 | ||
1669 | 22 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1784398 | ||
1670 | 23 | Applied-Upstream: 3.28.4, commit:https://gitlab.gnome.org/GNOME/mutter/commit/d74a04606 | ||
1671 | 24 | --- | ||
1672 | 25 | src/wayland/meta-window-wayland.c | 6 ++++++ | ||
1673 | 26 | 1 file changed, 6 insertions(+) | ||
1674 | 27 | |||
1675 | 28 | diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c | ||
1676 | 29 | index 705bc49..8bafb25 100644 | ||
1677 | 30 | --- a/src/wayland/meta-window-wayland.c | ||
1678 | 31 | +++ b/src/wayland/meta-window-wayland.c | ||
1679 | 32 | @@ -413,6 +413,12 @@ meta_window_wayland_update_main_monitor (MetaWindow *window, | ||
1680 | 33 | return; | ||
1681 | 34 | } | ||
1682 | 35 | |||
1683 | 36 | + if (!user_op) | ||
1684 | 37 | + { | ||
1685 | 38 | + window->monitor = to; | ||
1686 | 39 | + return; | ||
1687 | 40 | + } | ||
1688 | 41 | + | ||
1689 | 42 | from_scale = meta_logical_monitor_get_scale (from); | ||
1690 | 43 | to_scale = meta_logical_monitor_get_scale (to); | ||
1691 | 44 |
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".