From 7cc7ff6a0c8e1b77c230fe0212fe90da2f94c97d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 09:36:08 +0000 Subject: import mutter-3.32.2-34.el8 --- diff --git a/SOURCES/0001-Add-support-for-quad-buffer-stereo.patch b/SOURCES/0001-Add-support-for-quad-buffer-stereo.patch index 8e12a79..397dc41 100644 --- a/SOURCES/0001-Add-support-for-quad-buffer-stereo.patch +++ b/SOURCES/0001-Add-support-for-quad-buffer-stereo.patch @@ -1,4 +1,4 @@ -From 2b45c3e37da7a590227e965d8a18e89337b791ba Mon Sep 17 00:00:00 2001 +From d0ad5ea18bb02112837bcdf7270d58d8ad235a4d Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Thu, 8 May 2014 18:44:15 -0400 Subject: [PATCH] Add support for quad-buffer stereo @@ -21,7 +21,7 @@ texture_from_pixmap. src/compositor/compositor-private.h | 9 ++ src/compositor/compositor.c | 125 +++++++++++++++ src/compositor/meta-shaped-texture-private.h | 5 +- - src/compositor/meta-shaped-texture.c | 86 ++++++++++- + src/compositor/meta-shaped-texture.c | 84 +++++++++- src/compositor/meta-surface-actor-wayland.c | 2 +- src/compositor/meta-surface-actor-x11.c | 54 ++++++- src/compositor/meta-surface-actor-x11.h | 5 + @@ -32,7 +32,7 @@ texture_from_pixmap. src/core/stereo.h | 28 ++++ src/meson.build | 2 + src/wayland/meta-wayland-surface.c | 2 +- - 14 files changed, 483 insertions(+), 20 deletions(-) + 14 files changed, 481 insertions(+), 20 deletions(-) create mode 100644 src/core/stereo.c create mode 100644 src/core/stereo.h @@ -265,7 +265,7 @@ index a86a2bff0..d0efdd4dc 100644 gboolean is_y_inverted); void meta_shaped_texture_set_snippet (MetaShapedTexture *stex, diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c -index ea8daa03d..9665ce2b6 100644 +index ea8daa03d..9a00ccd6d 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -102,8 +102,10 @@ struct _MetaShapedTexture @@ -279,17 +279,15 @@ index ea8daa03d..9665ce2b6 100644 CoglTexture *mask_texture; CoglSnippet *snippet; -@@ -193,6 +195,9 @@ meta_shaped_texture_init (MetaShapedTexture *stex) +@@ -192,6 +194,7 @@ meta_shaped_texture_init (MetaShapedTexture *stex) + clutter_backend_get_cogl_context (clutter_backend); stex->paint_tower = meta_texture_tower_new (); - -+ stex->paint_tower = meta_texture_tower_new (); + stex->paint_tower_right = NULL; /* demand create */ -+ + stex->texture = NULL; stex->mask_texture = NULL; - stex->create_mipmaps = TRUE; -@@ -335,6 +340,9 @@ meta_shaped_texture_dispose (GObject *object) +@@ -335,6 +338,9 @@ meta_shaped_texture_dispose (GObject *object) meta_texture_tower_free (stex->paint_tower); stex->paint_tower = NULL; @@ -299,7 +297,7 @@ index ea8daa03d..9665ce2b6 100644 g_clear_pointer (&stex->texture, cogl_object_unref); g_clear_pointer (&stex->opaque_region, cairo_region_destroy); -@@ -611,8 +619,9 @@ paint_clipped_rectangle (MetaShapedTexture *stex, +@@ -611,8 +617,9 @@ paint_clipped_rectangle (MetaShapedTexture *stex, } static void @@ -311,7 +309,7 @@ index ea8daa03d..9665ce2b6 100644 { int width, height; -@@ -620,10 +629,13 @@ set_cogl_texture (MetaShapedTexture *stex, +@@ -620,10 +627,13 @@ set_cogl_texture (MetaShapedTexture *stex, if (stex->texture) cogl_object_unref (stex->texture); @@ -325,7 +323,7 @@ index ea8daa03d..9665ce2b6 100644 if (cogl_tex != NULL) { -@@ -637,6 +649,9 @@ set_cogl_texture (MetaShapedTexture *stex, +@@ -637,6 +647,9 @@ set_cogl_texture (MetaShapedTexture *stex, height = 0; } @@ -335,7 +333,7 @@ index ea8daa03d..9665ce2b6 100644 if (stex->tex_width != width || stex->tex_height != height) { -@@ -650,8 +665,23 @@ set_cogl_texture (MetaShapedTexture *stex, +@@ -650,8 +663,23 @@ set_cogl_texture (MetaShapedTexture *stex, * previous buffer. We only queue a redraw in response to surface * damage. */ @@ -360,7 +358,7 @@ index ea8daa03d..9665ce2b6 100644 } static gboolean -@@ -927,7 +957,9 @@ meta_shaped_texture_paint (ClutterActor *actor) +@@ -927,7 +955,9 @@ meta_shaped_texture_paint (ClutterActor *actor) { MetaShapedTexture *stex = META_SHAPED_TEXTURE (actor); CoglTexture *paint_tex; @@ -370,7 +368,7 @@ index ea8daa03d..9665ce2b6 100644 if (!stex->texture) return; -@@ -989,7 +1021,32 @@ meta_shaped_texture_paint (ClutterActor *actor) +@@ -989,7 +1019,32 @@ meta_shaped_texture_paint (ClutterActor *actor) return; fb = cogl_get_draw_framebuffer (); @@ -404,7 +402,7 @@ index ea8daa03d..9665ce2b6 100644 } static void -@@ -1063,6 +1120,12 @@ meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex, +@@ -1063,6 +1118,12 @@ meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex, stex->create_mipmaps = create_mipmaps; base_texture = create_mipmaps ? stex->texture : NULL; meta_texture_tower_set_base_texture (stex->paint_tower, base_texture); @@ -417,7 +415,7 @@ index ea8daa03d..9665ce2b6 100644 } } -@@ -1256,6 +1319,12 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, +@@ -1256,6 +1317,12 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, clip.y, clip.width, clip.height); @@ -430,7 +428,7 @@ index ea8daa03d..9665ce2b6 100644 stex->prev_invalidation = stex->last_invalidation; stex->last_invalidation = g_get_monotonic_time (); -@@ -1302,17 +1371,18 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, +@@ -1302,17 +1369,18 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, } /** @@ -905,5 +903,5 @@ index da0acfcbb..ddad1a45c 100644 meta_shaped_texture_set_is_y_inverted (stex, is_y_inverted); g_clear_pointer (&snippet, cogl_object_unref); -- -2.21.0 +2.23.0 diff --git a/SOURCES/0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch b/SOURCES/0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch new file mode 100644 index 0000000..732b754 --- /dev/null +++ b/SOURCES/0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch @@ -0,0 +1,55 @@ +From 38d88d4e4286c3ada041561426873e44fdba3c40 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 17 Jan 2020 14:45:00 +0100 +Subject: [PATCH] Create explicit WacomDevices for tablet "touchpad" devices + +--- + src/backends/meta-input-settings.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c +index 28dc387ef9..820a3b201e 100644 +--- a/src/backends/meta-input-settings.c ++++ b/src/backends/meta-input-settings.c +@@ -521,27 +521,34 @@ static gboolean + device_is_tablet_touchpad (MetaInputSettings *input_settings, + ClutterInputDevice *device) + { ++ gboolean is_tablet = FALSE; + #ifdef HAVE_LIBWACOM ++ MetaInputSettingsPrivate *priv; + WacomIntegrationFlags flags = 0; + WacomDevice *wacom_device; + ++ priv = meta_input_settings_get_instance_private (input_settings); ++ + if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE) + return FALSE; + + wacom_device = +- meta_input_settings_get_tablet_wacom_device (input_settings, +- device); ++ libwacom_new_from_path (priv->wacom_db, ++ clutter_input_device_get_device_node (device), ++ WFALLBACK_NONE, NULL); + if (wacom_device) + { + flags = libwacom_get_integration_flags (wacom_device); + + if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM | + WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0) +- return TRUE; ++ is_tablet = TRUE; ++ ++ libwacom_destroy (wacom_device); + } + #endif + +- return FALSE; ++ return is_tablet; + } + + static void +-- +2.25.0.rc2 + diff --git a/SOURCES/0001-EGL-Include-EGL-eglmesaext.h.patch b/SOURCES/0001-EGL-Include-EGL-eglmesaext.h.patch new file mode 100644 index 0000000..ae7ff46 --- /dev/null +++ b/SOURCES/0001-EGL-Include-EGL-eglmesaext.h.patch @@ -0,0 +1,68 @@ +From abfc64268d4135663fb46c5f3529cd5f082a5c20 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +Date: Sun, 20 Oct 2019 12:04:31 +0200 +Subject: [PATCH] EGL: Include EGL/eglmesaext.h + +The eglext.h shipped by libglvnd does not include the Mesa extensions, +unlike the header shipped in Mesa. + +Fixes https://gitlab.gnome.org/GNOME/mutter/issues/876 +--- + cogl/cogl/meson.build | 2 +- + src/backends/meta-egl-ext.h | 1 + + src/backends/meta-egl.c | 1 + + src/backends/meta-egl.h | 1 + + 4 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build +index cb940420a..8032669e4 100644 +--- a/cogl/cogl/meson.build ++++ b/cogl/cogl/meson.build +@@ -48,7 +48,7 @@ cogl_gl_header_h = configure_file( + built_headers += [cogl_gl_header_h] + + if have_egl +- cogl_egl_includes_string = '#include \n#include ' ++ cogl_egl_includes_string = '#include \n#include \n#include ' + else + cogl_egl_includes_string = '' + endif +diff --git a/src/backends/meta-egl-ext.h b/src/backends/meta-egl-ext.h +index 8705e7d5b..db0b74f76 100644 +--- a/src/backends/meta-egl-ext.h ++++ b/src/backends/meta-egl-ext.h +@@ -29,6 +29,7 @@ + + #include + #include ++#include + + /* + * This is a little different to the tests shipped with EGL implementations, +diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c +index 8b953449a..a28eef4ca 100644 +--- a/src/backends/meta-egl.c ++++ b/src/backends/meta-egl.c +@@ -26,6 +26,7 @@ + + #include + #include ++#include + #include + #include + #include +diff --git a/src/backends/meta-egl.h b/src/backends/meta-egl.h +index ff37f124f..81b53b32d 100644 +--- a/src/backends/meta-egl.h ++++ b/src/backends/meta-egl.h +@@ -27,6 +27,7 @@ + + #include + #include ++#include + #include + + #define META_EGL_ERROR meta_egl_error_quark () +-- +2.23.0 + diff --git a/SOURCES/0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch b/SOURCES/0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch new file mode 100644 index 0000000..f61ecf6 --- /dev/null +++ b/SOURCES/0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch @@ -0,0 +1,28 @@ +From d9d355bfd8ecfb7dcf65a3810ec30e12f12673ab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 24 Feb 2020 16:09:59 +0100 +Subject: [PATCH] Revert "MetaMonitorManager: ignore hotplug_mode_update at + startup" + +This reverts commit 183f4b0c13f3dc9565bf5f693f2e5d61ca0199c9. +--- + src/backends/meta-monitor-manager.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c +index 076dca8cb..0adf2100d 100644 +--- a/src/backends/meta-monitor-manager.c ++++ b/src/backends/meta-monitor-manager.c +@@ -527,8 +527,7 @@ meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager) + static gboolean + should_use_stored_config (MetaMonitorManager *manager) + { +- return (manager->in_init || +- !meta_monitor_manager_has_hotplug_mode_update (manager)); ++ return !meta_monitor_manager_has_hotplug_mode_update (manager); + } + + static gboolean +-- +2.24.1 + diff --git a/SOURCES/0001-Skip-wacom-touchpads-when-updating-setting.patch b/SOURCES/0001-Skip-wacom-touchpads-when-updating-setting.patch new file mode 100644 index 0000000..ba10e5e --- /dev/null +++ b/SOURCES/0001-Skip-wacom-touchpads-when-updating-setting.patch @@ -0,0 +1,94 @@ +From dafc9cb414fd47112b972d34c205e73797a3c1c1 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 21 Feb 2020 16:45:35 +0100 +Subject: [PATCH] Skip wacom touchpads when updating setting + +--- + src/backends/meta-input-settings.c | 46 +++++++++++++++++++++++------- + 1 file changed, 36 insertions(+), 10 deletions(-) + +diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c +index cdff7b346..7d866594a 100644 +--- a/src/backends/meta-input-settings.c ++++ b/src/backends/meta-input-settings.c +@@ -569,20 +569,33 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings, + + priv = meta_input_settings_get_instance_private (input_settings); + input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); +- enabled = device_is_tablet_touchpad (input_settings, device) || +- g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); + + if (device) + { ++ enabled = device_is_tablet_touchpad (input_settings, device) || ++ g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); + settings_device_set_bool_setting (input_settings, device, + input_settings_class->set_tap_enabled, + enabled); + } + else + { +- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, +- input_settings_class->set_tap_enabled, +- enabled); ++ const GSList *devices, *l; ++ ++ devices = clutter_device_manager_peek_devices (priv->device_manager); ++ for (l = devices; l; l = l->next) ++ { ++ device = l->data; ++ ++ if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE) ++ continue; ++ ++ enabled = device_is_tablet_touchpad (input_settings, device) || ++ g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); ++ settings_device_set_bool_setting (input_settings, device, ++ input_settings_class->set_tap_enabled, ++ enabled); ++ } + } + } + +@@ -600,20 +613,33 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings, + + priv = meta_input_settings_get_instance_private (input_settings); + input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); +- enabled = device_is_tablet_touchpad (input_settings, device) || +- g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); + + if (device) + { ++ enabled = device_is_tablet_touchpad (input_settings, device) || ++ g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); + settings_device_set_bool_setting (input_settings, device, + input_settings_class->set_tap_and_drag_enabled, + enabled); + } + else + { +- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, +- input_settings_class->set_tap_and_drag_enabled, +- enabled); ++ const GSList *devices, *l; ++ ++ devices = clutter_device_manager_peek_devices (priv->device_manager); ++ for (l = devices; l; l = l->next) ++ { ++ device = l->data; ++ ++ if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE) ++ continue; ++ ++ enabled = device_is_tablet_touchpad (input_settings, device) || ++ g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); ++ settings_device_set_bool_setting (input_settings, device, ++ input_settings_class->set_tap_and_drag_enabled, ++ enabled); ++ } + } + } + +-- +2.24.1 + diff --git a/SOURCES/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch b/SOURCES/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch new file mode 100644 index 0000000..0420251 --- /dev/null +++ b/SOURCES/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch @@ -0,0 +1,80 @@ +From eeff82f534f81b086d10d53124362d9e316e2cf9 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Thu, 12 Dec 2019 18:05:08 +0100 +Subject: [PATCH] backends: Always enable tap-to-click/drag on opaque Wacom + tablets + +Touch-wise, those are essentially giant touchpads, but have no buttons +associated to the "touchpad" device (There may be pad buttons, but +those are not mouse buttons). + +Without tap-to-click/drag, touch in those devices is somewhat useless +out of the box. Have them always enable these features, despite the +setting. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/968 +--- + src/backends/meta-input-settings.c | 33 ++++++++++++++++++++++++++++-- + 1 file changed, 31 insertions(+), 2 deletions(-) + +diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c +index 2e6672d9c..28dc387ef 100644 +--- a/src/backends/meta-input-settings.c ++++ b/src/backends/meta-input-settings.c +@@ -517,6 +517,33 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings, + } + } + ++static gboolean ++device_is_tablet_touchpad (MetaInputSettings *input_settings, ++ ClutterInputDevice *device) ++{ ++#ifdef HAVE_LIBWACOM ++ WacomIntegrationFlags flags = 0; ++ WacomDevice *wacom_device; ++ ++ if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE) ++ return FALSE; ++ ++ wacom_device = ++ meta_input_settings_get_tablet_wacom_device (input_settings, ++ device); ++ if (wacom_device) ++ { ++ flags = libwacom_get_integration_flags (wacom_device); ++ ++ if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM | ++ WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0) ++ return TRUE; ++ } ++#endif ++ ++ return FALSE; ++} ++ + static void + update_touchpad_tap_enabled (MetaInputSettings *input_settings, + ClutterInputDevice *device) +@@ -531,7 +558,8 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings, + + priv = meta_input_settings_get_instance_private (input_settings); + input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); +- enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); ++ enabled = device_is_tablet_touchpad (input_settings, device) || ++ g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); + + if (device) + { +@@ -561,7 +589,8 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings, + + priv = meta_input_settings_get_instance_private (input_settings); + input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); +- enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); ++ enabled = device_is_tablet_touchpad (input_settings, device) || ++ g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); + + if (device) + { +-- +2.23.0 + diff --git a/SOURCES/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch b/SOURCES/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch new file mode 100644 index 0000000..9880a83 --- /dev/null +++ b/SOURCES/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch @@ -0,0 +1,205 @@ +From 20fcc3e045287c1ca591f3e795b19e120479a89a Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 12 Feb 2020 20:26:56 +0100 +Subject: [PATCH 1/2] backends/x11: Implement is_grouped for X11 + +If the devices have a wacom description, compare those. Otherwise, +look up the devices' VID:PID, if they match they should also be +grouped. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/971 +--- + .../clutter/x11/clutter-input-device-xi2.c | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c +index ae2fa27..9eca34d 100644 +--- a/clutter/clutter/x11/clutter-input-device-xi2.c ++++ b/clutter/clutter/x11/clutter-input-device-xi2.c +@@ -98,6 +98,31 @@ static gboolean + clutter_input_device_xi2_is_grouped (ClutterInputDevice *device, + ClutterInputDevice *other_device) + { ++#ifdef HAVE_LIBWACOM ++ ClutterInputDeviceXI2 *device_x11 = CLUTTER_INPUT_DEVICE_XI2 (device); ++ ClutterInputDeviceXI2 *other_device_x11 = CLUTTER_INPUT_DEVICE_XI2 (other_device); ++ ++ if (device_x11->wacom_device && ++ other_device_x11->wacom_device && ++ libwacom_compare (device_x11->wacom_device, ++ other_device_x11->wacom_device, ++ WCOMPARE_NORMAL) == 0) ++ return TRUE; ++#endif ++ ++ /* Devices with the same VID:PID get grouped together */ ++ if (clutter_input_device_get_vendor_id (device) && ++ clutter_input_device_get_product_id (device) && ++ clutter_input_device_get_vendor_id (other_device) && ++ clutter_input_device_get_product_id (other_device)) ++ { ++ if (strcmp (clutter_input_device_get_vendor_id (device), ++ clutter_input_device_get_vendor_id (other_device)) == 0 && ++ strcmp (clutter_input_device_get_product_id (device), ++ clutter_input_device_get_product_id (other_device)) == 0) ++ return TRUE; ++ } ++ + return FALSE; + } + +-- +2.24.1 + + +From 5914ab9ac79ce42da054036c4a8f118a3a868cc0 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 13 Dec 2019 15:26:05 +0100 +Subject: [PATCH 2/2] backends: Check both input settings and mapper for tablet + monitors + +The upper layers (OSDs basically) want to know the monitor that a +tablet is currently assigned to, not the monitor just as configured +through settings. + +This broke proper OSD positioning for display-attached tablets since +commit 87858a4e01d9, as the MetaInputMapper kicks in precisely when +there is no configured monitor for the given device. + +Consulting both about the assigned output will make OSDs pop up +again in the right place. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/971 +--- + src/backends/meta-input-mapper-private.h | 3 ++ + src/backends/meta-input-mapper.c | 26 ++++++++++++ + src/backends/meta-input-settings.c | 54 +++++++++++++++++++++++- + 3 files changed, 81 insertions(+), 2 deletions(-) + +diff --git a/src/backends/meta-input-mapper-private.h b/src/backends/meta-input-mapper-private.h +index 3431457..cdfdccd 100644 +--- a/src/backends/meta-input-mapper-private.h ++++ b/src/backends/meta-input-mapper-private.h +@@ -42,5 +42,8 @@ ClutterInputDevice * + meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper, + MetaLogicalMonitor *logical_monitor, + ClutterInputDeviceType device_type); ++MetaLogicalMonitor * ++meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper, ++ ClutterInputDevice *device); + + #endif /* META_INPUT_MAPPER_H */ +diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c +index fc4f3bd..fe02ab8 100644 +--- a/src/backends/meta-input-mapper.c ++++ b/src/backends/meta-input-mapper.c +@@ -675,3 +675,29 @@ meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper, + + return NULL; + } ++ ++MetaLogicalMonitor * ++meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper, ++ ClutterInputDevice *device) ++{ ++ MetaMapperOutputInfo *output; ++ MetaLogicalMonitor *logical_monitor; ++ GHashTableIter iter; ++ GList *l; ++ ++ g_hash_table_iter_init (&iter, mapper->output_devices); ++ ++ while (g_hash_table_iter_next (&iter, (gpointer *) &logical_monitor, ++ (gpointer *) &output)) ++ { ++ for (l = output->input_devices; l; l = l->next) ++ { ++ MetaMapperInputInfo *input = l->data; ++ ++ if (input->device == device) ++ return logical_monitor; ++ } ++ } ++ ++ return NULL; ++} +diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c +index b84595e..ab80bee 100644 +--- a/src/backends/meta-input-settings.c ++++ b/src/backends/meta-input-settings.c +@@ -1937,6 +1937,42 @@ meta_input_settings_get_tablet_settings (MetaInputSettings *settings, + return info ? g_object_ref (info->settings) : NULL; + } + ++static ClutterInputDevice * ++find_grouped_pen (MetaInputSettings *settings, ++ ClutterInputDevice *device) ++{ ++ MetaInputSettingsPrivate *priv; ++ GSList *l, *devices; ++ ClutterInputDeviceType device_type; ++ ClutterInputDevice *pen = NULL; ++ ++ device_type = clutter_input_device_get_device_type (device); ++ ++ if (device_type == CLUTTER_TABLET_DEVICE || ++ device_type == CLUTTER_PEN_DEVICE) ++ return device; ++ ++ priv = meta_input_settings_get_instance_private (settings); ++ devices = clutter_device_manager_peek_devices (priv->device_manager); ++ ++ for (l = devices; l; l = l->next) ++ { ++ ClutterInputDevice *device = l->data; ++ ++ device_type = clutter_input_device_get_device_type (l->data); ++ ++ if ((device_type == CLUTTER_TABLET_DEVICE || ++ device_type == CLUTTER_PEN_DEVICE) && ++ clutter_input_device_is_grouped (device, l->data)) ++ { ++ pen = l->data; ++ break; ++ } ++ } ++ ++ return pen; ++} ++ + MetaLogicalMonitor * + meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings, + ClutterInputDevice *device) +@@ -1948,13 +1984,27 @@ meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings, + g_return_val_if_fail (META_IS_INPUT_SETTINGS (settings), NULL); + g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL); + ++ if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE) ++ { ++ device = find_grouped_pen (settings, device); ++ if (!device) ++ return NULL; ++ } ++ + priv = meta_input_settings_get_instance_private (settings); + info = g_hash_table_lookup (priv->mappable_devices, device); + if (!info) + return NULL; + +- meta_input_settings_find_monitor (settings, info->settings, device, +- NULL, &logical_monitor); ++ logical_monitor = ++ meta_input_mapper_get_device_logical_monitor (priv->input_mapper, device); ++ ++ if (!logical_monitor) ++ { ++ meta_input_settings_find_monitor (settings, info->settings, device, ++ NULL, &logical_monitor); ++ } ++ + return logical_monitor; + } + +-- +2.24.1 + diff --git a/SOURCES/0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch b/SOURCES/0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch new file mode 100644 index 0000000..f7fa3b2 --- /dev/null +++ b/SOURCES/0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch @@ -0,0 +1,30 @@ +From e512c397a640994807f239c570333e9942717ef5 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 13 Dec 2019 17:01:44 +0100 +Subject: [PATCH] backends: Consider pen/eraser devices when looking for + matching WacomDevice + +Those device types are still in use through the X11 backend, breaking some +checks around on that backend... + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/972 +--- + src/backends/meta-input-settings.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c +index 2e6672d9c..18ae52dd7 100644 +--- a/src/backends/meta-input-settings.c ++++ b/src/backends/meta-input-settings.c +@@ -1589,6 +1589,8 @@ check_add_mappable_device (MetaInputSettings *input_settings, + + #ifdef HAVE_LIBWACOM + if (device_type == CLUTTER_TABLET_DEVICE || ++ device_type == CLUTTER_PEN_DEVICE || ++ device_type == CLUTTER_ERASER_DEVICE || + device_type == CLUTTER_PAD_DEVICE) + { + WacomError *error = libwacom_error_new (); +-- +2.23.0 + diff --git a/SOURCES/0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch b/SOURCES/0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch new file mode 100644 index 0000000..ac6986f --- /dev/null +++ b/SOURCES/0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch @@ -0,0 +1,118 @@ +From a8f12e7afdb35ebda581cee6a32b295cb6e643ec Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 13 Dec 2019 14:22:12 +0100 +Subject: [PATCH] backends/x11: Observe multiple pad mode switch buttons in a + group + +Some tablets like the Cintiq 24HDT have several mode switch buttons +per group. Those are meant to jump straight to a given mode, however +we just handle cycling across modes (as most other tablets have a +single mode switch button per group). + +So spice up the mode switch handling so we handle multiple mode +switch buttons, assigning each of them a mode. If the device only +has one mode switch button, we do the old-fashioned cycling. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/970 +--- + .../clutter/x11/clutter-input-device-xi2.c | 71 ++++++++++++++++--- + 1 file changed, 60 insertions(+), 11 deletions(-) + +diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c +index 1254aca3a..c33adffc2 100644 +--- a/clutter/clutter/x11/clutter-input-device-xi2.c ++++ b/clutter/clutter/x11/clutter-input-device-xi2.c +@@ -318,6 +318,57 @@ clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device, + return g_array_index (device_xi2->group_modes, guint, group); + } + ++static gboolean ++pad_switch_mode (ClutterInputDevice *device, ++ uint32_t button, ++ uint32_t group, ++ uint32_t *mode) ++{ ++ ClutterInputDeviceXI2 *device_x11 = CLUTTER_INPUT_DEVICE_XI2 (device); ++ uint32_t n_buttons, n_modes, button_group, next_mode, i; ++ GList *switch_buttons = NULL; ++ ++ n_buttons = libwacom_get_num_buttons (device_x11->wacom_device); ++ ++ for (i = 0; i < n_buttons; i++) ++ { ++ button_group = clutter_input_device_xi2_get_button_group (device, i); ++ if (button_group == group) ++ switch_buttons = g_list_prepend (switch_buttons, GINT_TO_POINTER (i)); ++ } ++ ++ switch_buttons = g_list_reverse (switch_buttons); ++ n_modes = clutter_input_device_get_group_n_modes (device, group); ++ ++ if (g_list_length (switch_buttons) > 1) ++ { ++ /* If there's multiple switch buttons, we don't toggle but assign a mode ++ * to each of those buttons. ++ */ ++ next_mode = g_list_index (switch_buttons, GINT_TO_POINTER (button)); ++ } ++ else if (switch_buttons) ++ { ++ uint32_t cur_mode; ++ ++ /* If there is a single button, have it toggle across modes */ ++ cur_mode = g_array_index (device_x11->group_modes, uint32_t, group); ++ next_mode = (cur_mode + 1) % n_modes; ++ } ++ else ++ { ++ return FALSE; ++ } ++ ++ g_list_free (switch_buttons); ++ ++ if (next_mode < 0 || next_mode > n_modes) ++ return FALSE; ++ ++ *mode = next_mode; ++ return TRUE; ++} ++ + void + clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device, + guint button, +@@ -330,23 +381,21 @@ clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device, + gboolean is_mode_switch = FALSE; + + button_group = clutter_input_device_xi2_get_button_group (device, button); +- is_mode_switch = button_group >= 0; + +- /* Assign all non-mode-switch buttons to group 0 so far */ +- button_group = MAX (0, button_group); +- +- if (button_group >= device_xi2->group_modes->len) +- return; ++ if (button_group < 0 || button_group >= device_xi2->group_modes->len) ++ { ++ *group = *mode = 0; ++ return; ++ } + + group_mode = &g_array_index (device_xi2->group_modes, guint, button_group); + +- if (is_mode_switch && state) ++ if (state) + { +- guint next, n_modes; ++ uint32_t next_mode; + +- n_modes = clutter_input_device_get_group_n_modes (device, button_group); +- next = (*group_mode + 1) % n_modes; +- *group_mode = next; ++ if (pad_switch_mode (device, button, button_group, &next_mode)) ++ *group_mode = next_mode; + } + + if (group) +-- +2.23.0 + diff --git a/SOURCES/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch b/SOURCES/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch new file mode 100644 index 0000000..5ee31d1 --- /dev/null +++ b/SOURCES/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch @@ -0,0 +1,64 @@ +From 5cab6bac4d4fb06e60d3198dc654a5d70fa6240e Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 16 Dec 2019 13:53:26 +0100 +Subject: [PATCH] core: Let pad mode switch events always go through + MetaInputSettings + +We used to inhibit all pad actions while the OSD is shown, but one we +would actually want to handle are mode switches while the OSD is open. +So it has an opportunity to catch up to the mode switch. + +This lets MetaInputSettings reflect the mode switch (eg. when querying +action labels), so the OSD has an opportunity to update the current +actions. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/975 +--- + src/core/events.c | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) + +diff --git a/src/core/events.c b/src/core/events.c +index d383778629..44f28d0b97 100644 +--- a/src/core/events.c ++++ b/src/core/events.c +@@ -256,13 +256,31 @@ meta_display_handle_event (MetaDisplay *display, + } + #endif + +- if (!display->current_pad_osd && +- (event->type == CLUTTER_PAD_BUTTON_PRESS || +- event->type == CLUTTER_PAD_BUTTON_RELEASE || +- event->type == CLUTTER_PAD_RING || +- event->type == CLUTTER_PAD_STRIP)) ++ if (event->type == CLUTTER_PAD_BUTTON_PRESS || ++ event->type == CLUTTER_PAD_BUTTON_RELEASE || ++ event->type == CLUTTER_PAD_RING || ++ event->type == CLUTTER_PAD_STRIP) + { +- if (meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend), ++ gboolean handle_pad_event = TRUE; ++ gboolean is_mode_switch = FALSE; ++ ++ if (event->type == CLUTTER_PAD_BUTTON_PRESS || ++ event->type == CLUTTER_PAD_BUTTON_RELEASE) ++ { ++ ClutterInputDevice *pad; ++ uint32_t button; ++ ++ pad = clutter_event_get_source_device (event); ++ button = clutter_event_get_button (event); ++ ++ is_mode_switch = ++ clutter_input_device_get_mode_switch_button_group (pad, button) >= 0; ++ } ++ ++ handle_pad_event = !display->current_pad_osd || is_mode_switch; ++ ++ if (handle_pad_event && ++ meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend), + event)) + { + bypass_wayland = bypass_clutter = TRUE; +-- +2.24.0 + diff --git a/SOURCES/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch b/SOURCES/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch new file mode 100644 index 0000000..29e6b88 --- /dev/null +++ b/SOURCES/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch @@ -0,0 +1,73 @@ +From bac090f571e6f413ba2a362ed2d70146b7701d16 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 24 Feb 2020 17:37:34 +0100 +Subject: [PATCH] crtc-xrandr: Respect configured RANDR panning + +A user may have configured an output to be panning, e.g. using xrandr +--output --mode --panning . Respect this by making +the logical monitor use the panning size, instead of the mode. This +makes e.g. makes the background cover the whole panning size, and panels +etc will cover the whole top of the panned area, instead of just the top +left part covering the monitor if having panned to (0, 0). + +No support is added to configuring panning, i.e. a panned monitor +configuration cannot be stored in monitors.xml. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/1085 +--- + src/backends/x11/meta-crtc-xrandr.c | 31 +++++++++++++++++++++++++---- + 1 file changed, 27 insertions(+), 4 deletions(-) + +diff --git a/src/backends/x11/meta-crtc-xrandr.c b/src/backends/x11/meta-crtc-xrandr.c +index d201b8581..dc3f931e3 100644 +--- a/src/backends/x11/meta-crtc-xrandr.c ++++ b/src/backends/x11/meta-crtc-xrandr.c +@@ -177,7 +177,14 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr, + RRCrtc crtc_id, + XRRScreenResources *resources) + { ++ MetaGpu *gpu = META_GPU (gpu_xrandr); ++ MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu); ++ MetaMonitorManagerXrandr *monitor_manager_xrandr = ++ META_MONITOR_MANAGER_XRANDR (monitor_manager); ++ Display *xdisplay = ++ meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr); + MetaCrtc *crtc; ++ XRRPanning *panning; + unsigned int i; + GList *modes; + +@@ -185,10 +192,26 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr, + + crtc->gpu = META_GPU (gpu_xrandr); + crtc->crtc_id = crtc_id; +- crtc->rect.x = xrandr_crtc->x; +- crtc->rect.y = xrandr_crtc->y; +- crtc->rect.width = xrandr_crtc->width; +- crtc->rect.height = xrandr_crtc->height; ++ ++ panning = XRRGetPanning (xdisplay, resources, crtc_id); ++ if (panning && panning->width > 0 && panning->height > 0) ++ { ++ crtc->rect = (MetaRectangle) { ++ .x = panning->left, ++ .y = panning->top, ++ .width = panning->width, ++ .height = panning->height, ++ }; ++ } ++ else ++ { ++ crtc->rect = (MetaRectangle) { ++ .x = xrandr_crtc->x, ++ .y = xrandr_crtc->y, ++ .width = xrandr_crtc->width, ++ .height = xrandr_crtc->height, ++ }; ++ } + crtc->is_dirty = FALSE; + crtc->transform = + meta_monitor_transform_from_xrandr (xrandr_crtc->rotation); +-- +2.24.1 + diff --git a/SOURCES/0001-events-Sync-pending-pointer-events-without-a-window.patch b/SOURCES/0001-events-Sync-pending-pointer-events-without-a-window.patch new file mode 100644 index 0000000..3ba3963 --- /dev/null +++ b/SOURCES/0001-events-Sync-pending-pointer-events-without-a-window.patch @@ -0,0 +1,122 @@ +From f108395c32351cda8722130e0e2970827b18e5a9 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Wed, 2 Oct 2019 16:49:28 +0200 +Subject: [PATCH] events: Sync pending pointer events without a window + +Mutter issues a synchronous grab on the pointer for unfocused client +windows to be able to catch the button events first and raise/focus +client windows accordingly. + +When there is a synchronous grab in effect, all events are queued until +the grabbing client releases the event queue as it processes the events. + +Mutter does release the events in its event handler function but does so +only if it is able to find the window matching the event. If the window +is a shell widget, that matching may fail and therefore Mutter will not +release the events, hence causing a freeze in pointer events delivery. + +To avoid the issue, make sure we sync the pointer events in case we +can't find a matching window. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/821 +--- + src/core/events.c | 62 ++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 51 insertions(+), 11 deletions(-) + +diff --git a/src/core/events.c b/src/core/events.c +index 5b8e49fc7..831cb007b 100644 +--- a/src/core/events.c ++++ b/src/core/events.c +@@ -50,6 +50,12 @@ + #define IS_KEY_EVENT(e) ((e)->type == CLUTTER_KEY_PRESS || \ + (e)->type == CLUTTER_KEY_RELEASE) + ++typedef enum ++{ ++ EVENTS_UNFREEZE_SYNC, ++ EVENTS_UNFREEZE_REPLAY, ++} EventsUnfreezeMethod; ++ + static gboolean + stage_has_key_focus (void) + { +@@ -167,6 +173,43 @@ sequence_is_pointer_emulated (MetaDisplay *display, + return FALSE; + } + ++static void ++maybe_unfreeze_pointer_events (MetaBackend *backend, ++ const ClutterEvent *event, ++ EventsUnfreezeMethod unfreeze_method) ++{ ++ Display *xdisplay; ++ int event_mode; ++ int device_id; ++ ++ if (event->type != CLUTTER_BUTTON_PRESS) ++ return; ++ ++ if (!META_IS_BACKEND_X11 (backend)) ++ return; ++ ++ device_id = clutter_event_get_device_id (event); ++ switch (unfreeze_method) ++ { ++ case EVENTS_UNFREEZE_SYNC: ++ event_mode = XISyncDevice; ++ meta_verbose ("Syncing events time %u device %i\n", ++ (unsigned int) event->button.time, device_id); ++ break; ++ case EVENTS_UNFREEZE_REPLAY: ++ event_mode = XIReplayDevice; ++ meta_verbose ("Replaying events time %u device %i\n", ++ (unsigned int) event->button.time, device_id); ++ break; ++ default: ++ g_assert_not_reached (); ++ return; ++ } ++ ++ xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); ++ XIAllowEvents (xdisplay, device_id, event_mode, event->button.time); ++} ++ + static gboolean + meta_display_handle_event (MetaDisplay *display, + const ClutterEvent *event) +@@ -366,17 +409,7 @@ meta_display_handle_event (MetaDisplay *display, + { + /* Only replay button press events, since that's where we + * have the synchronous grab. */ +- if (event->type == CLUTTER_BUTTON_PRESS) +- { +- if (META_IS_BACKEND_X11 (backend)) +- { +- Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); +- meta_verbose ("Allowing events time %u\n", +- (unsigned int)event->button.time); +- XIAllowEvents (xdisplay, clutter_event_get_device_id (event), +- XIReplayDevice, event->button.time); +- } +- } ++ maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_REPLAY); + + /* If the focus window has an active close dialog let clutter + * events go through, so fancy clutter dialogs can get to handle +@@ -392,6 +425,13 @@ meta_display_handle_event (MetaDisplay *display, + + goto out; + } ++ else ++ { ++ /* We could not match the event with a window, make sure we sync ++ * the pointer to discard the sequence and don't keep events frozen. ++ */ ++ maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_SYNC); ++ } + + out: + /* If the compositor has a grab, don't pass that through to Wayland */ +-- +2.23.0 + diff --git a/SOURCES/0001-wayland-Check-stylus-serials-on-meta_wayland_seat_ca.patch b/SOURCES/0001-wayland-Check-stylus-serials-on-meta_wayland_seat_ca.patch new file mode 100644 index 0000000..486df56 --- /dev/null +++ b/SOURCES/0001-wayland-Check-stylus-serials-on-meta_wayland_seat_ca.patch @@ -0,0 +1,109 @@ +From f2b3dd318f1165849b45a86251724939b100ef7d Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 28 Oct 2019 18:07:31 +0100 +Subject: [PATCH] wayland: Check stylus serials on + meta_wayland_seat_can_popup() + +This allows xdg_popup.grab() to work with styli. Without this check +we would bail out and emit xdg_popup.popup_done, leaving stylus users +unable to interact with popup menus, comboboxes, etc... + +Closes: https://gitlab.gnome.org/GNOME/mutter/issues/886 +--- + src/wayland/meta-wayland-seat.c | 10 +++++++++- + src/wayland/meta-wayland-tablet-seat.c | 17 +++++++++++++++++ + src/wayland/meta-wayland-tablet-seat.h | 2 ++ + src/wayland/meta-wayland-tablet-tool.c | 7 +++++++ + src/wayland/meta-wayland-tablet-tool.h | 2 ++ + 5 files changed, 37 insertions(+), 1 deletion(-) + +diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c +index 91fe376ff..cf41d6eb8 100644 +--- a/src/wayland/meta-wayland-seat.c ++++ b/src/wayland/meta-wayland-seat.c +@@ -504,9 +504,17 @@ gboolean + meta_wayland_seat_can_popup (MetaWaylandSeat *seat, + uint32_t serial) + { ++ MetaWaylandCompositor *compositor; ++ MetaWaylandTabletSeat *tablet_seat; ++ ++ compositor = meta_wayland_compositor_get_default (); ++ tablet_seat = ++ meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat); ++ + return (meta_wayland_pointer_can_popup (seat->pointer, serial) || + meta_wayland_keyboard_can_popup (seat->keyboard, serial) || +- meta_wayland_touch_can_popup (seat->touch, serial)); ++ meta_wayland_touch_can_popup (seat->touch, serial) || ++ meta_wayland_tablet_seat_can_popup (tablet_seat, serial)); + } + + gboolean +diff --git a/src/wayland/meta-wayland-tablet-seat.c b/src/wayland/meta-wayland-tablet-seat.c +index b4bc4aa58..b1964714a 100644 +--- a/src/wayland/meta-wayland-tablet-seat.c ++++ b/src/wayland/meta-wayland-tablet-seat.c +@@ -552,3 +552,20 @@ meta_wayland_tablet_seat_set_pad_focus (MetaWaylandTabletSeat *tablet_seat, + while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &pad)) + meta_wayland_tablet_pad_set_focus (pad, surface); + } ++ ++gboolean ++meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat, ++ uint32_t serial) ++{ ++ MetaWaylandTabletTool *tool; ++ GHashTableIter iter; ++ ++ g_hash_table_iter_init (&iter, tablet_seat->tools); ++ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &tool)) ++ { ++ if (meta_wayland_tablet_tool_can_popup (tool, serial)) ++ return TRUE; ++ } ++ ++ return FALSE; ++} +diff --git a/src/wayland/meta-wayland-tablet-seat.h b/src/wayland/meta-wayland-tablet-seat.h +index c083dec5f..e3be5f264 100644 +--- a/src/wayland/meta-wayland-tablet-seat.h ++++ b/src/wayland/meta-wayland-tablet-seat.h +@@ -75,5 +75,7 @@ MetaWaylandTablet *meta_wayland_tablet_seat_lookup_paired_tablet (MetaWaylan + MetaWaylandTabletPad *pad); + GList *meta_wayland_tablet_seat_lookup_paired_pads (MetaWaylandTabletSeat *tablet_seat, + MetaWaylandTablet *tablet); ++gboolean meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat, ++ uint32_t serial); + + #endif /* META_WAYLAND_TABLET_SEAT_H */ +diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c +index c02831d73..065c834bb 100644 +--- a/src/wayland/meta-wayland-tablet-tool.c ++++ b/src/wayland/meta-wayland-tablet-tool.c +@@ -1018,3 +1018,10 @@ meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool, + return ((tool->down_serial == serial || tool->button_serial == serial) && + tablet_tool_can_grab_surface (tool, surface)); + } ++ ++gboolean ++meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool, ++ uint32_t serial) ++{ ++ return tool->down_serial == serial || tool->button_serial == serial; ++} +diff --git a/src/wayland/meta-wayland-tablet-tool.h b/src/wayland/meta-wayland-tablet-tool.h +index 71bc86643..315e26bde 100644 +--- a/src/wayland/meta-wayland-tablet-tool.h ++++ b/src/wayland/meta-wayland-tablet-tool.h +@@ -85,5 +85,7 @@ void meta_wayland_tablet_tool_set_cursor_position (MetaWaylandTabletTool *t + gboolean meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool, + MetaWaylandSurface *surface, + uint32_t serial); ++gboolean meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool, ++ uint32_t serial); + + #endif /* META_WAYLAND_TABLET_TOOL_H */ +-- +2.23.0 + diff --git a/SOURCES/0001-x11-Check-wacom-button-flags-to-determine-whether-bu.patch b/SOURCES/0001-x11-Check-wacom-button-flags-to-determine-whether-bu.patch new file mode 100644 index 0000000..5303bbc --- /dev/null +++ b/SOURCES/0001-x11-Check-wacom-button-flags-to-determine-whether-bu.patch @@ -0,0 +1,53 @@ +From 57b3a2ea620f754cfd38f1ed4851dd8223efbcab Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Thu, 28 Nov 2019 22:50:36 +0100 +Subject: [PATCH] x11: Check wacom button flags to determine whether button is + mode switch + +Checking the leds is not really accurate, since some devices have mode +switch buttons without leds. Check in the button flags whether they are +mode switch buttons for any of ring/ring2/strip/strip2, and return the +appropriate group. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/952 +--- + .../clutter/x11/clutter-input-device-xi2.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c +index 1254aca3ae..4e5e2fd12c 100644 +--- a/clutter/clutter/x11/clutter-input-device-xi2.c ++++ b/clutter/clutter/x11/clutter-input-device-xi2.c +@@ -155,14 +155,25 @@ clutter_input_device_xi2_get_button_group (ClutterInputDevice *device, + + if (device_xi2->wacom_device) + { ++ WacomButtonFlags flags; ++ + if (button >= libwacom_get_num_buttons (device_xi2->wacom_device)) + return -1; + +- return libwacom_get_button_led_group (device_xi2->wacom_device, +- 'A' + button); ++ flags = libwacom_get_button_flag (device_xi2->wacom_device, ++ 'A' + button); ++ ++ if (flags & ++ (WACOM_BUTTON_RING_MODESWITCH | ++ WACOM_BUTTON_TOUCHSTRIP_MODESWITCH)) ++ return 0; ++ if (flags & ++ (WACOM_BUTTON_RING2_MODESWITCH | ++ WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH)) ++ return 1; + } +- else +- return -1; ++ ++ return -1; + } + #endif + +-- +2.24.0 + diff --git a/SOURCES/handle-hotplug-better.patch b/SOURCES/handle-hotplug-better.patch new file mode 100644 index 0000000..57668d9 --- /dev/null +++ b/SOURCES/handle-hotplug-better.patch @@ -0,0 +1,614 @@ +From d442ef48412e3dc1b24a9f97b02ee3383404d501 Mon Sep 17 00:00:00 2001 +From: Emil Velikov +Date: Wed, 12 Jun 2019 16:58:54 +0000 +Subject: [PATCH 1/8] renderer/native: add missing eglTerminate in EGLDevice + error path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently the EGLDevice code gets the display and calls eglInitialize. +As a follow-up it checks the required EGL extensions - technically it +could check the EGL device extensions earlier. + +In either case, eglTerminate is missing. Thus the connection to the +display was still bound. + +This was highlighted with Mesa commit d6edccee8da ("egl: add +EGL_platform_device support") + amdgpu. + +In that case, since the eglTerminate is missing, we end up reusing the +underlying amdgpu_device due to some caching in libdrm_amdgpu. The +latter in itself being a good solution since it allows buffer sharing +across primary and render node of the same device. + +Note: we should really get this in branches all the way back to 3.30. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/619 + +Fixes: 934184e23 ("MetaRendererNative: Add EGLDevice based rendering support") +Cc: Jonas Ådahl +Signed-off-by: Emil Velikov + + +(cherry picked from commit 9213574870faee7fe40609791fc48f4b44f861c0) +--- + src/backends/native/meta-renderer-native.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index dbfc97aae..207b654fa 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -4038,6 +4038,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, + G_IO_ERROR_FAILED, + "Missing EGL extensions required for EGLDevice renderer: %s", + missing_extensions_str); ++ meta_egl_terminate (egl, egl_display, NULL); + g_free (missing_extensions_str); + g_free (missing_extensions); + return NULL; +-- +2.24.1 + + +From e18dfc888343585d21b3f64568571009c4967a95 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 17 Jun 2019 18:18:12 +0200 +Subject: [PATCH 2/8] renderer/native: Use g_set_error() instead of + _cogl_set_error() + +It's even a GError, so lets use the proper API. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/622 +(cherry picked from commit 1efb32d3000ca06ee3cfcc146dc812866d243619) +--- + src/backends/native/meta-renderer-native.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index 207b654fa..e7aa6f389 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -1277,7 +1277,7 @@ meta_renderer_native_egl_context_created (CoglDisplay *cogl_display, + cogl_display_egl->dummy_surface, + cogl_display_egl->egl_context)) + { +- _cogl_set_error (error, COGL_WINSYS_ERROR, ++ g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to make context current"); + return FALSE; +-- +2.24.1 + + +From 1947a81db93624d57471ce1edf5548c7774c3569 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 17 Jun 2019 18:18:42 +0200 +Subject: [PATCH 3/8] renderer/native: Make sure we're not destroying an active + EGLSurface + +When making a new surface/context pair current, mesa may want to flush +the old context. Make sure we don't try to flush any freed memory by +unmaking a surface/context pair current before freeing it. + +Not doing this results in the following valgrind warnings: + +==15986== Invalid read of size 8 +==15986== at 0x69A6D80: dri_flush_front_buffer (gbm_dri.c:92) +==15986== by 0x1750D458: intel_flush_front (brw_context.c:251) +==15986== by 0x1750D4BB: intel_glFlush (brw_context.c:296) +==15986== by 0x1739D8DD: dri2_make_current (egl_dri2.c:1461) +==15986== by 0x17393A3A: eglMakeCurrent (eglapi.c:869) +==15986== by 0x54381FB: InternalMakeCurrentVendor (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0) +==15986== by 0x5438515: eglMakeCurrent (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0) +==15986== by 0x522A782: _cogl_winsys_egl_make_current (cogl-winsys-egl.c:303) +==15986== by 0x49B64C8: meta_renderer_native_create_view (meta-renderer-native.c:3076) +==15986== by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78) +==15986== by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111) +==15986== by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142) +==15986== Address 0x1b076600 is 0 bytes inside a block of size 48 free'd +==15986== at 0x4839A0C: free (vg_replace_malloc.c:540) +==15986== by 0x49B59F3: meta_renderer_native_release_onscreen (meta-renderer-native.c:2651) +==15986== by 0x5211441: _cogl_onscreen_free (cogl-onscreen.c:167) +==15986== by 0x5210D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51) +==15986== by 0x51D0066: _cogl_object_default_unref (cogl-object.c:103) +==15986== by 0x520F989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814) +==15986== by 0x51D00B1: cogl_object_unref (cogl-object.c:115) +==15986== by 0x536F3C7: clutter_stage_view_dispose (clutter-stage-view.c:304) +==15986== by 0x4B7DAF2: g_object_unref (gobject.c:3309) +==15986== by 0x4A9596C: g_list_foreach (glist.c:1013) +==15986== by 0x4A9599A: g_list_free_full (glist.c:223) +==15986== by 0x48D2737: meta_renderer_rebuild_views (meta-renderer.c:100) +==15986== Block was alloc'd at +==15986== at 0x483AB1A: calloc (vg_replace_malloc.c:762) +==15986== by 0x69A76B2: gbm_dri_surface_create (gbm_dri.c:1252) +==15986== by 0x69A6BFE: gbm_surface_create (gbm.c:600) +==15986== by 0x49B4E29: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2221) +==15986== by 0x49B57DB: meta_onscreen_native_allocate (meta-renderer-native.c:2569) +==15986== by 0x49B6423: meta_renderer_native_create_view (meta-renderer-native.c:3062) +==15986== by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78) +==15986== by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111) +==15986== by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142) +==15986== by 0x49A75B5: meta_backend_native_update_screen_size (meta-backend-native.c:520) +==15986== by 0x48B01BB: meta_backend_sync_screen_size (meta-backend.c:224) +==15986== by 0x48B09B7: meta_backend_real_post_init (meta-backend.c:501) + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/622 +(cherry picked from commit 56ddaaa3809240a357b5e19b5789d1aa49aaecc3) +--- + src/backends/native/meta-renderer-native.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index e7aa6f389..b7bc3121a 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -3040,6 +3040,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + { + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *cogl_context = framebuffer->context; ++ CoglDisplay *cogl_display = cogl_context_get_display (cogl_context); ++ CoglDisplayEGL *cogl_display_egl = cogl_display->winsys; + CoglRenderer *cogl_renderer = cogl_context->display->renderer; + CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys; + CoglOnscreenEGL *onscreen_egl = onscreen->winsys; +@@ -3052,6 +3054,17 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + + onscreen_native = onscreen_egl->platform; + ++ if (onscreen_egl->egl_surface != EGL_NO_SURFACE && ++ (cogl_display_egl->current_draw_surface == onscreen_egl->egl_surface || ++ cogl_display_egl->current_read_surface == onscreen_egl->egl_surface)) ++ { ++ if (!_cogl_winsys_egl_make_current (cogl_display, ++ cogl_display_egl->dummy_surface, ++ cogl_display_egl->dummy_surface, ++ cogl_display_egl->egl_context)) ++ g_warning ("Failed to clear current context"); ++ } ++ + g_list_free_full (onscreen_native->pending_page_flip_retries, + (GDestroyNotify) retry_page_flip_data_free); + if (onscreen_native->retry_page_flips_source) +-- +2.24.1 + + +From 60551e5e6f984a7ed3ba3339f027ed7b37f802c4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 17 Jun 2019 19:16:12 +0200 +Subject: [PATCH 4/8] renderer/native: Fix EGLSurface destruction order + +Make sure to destroy the EGL surface after releasing held buffers, +otherwise we'll get the following valgrind warnings: + +==24016== Invalid read of size 8 +==24016== at 0x1739943F: release_buffer (platform_drm.c:73) +==24016== by 0x49AC355: meta_drm_buffer_gbm_finalize (meta-drm-buffer-gbm.c:213) +==24016== by 0x4B75B61: g_object_unref (gobject.c:3346) +==24016== by 0x49B4B41: free_current_bo (meta-renderer-native.c:991) +==24016== by 0x49B816F: meta_renderer_native_release_onscreen (meta-renderer-native.c:2971) +==24016== by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167) +==24016== by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51) +==24016== by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103) +==24016== by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814) +==24016== by 0x51C80B1: cogl_object_unref (cogl-object.c:115) +==24016== by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304) +==24016== by 0x4B75AF2: g_object_unref (gobject.c:3309) +==24016== Address 0x18e742a8 is 536 bytes inside a block of size 784 free'd +==24016== at 0x4839A0C: free (vg_replace_malloc.c:540) +==24016== by 0x17399764: dri2_drm_destroy_surface (platform_drm.c:231) +==24016== by 0x1738550A: eglDestroySurface (eglapi.c:1145) +==24016== by 0x5440286: eglDestroySurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0) +==24016== by 0x49613A5: meta_egl_destroy_surface (meta-egl.c:432) +==24016== by 0x49B80F9: meta_renderer_native_release_onscreen (meta-renderer-native.c:2954) +==24016== by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167) +==24016== by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51) +==24016== by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103) +==24016== by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814) +==24016== by 0x51C80B1: cogl_object_unref (cogl-object.c:115) +==24016== by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304) +==24016== Block was alloc'd at +==24016== at 0x483AB1A: calloc (vg_replace_malloc.c:762) +==24016== by 0x173997AE: dri2_drm_create_window_surface (platform_drm.c:145) +==24016== by 0x17388906: _eglCreateWindowSurfaceCommon (eglapi.c:929) +==24016== by 0x5440197: eglCreateWindowSurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0) +==24016== by 0x49612FF: meta_egl_create_window_surface (meta-egl.c:396) +==24016== by 0x49B752E: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2538) +==24016== by 0x49B7E6C: meta_onscreen_native_allocate (meta-renderer-native.c:2870) +==24016== by 0x49B8BCF: meta_renderer_native_create_view (meta-renderer-native.c:3387) +==24016== by 0x48D274B: meta_renderer_create_view (meta-renderer.c:78) +==24016== by 0x48D27DE: meta_renderer_rebuild_views (meta-renderer.c:111) +==24016== by 0x49BB4FB: meta_stage_native_rebuild_views (meta-stage-native.c:142) +==24016== by 0x49A733C: meta_backend_native_update_screen_size (meta-backend-native.c:517) + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/622 +(cherry picked from commit d9fb11b04319c00fd89715dd9207fe54e1d18c2d) +--- + src/backends/native/meta-renderer-native.c | 38 +++++++++++++++------- + 1 file changed, 27 insertions(+), 11 deletions(-) + +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index b7bc3121a..62c27c191 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -3035,6 +3035,28 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen, + return TRUE; + } + ++static void ++destroy_egl_surface (CoglOnscreen *onscreen) ++{ ++ CoglOnscreenEGL *onscreen_egl = onscreen->winsys; ++ ++ if (onscreen_egl->egl_surface != EGL_NO_SURFACE) ++ { ++ MetaOnscreenNative *onscreen_native = onscreen_egl->platform; ++ MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native); ++ CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); ++ CoglContext *cogl_context = framebuffer->context; ++ CoglRenderer *cogl_renderer = cogl_context->display->renderer; ++ CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys; ++ ++ meta_egl_destroy_surface (egl, ++ cogl_renderer_egl->edpy, ++ onscreen_egl->egl_surface, ++ NULL); ++ onscreen_egl->egl_surface = EGL_NO_SURFACE; ++ } ++} ++ + static void + meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + { +@@ -3077,17 +3099,6 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + g_source_destroy); + } + +- if (onscreen_egl->egl_surface != EGL_NO_SURFACE) +- { +- MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native); +- +- meta_egl_destroy_surface (egl, +- cogl_renderer_egl->edpy, +- onscreen_egl->egl_surface, +- NULL); +- onscreen_egl->egl_surface = EGL_NO_SURFACE; +- } +- + renderer_gpu_data = + meta_renderer_native_get_gpu_data (onscreen_native->renderer_native, + onscreen_native->render_gpu); +@@ -3100,6 +3111,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + + free_current_bo (onscreen); + ++ destroy_egl_surface (onscreen); ++ + if (onscreen_native->gbm.surface) + { + gbm_surface_destroy (onscreen_native->gbm.surface); +@@ -3110,6 +3123,9 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + case META_RENDERER_NATIVE_MODE_EGL_DEVICE: + release_dumb_fb (&onscreen_native->egl.dumb_fb, + onscreen_native->render_gpu); ++ ++ destroy_egl_surface (onscreen); ++ + if (onscreen_native->egl.stream != EGL_NO_STREAM_KHR) + { + MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native); +-- +2.24.1 + + +From c447010a23edc03c7a1103b477972ad666c2600f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 19 Jun 2019 20:55:48 +0200 +Subject: [PATCH 5/8] renderer/native: Remove left-over function declarations + +There are no callers and no definitions of these. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/655 +--- + src/backends/native/meta-renderer-native.h | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h +index a006dcbe7..8468208e1 100644 +--- a/src/backends/native/meta-renderer-native.h ++++ b/src/backends/native/meta-renderer-native.h +@@ -55,18 +55,6 @@ gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_n + + void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native); + +-gboolean meta_renderer_native_set_legacy_view_size (MetaRendererNative *renderer_native, +- MetaRendererView *view, +- int width, +- int height, +- GError **error); +- +-void meta_renderer_native_set_ignore_crtc (MetaRendererNative *renderer_native, +- uint32_t id, +- gboolean ignore); +- +-MetaRendererView * meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native); +- + void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native); + + int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native); +-- +2.24.1 + + +From 7f97403d12df19cf936a341cc218743ec339aa0a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 19 Jun 2019 20:57:14 +0200 +Subject: [PATCH 6/8] renderer/native: Queue mode reset from new rebuild_views + vfunc + +Simplify the call site a bit and make the native renderer know it should +queue mode reset itself when views have been rebuilt. This is done +partly due to more things needing to be dealt with after views have been +rebuilt. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/655 +--- + src/backends/meta-renderer.c | 8 ++++++++ + src/backends/meta-renderer.h | 1 + + src/backends/native/meta-renderer-native.c | 17 ++++++++++++++++- + src/backends/native/meta-renderer-native.h | 2 -- + src/backends/native/meta-stage-native.c | 1 - + 5 files changed, 25 insertions(+), 4 deletions(-) + +diff --git a/src/backends/meta-renderer.c b/src/backends/meta-renderer.c +index 28637437b..87ba9f9f0 100644 +--- a/src/backends/meta-renderer.c ++++ b/src/backends/meta-renderer.c +@@ -90,6 +90,12 @@ meta_renderer_create_view (MetaRenderer *renderer, + */ + void + meta_renderer_rebuild_views (MetaRenderer *renderer) ++{ ++ return META_RENDERER_GET_CLASS (renderer)->rebuild_views (renderer); ++} ++ ++static void ++meta_renderer_real_rebuild_views (MetaRenderer *renderer) + { + MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer); + MetaBackend *backend = meta_get_backend (); +@@ -181,4 +187,6 @@ meta_renderer_class_init (MetaRendererClass *klass) + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meta_renderer_finalize; ++ ++ klass->rebuild_views = meta_renderer_real_rebuild_views; + } +diff --git a/src/backends/meta-renderer.h b/src/backends/meta-renderer.h +index dae52cb9a..478baee91 100644 +--- a/src/backends/meta-renderer.h ++++ b/src/backends/meta-renderer.h +@@ -43,6 +43,7 @@ struct _MetaRendererClass + CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer); + MetaRendererView * (* create_view) (MetaRenderer *renderer, + MetaLogicalMonitor *logical_monitor); ++ void (* rebuild_views) (MetaRenderer *renderer); + }; + + CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer); +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index 62c27c191..70e1c4f9d 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -258,6 +258,9 @@ cogl_pixel_format_from_drm_format (uint32_t drm_format, + CoglPixelFormat *out_format, + CoglTextureComponents *out_components); + ++static void ++meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native); ++ + static MetaBackend * + backend_from_renderer_native (MetaRendererNative *renderer_native) + { +@@ -3186,7 +3189,7 @@ meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native) + return TRUE; + } + +-void ++static void + meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native) + { + MetaRenderer *renderer = META_RENDERER (renderer_native); +@@ -3552,6 +3555,17 @@ meta_renderer_native_create_view (MetaRenderer *renderer, + return view; + } + ++static void ++meta_renderer_native_rebuild_views (MetaRenderer *renderer) ++{ ++ MetaRendererClass *parent_renderer_class = ++ META_RENDERER_CLASS (meta_renderer_native_parent_class); ++ ++ parent_renderer_class->rebuild_views (renderer); ++ ++ meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer)); ++} ++ + void + meta_renderer_native_finish_frame (MetaRendererNative *renderer_native) + { +@@ -4350,6 +4364,7 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass) + + renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer; + renderer_class->create_view = meta_renderer_native_create_view; ++ renderer_class->rebuild_views = meta_renderer_native_rebuild_views; + + obj_props[PROP_MONITOR_MANAGER] = + g_param_spec_object ("monitor-manager", +diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h +index 8468208e1..9eecdead1 100644 +--- a/src/backends/native/meta-renderer-native.h ++++ b/src/backends/native/meta-renderer-native.h +@@ -53,8 +53,6 @@ struct gbm_device * meta_gbm_device_from_gpu (MetaGpuKms *gpu_kms); + + gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native); + +-void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native); +- + void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native); + + int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native); +diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c +index add3e81fd..9b9c45ef3 100644 +--- a/src/backends/native/meta-stage-native.c ++++ b/src/backends/native/meta-stage-native.c +@@ -140,7 +140,6 @@ meta_stage_native_rebuild_views (MetaStageNative *stage_native) + ClutterActor *stage = meta_backend_get_stage (backend); + + meta_renderer_rebuild_views (renderer); +- meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer)); + clutter_stage_update_resource_scales (CLUTTER_STAGE (stage)); + ensure_frame_callbacks (stage_native); + } +-- +2.24.1 + + +From 025054c93e43e8359c9ecafb6edea1eb4b7ad681 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 19 Jun 2019 21:14:05 +0200 +Subject: [PATCH 7/8] renderer/native: Discard page flip retries when + rebuilding views + +Rebuilding views means we don't care to retry page flip attempts for +previous views, especially since connectors may have been disconnected, +making a page flip retry hit an assert a flipped CRTC has connectors +associated with it. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/655 +--- + src/backends/native/meta-renderer-native.c | 50 +++++++++++++++++----- + 1 file changed, 39 insertions(+), 11 deletions(-) + +diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c +index 70e1c4f9d..3cd01bcb7 100644 +--- a/src/backends/native/meta-renderer-native.c ++++ b/src/backends/native/meta-renderer-native.c +@@ -3060,6 +3060,24 @@ destroy_egl_surface (CoglOnscreen *onscreen) + } + } + ++static void ++discard_onscreen_page_flip_retries (MetaOnscreenNative *onscreen_native) ++{ ++ g_list_free_full (onscreen_native->pending_page_flip_retries, ++ (GDestroyNotify) retry_page_flip_data_free); ++ onscreen_native->pending_page_flip_retries = NULL; ++ ++ if (onscreen_native->retry_page_flips_source) ++ { ++ MetaBackend *backend = ++ backend_from_renderer_native (onscreen_native->renderer_native); ++ ++ meta_backend_thaw_updates (backend); ++ g_clear_pointer (&onscreen_native->retry_page_flips_source, ++ g_source_destroy); ++ } ++} ++ + static void + meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + { +@@ -3090,17 +3108,7 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen) + g_warning ("Failed to clear current context"); + } + +- g_list_free_full (onscreen_native->pending_page_flip_retries, +- (GDestroyNotify) retry_page_flip_data_free); +- if (onscreen_native->retry_page_flips_source) +- { +- MetaBackend *backend = +- backend_from_renderer_native (onscreen_native->renderer_native); +- +- meta_backend_thaw_updates (backend); +- g_clear_pointer (&onscreen_native->retry_page_flips_source, +- g_source_destroy); +- } ++ discard_onscreen_page_flip_retries (onscreen_native); + + renderer_gpu_data = + meta_renderer_native_get_gpu_data (onscreen_native->renderer_native, +@@ -3555,12 +3563,32 @@ meta_renderer_native_create_view (MetaRenderer *renderer, + return view; + } + ++static void ++discard_page_flip_retries (MetaRenderer *renderer) ++{ ++ GList *l; ++ ++ for (l = meta_renderer_get_views (renderer); l; l = l->next) ++ { ++ ClutterStageView *stage_view = l->data; ++ CoglFramebuffer *framebuffer = ++ clutter_stage_view_get_onscreen (stage_view); ++ CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); ++ CoglOnscreenEGL *onscreen_egl = onscreen->winsys; ++ MetaOnscreenNative *onscreen_native = onscreen_egl->platform; ++ ++ discard_onscreen_page_flip_retries (onscreen_native); ++ } ++} ++ + static void + meta_renderer_native_rebuild_views (MetaRenderer *renderer) + { + MetaRendererClass *parent_renderer_class = + META_RENDERER_CLASS (meta_renderer_native_parent_class); + ++ discard_page_flip_retries (renderer); ++ + parent_renderer_class->rebuild_views (renderer); + + meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer)); +-- +2.24.1 + + +From f4fdec6003e2cf9fa4b1882e92faf1da64e6052e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 27 Nov 2019 17:34:35 +0100 +Subject: [PATCH 8/8] =?UTF-8?q?crtc-kms:=20Ignore=2090=C2=B0=20rotations?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +They tend to require special modifiers or won't work at all; ignore +them. +--- + src/backends/native/meta-crtc-kms.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c +index 8c2fbfe3c..8374376d5 100644 +--- a/src/backends/native/meta-crtc-kms.c ++++ b/src/backends/native/meta-crtc-kms.c +@@ -368,12 +368,8 @@ parse_transforms (MetaCrtc *crtc, + + if (strcmp (prop->enums[i].name, "rotate-0") == 0) + transform = META_MONITOR_TRANSFORM_NORMAL; +- else if (strcmp (prop->enums[i].name, "rotate-90") == 0) +- transform = META_MONITOR_TRANSFORM_90; + else if (strcmp (prop->enums[i].name, "rotate-180") == 0) + transform = META_MONITOR_TRANSFORM_180; +- else if (strcmp (prop->enums[i].name, "rotate-270") == 0) +- transform = META_MONITOR_TRANSFORM_270; + + if (transform != -1) + { +-- +2.24.1 + diff --git a/SOURCES/idle-monitor-reset-fix.patch b/SOURCES/idle-monitor-reset-fix.patch new file mode 100644 index 0000000..b67e015 --- /dev/null +++ b/SOURCES/idle-monitor-reset-fix.patch @@ -0,0 +1,128 @@ +From 35333114a991440d671e3642170aa080df45a171 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 16 Sep 2019 16:17:48 +0200 +Subject: [PATCH 1/3] idle-monitor: Make helper function static + +It wasn't used outside the file, so no reason to not have it static. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/799 +--- + src/backends/meta-idle-monitor-private.h | 1 - + src/backends/meta-idle-monitor.c | 8 ++++---- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/src/backends/meta-idle-monitor-private.h b/src/backends/meta-idle-monitor-private.h +index 93948b14b..cc08f8c8e 100644 +--- a/src/backends/meta-idle-monitor-private.h ++++ b/src/backends/meta-idle-monitor-private.h +@@ -54,7 +54,6 @@ struct _MetaIdleMonitorClass + GObjectClass parent_class; + }; + +-void _meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch); + void meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor); + + #endif /* META_IDLE_MONITOR_PRIVATE_H */ +diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c +index e83d6c778..de1c7e0ba 100644 +--- a/src/backends/meta-idle-monitor.c ++++ b/src/backends/meta-idle-monitor.c +@@ -54,8 +54,8 @@ static GParamSpec *obj_props[PROP_LAST]; + + G_DEFINE_TYPE (MetaIdleMonitor, meta_idle_monitor, G_TYPE_OBJECT) + +-void +-_meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch) ++static void ++meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch) + { + MetaIdleMonitor *monitor; + guint id; +@@ -324,7 +324,7 @@ idle_monitor_dispatch_timeout (GSource *source, + if (ready_time > now) + return G_SOURCE_CONTINUE; + +- _meta_idle_monitor_watch_fire (watch); ++ meta_idle_monitor_watch_fire (watch); + g_source_set_ready_time (watch->timeout_source, -1); + + return G_SOURCE_CONTINUE; +@@ -511,7 +511,7 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor) + + if (watch->timeout_msec == 0) + { +- _meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch); ++ meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch); + } + else + { +-- +2.23.0 + + +From 07276cf94d84489d450c17b7dec5a8075c60440a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 16 Sep 2019 16:36:05 +0200 +Subject: [PATCH 2/3] idle-monitor: Remove redundant type cast + +No need to type cast a `MetaIdleMonitorWatch *` to a +`MetaIdleMonitorWatch *`. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/799 +--- + src/backends/meta-idle-monitor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c +index de1c7e0ba..e5124abc1 100644 +--- a/src/backends/meta-idle-monitor.c ++++ b/src/backends/meta-idle-monitor.c +@@ -511,7 +511,7 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor) + + if (watch->timeout_msec == 0) + { +- meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch); ++ meta_idle_monitor_watch_fire (watch); + } + else + { +-- +2.23.0 + + +From 73c1f387765ef528c7323e6e7ca3c05899cfcc4a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Mon, 16 Sep 2019 16:36:51 +0200 +Subject: [PATCH 3/3] idle-monitor: Reset timeout before firing watch + +The watch might be removed during firing, meaning the source is +destroyed after returning. Avoid use-after-free by unsetting the timeout +before firing. Returning G_SOURCE_CONTINUE in that case is harmless, as +source is destroyed. + +Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/796 + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/799 +--- + src/backends/meta-idle-monitor.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c +index e5124abc1..9fa481742 100644 +--- a/src/backends/meta-idle-monitor.c ++++ b/src/backends/meta-idle-monitor.c +@@ -324,9 +324,10 @@ idle_monitor_dispatch_timeout (GSource *source, + if (ready_time > now) + return G_SOURCE_CONTINUE; + +- meta_idle_monitor_watch_fire (watch); + g_source_set_ready_time (watch->timeout_source, -1); + ++ meta_idle_monitor_watch_fire (watch); ++ + return G_SOURCE_CONTINUE; + } + +-- +2.23.0 + diff --git a/SOURCES/input-after-long-idle-fix.patch b/SOURCES/input-after-long-idle-fix.patch new file mode 100644 index 0000000..9c4c2a6 --- /dev/null +++ b/SOURCES/input-after-long-idle-fix.patch @@ -0,0 +1,374 @@ +From 05bca153bb92c5daa5b961214ff7f80af88cb7cf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Thu, 24 Oct 2019 21:19:36 +0200 +Subject: [PATCH 1/2] display: Move finishing of touch sequence to the backend + +We need to manipulate an X11 grab when a touch sequence ends; move that +logic to where it belongs - in the X11 backend. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/886 +--- + src/backends/meta-backend-private.h | 16 ++++++++++++ + src/backends/meta-backend.c | 14 +++++++++++ + src/backends/x11/meta-backend-x11.c | 23 +++++++++++++++++ + src/core/display.c | 33 +++++++++++-------------- + src/core/meta-gesture-tracker-private.h | 9 +------ + 5 files changed, 69 insertions(+), 26 deletions(-) + +diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h +index 7eba1806b..81ec81e5f 100644 +--- a/src/backends/meta-backend-private.h ++++ b/src/backends/meta-backend-private.h +@@ -49,6 +49,14 @@ + #define DEFAULT_XKB_RULES_FILE "evdev" + #define DEFAULT_XKB_MODEL "pc105+inet" + ++typedef enum ++{ ++ META_SEQUENCE_NONE, ++ META_SEQUENCE_ACCEPTED, ++ META_SEQUENCE_REJECTED, ++ META_SEQUENCE_PENDING_END ++} MetaSequenceState; ++ + struct _MetaBackendClass + { + GObjectClass parent_class; +@@ -71,6 +79,10 @@ struct _MetaBackendClass + int device_id, + uint32_t timestamp); + ++ void (* finish_touch_sequence) (MetaBackend *backend, ++ ClutterEventSequence *sequence, ++ MetaSequenceState state); ++ + void (* warp_pointer) (MetaBackend *backend, + int x, + int y); +@@ -135,6 +147,10 @@ gboolean meta_backend_ungrab_device (MetaBackend *backend, + int device_id, + uint32_t timestamp); + ++void meta_backend_finish_touch_sequence (MetaBackend *backend, ++ ClutterEventSequence *sequence, ++ MetaSequenceState state); ++ + void meta_backend_warp_pointer (MetaBackend *backend, + int x, + int y); +diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c +index c980cf150..bb7d66f2a 100644 +--- a/src/backends/meta-backend.c ++++ b/src/backends/meta-backend.c +@@ -1086,6 +1086,20 @@ meta_backend_ungrab_device (MetaBackend *backend, + return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp); + } + ++/** ++ * meta_backend_finish_touch_sequence: (skip) ++ */ ++void ++meta_backend_finish_touch_sequence (MetaBackend *backend, ++ ClutterEventSequence *sequence, ++ MetaSequenceState state) ++{ ++ if (META_BACKEND_GET_CLASS (backend)->finish_touch_sequence) ++ META_BACKEND_GET_CLASS (backend)->finish_touch_sequence (backend, ++ sequence, ++ state); ++} ++ + /** + * meta_backend_warp_pointer: (skip) + */ +diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c +index c10365f9d..cdefa50a9 100644 +--- a/src/backends/x11/meta-backend-x11.c ++++ b/src/backends/x11/meta-backend-x11.c +@@ -591,6 +591,28 @@ meta_backend_x11_ungrab_device (MetaBackend *backend, + return (ret == Success); + } + ++static void ++meta_backend_x11_finish_touch_sequence (MetaBackend *backend, ++ ClutterEventSequence *sequence, ++ MetaSequenceState state) ++{ ++ MetaBackendX11 *x11 = META_BACKEND_X11 (backend); ++ MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); ++ int event_mode; ++ ++ if (state == META_SEQUENCE_ACCEPTED) ++ event_mode = XIAcceptTouch; ++ else if (state == META_SEQUENCE_REJECTED) ++ event_mode = XIRejectTouch; ++ else ++ g_return_if_reached (); ++ ++ XIAllowTouchEvents (priv->xdisplay, ++ META_VIRTUAL_CORE_POINTER_ID, ++ clutter_x11_event_sequence_get_touch_detail (sequence), ++ DefaultRootWindow (priv->xdisplay), event_mode); ++} ++ + static void + meta_backend_x11_warp_pointer (MetaBackend *backend, + int x, +@@ -776,6 +798,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass) + backend_class->post_init = meta_backend_x11_post_init; + backend_class->grab_device = meta_backend_x11_grab_device; + backend_class->ungrab_device = meta_backend_x11_ungrab_device; ++ backend_class->finish_touch_sequence = meta_backend_x11_finish_touch_sequence; + backend_class->warp_pointer = meta_backend_x11_warp_pointer; + backend_class->get_current_logical_monitor = meta_backend_x11_get_current_logical_monitor; + backend_class->get_keymap = meta_backend_x11_get_keymap; +diff --git a/src/core/display.c b/src/core/display.c +index 4c8907f40..eb7dc43b6 100644 +--- a/src/core/display.c ++++ b/src/core/display.c +@@ -42,6 +42,7 @@ + #include + #include + ++#include "backends/meta-backend-private.h" + #include "backends/meta-cursor-sprite-xcursor.h" + #include "backends/meta-cursor-tracker-private.h" + #include "backends/meta-idle-monitor-dbus.h" +@@ -598,27 +599,23 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker, + MetaSequenceState state, + MetaDisplay *display) + { +- if (meta_is_wayland_compositor ()) ++ switch (state) + { +- if (state == META_SEQUENCE_ACCEPTED) +- meta_display_cancel_touch (display); +- } +- else +- { +- MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ()); +- int event_mode; ++ case META_SEQUENCE_NONE: ++ case META_SEQUENCE_PENDING_END: ++ return; ++ case META_SEQUENCE_ACCEPTED: ++ meta_display_cancel_touch (display); + +- if (state == META_SEQUENCE_ACCEPTED) +- event_mode = XIAcceptTouch; +- else if (state == META_SEQUENCE_REJECTED) +- event_mode = XIRejectTouch; +- else +- return; ++ /* Intentional fall-through */ ++ case META_SEQUENCE_REJECTED: ++ { ++ MetaBackend *backend; + +- XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend), +- META_VIRTUAL_CORE_POINTER_ID, +- clutter_x11_event_sequence_get_touch_detail (sequence), +- DefaultRootWindow (display->x11_display->xdisplay), event_mode); ++ backend = meta_get_backend (); ++ meta_backend_finish_touch_sequence (backend, sequence, state); ++ break; ++ } + } + } + +diff --git a/src/core/meta-gesture-tracker-private.h b/src/core/meta-gesture-tracker-private.h +index a9db35ebc..e7bfc5472 100644 +--- a/src/core/meta-gesture-tracker-private.h ++++ b/src/core/meta-gesture-tracker-private.h +@@ -26,6 +26,7 @@ + + #include + ++#include "backends/meta-backend-private.h" + #include "clutter/clutter.h" + #include "meta/window.h" + +@@ -39,14 +40,6 @@ + typedef struct _MetaGestureTracker MetaGestureTracker; + typedef struct _MetaGestureTrackerClass MetaGestureTrackerClass; + +-typedef enum +-{ +- META_SEQUENCE_NONE, +- META_SEQUENCE_ACCEPTED, +- META_SEQUENCE_REJECTED, +- META_SEQUENCE_PENDING_END +-} MetaSequenceState; +- + struct _MetaGestureTracker + { + GObject parent_instance; +-- +2.23.0 + + +From 8cf4f500defb421d5c96f2c1f9fcf7bb5545d70d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 25 Oct 2019 10:06:55 +0200 +Subject: [PATCH 2/2] x11: Limit touch replay pointer events to when replaying + +When a touch sequence was rejected, the emulated pointer events would be +replayed with old timestamps. This caused issues with grabs as they +would be ignored due to being too old. This was mitigated by making sure +device event timestamps never travelled back in time by tampering with +any event that had a timestamp seemingly in the past. + +This failed when the most recent timestamp that had been received were +much older than the timestamp of the new event. This could for example +happen when a session was left not interacted with for 40+ days or so; +when interacted with again, as any new timestamp would according to +XSERVER_TIME_IS_BEFORE() still be in the past compared to the "most +recent" one. The effect is that we'd always use the `latest_evtime` for +all new device events without ever updating it. + +The end result of this was that passive grabs would become active when +interacted with, but would then newer be released, as the timestamps to +XIAllowEvents() would out of date, resulting in the desktop effectively +freezing, as the Shell would have an active pointer grab. + +To avoid the situation where we get stuck with an old `latest_evtime` +timestamp, limit the tampering with device event timestamp to 1) only +pointer events, and 2) only during the replay sequence. The second part +is implemented by sending an asynchronous message via the X server after +rejecting a touch sequence, only potentially tampering with the device +event timestamps until the reply. This should avoid the stuck timestamp +as in those situations, we'll always have a relatively up to date +`latest_evtime` meaning XSERVER_TIME_IS_BEFORE() will not get confused. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/886 +--- + src/backends/x11/meta-backend-x11.c | 71 +++++++++++++++++++++++------ + 1 file changed, 58 insertions(+), 13 deletions(-) + +diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c +index cdefa50a9..821b30f5b 100644 +--- a/src/backends/x11/meta-backend-x11.c ++++ b/src/backends/x11/meta-backend-x11.c +@@ -66,6 +66,10 @@ struct _MetaBackendX11Private + XSyncAlarm user_active_alarm; + XSyncCounter counter; + ++ int current_touch_replay_sync_serial; ++ int pending_touch_replay_sync_serial; ++ Atom touch_replay_sync_atom; ++ + int xinput_opcode; + int xinput_event_base; + int xinput_error_base; +@@ -174,6 +178,26 @@ meta_backend_x11_translate_device_event (MetaBackendX11 *x11, + backend_x11_class->translate_device_event (x11, device_event); + } + ++static void ++maybe_translate_touch_replay_pointer_event (MetaBackendX11 *x11, ++ XIDeviceEvent *device_event) ++{ ++ MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); ++ ++ if (!device_event->send_event && ++ device_event->time != META_CURRENT_TIME && ++ priv->current_touch_replay_sync_serial != ++ priv->pending_touch_replay_sync_serial && ++ XSERVER_TIME_IS_BEFORE (device_event->time, priv->latest_evtime)) ++ { ++ /* Emulated pointer events received after XIRejectTouch is received ++ * on a passive touch grab will contain older timestamps, update those ++ * so we dont get InvalidTime at grabs. ++ */ ++ device_event->time = priv->latest_evtime; ++ } ++} ++ + static void + translate_device_event (MetaBackendX11 *x11, + XIDeviceEvent *device_event) +@@ -183,19 +207,7 @@ translate_device_event (MetaBackendX11 *x11, + meta_backend_x11_translate_device_event (x11, device_event); + + if (!device_event->send_event && device_event->time != META_CURRENT_TIME) +- { +- if (XSERVER_TIME_IS_BEFORE (device_event->time, priv->latest_evtime)) +- { +- /* Emulated pointer events received after XIRejectTouch is received +- * on a passive touch grab will contain older timestamps, update those +- * so we dont get InvalidTime at grabs. +- */ +- device_event->time = priv->latest_evtime; +- } +- +- /* Update the internal latest evtime, for any possible later use */ +- priv->latest_evtime = device_event->time; +- } ++ priv->latest_evtime = device_event->time; + } + + static void +@@ -260,6 +272,9 @@ maybe_spoof_event_as_stage_event (MetaBackendX11 *x11, + case XI_Motion: + case XI_ButtonPress: + case XI_ButtonRelease: ++ maybe_translate_touch_replay_pointer_event (x11, ++ (XIDeviceEvent *) input_event); ++ /* Intentional fall-through */ + case XI_KeyPress: + case XI_KeyRelease: + case XI_TouchBegin: +@@ -327,6 +342,17 @@ handle_host_xevent (MetaBackend *backend, + MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); + gboolean bypass_clutter = FALSE; + ++ switch (event->type) ++ { ++ case ClientMessage: ++ if (event->xclient.window == meta_backend_x11_get_xwindow (x11) && ++ event->xclient.message_type == priv->touch_replay_sync_atom) ++ priv->current_touch_replay_sync_serial = event->xclient.data.l[0]; ++ break; ++ default: ++ break; ++ } ++ + XGetEventData (priv->xdisplay, &event->xcookie); + + { +@@ -534,6 +560,10 @@ meta_backend_x11_post_init (MetaBackend *backend) + monitor_manager = meta_backend_get_monitor_manager (backend); + g_signal_connect (monitor_manager, "monitors-changed-internal", + G_CALLBACK (on_monitors_changed), backend); ++ ++ priv->touch_replay_sync_atom = XInternAtom (priv->xdisplay, ++ "_MUTTER_TOUCH_SEQUENCE_SYNC", ++ False); + } + + static ClutterBackend * +@@ -611,6 +641,21 @@ meta_backend_x11_finish_touch_sequence (MetaBackend *backend, + META_VIRTUAL_CORE_POINTER_ID, + clutter_x11_event_sequence_get_touch_detail (sequence), + DefaultRootWindow (priv->xdisplay), event_mode); ++ ++ if (state == META_SEQUENCE_REJECTED) ++ { ++ XClientMessageEvent ev; ++ ++ ev = (XClientMessageEvent) { ++ .type = ClientMessage, ++ .window = meta_backend_x11_get_xwindow (x11), ++ .message_type = priv->touch_replay_sync_atom, ++ .format = 32, ++ .data.l[0] = ++priv->pending_touch_replay_sync_serial, ++ }; ++ XSendEvent (priv->xdisplay, meta_backend_x11_get_xwindow (x11), ++ False, 0, (XEvent *) &ev); ++ } + } + + static void +-- +2.23.0 + diff --git a/SPECS/mutter.spec b/SPECS/mutter.spec index c9ea43d..9e14457 100644 --- a/SPECS/mutter.spec +++ b/SPECS/mutter.spec @@ -8,7 +8,7 @@ Name: mutter Version: 3.32.2 -Release: 12%{?dist} +Release: 34%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -67,8 +67,17 @@ Patch116: 0001-iconcache-Avoid-xrender-picture-formats-when-creatin.patch Patch117: 0001-workspace-Focus-only-ancestors-that-are-focusable.patch Patch118: 0002-window-Emit-an-error-and-return-when-trying-to-activ.patch +# Don't freeze on rapid input (rhbz#1759525) +Patch119: 0001-events-Sync-pending-pointer-events-without-a-window.patch + +# Don't freeze if input happens after many days of inactivity (rhbz#1766649) +Patch120: input-after-long-idle-fix.patch + +# Fix invalid read in idle monitor (rhbz#1766695) +Patch121: idle-monitor-reset-fix.patch + # Improve shadow-fb performance on llvmpipe -# https://bugzilla.redhat.com/1757144 +# https://bugzilla.redhat.com/1737553 Patch201: 0001-cogl-Remove-unused-OFFSCREEN_BLIT-feature-flag.patch Patch202: 0002-cogl-Fix-doc-for-_cogl_blit_framebuffer.patch Patch203: 0003-cogl-Replace-ANGLE-with-GLES3-and-NV-framebuffer_bli.patch @@ -82,9 +91,36 @@ Patch210: 0010-cogl-Flush-journal-before-blitting.patch Patch211: 0011-clutter-stage-view-Separate-offscreen-and-shadowfb.patch Patch212: 0012-renderer-native-Separate-offscreen-and-shadowfb.patch -# Handle lack of RANDR (rhbz#1792393) -Patch220: 0001-monitor-manager-xrandr-Move-dpms-state-and-screen-si.patch -Patch221: 0002-monitor-manager-xrandr-Create-dummy-screen-sized-mon.patch +# Handle lack of RANDR (#1776530) +Patch250: 0001-monitor-manager-xrandr-Move-dpms-state-and-screen-si.patch +Patch251: 0002-monitor-manager-xrandr-Create-dummy-screen-sized-mon.patch + +# Fix build due to egl.pc provider change +Patch260: 0001-EGL-Include-EGL-eglmesaext.h.patch + +# Fix popups with styli +Patch261: 0001-wayland-Check-stylus-serials-on-meta_wayland_seat_ca.patch + +# Fix led-less pad mode switch buttons +Patch262: 0001-x11-Check-wacom-button-flags-to-determine-whether-bu.patch + +# Wacom fixes +Patch263: 0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch +Patch264: 0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch +Patch265: 0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch +Patch266: 0001-backends-Check-both-input-settings-and-mapper-for-ta.patch +Patch267: 0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch +Patch268: 0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch +Patch269: 0001-Skip-wacom-touchpads-when-updating-setting.patch + +# Revert stored-config behavior for VMs (#1365717) +Patch280: 0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch + +# Respect xrandr --panning (#1690170) +Patch281: 0001-crtc-xrandr-Respect-configured-RANDR-panning.patch + +# gnome-shell core dump after connection to docking station (#1809079) +Patch282: handle-hotplug-better.patch BuildRequires: chrpath BuildRequires: pango-devel @@ -227,13 +263,101 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog -* Tue Feb 04 2020 Jonas Ådahl - 3.32.2-12 +* Thu Mar 05 2020 Jonas Ådahl - 3.32.2-34 +- gnome-shell core dump after connection to docking station + Resolves: #1809079 + +* Mon Feb 24 2020 Jonas Ådahl - 3.32.2-33 +- Respect xrandr --panning + Resolves: #1690170 + +* Mon Feb 24 2020 Jonas Ådahl - 3.32.2-32 +- Revert stored-config behavior for VMs + Resolves: #1365717 + +* Mon Feb 24 2020 Carlos Garnacho - 3.32.2-31 +- Fixup detection of multiple mode switch buttons + Resolves: #1687979 + +* Fri Feb 21 2020 Carlos Garnacho - 3.32.2-30 +- Avoid toggling wacom touchpads on tap-to-click/drag setting updates + Resolves: #1716754 + +* Thu Feb 13 2020 Carlos Garnacho - 3.32.2-29 +- Fixup Wacom pad OSD so it appears on the right monitor + Resolves: #1777556 + +* Thu Feb 13 2020 Carlos Garnacho - 3.32.2-28 +- Fixup automatic enabling of wacom touchpad tapping + Resolves: #1716754 + +* Thu Feb 13 2020 Carlos Garnacho - 3.32.2-27 +- Fixup handling of multiple mode switch buttons in pads + Resolves: #1687979 + +* Mon Dec 16 2019 Carlos Garnacho - 3.32.2-26 +- Let pad OSD update on mode switching + Resolves: #1716774 + +* Fri Dec 13 2019 Carlos Garnacho - 3.32.2-25 +- Fix Wacom OSDs so they appear on the right monitor + Resolves: #1777556 + +* Fri Dec 13 2019 Carlos Garnacho - 3.32.2-24 +- Handle multiple mode switch buttons in Cintiq 27QHD + Resolves: #1687979 + +* Fri Dec 13 2019 Carlos Garnacho - 3.32.2-23 +- Enable tapping features by default on standalone Wacom tablets + Resolves: #1716754 + +* Fri Dec 13 2019 Carlos Garnacho - 3.32.2-22 +- Fix detection of Wacom tablet features on X11 + Resolves: #1759619 + +* Wed Dec 04 2019 Carlos Garnacho - 3.32.2-21 +- Fix mode switch pad buttons without LEDs + Resolves: #1666070 + +* Mon Dec 01 2019 Tomas Pelka - 3.32.2-20 +- Need rebuild in correct build target + Resolves: #1730891 + +* Fri Nov 29 2019 Carlos Garnacho - 3.32.2-19 +- Fix pop ups with stylus input + Resolves: #1730891 + +* Wed Nov 27 2019 Jonas Ådahl - 3.32.2-18 +- Revert memory leak fix + Resolves: #1777911 + +* Wed Nov 27 2019 Florian Müllner - 3.32.2-17 +- Fix some memory leaks + Resolves: #1719819 + +* Wed Nov 27 2019 Jonas Ådahl - 3.32.2-16 +- Fix build due to egl.pc provider change + Related: #1776530 + +* Wed Nov 27 2019 Jonas Ådahl - 3.32.2-15 - Handle lack of RANDR - Resolves: #1792393 + Resolves: #1776530 -* Wed Nov 13 2019 Olivier Fourdan - 3.32.2-11 +* Mon Nov 4 2019 Olivier Fourdan - 3.32.2-14 - Backports shadow FB improvements on llvmpipe - Resolves: #1757144 + Resolves: #1737553 + +* Wed Oct 30 2019 Jonas Ådahl - 3.32.2-13 +- Fix invalid read in idle monitor + Resolves: #1766695 + +* Wed Oct 30 2019 Jonas Ådahl - 3.32.2-12 +- Don't freeze if input happens after many days of inactivity + Resolves: #1766649 + +* Fri Oct 25 2019 Jonas Ådahl - 3.32.2-11 +- Don't freeze on rapid input + Resolves: #1759525 * Fri Aug 16 2019 Jonas Ådahl - 3.32.2-10 - Don't focus or activate unmanaging windows