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

Proposed by Marco Trevisan (Treviño) on 2019-04-03
Status: Merged
Merged at revision: de028410be38c2ee6140f90da0b24c10f91b5fe4
Proposed branch: ~3v1n0/ubuntu/+source/mutter:ubuntu/master
Merge into: ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master
Diff against target: 810 lines (+111/-344)
2 files modified
debian/changelog (+8/-0)
debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch (+103/-344)
Reviewer Review Type Date Requested Status
Daniel van Vugt (community) Approve on 2019-04-05
Ubuntu Desktop 2019-04-03 Pending
Review via email: mp+365502@code.launchpad.net
To post a comment you must log in.
Daniel van Vugt (vanvugt) wrote :

Sounds and looks sensible.

Although it's never easy to read the diff-of-a-diff, the fact that the patch is shrinking is also good.

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

> Although it's never easy to read the diff-of-a-diff, the fact that the patch
> is shrinking is also good.

In such cases I suggest you to fetch the ubuntu-desktop ubuntu/master branch and do:
 gbp pq import

Fetch my branch locally (say you call it marco-ubuntu), and there again
 gbp pq import

Then you can easily diff things with
  git diff patch-queue/ubuntu/master patch-queue/marco-ubuntu/master

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index d096e50..67c17c0 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+mutter (3.32.0-1ubuntu2) UNRELEASED; urgency=medium
7+
8+ * debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch:
9+ - Don't invert the screen size when rotation is enabled (LP: #1822513)
10+ - Remove unneeded cleanup changes
11+
12+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 03 Apr 2019 19:19:59 -0400
13+
14 mutter (3.32.0-1ubuntu1) disco; urgency=medium
15
16 * debian/control:
17diff --git a/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch b/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch
18index 987f4f9..ea6c35f 100644
19--- a/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch
20+++ b/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch
21@@ -1,19 +1,25 @@
22-From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
23-Date: Wed, 27 Mar 2019 06:44:56 +0100
24-Subject: X11: Add support for fractional scaling using Randr
25+From: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+Date: Wed, 3 Apr 2019 19:18:03 -0400
27+Subject: x11-Add-support-for-fractional-scaling-using-Randr
28+MIME-Version: 1.0
29+Content-Type: text/plain; charset="utf-8"
30+Content-Transfer-Encoding: 8bit
31+
32+commit ed760c44b1998fc5fadde18186c51e74525038cc
33+Author: Marco Trevisan (Treviño) <mail@3v1n0.net>
34+Date: Wed Apr 3 18:57:28 2019 -0400
35
36 Add scaling support using randr under x11.
37
38+Origin: https://gitlab.gnome.org/3v1n0/mutter/commits/xrandr-scaling
39 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1820850
40 Forwarded: No, forwarding is in progress and planned though
41 ---
42 data/meson.build | 7 +
43 data/org.gnome.mutter.gschema.xml.in | 5 +
44 data/org.gnome.mutter.x11.gschema.xml.in | 30 ++
45- meson.build | 2 +-
46 src/backends/meta-crtc.h | 1 +
47- src/backends/meta-logical-monitor.c | 36 +--
48- src/backends/meta-monitor-config-manager.c | 150 ++++++++-
49+ src/backends/meta-monitor-config-manager.c | 150 +++++++++-
50 src/backends/meta-monitor-config-migration.c | 15 +-
51 src/backends/meta-monitor-config-store.c | 1 +
52 src/backends/meta-monitor-manager-dummy.c | 24 +-
53@@ -22,26 +28,22 @@ Forwarded: No, forwarding is in progress and planned though
54 src/backends/meta-monitor.c | 60 ++--
55 src/backends/meta-monitor.h | 6 +-
56 src/backends/meta-settings-private.h | 9 +
57- src/backends/meta-settings.c | 80 ++++-
58+ src/backends/meta-settings.c | 76 ++++-
59 src/backends/native/meta-monitor-manager-kms.c | 44 ++-
60 src/backends/x11/meta-crtc-xrandr.c | 87 +++++-
61 src/backends/x11/meta-crtc-xrandr.h | 13 +-
62 src/backends/x11/meta-gpu-xrandr.c | 89 +++++-
63 src/backends/x11/meta-gpu-xrandr.h | 4 +
64- src/backends/x11/meta-monitor-manager-xrandr.c | 407 +++++++++++++++++--------
65+ src/backends/x11/meta-monitor-manager-xrandr.c | 399 +++++++++++++++++--------
66 src/backends/x11/meta-monitor-manager-xrandr.h | 4 +-
67 src/backends/x11/meta-output-xrandr.c | 5 +-
68- src/compositor/compositor-private.h | 2 +
69- src/compositor/compositor.c | 96 +++++-
70- src/core/boxes-private.h | 8 +
71- src/core/boxes.c | 53 ++++
72- src/core/display.c | 3 +-
73+ src/compositor/compositor.c | 54 ++++
74+ src/core/boxes-private.h | 4 +
75+ src/core/boxes.c | 21 ++
76 src/core/window.c | 19 ++
77- src/meta/compositor.h | 5 +
78- src/meta/display.h | 8 +-
79 src/org.gnome.Mutter.DisplayConfig.xml | 5 +
80 src/tests/meta-monitor-manager-test.c | 14 +-
81- 34 files changed, 1366 insertions(+), 303 deletions(-)
82+ 28 files changed, 1269 insertions(+), 254 deletions(-)
83 create mode 100644 data/org.gnome.mutter.x11.gschema.xml.in
84
85 diff --git a/data/meson.build b/data/meson.build
86@@ -114,19 +116,6 @@ index 0000000..3696659
87 + </schema>
88 +
89 +</schemalist>
90-diff --git a/meson.build b/meson.build
91-index cafbde4..afcbd31 100644
92---- a/meson.build
93-+++ b/meson.build
94-@@ -9,7 +9,7 @@ mutter_plugin_api_version = '3'
95- libmutter_api_version = '4'
96-
97- # generic version requirements
98--glib_req = '>= 2.53.2'
99-+glib_req = '>= 2.56'
100- gi_req = '>= 0.9.5'
101- gtk3_req = '>= 3.19.8'
102- gdk_pixbuf_req = '>= 2.0'
103 diff --git a/src/backends/meta-crtc.h b/src/backends/meta-crtc.h
104 index ddacfea..8d16455 100644
105 --- a/src/backends/meta-crtc.h
106@@ -139,58 +128,6 @@ index ddacfea..8d16455 100644
107
108 MetaLogicalMonitor *logical_monitor;
109
110-diff --git a/src/backends/meta-logical-monitor.c b/src/backends/meta-logical-monitor.c
111-index 99a35f7..a2d8f41 100644
112---- a/src/backends/meta-logical-monitor.c
113-+++ b/src/backends/meta-logical-monitor.c
114-@@ -45,6 +45,7 @@
115- #include "backends/meta-backend-private.h"
116- #include "backends/meta-crtc.h"
117- #include "backends/meta-output.h"
118-+#include "core/boxes-private.h"
119-
120- G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
121-
122-@@ -302,37 +303,6 @@ meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor,
123- MetaLogicalMonitor *neighbor,
124- MetaDisplayDirection neighbor_direction)
125- {
126-- switch (neighbor_direction)
127-- {
128-- case META_DISPLAY_RIGHT:
129-- if (neighbor->rect.x == (logical_monitor->rect.x +
130-- logical_monitor->rect.width) &&
131-- meta_rectangle_vert_overlap (&neighbor->rect,
132-- &logical_monitor->rect))
133-- return TRUE;
134-- break;
135-- case META_DISPLAY_LEFT:
136-- if (logical_monitor->rect.x == (neighbor->rect.x +
137-- neighbor->rect.width) &&
138-- meta_rectangle_vert_overlap (&neighbor->rect,
139-- &logical_monitor->rect))
140-- return TRUE;
141-- break;
142-- case META_DISPLAY_UP:
143-- if (logical_monitor->rect.y == (neighbor->rect.y +
144-- neighbor->rect.height) &&
145-- meta_rectangle_horiz_overlap (&neighbor->rect,
146-- &logical_monitor->rect))
147-- return TRUE;
148-- break;
149-- case META_DISPLAY_DOWN:
150-- if (neighbor->rect.y == (logical_monitor->rect.y +
151-- logical_monitor->rect.height) &&
152-- meta_rectangle_horiz_overlap (&neighbor->rect,
153-- &logical_monitor->rect))
154-- return TRUE;
155-- break;
156-- }
157--
158-- return FALSE;
159-+ return meta_rectangle_has_neighbor (&logical_monitor->rect, &neighbor->rect,
160-+ (MetaSide) neighbor_direction);
161- }
162 diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
163 index 771c57f..5d620a3 100644
164 --- a/src/backends/meta-monitor-config-manager.c
165@@ -774,7 +711,7 @@ index 3b951c6..3b375a0 100644
166 meta_monitor_manager_get_capabilities (MetaMonitorManager *manager);
167
168 diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
169-index c4ed245..7cb3415 100644
170+index c4ed245..8b5b983 100644
171 --- a/src/backends/meta-monitor-manager.c
172 +++ b/src/backends/meta-monitor-manager.c
173 @@ -104,8 +104,18 @@ static gboolean
174@@ -1196,7 +1133,7 @@ index c4ed245..7cb3415 100644
175 + {
176 + MetaLogicalMonitorConfig *logical_monitor_config = l->data;
177 +
178-+ if (logical_monitor_config->scale != scale)
179++ if (fabs (logical_monitor_config->scale - scale) > FLT_EPSILON)
180 + return FALSE;
181 + }
182 +
183@@ -1509,7 +1446,7 @@ index 619de17..8d20b88 100644
184
185 #endif /* META_SETTINGS_PRIVATE_H */
186 diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c
187-index 34d49b3..52c6632 100644
188+index 34d49b3..e54317e 100644
189 --- a/src/backends/meta-settings.c
190 +++ b/src/backends/meta-settings.c
191 @@ -40,6 +40,7 @@ enum
192@@ -1537,7 +1474,7 @@ index 34d49b3..52c6632 100644
193 };
194
195 G_DEFINE_TYPE (MetaSettings, meta_settings, G_TYPE_OBJECT)
196-@@ -77,14 +81,37 @@ calculate_ui_scaling_factor (MetaSettings *settings)
197+@@ -77,14 +81,33 @@ calculate_ui_scaling_factor (MetaSettings *settings)
198 {
199 MetaMonitorManager *monitor_manager =
200 meta_backend_get_monitor_manager (settings->backend);
201@@ -1547,28 +1484,24 @@ index 34d49b3..52c6632 100644
202 - meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
203 - if (!primary_logical_monitor)
204 - return 1;
205-
206-- return (int) meta_logical_monitor_get_scale (primary_logical_monitor);
207-+ if (settings->experimental_features &
208-+ META_EXPERIMENTAL_FEATURE_X11_RANDR_FRACTIONAL_SCALING)
209++ if (!meta_is_wayland_compositor () &&
210++ (settings->experimental_features &
211++ META_EXPERIMENTAL_FEATURE_X11_RANDR_FRACTIONAL_SCALING))
212 + {
213-+ if (settings->x11_scale_mode == META_X11_SCALE_MODE_UP)
214-+ return 1;
215++ float scale = 1;
216 +
217 + if (monitor_manager &&
218 + settings->x11_scale_mode == META_X11_SCALE_MODE_UI_DOWN)
219-+ {
220-+ float max_scale =
221-+ meta_monitor_manager_get_maximum_crtc_scale (monitor_manager);
222-+ return ceilf (max_scale);
223-+ }
224++ scale =
225++ ceilf (meta_monitor_manager_get_maximum_crtc_scale (monitor_manager));
226 +
227-+ return 1;
228++ return scale;
229 + }
230 + else if (monitor_manager)
231 + {
232 + MetaLogicalMonitor *primary_logical_monitor;
233-+
234+
235+- return (int) meta_logical_monitor_get_scale (primary_logical_monitor);
236 + primary_logical_monitor =
237 + meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
238 + if (!primary_logical_monitor)
239@@ -1581,7 +1514,7 @@ index 34d49b3..52c6632 100644
240 }
241
242 static gboolean
243-@@ -264,6 +291,8 @@ experimental_features_handler (GVariant *features_variant,
244+@@ -264,6 +287,8 @@ experimental_features_handler (GVariant *features_variant,
245 features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
246 else if (g_str_equal (feature, "kms-modifiers"))
247 features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
248@@ -1590,7 +1523,7 @@ index 34d49b3..52c6632 100644
249 else
250 g_info ("Unknown experimental feature '%s'\n", feature);
251 }
252-@@ -392,6 +421,25 @@ wayland_settings_changed (GSettings *wayland_settings,
253+@@ -392,6 +417,25 @@ wayland_settings_changed (GSettings *wayland_settings,
254 }
255 }
256
257@@ -1616,7 +1549,7 @@ index 34d49b3..52c6632 100644
258 void
259 meta_settings_get_xwayland_grab_patterns (MetaSettings *settings,
260 GPtrArray **whitelist_patterns,
261-@@ -407,6 +455,12 @@ gboolean
262+@@ -407,6 +451,12 @@ gboolean
263 return (settings->xwayland_allow_grabs);
264 }
265
266@@ -1629,7 +1562,7 @@ index 34d49b3..52c6632 100644
267 MetaSettings *
268 meta_settings_new (MetaBackend *backend)
269 {
270-@@ -426,6 +480,7 @@ meta_settings_dispose (GObject *object)
271+@@ -426,6 +476,7 @@ meta_settings_dispose (GObject *object)
272 g_clear_object (&settings->mutter_settings);
273 g_clear_object (&settings->interface_settings);
274 g_clear_object (&settings->wayland_settings);
275@@ -1637,7 +1570,7 @@ index 34d49b3..52c6632 100644
276 g_clear_pointer (&settings->xwayland_grab_whitelist_patterns,
277 g_ptr_array_unref);
278 g_clear_pointer (&settings->xwayland_grab_blacklist_patterns,
279-@@ -449,6 +504,10 @@ meta_settings_init (MetaSettings *settings)
280+@@ -449,6 +500,10 @@ meta_settings_init (MetaSettings *settings)
281 g_signal_connect (settings->wayland_settings, "changed",
282 G_CALLBACK (wayland_settings_changed),
283 settings);
284@@ -1648,7 +1581,7 @@ index 34d49b3..52c6632 100644
285
286 /* Chain up inter-dependent settings. */
287 g_signal_connect (settings, "global-scaling-factor-changed",
288-@@ -460,6 +519,7 @@ meta_settings_init (MetaSettings *settings)
289+@@ -460,6 +515,7 @@ meta_settings_init (MetaSettings *settings)
290 update_experimental_features (settings);
291 update_xwayland_grab_access_rules (settings);
292 update_xwayland_allow_grabs (settings);
293@@ -1656,7 +1589,7 @@ index 34d49b3..52c6632 100644
294 }
295
296 static void
297-@@ -514,6 +574,14 @@ meta_settings_class_init (MetaSettingsClass *klass)
298+@@ -514,6 +570,14 @@ meta_settings_class_init (MetaSettingsClass *klass)
299 NULL, NULL, NULL,
300 G_TYPE_NONE, 0);
301
302@@ -2063,7 +1996,7 @@ index aad49d0..4ac32b9 100644
303 int *max_width,
304 int *max_height);
305 diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
306-index 784bbde..9594bf4 100644
307+index 784bbde..47d19d6 100644
308 --- a/src/backends/x11/meta-monitor-manager-xrandr.c
309 +++ b/src/backends/x11/meta-monitor-manager-xrandr.c
310 @@ -63,6 +63,9 @@
311@@ -2072,7 +2005,7 @@ index 784bbde..9594bf4 100644
312 #define DPI_FALLBACK 96.0
313 +#define RANDR_VERSION_FORMAT(major, minor) ((major * 100) + minor)
314 +#define RANDR_TILING_MIN_VERSION RANDR_VERSION_FORMAT (1, 5)
315-+#define RANDR_TRANSFOMR_MIN_VERSION RANDR_VERSION_FORMAT (1, 3)
316++#define RANDR_TRANSFORM_MIN_VERSION RANDR_VERSION_FORMAT (1, 3)
317
318 struct _MetaMonitorManagerXrandr
319 {
320@@ -2374,7 +2307,7 @@ index 784bbde..9594bf4 100644
321 }
322 }
323
324-@@ -568,8 +681,64 @@ meta_monitor_manager_xrandr_rebuild_derived (MetaMonitorManager *manager,
325+@@ -568,8 +681,56 @@ meta_monitor_manager_xrandr_rebuild_derived (MetaMonitorManager *manager,
326 {
327 MetaMonitorManagerXrandr *manager_xrandr =
328 META_MONITOR_MANAGER_XRANDR (manager);
329@@ -2408,21 +2341,13 @@ index 784bbde..9594bf4 100644
330 + scale = crtc->scale > 1.0f ? crtc->scale : 1.0f;
331 + }
332 +
333-+ if (meta_monitor_transform_is_rotated (crtc->transform))
334-+ {
335-+ screen_width = MAX (screen_width, crtc->rect.x +
336-+ roundf (crtc->rect.height * scale));
337-+ screen_height = MAX (screen_height, crtc->rect.y +
338-+ roundf (crtc->rect.width * scale));
339-+ }
340-+ else
341-+ {
342-+ screen_width = MAX (screen_width, crtc->rect.x +
343-+ roundf (crtc->rect.width * scale));
344-+ screen_height = MAX (screen_height, crtc->rect.y +
345-+ roundf (crtc->rect.height * scale));
346-+ }
347-+
348++ /* When computing the screen size from the crtc rects we don't have to
349++ * use inverted values when monitors are rotated, because this is already
350++ * taken in account in the crtc rectangles */
351++ screen_width = MAX (screen_width, crtc->rect.x +
352++ roundf (crtc->rect.width * scale));
353++ screen_height = MAX (screen_height, crtc->rect.y +
354++ roundf (crtc->rect.height * scale));
355 + ++n_crtcs;
356 +
357 + /* This value isn't completely exact, since it doesn't take care of the
358@@ -2440,7 +2365,7 @@ index 784bbde..9594bf4 100644
359 meta_monitor_manager_rebuild_derived (manager, config);
360 }
361
362-@@ -595,6 +764,9 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
363+@@ -595,6 +756,9 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
364
365 if (method != META_MONITORS_CONFIG_METHOD_VERIFY)
366 {
367@@ -2450,7 +2375,7 @@ index 784bbde..9594bf4 100644
368 /*
369 * If the assignment has not changed, we won't get any notification about
370 * any new configuration from the X server; but we still need to update
371-@@ -615,6 +787,8 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
372+@@ -615,6 +779,8 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
373 crtc_infos->len,
374 (MetaOutputInfo **) output_infos->pdata,
375 output_infos->len);
376@@ -2459,7 +2384,7 @@ index 784bbde..9594bf4 100644
377 }
378 else
379 {
380-@@ -748,7 +922,8 @@ meta_monitor_manager_xrandr_tiled_monitor_added (MetaMonitorManager *manager,
381+@@ -748,7 +914,8 @@ meta_monitor_manager_xrandr_tiled_monitor_added (MetaMonitorManager *manager,
382 GList *l;
383 int i;
384
385@@ -2469,7 +2394,7 @@ index 784bbde..9594bf4 100644
386 return;
387
388 product = meta_monitor_get_product (monitor);
389-@@ -797,7 +972,8 @@ meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager,
390+@@ -797,7 +964,8 @@ meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager,
391
392 int monitor_count;
393
394@@ -2479,7 +2404,7 @@ index 784bbde..9594bf4 100644
395 return;
396
397 monitor_xrandr_data = meta_monitor_xrandr_data_from_monitor (monitor);
398-@@ -815,10 +991,12 @@ meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager,
399+@@ -815,10 +983,12 @@ meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager,
400 static void
401 meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xrandr)
402 {
403@@ -2493,7 +2418,7 @@ index 784bbde..9594bf4 100644
404 return;
405
406 /* delete any tiled monitors setup, as mutter will want to recreate
407-@@ -849,83 +1027,26 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
408+@@ -849,83 +1019,26 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
409 return TRUE;
410 }
411
412@@ -2506,25 +2431,25 @@ index 784bbde..9594bf4 100644
413 {
414 - return meta_monitor_calculate_mode_scale (monitor, monitor_mode);
415 -}
416-+ MetaMonitorScalesConstraint constraints = 0;
417-
418+-
419 -static void
420 -add_supported_scale (GArray *supported_scales,
421 - float scale)
422 -{
423 - unsigned int i;
424-+ if (meta_monitor_manager_get_capabilities (manager) &
425-+ META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED)
426-+ constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
427-
428+-
429 - for (i = 0; i < supported_scales->len; i++)
430 - {
431 - float supported_scale = g_array_index (supported_scales, float, i);
432--
433++ MetaMonitorScalesConstraint constraints = 0;
434+
435 - if (scale == supported_scale)
436 - return;
437 - }
438--
439++ if (meta_monitor_manager_get_capabilities (manager) &
440++ META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED)
441++ constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
442+
443 - g_array_append_val (supported_scales, scale);
444 + return constraints;
445 }
446@@ -2532,7 +2457,12 @@ index 784bbde..9594bf4 100644
447 -static int
448 -compare_scales (gconstpointer a,
449 - gconstpointer b)
450--{
451++static float
452++meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *manager,
453++ MetaLogicalMonitorLayoutMode layout_mode,
454++ MetaMonitor *monitor,
455++ MetaMonitorMode *monitor_mode)
456+ {
457 - float f = *(float *) a - *(float *) b;
458 -
459 - if (f < 0)
460@@ -2544,12 +2474,7 @@ index 784bbde..9594bf4 100644
461 -
462 -static void
463 -ensure_supported_monitor_scales (MetaMonitorManager *manager)
464-+static float
465-+meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *manager,
466-+ MetaLogicalMonitorLayoutMode layout_mode,
467-+ MetaMonitor *monitor,
468-+ MetaMonitorMode *monitor_mode)
469- {
470+-{
471 - MetaMonitorManagerXrandr *manager_xrandr =
472 - META_MONITOR_MANAGER_XRANDR (manager);
473 - MetaMonitorScalesConstraint constraints;
474@@ -2591,7 +2516,7 @@ index 784bbde..9594bf4 100644
475 }
476
477 static float *
478-@@ -935,21 +1056,35 @@ meta_monitor_manager_xrandr_calculate_supported_scales (MetaMonitorManager
479+@@ -935,21 +1048,35 @@ meta_monitor_manager_xrandr_calculate_supported_scales (MetaMonitorManager
480 MetaMonitorMode *monitor_mode,
481 int *n_supported_scales)
482 {
483@@ -2625,7 +2550,7 @@ index 784bbde..9594bf4 100644
484 +
485 + if (meta_settings_is_experimental_feature_enabled (settings,
486 + META_EXPERIMENTAL_FEATURE_X11_RANDR_FRACTIONAL_SCALING) &&
487-+ xrandr_manager->randr_version >= RANDR_TRANSFOMR_MIN_VERSION)
488++ xrandr_manager->randr_version >= RANDR_TRANSFORM_MIN_VERSION)
489 + {
490 + capabilities |= META_MONITOR_MANAGER_CAPABILITY_NATIVE_OUTPUT_SCALING |
491 + META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE;
492@@ -2637,7 +2562,7 @@ index 784bbde..9594bf4 100644
493 }
494
495 static gboolean
496-@@ -966,9 +1101,30 @@ meta_monitor_manager_xrandr_get_max_screen_size (MetaMonitorManager *manager,
497+@@ -966,9 +1093,30 @@ meta_monitor_manager_xrandr_get_max_screen_size (MetaMonitorManager *manager,
498 return TRUE;
499 }
500
501@@ -2668,7 +2593,7 @@ index 784bbde..9594bf4 100644
502 return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
503 }
504
505-@@ -978,10 +1134,15 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
506+@@ -978,10 +1126,15 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
507 MetaMonitorManagerXrandr *manager_xrandr =
508 META_MONITOR_MANAGER_XRANDR (object);
509 MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
510@@ -2687,7 +2612,7 @@ index 784bbde..9594bf4 100644
511
512 manager_xrandr->gpu = META_GPU (meta_gpu_xrandr_new (manager_xrandr));
513 meta_monitor_manager_add_gpu (manager, manager_xrandr->gpu);
514-@@ -1003,16 +1164,13 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
515+@@ -1003,16 +1156,13 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
516 | RRCrtcChangeNotifyMask
517 | RROutputPropertyNotifyMask);
518
519@@ -2709,7 +2634,7 @@ index 784bbde..9594bf4 100644
520 meta_monitor_manager_xrandr_init_monitors (manager_xrandr);
521 }
522
523-@@ -1026,7 +1184,6 @@ meta_monitor_manager_xrandr_finalize (GObject *object)
524+@@ -1026,7 +1176,6 @@ meta_monitor_manager_xrandr_finalize (GObject *object)
525
526 g_clear_object (&manager_xrandr->gpu);
527 g_hash_table_destroy (manager_xrandr->tiled_monitor_atoms);
528@@ -2756,47 +2681,35 @@ index 515389d..3bc7f0b 100644
529 return;
530
531 tile_atom = XInternAtom (xdisplay, "TILE", FALSE);
532-diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
533-index 0f92d42..13a8a6a 100644
534---- a/src/compositor/compositor-private.h
535-+++ b/src/compositor/compositor-private.h
536-@@ -13,6 +13,8 @@
537-
538- struct _MetaCompositor
539- {
540-+ GObject parent;
541-+
542- MetaDisplay *display;
543-
544- guint pre_paint_func_id;
545 diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
546-index 0854a19..7fc2943 100644
547+index 0854a19..e412784 100644
548 --- a/src/compositor/compositor.c
549 +++ b/src/compositor/compositor.c
550-@@ -86,6 +86,8 @@
551- #include "wayland/meta-wayland-private.h"
552- #endif
553+@@ -92,6 +92,11 @@ on_presented (ClutterStage *stage,
554+ ClutterFrameInfo *frame_info,
555+ MetaCompositor *compositor);
556
557-+G_DEFINE_TYPE (MetaCompositor, meta_compositor, G_TYPE_OBJECT)
558++static void
559++on_redirected_monitor_changed (MetaWindow *window,
560++ int old_monitor,
561++ MetaCompositor *compositor);
562 +
563- static void
564- on_presented (ClutterStage *stage,
565- CoglFrameEvent event,
566-@@ -131,11 +133,8 @@ meta_switch_workspace_completed (MetaCompositor *compositor)
567- void
568- meta_compositor_destroy (MetaCompositor *compositor)
569+ static gboolean
570+ is_modal (MetaDisplay *display)
571 {
572-- clutter_threads_remove_repaint_func (compositor->pre_paint_func_id);
573-- clutter_threads_remove_repaint_func (compositor->post_paint_func_id);
574--
575-- if (compositor->have_x11_sync_object)
576-- meta_sync_ring_destroy ();
577-+ g_object_run_dispose (G_OBJECT (compositor));
578-+ g_object_unref (compositor);
579- }
580+@@ -134,6 +139,11 @@ meta_compositor_destroy (MetaCompositor *compositor)
581+ clutter_threads_remove_repaint_func (compositor->pre_paint_func_id);
582+ clutter_threads_remove_repaint_func (compositor->post_paint_func_id);
583
584- static void
585-@@ -635,16 +634,54 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
586++ if (compositor->unredirected_window)
587++ g_signal_handlers_disconnect_by_func (compositor->unredirected_window,
588++ on_redirected_monitor_changed,
589++ compositor);
590++
591+ if (compositor->have_x11_sync_object)
592+ meta_sync_ring_destroy ();
593+ }
594+@@ -635,16 +645,54 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
595 }
596 }
597
598@@ -2851,81 +2764,21 @@ index 0854a19..7fc2943 100644
599 meta_window_actor_set_unredirected (window_actor, FALSE);
600 }
601
602-@@ -654,6 +691,13 @@ set_unredirected_window (MetaCompositor *compositor,
603+@@ -654,6 +702,12 @@ set_unredirected_window (MetaCompositor *compositor,
604 if (compositor->unredirected_window != NULL)
605 {
606 MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
607 +
608 + meta_monitor_manager_disable_scale_for_monitor (monitor_manager,
609 + window->monitor);
610-+ g_signal_connect_object (window, "monitor-changed",
611-+ G_CALLBACK (on_redirected_monitor_changed),
612-+ compositor, 0);
613++ g_signal_connect (window, "monitor-changed",
614++ G_CALLBACK (on_redirected_monitor_changed), compositor);
615 +
616 meta_window_actor_set_unredirected (window_actor, TRUE);
617 }
618 }
619-@@ -1274,12 +1318,20 @@ on_shadow_factory_changed (MetaShadowFactory *factory,
620- MetaCompositor *
621- meta_compositor_new (MetaDisplay *display)
622- {
623-- MetaBackend *backend = meta_get_backend ();
624-- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
625- MetaCompositor *compositor;
626-
627-- compositor = g_new0 (MetaCompositor, 1);
628-+ compositor = g_object_new (META_TYPE_COMPOSITOR, NULL);
629- compositor->display = display;
630-+
631-+ return compositor;
632-+}
633-+
634-+static void
635-+meta_compositor_init (MetaCompositor *compositor)
636-+{
637-+ MetaBackend *backend = meta_get_backend ();
638-+ ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
639-+
640- compositor->context = clutter_backend->cogl_context;
641-
642- g_signal_connect (meta_shadow_factory_get_default (),
643-@@ -1297,7 +1349,33 @@ meta_compositor_new (MetaDisplay *display)
644- meta_post_paint_func,
645- compositor,
646- NULL);
647-- return compositor;
648-+}
649-+
650-+static void
651-+meta_compositor_dispose (GObject *gobject)
652-+{
653-+ MetaCompositor *compositor = META_COMPOSITOR (gobject);
654-+
655-+ g_clear_handle_id (&compositor->pre_paint_func_id,
656-+ clutter_threads_remove_repaint_func);
657-+ g_clear_handle_id (&compositor->post_paint_func_id,
658-+ clutter_threads_remove_repaint_func);
659-+
660-+ if (compositor->have_x11_sync_object)
661-+ {
662-+ meta_sync_ring_destroy ();
663-+ compositor->have_x11_sync_object = FALSE;
664-+ }
665-+
666-+ G_OBJECT_CLASS (meta_compositor_parent_class)->dispose (gobject);
667-+}
668-+
669-+static void
670-+meta_compositor_class_init (MetaCompositorClass *klass)
671-+{
672-+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
673-+
674-+ gobject_class->dispose = meta_compositor_dispose;
675- }
676-
677- /**
678 diff --git a/src/core/boxes-private.h b/src/core/boxes-private.h
679-index 24c596b..bb88083 100644
680+index 24c596b..f92837a 100644
681 --- a/src/core/boxes-private.h
682 +++ b/src/core/boxes-private.h
683 @@ -157,6 +157,10 @@ gboolean meta_rectangle_overlaps_with_region (
684@@ -2939,17 +2792,8 @@ index 24c596b..bb88083 100644
685 /* Make the rectangle small enough to fit into one of the spanning_rects,
686 * but make it no smaller than min_size.
687 */
688-@@ -284,4 +288,8 @@ void meta_rectangle_crop_and_scale (const MetaRectangle *rect,
689- int dst_height,
690- MetaRectangle *dest);
691-
692-+gboolean meta_rectangle_has_neighbor (const MetaRectangle *rect,
693-+ const MetaRectangle *neighbor,
694-+ MetaSide neighbor_side);
695-+
696- #endif /* META_BOXES_PRIVATE_H */
697 diff --git a/src/core/boxes.c b/src/core/boxes.c
698-index 87f2d5d..7c30153 100644
699+index 87f2d5d..95978c1 100644
700 --- a/src/core/boxes.c
701 +++ b/src/core/boxes.c
702 @@ -911,6 +911,27 @@ meta_rectangle_overlaps_with_region (const GList *spanning_rects,
703@@ -2966,7 +2810,7 @@ index 87f2d5d..7c30153 100644
704 + {
705 + MetaRectangle *other = (MetaRectangle *) l->data;
706 +
707-+ if (other == rect)
708++ if (rect == other || meta_rectangle_equal (rect, other))
709 + continue;
710 +
711 + if (meta_rectangle_is_adjecent_to ((MetaRectangle *) rect, other))
712@@ -2980,56 +2824,6 @@ index 87f2d5d..7c30153 100644
713
714 void
715 meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects,
716-@@ -2201,3 +2222,35 @@ meta_rectangle_crop_and_scale (const MetaRectangle *rect,
717-
718- meta_rectangle_from_clutter_rect (&tmp, META_ROUNDING_STRATEGY_GROW, dest);
719- }
720-+
721-+gboolean
722-+meta_rectangle_has_neighbor (const MetaRectangle *rect,
723-+ const MetaRectangle *neighbor,
724-+ MetaSide neighbor_side)
725-+{
726-+ switch (neighbor_side)
727-+ {
728-+ case META_SIDE_RIGHT:
729-+ if (neighbor->x == (rect->x + rect->width) &&
730-+ meta_rectangle_vert_overlap (neighbor, rect))
731-+ return TRUE;
732-+ break;
733-+ case META_SIDE_LEFT:
734-+ if (rect->x == (neighbor->x + neighbor->width) &&
735-+ meta_rectangle_vert_overlap (neighbor, rect))
736-+ return TRUE;
737-+ break;
738-+ case META_SIDE_TOP:
739-+ if (rect->y == (neighbor->y + neighbor->height) &&
740-+ meta_rectangle_horiz_overlap (neighbor, rect))
741-+ return TRUE;
742-+ break;
743-+ case META_SIDE_BOTTOM:
744-+ if (neighbor->y == (rect->y + rect->height) &&
745-+ meta_rectangle_horiz_overlap (neighbor, rect))
746-+ return TRUE;
747-+ break;
748-+ }
749-+
750-+ return FALSE;
751-+}
752-diff --git a/src/core/display.c b/src/core/display.c
753-index e1477d3..0a55d90 100644
754---- a/src/core/display.c
755-+++ b/src/core/display.c
756-@@ -946,8 +946,7 @@ meta_display_close (MetaDisplay *display,
757- g_hash_table_destroy (display->wayland_windows);
758- g_hash_table_destroy (display->stamps);
759-
760-- if (display->compositor)
761-- meta_compositor_destroy (display->compositor);
762-+ g_clear_object (&display->compositor);
763-
764- if (display->x11_display)
765- {
766 diff --git a/src/core/window.c b/src/core/window.c
767 index 62b2df8..d1cf7c3 100644
768 --- a/src/core/window.c
769@@ -3074,41 +2868,6 @@ index 62b2df8..d1cf7c3 100644
770 if (old)
771 g_signal_emit_by_name (window->display, "window-left-monitor",
772 old->number, window);
773-diff --git a/src/meta/compositor.h b/src/meta/compositor.h
774-index 31d14dd..7fad05b 100644
775---- a/src/meta/compositor.h
776-+++ b/src/meta/compositor.h
777-@@ -28,6 +28,11 @@
778- #include <meta/window.h>
779- #include <meta/workspace.h>
780-
781-+#define META_TYPE_COMPOSITOR (meta_compositor_get_type ())
782-+
783-+META_EXPORT
784-+G_DECLARE_FINAL_TYPE (MetaCompositor, meta_compositor, META, COMPOSITOR, GObject)
785-+
786- /**
787- * MetaCompEffect:
788- * @META_COMP_EFFECT_CREATE: The window is newly created
789-diff --git a/src/meta/display.h b/src/meta/display.h
790-index 1703920..0eb1629 100644
791---- a/src/meta/display.h
792-+++ b/src/meta/display.h
793-@@ -226,10 +226,10 @@ void meta_display_set_cursor (MetaDisplay *display,
794- */
795- typedef enum
796- {
797-- META_DISPLAY_UP,
798-- META_DISPLAY_DOWN,
799-- META_DISPLAY_LEFT,
800-- META_DISPLAY_RIGHT
801-+ META_DISPLAY_UP = META_DIRECTION_UP,
802-+ META_DISPLAY_DOWN = META_DIRECTION_DOWN,
803-+ META_DISPLAY_LEFT = META_DIRECTION_LEFT,
804-+ META_DISPLAY_RIGHT = META_DIRECTION_RIGHT,
805- } MetaDisplayDirection;
806-
807- META_EXPORT
808 diff --git a/src/org.gnome.Mutter.DisplayConfig.xml b/src/org.gnome.Mutter.DisplayConfig.xml
809 index 3abfa15..4ec6cd4 100644
810 --- a/src/org.gnome.Mutter.DisplayConfig.xml

Subscribers

People subscribed via source and target branches