diff --git a/mutter.changes b/mutter.changes index 91c633e..3ca00ef 100644 --- a/mutter.changes +++ b/mutter.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 2 21:28:47 UTC 2015 - zaitor@opensuse.org + +- Add wayland-Dont-pre-multiply-root-cursor-sizes.patch and + wayland-Dont-scale-XWayland-pointer-cursor-sprites.patch: taken + from upstream git. Fixes for HiDPI under wayland (bgo#755099). + ------------------------------------------------------------------- Tue Sep 22 06:48:55 UTC 2015 - dimstar@opensuse.org diff --git a/mutter.spec b/mutter.spec index 235cdc7..eeacdb4 100644 --- a/mutter.spec +++ b/mutter.spec @@ -30,6 +30,10 @@ License: GPL-2.0+ Group: System/GUI/GNOME Url: http://www.gnome.org Source: http://download.gnome.org/sources/mutter/3.18/%{name}-%{version}.tar.xz +# PATCH-FIX-UPSTREAM wayland-Dont-pre-multiply-root-cursor-sizes.patch bgo#755099 zaitor@opensuse.org - Upstream patch for HiDPI in wayland +Patch0: wayland-Dont-pre-multiply-root-cursor-sizes.patch +# PATCH-FIX-UPSTREAM wayland-Dont-scale-XWayland-pointer-cursor-sprites.patch bgo#755099 zaitor@opensuse.org - Upstream patch for HiDPI in wayland +Patch1: wayland-Dont-scale-XWayland-pointer-cursor-sprites.patch BuildRequires: fdupes BuildRequires: gobject-introspection-devel >= 0.9.5 BuildRequires: intltool @@ -136,6 +140,8 @@ to develop applications that require these. %prep %setup -q translation-update-upstream +%patch0 -p1 +%patch1 -p1 %build %configure \ diff --git a/wayland-Dont-pre-multiply-root-cursor-sizes.patch b/wayland-Dont-pre-multiply-root-cursor-sizes.patch new file mode 100644 index 0000000..27dd1e1 --- /dev/null +++ b/wayland-Dont-pre-multiply-root-cursor-sizes.patch @@ -0,0 +1,140 @@ +From 4f1461b9c3fd57e092ced0e95775a6f952664acf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 16 Sep 2015 15:47:31 +0800 +Subject: [PATCH] wayland: Don't pre-multiply root cursor sizes with primary + monitor scale + +We cannot use the XSETTINGS value for cursor theme size because +gnome-settings-daemon already multiplies it by the primary monitor's +scale. + +https://bugzilla.gnome.org/show_bug.cgi?id=755099 +--- + src/core/prefs.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 55 insertions(+), 9 deletions(-) + +diff --git a/src/core/prefs.c b/src/core/prefs.c +index 2da8da3..90ad108 100644 +--- a/src/core/prefs.c ++++ b/src/core/prefs.c +@@ -96,6 +96,10 @@ static gboolean bell_is_audible = TRUE; + static gboolean gnome_accessibility = FALSE; + static gboolean gnome_animations = TRUE; + static char *cursor_theme = NULL; ++/* cursor_size will, when running as an X11 compositing window manager, be the ++ * actual cursor size, multiplied with the global window scaling factor. On ++ * Wayland, it will be the actual cursor size retrieved from gsettings. ++ */ + static int cursor_size = 24; + static int draggable_border_width = 10; + static int drag_threshold; +@@ -123,6 +127,9 @@ static gboolean update_binding (MetaKeyPref *binding, + static gboolean update_key_binding (const char *key, + gchar **strokes); + ++static void wayland_settings_changed (GSettings *settings, ++ gchar *key, ++ gpointer data); + static void settings_changed (GSettings *settings, + gchar *key, + gpointer data); +@@ -134,9 +141,10 @@ static void shell_shows_app_menu_changed (GtkSettings *settings, + GParamSpec *pspec, + gpointer data); + +-static void update_cursor_size (GtkSettings *settings, +- GParamSpec *pspec, +- gpointer data); ++static void update_cursor_size_from_gtk (GtkSettings *settings, ++ GParamSpec *pspec, ++ gpointer data); ++static void update_cursor_size (void); + + static void queue_changed (MetaPreference pref); + +@@ -963,14 +971,18 @@ meta_prefs_init (void) + G_CALLBACK (settings_changed), NULL); + g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_THEME, + G_CALLBACK (settings_changed), NULL); ++ if (meta_is_wayland_compositor ()) ++ g_signal_connect (settings, "changed::cursor-size", ++ G_CALLBACK (wayland_settings_changed), NULL); + g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings); + + g_signal_connect (gtk_settings_get_default (), + "notify::gtk-shell-shows-app-menu", + G_CALLBACK (shell_shows_app_menu_changed), NULL); + +- g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size", +- G_CALLBACK (update_cursor_size), NULL); ++ if (!meta_is_wayland_compositor ()) ++ g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size", ++ G_CALLBACK (update_cursor_size_from_gtk), NULL); + + settings = g_settings_new (SCHEMA_INPUT_SOURCES); + g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS, +@@ -992,7 +1004,7 @@ meta_prefs_init (void) + handle_preference_init_string_array (); + handle_preference_init_int (); + +- update_cursor_size (gtk_settings_get_default (), NULL, NULL); ++ update_cursor_size (); + shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL); + + init_bindings (); +@@ -1134,6 +1146,20 @@ meta_prefs_override_preference_schema (const char *key, const char *schema) + + + static void ++wayland_settings_changed (GSettings *settings, ++ gchar *key, ++ gpointer data) ++{ ++ GVariant *value = g_settings_get_value (settings, key); ++ const GVariantType *type = g_variant_get_type (value); ++ ++ g_return_if_fail (g_variant_type_equal (type, G_VARIANT_TYPE_INT32)); ++ g_return_if_fail (g_str_equal (key, "cursor-size")); ++ ++ update_cursor_size (); ++} ++ ++static void + settings_changed (GSettings *settings, + gchar *key, + gpointer data) +@@ -1216,9 +1242,29 @@ shell_shows_app_menu_changed (GtkSettings *settings, + } + + static void +-update_cursor_size (GtkSettings *settings, +- GParamSpec *pspec, +- gpointer data) ++update_cursor_size (void) ++{ ++ if (meta_is_wayland_compositor ()) ++ { ++ /* When running as a Wayland compositor, since we size of the cursor ++ * depends on what output it is on, we cannot use the GTK+ ++ * "gtk-cursor-theme-size" setting because it has already been multiplied ++ * by the primary monitor scale. So, instead get the non-premultiplied ++ * cursor size value directly from gsettings instead. ++ */ ++ cursor_size = ++ g_settings_get_int (SETTINGS (SCHEMA_INTERFACE), "cursor-size"); ++ } ++ else ++ { ++ update_cursor_size_from_gtk (gtk_settings_get_default (), NULL, NULL); ++ } ++} ++ ++static void ++update_cursor_size_from_gtk (GtkSettings *settings, ++ GParamSpec *pspec, ++ gpointer data) + { + GdkScreen *screen = gdk_screen_get_default (); + GValue value = G_VALUE_INIT; +-- +2.4.3 \ No newline at end of file diff --git a/wayland-Dont-scale-XWayland-pointer-cursor-sprites.patch b/wayland-Dont-scale-XWayland-pointer-cursor-sprites.patch new file mode 100644 index 0000000..0977ef4 --- /dev/null +++ b/wayland-Dont-scale-XWayland-pointer-cursor-sprites.patch @@ -0,0 +1,79 @@ +From 505fcdc37c18ed2ed6b45173683a5d6e5e2e33fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 16 Sep 2015 15:49:46 +0800 +Subject: [PATCH] wayland: Don't scale XWayland pointer cursor sprites + +We don't have any way of knowing what the intended size of a XWayland +cursor is supposed to be, so lets do what we do with regular XWayland +surfaces and don't scale them. The result is that cursor sprites of +HiDPI aware X11 clients will show correctly, but non-aware clients may +have tiny cursor sprites. + +https://bugzilla.gnome.org/show_bug.cgi?id=755099 +--- + src/wayland/meta-wayland-pointer.c | 10 +++++++--- + src/wayland/meta-xwayland.c | 9 +++++++++ + src/wayland/meta-xwayland.h | 5 +++++ + 3 files changed, 21 insertions(+), 3 deletions(-) + +diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c +index 08172fb..82dd2c1 100644 +--- a/src/wayland/meta-wayland-pointer.c ++++ b/src/wayland/meta-wayland-pointer.c +@@ -820,9 +820,13 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite, + MetaScreen *screen = display->screen; + const MetaMonitorInfo *monitor; + +- monitor = meta_screen_get_monitor_for_point (screen, x, y); +- meta_cursor_sprite_set_texture_scale (cursor_sprite, +- (float)monitor->scale / surface->scale); ++ ++ if (!meta_xwayland_is_xwayland_surface (surface)) ++ { ++ monitor = meta_screen_get_monitor_for_point (screen, x, y); ++ meta_cursor_sprite_set_texture_scale (cursor_sprite, ++ (float)monitor->scale / surface->scale); ++ } + meta_wayland_surface_update_outputs (surface); + } + +diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c +index 1e7cb34..3cfc69f 100644 +--- a/src/wayland/meta-xwayland.c ++++ b/src/wayland/meta-xwayland.c +@@ -172,6 +172,15 @@ meta_xwayland_handle_wl_surface_id (MetaWindow *window, + } + } + ++gboolean ++meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface) ++{ ++ MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); ++ MetaXWaylandManager *manager = &compositor->xwayland_manager; ++ ++ return wl_resource_get_client (surface->resource) == manager->client; ++} ++ + static gboolean + try_display (int display, + char **filename_out, +diff --git a/src/wayland/meta-xwayland.h b/src/wayland/meta-xwayland.h +index 5308f29..caaf510 100644 +--- a/src/wayland/meta-xwayland.h ++++ b/src/wayland/meta-xwayland.h +@@ -28,8 +28,13 @@ + #include + #include + ++#include "wayland/meta-wayland-types.h" ++ + void + meta_xwayland_handle_wl_surface_id (MetaWindow *window, + guint32 surface_id); + ++gboolean ++meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface); ++ + #endif /* META_XWAYLAND_H */ +-- +2.4.3