From fcab2553d1c5fb7b99e8e975b3051227a553233bc6ca816b5173661894ea5302 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Mon, 26 Sep 2016 18:15:13 +0000 Subject: [PATCH] Accepting request 430458 from GNOME:Next 1 OBS-URL: https://build.opensuse.org/request/show/430458 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/mutter?expand=0&rev=211 --- mutter-fix-string-format.patch | 28 +++ mutter-scale-positioner-coordinates.patch | 280 ++++++++++++++++++++++ mutter.changes | 19 ++ mutter.spec | 6 + 4 files changed, 333 insertions(+) create mode 100644 mutter-fix-string-format.patch create mode 100644 mutter-scale-positioner-coordinates.patch diff --git a/mutter-fix-string-format.patch b/mutter-fix-string-format.patch new file mode 100644 index 0000000..dc7466f --- /dev/null +++ b/mutter-fix-string-format.patch @@ -0,0 +1,28 @@ +From 028157081c0428bac1269078dd7f3360e3810824 Mon Sep 17 00:00:00 2001 +From: Olav Vitters +Date: Thu, 22 Sep 2016 21:00:29 +0200 +Subject: Fix string format build error + +backends/meta-input-settings.c:1245:27: error: format '%lx' expects +argument of type 'long unsigned int', but argument 3 has type 'guint64 +{aka long long unsigned int}' [-Werror=format=] +--- + src/backends/meta-input-settings.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c +index ae17f7b..74cf30a 100644 +--- a/src/backends/meta-input-settings.c ++++ b/src/backends/meta-input-settings.c +@@ -1242,7 +1242,7 @@ lookup_tool_settings (ClutterInputDeviceTool *tool, + + tool_id = clutter_input_device_tool_get_id (tool); + device_id = get_tablet_settings_id (device, lookup_mapping_info (device)); +- path = g_strdup_printf ("/org/gnome/settings-daemon/peripherals/wacom/%s/%lx/", ++ path = g_strdup_printf ("/org/gnome/settings-daemon/peripherals/wacom/%s/%" G_GUINT64_FORMAT "/", + device_id, tool_id); + tool_settings = tool_settings_new (tool, path); + g_object_set_qdata_full (G_OBJECT (tool), quark_tool_settings, tool_settings, +-- +cgit v0.12 + diff --git a/mutter-scale-positioner-coordinates.patch b/mutter-scale-positioner-coordinates.patch new file mode 100644 index 0000000..954cdad --- /dev/null +++ b/mutter-scale-positioner-coordinates.patch @@ -0,0 +1,280 @@ +From 3183f86aea4e3c1005995cfd928b7d42c16ff39f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 23 Sep 2016 14:01:34 +0800 +Subject: [PATCH] wayland/xdg-shell: Scale positioner coordinates + +When the monitor is scaled (i.e. HiDPI scaling) the placement +coordinates are still in unscaled xdg_surface window geometry +coordinate space. Fix this by simply scaling the coordinates by the +monitor scale of the parent toplevel window. + +This is inherently racy, but since we won't move the toplevel window +before the popup is placed, and we won't move the window without +unmapping the popup, there is little point in introducing more complex +adaptive scaling, especially when the end goal is to get rid of all +these types of scaling hacks. + +https://bugzilla.gnome.org/show_bug.cgi?id=771841 +--- + src/wayland/meta-wayland-xdg-shell.c | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c +index e9223a9..84bf40d 100644 +--- a/src/wayland/meta-wayland-xdg-shell.c ++++ b/src/wayland/meta-wayland-xdg-shell.c +@@ -126,7 +126,8 @@ G_DEFINE_TYPE_WITH_CODE (MetaWaylandXdgPopup, + popup_surface_iface_init)); + + static MetaPlacementRule +-meta_wayland_xdg_positioner_to_placement (MetaWaylandXdgPositioner *xdg_positioner); ++meta_wayland_xdg_positioner_to_placement (MetaWaylandXdgPositioner *xdg_positioner, ++ MetaWaylandSurface *parent_surface); + + static struct wl_resource * + meta_wayland_xdg_surface_get_shell_resource (MetaWaylandXdgSurface *xdg_surface); +@@ -1511,7 +1512,7 @@ xdg_surface_constructor_get_popup (struct wl_client *client, + + xdg_positioner = wl_resource_get_user_data (positioner_resource); + xdg_popup->setup.placement_rule = +- meta_wayland_xdg_positioner_to_placement (xdg_positioner); ++ meta_wayland_xdg_positioner_to_placement (xdg_positioner, parent_surface); + xdg_popup->setup.parent_surface = parent_surface; + } + +@@ -1560,17 +1561,29 @@ xdg_surface_constructor_destructor (struct wl_resource *resource) + } + + static MetaPlacementRule +-meta_wayland_xdg_positioner_to_placement (MetaWaylandXdgPositioner *xdg_positioner) ++meta_wayland_xdg_positioner_to_placement (MetaWaylandXdgPositioner *xdg_positioner, ++ MetaWaylandSurface *parent_surface) + { ++ MetaWindow *parent_window; ++ int monitor_scale; ++ ++ parent_window = meta_wayland_surface_get_toplevel_window (parent_surface); ++ monitor_scale = meta_window_wayland_get_main_monitor_scale (parent_window); ++ + return (MetaPlacementRule) { +- .anchor_rect = xdg_positioner->anchor_rect, ++ .anchor_rect = (MetaRectangle) { ++ .x = xdg_positioner->anchor_rect.x * monitor_scale, ++ .y = xdg_positioner->anchor_rect.y * monitor_scale, ++ .width = xdg_positioner->anchor_rect.width * monitor_scale, ++ .height = xdg_positioner->anchor_rect.height * monitor_scale, ++ }, + .gravity = xdg_positioner->gravity, + .anchor = xdg_positioner->anchor, + .constraint_adjustment = xdg_positioner->constraint_adjustment, +- .offset_x = xdg_positioner->offset_x, +- .offset_y = xdg_positioner->offset_y, +- .width = xdg_positioner->width, +- .height = xdg_positioner->height, ++ .offset_x = xdg_positioner->offset_x * monitor_scale, ++ .offset_y = xdg_positioner->offset_y * monitor_scale, ++ .width = xdg_positioner->width * monitor_scale, ++ .height = xdg_positioner->height * monitor_scale, + }; + } + +-- +2.7.4 + +From 60315f5a72741d0b6cdbe0ba19d771a922406bbb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 23 Sep 2016 17:15:56 +0800 +Subject: [PATCH] wayland/xdg-popup: Always use monitor of toplevel + +Always use the monitor of the toplevel surface's window, so that the +popup menu and the parent will always have the same scale. This fixes +the dimensions sent in the xdg_popup configure event. + +https://bugzilla.gnome.org/show_bug.cgi?id=771841 +--- + src/wayland/meta-wayland-xdg-shell.c | 1 + + src/wayland/meta-window-wayland.c | 24 ++++++++++++++++++------ + 2 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c +index 84bf40d..ac40504 100644 +--- a/src/wayland/meta-wayland-xdg-shell.c ++++ b/src/wayland/meta-wayland-xdg-shell.c +@@ -1464,6 +1464,7 @@ xdg_surface_constructor_get_toplevel (struct wl_client *client, + + window = meta_window_wayland_new (meta_get_display (), surface); + meta_wayland_surface_set_window (surface, window); ++ meta_window_update_monitor (window, FALSE); + } + + static void +diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c +index 7dd6f42..aa89066 100644 +--- a/src/wayland/meta-window-wayland.c ++++ b/src/wayland/meta-window-wayland.c +@@ -352,19 +352,31 @@ scale_rect_size (MetaRectangle *rect, + static void + meta_window_wayland_update_main_monitor (MetaWindow *window) + { ++ MetaWindow *toplevel_window; + const MetaMonitorInfo *from; + const MetaMonitorInfo *to; + const MetaMonitorInfo *scaled_new; + float scale; + MetaRectangle rect; + +- /* Require both the current and the new monitor would be the new main monitor, +- * even given the resulting scale the window would end up having. This is +- * needed to avoid jumping back and forth between the new and the old, since +- * changing main monitor may cause the window to be resized so that it no +- * longer have that same new main monitor. */ + from = window->monitor; +- to = meta_screen_calculate_monitor_for_window (window->screen, window); ++ ++ /* If the window is not a toplevel window (i.e. it's a popup window) just use ++ * the monitor of the toplevel. */ ++ toplevel_window = meta_wayland_surface_get_toplevel_window (window->surface); ++ if (toplevel_window != window) ++ { ++ to = toplevel_window->monitor; ++ } ++ else ++ { ++ /* Require both the current and the new monitor would be the new main monitor, ++ * even given the resulting scale the window would end up having. This is ++ * needed to avoid jumping back and forth between the new and the old, since ++ * changing main monitor may cause the window to be resized so that it no ++ * longer have that same new main monitor. */ ++ to = meta_screen_calculate_monitor_for_window (window->screen, window); ++ } + + if (from == to) + return; +-- +2.7.4 + +From 74274edbd5cdf36d90012fcff9199ccf64cb146f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 23 Sep 2016 17:18:21 +0800 +Subject: [PATCH] wayland/xdg-shell: Scale configure relative popup coordinate + +The parent local popup coordinate needs to be scaled according to the +monitor scale it is assigned. + +https://bugzilla.gnome.org/show_bug.cgi?id=771841 +--- + src/wayland/meta-wayland-xdg-shell.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c +index ac40504..70d8ee4 100644 +--- a/src/wayland/meta-wayland-xdg-shell.c ++++ b/src/wayland/meta-wayland-xdg-shell.c +@@ -874,6 +874,7 @@ xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role + MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (shell_surface_role); + MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_popup); + MetaWindow *parent_window = xdg_popup->parent_surface->window; ++ int monitor_scale; + int x, y; + + /* If the parent surface was destroyed, its window will be destroyed +@@ -887,8 +888,9 @@ xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role + if (!parent_window) + return; + +- x = new_x - parent_window->rect.x; +- y = new_y - parent_window->rect.y; ++ monitor_scale = meta_window_wayland_get_main_monitor_scale (parent_window); ++ x = (new_x - parent_window->rect.x) / monitor_scale; ++ y = (new_y - parent_window->rect.y) / monitor_scale; + zxdg_popup_v6_send_configure (xdg_popup->resource, + x, y, new_width, new_height); + meta_wayland_xdg_surface_send_configure (xdg_surface); +-- +2.7.4 + +From c5ef7eb1a8b255dfbad7c32ebde6241dc411fb7d Mon Sep 17 00:00:00 2001 +From: Sjoerd Simons +Date: Fri, 23 Sep 2016 23:09:39 +0200 +Subject: [PATCH] wayland/xdg-popup: Force monitor of the top-level + +Directly set the monitor of the toplevel window for the popup to avoid +the change not being applied due to later constraints calculation. + +Signed-off-by: Sjoerd Simons + +https://bugzilla.gnome.org/show_bug.cgi?id=771841 +--- + src/wayland/meta-window-wayland.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c +index aa89066..d85e935 100644 +--- a/src/wayland/meta-window-wayland.c ++++ b/src/wayland/meta-window-wayland.c +@@ -366,18 +366,17 @@ meta_window_wayland_update_main_monitor (MetaWindow *window) + toplevel_window = meta_wayland_surface_get_toplevel_window (window->surface); + if (toplevel_window != window) + { +- to = toplevel_window->monitor; +- } +- else +- { +- /* Require both the current and the new monitor would be the new main monitor, +- * even given the resulting scale the window would end up having. This is +- * needed to avoid jumping back and forth between the new and the old, since +- * changing main monitor may cause the window to be resized so that it no +- * longer have that same new main monitor. */ +- to = meta_screen_calculate_monitor_for_window (window->screen, window); ++ window->monitor = toplevel_window->monitor; ++ return; + } + ++ /* Require both the current and the new monitor would be the new main monitor, ++ * even given the resulting scale the window would end up having. This is ++ * needed to avoid jumping back and forth between the new and the old, since ++ * changing main monitor may cause the window to be resized so that it no ++ * longer have that same new main monitor. */ ++ to = meta_screen_calculate_monitor_for_window (window->screen, window); ++ + if (from == to) + return; + +-- +2.9.3 + +From b7d5bac26acbaee954e4db5fc9032cc8bc899285 Mon Sep 17 00:00:00 2001 +From: Sjoerd Simons +Date: Fri, 23 Sep 2016 23:12:56 +0200 +Subject: [PATCH] wayland/xdg-shell: update popup window monitor early + +As meta_window_place_with_placement_rule will trigger a configure event +being sent ensure that the popup is placed on the correct monitor first +to ensure the right scale factor is applied. + +Signed-off-by: Sjoerd Simons + +https://bugzilla.gnome.org/show_bug.cgi?id=771841 +--- + src/wayland/meta-wayland-xdg-shell.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c +index 70d8ee4..b8e7f83 100644 +--- a/src/wayland/meta-wayland-xdg-shell.c ++++ b/src/wayland/meta-wayland-xdg-shell.c +@@ -794,8 +794,9 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup) + &xdg_popup->parent_destroy_listener); + + window = meta_window_wayland_new (display, surface); +- meta_window_place_with_placement_rule (window, &placement_rule); + meta_wayland_surface_set_window (surface, window); ++ meta_window_update_monitor (window, FALSE); ++ meta_window_place_with_placement_rule (window, &placement_rule); + + if (seat) + { +-- +2.9.3 + + diff --git a/mutter.changes b/mutter.changes index e5274f6..558e93f 100644 --- a/mutter.changes +++ b/mutter.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Sat Sep 24 11:06:47 UTC 2016 - zaitor@opensuse.org + +- Add mutter-fix-string-format.patch: Fix string format build + error. Patch from upstream git. + +------------------------------------------------------------------- +Fri Sep 23 21:24:33 UTC 2016 - zaitor@opensuse.org + +- Add more fixes to mutter-scale-positioner-coordinates.patch: + Still more fixes comming out of upstreams bug. + +------------------------------------------------------------------- +Fri Sep 23 06:29:12 UTC 2016 - zaitor@opensuse.org + +- Add mutter-scale-positioner-coordinates.patch: wayland/xdg-shell: + Scale positioner coordinates, fix shrinking menus when on HiDPI + and wayland (bgo#771841). + ------------------------------------------------------------------- Wed Sep 21 13:20:08 UTC 2016 - dimstar@opensuse.org diff --git a/mutter.spec b/mutter.spec index 47c7d6c..c05d9f1 100644 --- a/mutter.spec +++ b/mutter.spec @@ -40,6 +40,10 @@ Patch2: relax-some-constraints-on-CSD-windows-in-sle-classic.patch Patch3: mutter-bsc984738-grab-display.patch # PATCH-FIX-UPSTREAM mutter-screeenshot-coords.patch bgo#771502 dimstar@opensuse.org -- Yet another fix for area-screenshots Patch4: mutter-screeenshot-coords.patch +# PATCH-FIX-UPSTREAM mutter-scale-positioner-coordinates.patch bgo#771841 zaitor@opensuse.org -- wayland/xdg-shell: Scale positioner coordinates, fix hidpi menus. +Patch5: mutter-scale-positioner-coordinates.patch +# PATCH-FIX-UPSTREAM mutter-fix-string-format.patch zaitor@opensuse.org -- Fix string format build error +Patch6: mutter-fix-string-format.patch BuildRequires: fdupes BuildRequires: gobject-introspection-devel >= 0.9.5 BuildRequires: libSM-devel @@ -140,6 +144,8 @@ translation-update-upstream %patch3 -p1 %endif %patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build %configure \