diff --git a/0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch b/0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch deleted file mode 100644 index 732b7540e4ed9aefe1c1cd3d58fbd5337103a9ed..0000000000000000000000000000000000000000 --- a/0001-Create-explicit-WacomDevices-for-tablet-touchpad-dev.patch +++ /dev/null @@ -1,55 +0,0 @@ -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/0001-EGL-Include-EGL-eglmesaext.h.patch b/0001-EGL-Include-EGL-eglmesaext.h.patch deleted file mode 100644 index ae7ff469727ba700ed6eccd8720baa0369beb76d..0000000000000000000000000000000000000000 --- a/0001-EGL-Include-EGL-eglmesaext.h.patch +++ /dev/null @@ -1,68 +0,0 @@ -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/0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch b/0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch deleted file mode 100644 index f61ecf68acc661949783541013d600a9c76dd0c4..0000000000000000000000000000000000000000 --- a/0001-Revert-MetaMonitorManager-ignore-hotplug_mode_update.patch +++ /dev/null @@ -1,28 +0,0 @@ -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/0001-Revert-build-Do-not-provide-built-sources-as-libmutt.patch b/0001-Revert-build-Do-not-provide-built-sources-as-libmutt.patch new file mode 100644 index 0000000000000000000000000000000000000000..bd18e8a1d189f0570effef518d27a2c741717984 --- /dev/null +++ b/0001-Revert-build-Do-not-provide-built-sources-as-libmutt.patch @@ -0,0 +1,26 @@ +From 3899a01cd6cb00ca686946d3065d58f59f5c2099 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Tue, 17 Nov 2020 14:00:02 +0100 +Subject: [PATCH] Revert "build: Do not provide built sources as libmutter_dep + sources" + +This reverts commit 4e9a2e479969973bf3063c740ceff149036b3af4. +--- + src/meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/meson.build b/src/meson.build +index e7c99caee..8fe484ec2 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -955,6 +955,7 @@ libmutter = shared_library(libmutter_name, + libmutter_dep = declare_dependency( + link_with: libmutter, + include_directories: mutter_includes, ++ sources: mutter_built_sources, + dependencies: [ + libmutter_cogl_dep, + libmutter_clutter_dep, +-- +2.28.0 + diff --git a/0001-Skip-wacom-touchpads-when-updating-setting.patch b/0001-Skip-wacom-touchpads-when-updating-setting.patch deleted file mode 100644 index ba10e5e7310b60830fa1a43cb84de153dcac292f..0000000000000000000000000000000000000000 --- a/0001-Skip-wacom-touchpads-when-updating-setting.patch +++ /dev/null @@ -1,94 +0,0 @@ -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/0001-Test-deny-atomic-KMS-for-tegra-RHBZ-1936991.patch b/0001-Test-deny-atomic-KMS-for-tegra-RHBZ-1936991.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8473973172312530bef8442b6a5c206a321072e --- /dev/null +++ b/0001-Test-deny-atomic-KMS-for-tegra-RHBZ-1936991.patch @@ -0,0 +1,35 @@ +From 9d0ded3178777cd6afcdd5fff7b6f0f39a0d5236 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Tue, 9 Mar 2021 17:21:59 -0800 +Subject: [PATCH] Test: deny atomic KMS for "tegra" (RHBZ #1936991) + +Signed-off-by: Adam Williamson +--- + data/61-mutter.rules | 1 + + src/backends/native/meta-kms-device.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/data/61-mutter.rules b/data/61-mutter.rules +index edc03e6c1..d8e3c5f00 100644 +--- a/data/61-mutter.rules ++++ b/data/61-mutter.rules +@@ -3,3 +3,4 @@ DRIVERS=="nouveau", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers" + DRIVERS=="amdgpu", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers" + DRIVERS=="radeon", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers" + ENV{ID_PATH}=="platform-vkms", TAG+="mutter-device-ignore" ++DRIVER=="tegra", SUBSYSTEM=="platform", TAG+="mutter-device-disable-atomic-kms" +diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c +index 85aded9a6..e749ab6b9 100644 +--- a/src/backends/native/meta-kms-device.c ++++ b/src/backends/native/meta-kms-device.c +@@ -253,6 +253,7 @@ is_atomic_allowed (const char *driver_name) + "vboxvideo", + "nvidia-drm", + "virtio_gpu", ++ "tegra", + NULL, + }; + +-- +2.32.0 + diff --git a/0001-backend-Add-getter-for-MetaScreenCast.patch b/0001-backend-Add-getter-for-MetaScreenCast.patch deleted file mode 100644 index d50b11bdd045c27c31fcbafc79c2cdacb5cf0996..0000000000000000000000000000000000000000 --- a/0001-backend-Add-getter-for-MetaScreenCast.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 967d8236d81c8689f2fe60621ec7e66d88b43dea Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Wed, 17 Jun 2020 17:46:25 +0200 -Subject: [PATCH 1/4] backend: Add getter for MetaScreenCast - -https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318 ---- - src/backends/meta-backend-private.h | 2 ++ - src/backends/meta-backend.c | 11 +++++++++++ - 2 files changed, 13 insertions(+) - -diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h -index 81ec81e5f1..77f4da77c4 100644 ---- a/src/backends/meta-backend-private.h -+++ b/src/backends/meta-backend-private.h -@@ -138,6 +138,8 @@ MetaEgl * meta_backend_get_egl (MetaBackend *backend); - - #ifdef HAVE_REMOTE_DESKTOP - MetaRemoteDesktop * meta_backend_get_remote_desktop (MetaBackend *backend); -+ -+MetaScreenCast * meta_backend_get_screen_cast (MetaBackend *backend); - #endif - - gboolean meta_backend_grab_device (MetaBackend *backend, -diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c -index 750a9248a8..b498b7aa44 100644 ---- a/src/backends/meta-backend.c -+++ b/src/backends/meta-backend.c -@@ -965,6 +965,17 @@ meta_backend_get_remote_desktop (MetaBackend *backend) - - return priv->remote_desktop; - } -+ -+/** -+ * meta_backend_get_screen_cast: (skip) -+ */ -+MetaScreenCast * -+meta_backend_get_screen_cast (MetaBackend *backend) -+{ -+ MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); -+ -+ return priv->screen_cast; -+} - #endif /* HAVE_REMOTE_DESKTOP */ - - /** --- -2.26.2 - diff --git a/0001-backend-Clean-up-renderer-after-clutter-backendm.patch b/0001-backend-Clean-up-renderer-after-clutter-backendm.patch new file mode 100644 index 0000000000000000000000000000000000000000..e1d9c4d977557e434108bbb2bc46cf67206c9d30 --- /dev/null +++ b/0001-backend-Clean-up-renderer-after-clutter-backendm.patch @@ -0,0 +1,92 @@ +From ff4dc8cc8274dc5f6ed11515e05a341e4e2cec28 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Thu, 12 Aug 2021 14:13:23 -0400 +Subject: [PATCH] backend: Clean up renderer after clutter backendm + +commit c4a73e795020722eda3e2bec0c16d96f9f37333b added +code to cleanup the renderer when the meta backend is +disposed. Unfortunately, this introduced a crash when +the window manager is replaced. + +This is because cleaning up the renderer involves talking +to the X server over a display connection that's closed +two lines higher as part of the clutter_backend_destroy +call. + +This commit fixes the crash by swapping their order. +--- + src/backends/meta-backend.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c +index ff84bfe6a..7e8b4ee95 100644 +--- a/src/backends/meta-backend.c ++++ b/src/backends/meta-backend.c +@@ -216,63 +216,63 @@ meta_backend_dispose (GObject *object) + + if (priv->sleep_signal_id) + { + g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id); + priv->sleep_signal_id = 0; + } + + if (priv->upower_watch_id) + { + g_bus_unwatch_name (priv->upower_watch_id); + priv->upower_watch_id = 0; + } + + g_cancellable_cancel (priv->cancellable); + g_clear_object (&priv->cancellable); + g_clear_object (&priv->system_bus); + g_clear_object (&priv->upower_proxy); + + g_clear_handle_id (&priv->device_update_idle_id, g_source_remove); + + g_clear_pointer (&priv->device_monitors, g_hash_table_destroy); + + g_clear_object (&priv->settings); + + #ifdef HAVE_PROFILER + g_clear_object (&priv->profiler); + #endif + + g_clear_pointer (&priv->default_seat, clutter_seat_destroy); + g_clear_pointer (&priv->stage, clutter_actor_destroy); +- g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy); + g_clear_object (&priv->renderer); + g_clear_list (&priv->gpus, g_object_unref); ++ g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy); + + G_OBJECT_CLASS (meta_backend_parent_class)->dispose (object); + } + + static void + meta_backend_destroy (MetaBackend *backend) + { + g_object_run_dispose (G_OBJECT (backend)); + g_object_unref (backend); + } + + static void + meta_backend_sync_screen_size (MetaBackend *backend) + { + MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); + int width, height; + + meta_monitor_manager_get_screen_size (priv->monitor_manager, &width, &height); + + META_BACKEND_GET_CLASS (backend)->update_screen_size (backend, width, height); + } + + static void + reset_pointer_position (MetaBackend *backend) + { + MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); + MetaMonitorManager *monitor_manager = priv->monitor_manager; + ClutterSeat *seat = clutter_backend_get_default_seat (priv->clutter_backend); + MetaLogicalMonitor *primary; + +-- +2.31.1 + diff --git a/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch b/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch deleted file mode 100644 index 042025124bd031a6ae7110b569f4c83e56c3a6ef..0000000000000000000000000000000000000000 --- a/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch +++ /dev/null @@ -1,80 +0,0 @@ -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/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch b/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch deleted file mode 100644 index 9880a83d4d3b4735d323c43acd09510d0b59f0b3..0000000000000000000000000000000000000000 --- a/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch +++ /dev/null @@ -1,205 +0,0 @@ -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/0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch b/0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch deleted file mode 100644 index f7fa3b2fbdaf10109fac959539a791f687ca47ef..0000000000000000000000000000000000000000 --- a/0001-backends-Consider-pen-eraser-devices-when-looking-fo.patch +++ /dev/null @@ -1,30 +0,0 @@ -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/0001-backends-Move-MetaKeyboardA11yFlags-to-a-public-head.patch b/0001-backends-Move-MetaKeyboardA11yFlags-to-a-public-head.patch new file mode 100644 index 0000000000000000000000000000000000000000..7af82f18b7d6bcbf8b6cd4afc384c5d99139fa94 --- /dev/null +++ b/0001-backends-Move-MetaKeyboardA11yFlags-to-a-public-head.patch @@ -0,0 +1,144 @@ +From 651f5e0c6a33d9ac32c2a16735a026153a2ddf38 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Tue, 14 Jun 2022 16:31:43 +0200 +Subject: [PATCH] backends: Move MetaKeyboardA11yFlags to a public header + +The MetaKeyboardA11yFlags are used by gnome-shell to show a dialog +whenever a keyboard accessibility feature is switched using the +keyboard. + +Unfortunately, commit c3acaeb25 renamed the Clutter flag to Meta and +moved them to a private header. As a result, gnome-shell do not show any +dialog anymore when a keyboard accessibility feature is activated. + +Move the MetaKeyboardA11yFlags definition to a public header so that +gnome-shell can use it. + +Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2306 +Fixes: c3acaeb25 - backends: Move keyboard a11y into backends +Part-of: +--- + src/backends/meta-input-settings-private.h | 19 +------ + src/meta/meson.build | 1 + + src/meta/meta-enums.h | 62 ++++++++++++++++++++++ + 3 files changed, 64 insertions(+), 18 deletions(-) + create mode 100644 src/meta/meta-enums.h + +diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h +index 42ee0e0e6..5ef54ee84 100644 +--- a/src/backends/meta-input-settings-private.h ++++ b/src/backends/meta-input-settings-private.h +@@ -31,29 +31,12 @@ + #include "backends/meta-backend-types.h" + #include "clutter/clutter.h" + #include "meta/display.h" ++#include "meta/meta-enums.h" + + #define META_TYPE_INPUT_SETTINGS (meta_input_settings_get_type ()) + G_DECLARE_DERIVABLE_TYPE (MetaInputSettings, meta_input_settings, + META, INPUT_SETTINGS, GObject) + +-typedef enum +-{ +- META_A11Y_KEYBOARD_ENABLED = 1 << 0, +- META_A11Y_TIMEOUT_ENABLED = 1 << 1, +- META_A11Y_MOUSE_KEYS_ENABLED = 1 << 2, +- META_A11Y_SLOW_KEYS_ENABLED = 1 << 3, +- META_A11Y_SLOW_KEYS_BEEP_PRESS = 1 << 4, +- META_A11Y_SLOW_KEYS_BEEP_ACCEPT = 1 << 5, +- META_A11Y_SLOW_KEYS_BEEP_REJECT = 1 << 6, +- META_A11Y_BOUNCE_KEYS_ENABLED = 1 << 7, +- META_A11Y_BOUNCE_KEYS_BEEP_REJECT = 1 << 8, +- META_A11Y_TOGGLE_KEYS_ENABLED = 1 << 9, +- META_A11Y_STICKY_KEYS_ENABLED = 1 << 10, +- META_A11Y_STICKY_KEYS_TWO_KEY_OFF = 1 << 11, +- META_A11Y_STICKY_KEYS_BEEP = 1 << 12, +- META_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13, +-} MetaKeyboardA11yFlags; +- + /** + * MetaKbdA11ySettings: + * +diff --git a/src/meta/meson.build b/src/meta/meson.build +index a096ee4dd..4a67abb25 100644 +--- a/src/meta/meson.build ++++ b/src/meta/meson.build +@@ -17,6 +17,7 @@ mutter_public_headers = [ + 'meta-close-dialog.h', + 'meta-cursor-tracker.h', + 'meta-dnd.h', ++ 'meta-enums.h', + 'meta-idle-monitor.h', + 'meta-inhibit-shortcuts-dialog.h', + 'meta-launch-context.h', +diff --git a/src/meta/meta-enums.h b/src/meta/meta-enums.h +new file mode 100644 +index 000000000..e59ebaf72 +--- /dev/null ++++ b/src/meta/meta-enums.h +@@ -0,0 +1,62 @@ ++/* ++ * Copyright (C) 2016-2021 Red Hat Inc. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++ * 02111-1307, USA. ++ * ++ */ ++ ++#ifndef META_ENUMS_H ++#define META_ENUMS_H ++ ++/** ++ * MetaKeyboardA11yFlags: ++ * @META_A11Y_KEYBOARD_ENABLED: ++ * @META_A11Y_TIMEOUT_ENABLED: ++ * @META_A11Y_MOUSE_KEYS_ENABLED: ++ * @META_A11Y_SLOW_KEYS_ENABLED: ++ * @META_A11Y_SLOW_KEYS_BEEP_PRESS: ++ * @META_A11Y_SLOW_KEYS_BEEP_ACCEPT: ++ * @META_A11Y_SLOW_KEYS_BEEP_REJECT: ++ * @META_A11Y_BOUNCE_KEYS_ENABLED: ++ * @META_A11Y_BOUNCE_KEYS_BEEP_REJECT: ++ * @META_A11Y_TOGGLE_KEYS_ENABLED: ++ * @META_A11Y_STICKY_KEYS_ENABLED: ++ * @META_A11Y_STICKY_KEYS_TWO_KEY_OFF: ++ * @META_A11Y_STICKY_KEYS_BEEP: ++ * @META_A11Y_FEATURE_STATE_CHANGE_BEEP: ++ * ++ * Keyboard accessibility features. ++ * ++ */ ++typedef enum ++{ ++ META_A11Y_KEYBOARD_ENABLED = 1 << 0, ++ META_A11Y_TIMEOUT_ENABLED = 1 << 1, ++ META_A11Y_MOUSE_KEYS_ENABLED = 1 << 2, ++ META_A11Y_SLOW_KEYS_ENABLED = 1 << 3, ++ META_A11Y_SLOW_KEYS_BEEP_PRESS = 1 << 4, ++ META_A11Y_SLOW_KEYS_BEEP_ACCEPT = 1 << 5, ++ META_A11Y_SLOW_KEYS_BEEP_REJECT = 1 << 6, ++ META_A11Y_BOUNCE_KEYS_ENABLED = 1 << 7, ++ META_A11Y_BOUNCE_KEYS_BEEP_REJECT = 1 << 8, ++ META_A11Y_TOGGLE_KEYS_ENABLED = 1 << 9, ++ META_A11Y_STICKY_KEYS_ENABLED = 1 << 10, ++ META_A11Y_STICKY_KEYS_TWO_KEY_OFF = 1 << 11, ++ META_A11Y_STICKY_KEYS_BEEP = 1 << 12, ++ META_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13, ++} MetaKeyboardA11yFlags; ++ ++#endif /* META_ENUMS_H */ +-- +2.36.1 + diff --git a/0001-backends-x11-Fix-key-repeat-of-on-screen-keyboard-fo.patch b/0001-backends-x11-Fix-key-repeat-of-on-screen-keyboard-fo.patch new file mode 100644 index 0000000000000000000000000000000000000000..10994612fc54ab159172775e96b58d63034dbc87 --- /dev/null +++ b/0001-backends-x11-Fix-key-repeat-of-on-screen-keyboard-fo.patch @@ -0,0 +1,260 @@ +From a1f33bdac95ba4fd0599f164ef893c05d8be123b Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Wed, 6 Oct 2021 15:31:30 -0400 +Subject: [PATCH] backends/x11: Fix key repeat of on-screen keyboard for second + level keysyms + +Certains keys (such as ~ and |) are in the keyboard map behind the +second shift level. This means in order for them to be input, the +shift key needs to be held down by the user. + +The GNOME Shell on-screen keyboard presents these keys separately on +a page of keys that has no shift key. Instead, it relies on mutter +to set a shift latch before the key event is emitted. A shift latch +is a virtual press of the shift key that automatically gets released +after the next key press (in our case the ~ or | key). + +The problem is using a shift latch doesn't work very well in the face +of key repeat. The latch is automatically released after the first +press, and subsequent repeats of that press no longer have shift +latched to them. + +This commit fixes the problem by using a shift lock instead of a shift +latch. A shift lock is never implicitly released, so it remains +in place for the duration of key repeat. +--- + src/backends/x11/meta-keymap-x11.c | 12 ++++++------ + src/backends/x11/meta-keymap-x11.h | 6 +++--- + src/backends/x11/meta-virtual-input-device-x11.c | 4 ++-- + 3 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/backends/x11/meta-keymap-x11.c b/src/backends/x11/meta-keymap-x11.c +index da5d064e7..1192cc387 100644 +--- a/src/backends/x11/meta-keymap-x11.c ++++ b/src/backends/x11/meta-keymap-x11.c +@@ -829,85 +829,85 @@ meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11, + g_warning ("Cannot reserve a keycode for keyval %d: no available keycode", keyval); + return FALSE; + } + + if (!meta_keymap_x11_replace_keycode (keymap_x11, *keycode_out, keyval)) + { + g_warning ("Failed to remap keycode %d to keyval %d", *keycode_out, keyval); + return FALSE; + } + + g_hash_table_insert (keymap_x11->reserved_keycodes, GUINT_TO_POINTER (*keycode_out), GUINT_TO_POINTER (keyval)); + g_queue_remove (keymap_x11->available_keycodes, GUINT_TO_POINTER (*keycode_out)); + + return TRUE; + } + + void + meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11, + uint32_t keycode) + { + g_return_if_fail (META_IS_KEYMAP_X11 (keymap_x11)); + + if (!g_hash_table_contains (keymap_x11->reserved_keycodes, GUINT_TO_POINTER (keycode)) || + g_queue_index (keymap_x11->available_keycodes, GUINT_TO_POINTER (keycode)) != -1) + return; + + g_queue_push_tail (keymap_x11->available_keycodes, GUINT_TO_POINTER (keycode)); + } + + void +-meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11, +- uint32_t level, +- gboolean enable) ++meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11, ++ uint32_t level, ++ gboolean enable) + { + uint32_t modifiers[] = { + 0, + ShiftMask, + keymap_x11->level3_shift_mask, + keymap_x11->level3_shift_mask | ShiftMask, + }; + uint32_t value = 0; + + if (!keymap_x11->use_xkb) + return; + + level = CLAMP (level, 0, G_N_ELEMENTS (modifiers) - 1); + + if (enable) + value = modifiers[level]; + else + value = 0; + +- XkbLatchModifiers (clutter_x11_get_default_display (), +- XkbUseCoreKbd, modifiers[level], +- value); ++ XkbLockModifiers (clutter_x11_get_default_display (), ++ XkbUseCoreKbd, modifiers[level], ++ value); + } + + static uint32_t + meta_keymap_x11_get_current_group (MetaKeymapX11 *keymap_x11) + { + XkbStateRec state_rec; + + if (keymap_x11->current_group >= 0) + return keymap_x11->current_group; + + XkbGetState (clutter_x11_get_default_display (), + XkbUseCoreKbd, &state_rec); + return XkbStateGroup (&state_rec); + } + + gboolean + meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11, + uint32_t keyval, + uint32_t *keycode_out, + uint32_t *level_out) + { + ClutterKeymapKey *keys; + int i, n_keys, group; + gboolean found = FALSE; + + g_return_val_if_fail (keycode_out != NULL, FALSE); + g_return_val_if_fail (level_out != NULL, FALSE); + + group = meta_keymap_x11_get_current_group (keymap_x11); + +diff --git a/src/backends/x11/meta-keymap-x11.h b/src/backends/x11/meta-keymap-x11.h +index 67a5f8eb9..2f93acdbc 100644 +--- a/src/backends/x11/meta-keymap-x11.h ++++ b/src/backends/x11/meta-keymap-x11.h +@@ -17,45 +17,45 @@ + * Author: Emmanuele Bassi + */ + + #ifndef META_KEYMAP_X11_H + #define META_KEYMAP_X11_H + + #include + #include + + #include "clutter/clutter.h" + + G_BEGIN_DECLS + + #define META_TYPE_KEYMAP_X11 (meta_keymap_x11_get_type ()) + G_DECLARE_FINAL_TYPE (MetaKeymapX11, meta_keymap_x11, + META, KEYMAP_X11, ClutterKeymap) + + int meta_keymap_x11_get_key_group (MetaKeymapX11 *keymap, + ClutterModifierType state); + int meta_keymap_x11_translate_key_state (MetaKeymapX11 *keymap, + guint hardware_keycode, + ClutterModifierType *modifier_state_p, + ClutterModifierType *mods_p); + gboolean meta_keymap_x11_get_is_modifier (MetaKeymapX11 *keymap, + int keycode); + + gboolean meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11, + guint keyval, + guint *keycode_out, + guint *level_out); +-void meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11, +- uint32_t level, +- gboolean enable); ++void meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11, ++ uint32_t level, ++ gboolean enable); + gboolean meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11, + guint keyval, + guint *keycode_out); + void meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11, + guint keycode); + + gboolean meta_keymap_x11_handle_event (MetaKeymapX11 *keymap_x11, + XEvent *xevent); + + G_END_DECLS + + #endif /* META_KEYMAP_X11_H */ +diff --git a/src/backends/x11/meta-virtual-input-device-x11.c b/src/backends/x11/meta-virtual-input-device-x11.c +index fe6040859..1a5cdfc2e 100644 +--- a/src/backends/x11/meta-virtual-input-device-x11.c ++++ b/src/backends/x11/meta-virtual-input-device-x11.c +@@ -159,71 +159,71 @@ meta_virtual_input_device_x11_notify_key (ClutterVirtualInputDevice *virtual_dev + ClutterKeyState key_state) + { + XTestFakeKeyEvent (clutter_x11_get_default_display (), + key + 8, key_state == CLUTTER_KEY_STATE_PRESSED, 0); + } + + static void + meta_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_device, + uint64_t time_us, + uint32_t keyval, + ClutterKeyState key_state) + { + ClutterBackend *backend = clutter_get_default_backend (); + ClutterSeat *seat = clutter_backend_get_default_seat (backend); + MetaKeymapX11 *keymap = META_KEYMAP_X11 (clutter_seat_get_keymap (seat)); + uint32_t keycode, level; + + if (!meta_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level)) + { + level = 0; + + if (!meta_keymap_x11_reserve_keycode (keymap, keyval, &keycode)) + { + g_warning ("No keycode found for keyval %x in current group", keyval); + return; + } + } + + if (!meta_keymap_x11_get_is_modifier (keymap, keycode) && + key_state == CLUTTER_KEY_STATE_PRESSED) +- meta_keymap_x11_latch_modifiers (keymap, level, TRUE); ++ meta_keymap_x11_lock_modifiers (keymap, level, TRUE); + + XTestFakeKeyEvent (clutter_x11_get_default_display (), + (KeyCode) keycode, + key_state == CLUTTER_KEY_STATE_PRESSED, 0); + + + if (key_state == CLUTTER_KEY_STATE_RELEASED) + { + if (!meta_keymap_x11_get_is_modifier (keymap, keycode)) +- meta_keymap_x11_latch_modifiers (keymap, level, FALSE); ++ meta_keymap_x11_lock_modifiers (keymap, level, FALSE); + meta_keymap_x11_release_keycode_if_needed (keymap, keycode); + } + } + + static void + meta_virtual_input_device_x11_notify_touch_down (ClutterVirtualInputDevice *virtual_device, + uint64_t time_us, + int device_slot, + double x, + double y) + { + g_warning ("Virtual touch motion not implemented under X11"); + } + + static void + meta_virtual_input_device_x11_notify_touch_motion (ClutterVirtualInputDevice *virtual_device, + uint64_t time_us, + int device_slot, + double x, + double y) + { + g_warning ("Virtual touch motion not implemented under X11"); + } + + static void + meta_virtual_input_device_x11_notify_touch_up (ClutterVirtualInputDevice *virtual_device, + uint64_t time_us, + int device_slot) + { + g_warning ("Virtual touch motion not implemented under X11"); +-- +2.33.1 + diff --git a/0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch b/0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch deleted file mode 100644 index ac6986f05648999876fe1fc24584d8216aff1e1c..0000000000000000000000000000000000000000 --- a/0001-backends-x11-Observe-multiple-pad-mode-switch-button.patch +++ /dev/null @@ -1,118 +0,0 @@ -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/0001-backends-x11-Support-synaptics-configuration.patch b/0001-backends-x11-Support-synaptics-configuration.patch deleted file mode 100644 index 2dd5bb9b4c522c006e6f8c5dbad25e37c8633c75..0000000000000000000000000000000000000000 --- a/0001-backends-x11-Support-synaptics-configuration.patch +++ /dev/null @@ -1,349 +0,0 @@ -From 471174ba6cf517baf8ff73e903202e1c73b6ec74 Mon Sep 17 00:00:00 2001 -From: Carlos Garnacho -Date: Thu, 19 Jan 2017 15:03:41 +0100 -Subject: [PATCH] backends/x11: Support synaptics configuration - -The code is taken mostly as-is from g-s-d, so we can drag the -dead horse a bit longer. ---- - src/backends/x11/meta-input-settings-x11.c | 268 +++++++++++++++++++++ - 1 file changed, 268 insertions(+) - -diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c -index 89f07ee1f..051a1c605 100644 ---- a/src/backends/x11/meta-input-settings-x11.c -+++ b/src/backends/x11/meta-input-settings-x11.c -@@ -26,6 +26,7 @@ - #include "backends/x11/meta-input-settings-x11.h" - - #include -+#include - #include - #include - #include -@@ -162,6 +163,180 @@ change_property (ClutterInputDevice *device, - meta_XFree (data_ret); - } - -+static gboolean -+is_device_synaptics (ClutterInputDevice *device) -+{ -+ guchar *has_setting; -+ -+ /* We just need looking for a synaptics-specific property */ -+ has_setting = get_property (device, "Synaptics Off", XA_INTEGER, 8, 1); -+ if (!has_setting) -+ return FALSE; -+ -+ meta_XFree (has_setting); -+ return TRUE; -+} -+ -+static void -+change_synaptics_tap_left_handed (ClutterInputDevice *device, -+ gboolean tap_enabled, -+ gboolean left_handed) -+{ -+ MetaDisplay *display = meta_get_display (); -+ MetaX11Display *x11_display = display ? display->x11_display : NULL; -+ MetaBackend *backend = meta_get_backend (); -+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); -+ XDevice *xdevice; -+ guchar *tap_action, *buttons; -+ guint buttons_capacity = 16, n_buttons; -+ -+ xdevice = XOpenDevice(xdisplay, clutter_input_device_get_device_id (device)); -+ if (!xdevice) -+ return; -+ -+ tap_action = get_property (device, "Synaptics Tap Action", -+ XA_INTEGER, 8, 7); -+ if (!tap_action) -+ goto out; -+ -+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0; -+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0; -+ tap_action[6] = tap_enabled ? 2 : 0; -+ -+ change_property (device, "Synaptics Tap Action", -+ XA_INTEGER, 8, tap_action, 7); -+ meta_XFree (tap_action); -+ -+ if (x11_display) -+ meta_x11_error_trap_push (x11_display); -+ buttons = g_new (guchar, buttons_capacity); -+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice, -+ buttons, buttons_capacity); -+ -+ while (n_buttons > buttons_capacity) -+ { -+ buttons_capacity = n_buttons; -+ buttons = (guchar *) g_realloc (buttons, -+ buttons_capacity * sizeof (guchar)); -+ -+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice, -+ buttons, buttons_capacity); -+ } -+ -+ buttons[0] = left_handed ? 3 : 1; -+ buttons[2] = left_handed ? 1 : 3; -+ XSetDeviceButtonMapping (xdisplay, xdevice, buttons, n_buttons); -+ g_free (buttons); -+ -+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display)) -+ { -+ g_warning ("Could not set synaptics touchpad left-handed for %s", -+ clutter_input_device_get_device_name (device)); -+ } -+ -+ out: -+ XCloseDevice (xdisplay, xdevice); -+} -+ -+static void -+change_synaptics_speed (ClutterInputDevice *device, -+ gdouble speed) -+{ -+ MetaDisplay *display = meta_get_display (); -+ MetaX11Display *x11_display = display ? display->x11_display : NULL; -+ MetaBackend *backend = meta_get_backend (); -+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); -+ XDevice *xdevice; -+ XPtrFeedbackControl feedback; -+ XFeedbackState *states, *state; -+ int i, num_feedbacks, motion_threshold, numerator, denominator; -+ gfloat motion_acceleration; -+ -+ xdevice = XOpenDevice(xdisplay, clutter_input_device_get_device_id (device)); -+ if (!xdevice) -+ return; -+ /* Get the list of feedbacks for the device */ -+ states = XGetFeedbackControl (xdisplay, xdevice, &num_feedbacks); -+ if (!states) -+ return; -+ -+ /* Calculate acceleration and threshold */ -+ motion_acceleration = (speed + 1) * 5; /* speed is [-1..1], map to [0..10] */ -+ motion_threshold = CLAMP (10 - floor (motion_acceleration), 1, 10); -+ -+ if (motion_acceleration >= 1.0) -+ { -+ /* we want to get the acceleration, with a resolution of 0.5 -+ */ -+ if ((motion_acceleration - floor (motion_acceleration)) < 0.25) -+ { -+ numerator = floor (motion_acceleration); -+ denominator = 1; -+ } -+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.5) -+ { -+ numerator = ceil (2.0 * motion_acceleration); -+ denominator = 2; -+ } -+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.75) -+ { -+ numerator = floor (2.0 *motion_acceleration); -+ denominator = 2; -+ } -+ else -+ { -+ numerator = ceil (motion_acceleration); -+ denominator = 1; -+ } -+ } -+ else if (motion_acceleration < 1.0 && motion_acceleration > 0) -+ { -+ /* This we do to 1/10ths */ -+ numerator = floor (motion_acceleration * 10) + 1; -+ denominator= 10; -+ } -+ else -+ { -+ numerator = -1; -+ denominator = -1; -+ } -+ -+ if (x11_display) -+ meta_x11_error_trap_push (x11_display); -+ -+ state = (XFeedbackState *) states; -+ -+ for (i = 0; i < num_feedbacks; i++) -+ { -+ if (state->class == PtrFeedbackClass) -+ { -+ /* And tell the device */ -+ feedback.class = PtrFeedbackClass; -+ feedback.length = sizeof (XPtrFeedbackControl); -+ feedback.id = state->id; -+ feedback.threshold = motion_threshold; -+ feedback.accelNum = numerator; -+ feedback.accelDenom = denominator; -+ -+ XChangeFeedbackControl (xdisplay, xdevice, -+ DvAccelNum | DvAccelDenom | DvThreshold, -+ (XFeedbackControl *) &feedback); -+ break; -+ } -+ -+ state = (XFeedbackState *) ((char *) state + state->length); -+ } -+ -+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display)) -+ { -+ g_warning ("Could not set synaptics touchpad acceleration for %s", -+ clutter_input_device_get_device_name (device)); -+ } -+ -+ XFreeFeedbackList (states); -+ XCloseDevice (xdisplay, xdevice); -+} -+ - static void - meta_input_settings_x11_set_send_events (MetaInputSettings *settings, - ClutterInputDevice *device, -@@ -170,6 +345,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings, - guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */ - guchar *available; - -+ if (is_device_synaptics (device)) -+ { -+ values[0] = mode != G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED; -+ change_property (device, "Synaptics Off", XA_INTEGER, 8, &values, 1); -+ return; -+ } -+ - available = get_property (device, "libinput Send Events Modes Available", - XA_INTEGER, 8, 2); - if (!available) -@@ -222,6 +404,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings, - Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); - gfloat value = speed; - -+ if (is_device_synaptics (device)) -+ { -+ change_synaptics_speed (device, speed); -+ return; -+ } -+ - change_property (device, "libinput Accel Speed", - XInternAtom (xdisplay, "FLOAT", False), - 32, &value, 1); -@@ -248,6 +436,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings, - else - { - value = enabled ? 1 : 0; -+ -+ if (is_device_synaptics (device)) -+ { -+ GSettings *settings; -+ -+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad"); -+ change_synaptics_tap_left_handed (device, -+ g_settings_get_boolean (settings, "tap-to-click"), -+ enabled); -+ g_object_unref (settings); -+ return; -+ } -+ - change_property (device, "libinput Left Handed Enabled", - XA_INTEGER, 8, &value, 1); - } -@@ -271,6 +472,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings, - { - guchar value = (enabled) ? 1 : 0; - -+ if (is_device_synaptics (device)) -+ { -+ GDesktopTouchpadHandedness handedness; -+ GSettings *settings; -+ -+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad"); -+ handedness = g_settings_get_enum (settings, "left-handed"); -+ g_object_unref (settings); -+ -+ change_synaptics_tap_left_handed (device, enabled, -+ handedness == G_DESKTOP_TOUCHPAD_HANDEDNESS_LEFT); -+ return; -+ } -+ - change_property (device, "libinput Tapping Enabled", - XA_INTEGER, 8, &value, 1); - } -@@ -293,6 +508,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings, - { - guchar value = (inverted) ? 1 : 0; - -+ if (is_device_synaptics (device)) -+ { -+ gint32 *scrolling_distance; -+ -+ scrolling_distance = get_property (device, "Synaptics Scrolling Distance", -+ XA_INTEGER, 32, 2); -+ if (scrolling_distance) -+ { -+ scrolling_distance[0] = inverted ? -+ -abs (scrolling_distance[0]) : abs (scrolling_distance[0]); -+ scrolling_distance[1] = inverted ? -+ -abs (scrolling_distance[1]) : abs (scrolling_distance[1]); -+ -+ change_property (device, "Synaptics Scrolling Distance", -+ XA_INTEGER, 32, scrolling_distance, 2); -+ meta_XFree (scrolling_distance); -+ } -+ -+ return; -+ } -+ - change_property (device, "libinput Natural Scrolling Enabled", - XA_INTEGER, 8, &value, 1); - } -@@ -306,6 +542,22 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings, - guchar *current = NULL; - guchar *available = NULL; - -+ if (is_device_synaptics (device)) -+ { -+ current = get_property (device, "Synaptics Edge Scrolling", -+ XA_INTEGER, 8, 3); -+ if (current) -+ { -+ current[0] = !!edge_scroll_enabled; -+ current[1] = !!edge_scroll_enabled; -+ change_property (device, "Synaptics Edge Scrolling", -+ XA_INTEGER, 8, current, 3); -+ meta_XFree (current); -+ } -+ -+ return; -+ } -+ - available = get_property (device, "libinput Scroll Methods Available", - XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS); - if (!available || !available[SCROLL_METHOD_FIELD_EDGE]) -@@ -335,6 +587,22 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set - guchar *current = NULL; - guchar *available = NULL; - -+ if (is_device_synaptics (device)) -+ { -+ current = get_property (device, "Synaptics Two-Finger Scrolling", -+ XA_INTEGER, 8, 2); -+ if (current) -+ { -+ current[0] = !!two_finger_scroll_enabled; -+ current[1] = !!two_finger_scroll_enabled; -+ change_property (device, "Synaptics Two-Finger Scrolling", -+ XA_INTEGER, 8, current, 2); -+ meta_XFree (current); -+ } -+ -+ return; -+ } -+ - available = get_property (device, "libinput Scroll Methods Available", - XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS); - if (!available || !available[SCROLL_METHOD_FIELD_2FG]) --- -2.21.0 - diff --git a/0001-background-Reload-when-GPU-memory-is-invalidated.patch b/0001-background-Reload-when-GPU-memory-is-invalidated.patch deleted file mode 100644 index fae4a7e7e5c2e47e365fa0a0755de88e58a49899..0000000000000000000000000000000000000000 --- a/0001-background-Reload-when-GPU-memory-is-invalidated.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 5a486f5b6bf5f838db5dc2bfc5819a0cba5d2d19 Mon Sep 17 00:00:00 2001 -From: Daniel van Vugt -Date: Thu, 23 May 2019 18:15:28 +0800 -Subject: [PATCH] background: Reload when GPU memory is invalidated - -Fixes corrupt background wallpaper when resuming from suspend on the -Nvidia driver. - -https://gitlab.gnome.org/GNOME/gnome-shell/issues/1084 - -(cherry picked from commit a5265365dd268e15a461a58000a10b122d0bccba) - -https://gitlab.gnome.org/GNOME/mutter/merge_requests/777 ---- - src/compositor/meta-background.c | 46 +++++++++++++++++++++++++------- - 1 file changed, 36 insertions(+), 10 deletions(-) - -diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c -index c033395fe..387ce5dd3 100644 ---- a/src/compositor/meta-background.c -+++ b/src/compositor/meta-background.c -@@ -252,12 +252,11 @@ static void - set_file (MetaBackground *self, - GFile **filep, - MetaBackgroundImage **imagep, -- GFile *file) -+ GFile *file, -+ gboolean force_reload) - { -- if (!file_equal0 (*filep, file)) -+ if (force_reload || !file_equal0 (*filep, file)) - { -- g_clear_object (filep); -- - if (*imagep) - { - g_signal_handlers_disconnect_by_func (*imagep, -@@ -267,11 +266,12 @@ set_file (MetaBackground *self, - *imagep = NULL; - } - -+ g_set_object (filep, file); -+ - if (file) - { - MetaBackgroundImageCache *cache = meta_background_image_cache_get_default (); - -- *filep = g_object_ref (file); - *imagep = meta_background_image_cache_load (cache, file); - g_signal_connect (*imagep, "loaded", - G_CALLBACK (on_background_loaded), self); -@@ -279,6 +279,32 @@ set_file (MetaBackground *self, - } - } - -+static void -+on_gl_video_memory_purged (MetaBackground *self) -+{ -+ MetaBackgroundImageCache *cache = meta_background_image_cache_get_default (); -+ -+ /* The GPU memory that just got invalidated is the texture inside -+ * self->background_image1,2 and/or its mipmaps. However, to save memory the -+ * original pixbuf isn't kept in RAM so we can't do a simple re-upload. The -+ * only copy of the image was the one in texture memory that got invalidated. -+ * So we need to do a full reload from disk. -+ */ -+ if (self->file1) -+ { -+ meta_background_image_cache_purge (cache, self->file1); -+ set_file (self, &self->file1, &self->background_image1, self->file1, TRUE); -+ } -+ -+ if (self->file2) -+ { -+ meta_background_image_cache_purge (cache, self->file2); -+ set_file (self, &self->file2, &self->background_image2, self->file2, TRUE); -+ } -+ -+ mark_changed (self); -+} -+ - static void - meta_background_dispose (GObject *object) - { -@@ -287,8 +313,8 @@ meta_background_dispose (GObject *object) - free_color_texture (self); - free_wallpaper_texture (self); - -- set_file (self, &self->file1, &self->background_image1, NULL); -- set_file (self, &self->file2, &self->background_image2, NULL); -+ set_file (self, &self->file1, &self->background_image1, NULL, FALSE); -+ set_file (self, &self->file2, &self->background_image2, NULL, FALSE); - - set_display (self, NULL); - -@@ -312,7 +338,7 @@ meta_background_constructed (GObject *object) - G_OBJECT_CLASS (meta_background_parent_class)->constructed (object); - - g_signal_connect_object (self->display, "gl-video-memory-purged", -- G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED); -+ G_CALLBACK (on_gl_video_memory_purged), object, G_CONNECT_SWAPPED); - - g_signal_connect_object (monitor_manager, "monitors-changed", - G_CALLBACK (on_monitors_changed), self, -@@ -937,8 +963,8 @@ meta_background_set_blend (MetaBackground *self, - g_return_if_fail (META_IS_BACKGROUND (self)); - g_return_if_fail (blend_factor >= 0.0 && blend_factor <= 1.0); - -- set_file (self, &self->file1, &self->background_image1, file1); -- set_file (self, &self->file2, &self->background_image2, file2); -+ set_file (self, &self->file1, &self->background_image1, file1, FALSE); -+ set_file (self, &self->file2, &self->background_image2, file2, FALSE); - - self->blend_factor = blend_factor; - self->style = style; --- -2.26.2 - diff --git a/0001-clutter-Backport-of-touch-mode.patch b/0001-clutter-Backport-of-touch-mode.patch deleted file mode 100644 index dff32fa65e16b86b33f6e0b3908709fa85ea0627..0000000000000000000000000000000000000000 --- a/0001-clutter-Backport-of-touch-mode.patch +++ /dev/null @@ -1,357 +0,0 @@ -From 2a2e870c139e2130b00d582546616269bca27458 Mon Sep 17 00:00:00 2001 -From: Carlos Garnacho -Date: Fri, 4 Sep 2020 17:11:36 +0200 -Subject: [PATCH] clutter: Backport of ::touch-mode - -In upstream/master this is a ClutterSeat readonly property. Add it to -ClutterDeviceManager here, the mechanism and triggering is the same -though. ---- - clutter/clutter/clutter-device-manager.c | 24 +++ - clutter/clutter/clutter-device-manager.h | 2 + - .../evdev/clutter-device-manager-evdev.c | 179 ++++++++++++++++++ - 3 files changed, 205 insertions(+) - -diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c -index c676384..e1cc455 100644 ---- a/clutter/clutter/clutter-device-manager.c -+++ b/clutter/clutter/clutter-device-manager.c -@@ -62,6 +62,7 @@ enum - PROP_0, - - PROP_BACKEND, -+ PROP_TOUCH_MODE, - - PROP_LAST - }; -@@ -108,6 +109,7 @@ clutter_device_manager_set_property (GObject *gobject, - priv->backend = g_value_get_object (value); - break; - -+ case PROP_TOUCH_MODE: - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - } -@@ -127,6 +129,10 @@ clutter_device_manager_get_property (GObject *gobject, - g_value_set_object (value, priv->backend); - break; - -+ case PROP_TOUCH_MODE: -+ g_value_set_boolean (value, FALSE); -+ break; -+ - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - } -@@ -143,6 +149,12 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) - P_("The ClutterBackend of the device manager"), - CLUTTER_TYPE_BACKEND, - CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); -+ obj_props[PROP_TOUCH_MODE] = -+ g_param_spec_boolean ("touch-mode", -+ P_("Touch mode"), -+ P_("Touch mode"), -+ FALSE, -+ CLUTTER_PARAM_READABLE); - - gobject_class->set_property = clutter_device_manager_set_property; - gobject_class->get_property = clutter_device_manager_get_property; -@@ -579,3 +591,15 @@ clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_man - - *settings = device_manager->priv->kbd_a11y_settings; - } -+ -+gboolean -+clutter_device_manager_get_touch_mode (ClutterDeviceManager *device_manager) -+{ -+ gboolean touch_mode; -+ -+ g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), FALSE); -+ -+ g_object_get (G_OBJECT (device_manager), "touch-mode", &touch_mode, NULL); -+ -+ return touch_mode; -+} -diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h -index 1cbf030..a4a6271 100644 ---- a/clutter/clutter/clutter-device-manager.h -+++ b/clutter/clutter/clutter-device-manager.h -@@ -155,6 +155,8 @@ void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *devic - CLUTTER_EXPORT - void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager, - ClutterKbdA11ySettings *settings); -+CLUTTER_EXPORT -+gboolean clutter_device_manager_get_touch_mode (ClutterDeviceManager *device_manager); - - G_END_DECLS - -diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c -index 84b0aad..78b5b64 100644 ---- a/clutter/clutter/evdev/clutter-device-manager-evdev.c -+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c -@@ -108,6 +108,19 @@ struct _ClutterDeviceManagerEvdevPrivate - - gint device_id_next; - GList *free_device_ids; -+ -+ guint tablet_mode_switch_state : 1; -+ guint has_touchscreen : 1; -+ guint has_tablet_switch : 1; -+ guint has_pointer : 1; -+ guint touch_mode : 1; -+}; -+ -+enum -+{ -+ PROP_0, -+ PROP_TOUCH_MODE, -+ N_PROPS - }; - - static void clutter_device_manager_evdev_event_extender_init (ClutterEventExtenderInterface *iface); -@@ -765,6 +778,34 @@ clutter_event_source_free (ClutterEventSource *source) - g_source_unref (g_source); - } - -+static void -+update_touch_mode (ClutterDeviceManagerEvdev *manager_evdev) -+{ -+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv; -+ gboolean touch_mode; -+ -+ /* No touch mode if we don't have a touchscreen, easy */ -+ if (!priv->has_touchscreen) -+ touch_mode = FALSE; -+ /* If we have a tablet mode switch, honor it being unset */ -+ else if (priv->has_tablet_switch && !priv->tablet_mode_switch_state) -+ touch_mode = FALSE; -+ /* If tablet mode is enabled, go for it */ -+ else if (priv->has_tablet_switch && priv->tablet_mode_switch_state) -+ touch_mode = TRUE; -+ /* If there is no tablet mode switch (eg. kiosk machines), -+ * assume touch-mode is mutually exclusive with pointers. -+ */ -+ else -+ touch_mode = !priv->has_pointer; -+ -+ if (priv->touch_mode != touch_mode) -+ { -+ priv->touch_mode = touch_mode; -+ g_object_notify (G_OBJECT (manager_evdev), "touch-mode"); -+ } -+} -+ - static void - evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev, - struct libinput_device *libinput_device) -@@ -942,19 +983,81 @@ flush_event_queue (void) - } - } - -+static gboolean -+has_touchscreen (ClutterDeviceManagerEvdev *manager_evdev) -+{ -+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv; -+ GSList *l; -+ -+ for (l = priv->devices; l; l = l->next) -+ { -+ ClutterInputDeviceType device_type; -+ -+ device_type = clutter_input_device_get_device_type (l->data); -+ -+ if (device_type == CLUTTER_TOUCHSCREEN_DEVICE) -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+static gboolean -+device_type_is_pointer (ClutterInputDeviceType device_type) -+{ -+ return (device_type == CLUTTER_POINTER_DEVICE || -+ device_type == CLUTTER_TOUCHPAD_DEVICE); -+} -+ -+static gboolean -+has_pointer (ClutterDeviceManagerEvdev *manager_evdev) -+{ -+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv; -+ GSList *l; -+ -+ for (l = priv->devices; l; l = l->next) -+ { -+ ClutterInputDeviceType device_type; -+ -+ device_type = clutter_input_device_get_device_type (l->data); -+ -+ if (device_type_is_pointer (device_type)) -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ - static gboolean - process_base_event (ClutterDeviceManagerEvdev *manager_evdev, - struct libinput_event *event) - { -+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv; - ClutterInputDevice *device; - struct libinput_device *libinput_device; - gboolean handled = TRUE; -+ gboolean check_touch_mode; - - switch (libinput_event_get_type (event)) - { - case LIBINPUT_EVENT_DEVICE_ADDED: - libinput_device = libinput_event_get_device (event); - -+ priv->has_touchscreen |= -+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_TOUCH); -+ priv->has_pointer |= -+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_POINTER); -+ check_touch_mode = priv->has_touchscreen | priv->has_pointer; -+ -+ if (libinput_device_has_capability (libinput_device, -+ LIBINPUT_DEVICE_CAP_SWITCH) && -+ libinput_device_switch_has_switch (libinput_device, -+ LIBINPUT_SWITCH_TABLET_MODE)) -+ { -+ priv->has_tablet_switch = TRUE; -+ check_touch_mode = TRUE; -+ } -+ - evdev_add_device (manager_evdev, libinput_device); - break; - -@@ -966,7 +1069,17 @@ process_base_event (ClutterDeviceManagerEvdev *manager_evdev, - - libinput_device = libinput_event_get_device (event); - -+ check_touch_mode = -+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_TOUCH); - device = libinput_device_get_user_data (libinput_device); -+ if (check_touch_mode) -+ priv->has_touchscreen = has_touchscreen (manager_evdev); -+ if (device_type_is_pointer (clutter_input_device_get_device_type (device))) -+ { -+ priv->has_pointer = has_pointer (manager_evdev); -+ check_touch_mode = TRUE; -+ } -+ - evdev_remove_device (manager_evdev, - CLUTTER_INPUT_DEVICE_EVDEV (device)); - break; -@@ -975,6 +1088,9 @@ process_base_event (ClutterDeviceManagerEvdev *manager_evdev, - handled = FALSE; - } - -+ if (check_touch_mode) -+ update_touch_mode (manager_evdev); -+ - return handled; - } - -@@ -1752,6 +1868,23 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev, - notify_pad_ring (device, time, number, source, group, mode, angle); - break; - } -+ case LIBINPUT_EVENT_SWITCH_TOGGLE: -+ { -+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv; -+ struct libinput_event_switch *switch_event = -+ libinput_event_get_switch_event (event); -+ enum libinput_switch sw = -+ libinput_event_switch_get_switch (switch_event); -+ enum libinput_switch_state state = -+ libinput_event_switch_get_switch_state (switch_event); -+ -+ if (sw == LIBINPUT_SWITCH_TABLET_MODE) -+ { -+ priv->tablet_mode_switch_state = (state == LIBINPUT_SWITCH_STATE_ON); -+ update_touch_mode (manager_evdev); -+ } -+ break; -+ } - default: - handled = FALSE; - } -@@ -1967,6 +2100,10 @@ clutter_device_manager_evdev_constructed (GObject *gobject) - - source = clutter_event_source_new (manager_evdev); - priv->event_source = source; -+ -+ priv->has_touchscreen = has_touchscreen (manager_evdev); -+ priv->has_pointer = has_pointer (manager_evdev); -+ update_touch_mode (manager_evdev); - } - - static void -@@ -2001,6 +2138,43 @@ clutter_device_manager_evdev_dispose (GObject *object) - G_OBJECT_CLASS (clutter_device_manager_evdev_parent_class)->dispose (object); - } - -+static void -+clutter_device_manager_evdev_set_property (GObject *object, -+ guint prop_id, -+ const GValue *value, -+ GParamSpec *pspec) -+{ -+ switch (prop_id) -+ { -+ case PROP_TOUCH_MODE: -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ } -+} -+ -+static void -+clutter_device_manager_evdev_get_property (GObject *object, -+ guint prop_id, -+ GValue *value, -+ GParamSpec *pspec) -+{ -+ ClutterDeviceManagerEvdev *manager_evdev; -+ ClutterDeviceManagerEvdevPrivate *priv; -+ -+ manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (object); -+ priv = manager_evdev->priv; -+ -+ switch (prop_id) -+ { -+ case PROP_TOUCH_MODE: -+ g_value_set_boolean (value, priv->touch_mode); -+ break; -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ } -+} -+ -+ - static void - clutter_device_manager_evdev_finalize (GObject *object) - { -@@ -2036,6 +2210,8 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass) - gobject_class->constructed = clutter_device_manager_evdev_constructed; - gobject_class->finalize = clutter_device_manager_evdev_finalize; - gobject_class->dispose = clutter_device_manager_evdev_dispose; -+ gobject_class->set_property = clutter_device_manager_evdev_set_property; -+ gobject_class->get_property = clutter_device_manager_evdev_get_property; - - manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass); - manager_class->add_device = clutter_device_manager_evdev_add_device; -@@ -2047,6 +2223,9 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass) - manager_class->get_supported_virtual_device_types = clutter_device_manager_evdev_get_supported_virtual_device_types; - manager_class->compress_motion = clutter_device_manager_evdev_compress_motion; - manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings; -+ -+ g_object_class_override_property (gobject_class, PROP_TOUCH_MODE, -+ "touch-mode"); - } - - static void --- -2.29.2 - diff --git a/0001-clutter-Extend-touchpad-device-property-check-for-Sy.patch b/0001-clutter-Extend-touchpad-device-property-check-for-Sy.patch deleted file mode 100644 index 96fe26b668b1eaac61411eaa5c9c9401d1ce908e..0000000000000000000000000000000000000000 --- a/0001-clutter-Extend-touchpad-device-property-check-for-Sy.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 368fdebe8f4f4e0c0e41f5be9961a748f328cb57 Mon Sep 17 00:00:00 2001 -From: Carlos Garnacho -Date: Tue, 13 Feb 2018 11:44:40 +0100 -Subject: [PATCH] clutter: Extend touchpad device property check for Synaptics - -So we reliably get CLUTTER_TOUCHPAD_DEVICE for those. The other heuristics -to get the device type may fall short. ---- - .../clutter/x11/clutter-device-manager-xi2.c | 22 ++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/clutter/clutter/x11/clutter-device-manager-xi2.c -index 87da4b050..297d3acfe 100644 ---- a/clutter/clutter/x11/clutter-device-manager-xi2.c -+++ b/clutter/clutter/x11/clutter-device-manager-xi2.c -@@ -282,8 +282,9 @@ is_touch_device (XIAnyClassInfo **classes, - } - - static gboolean --is_touchpad_device (ClutterBackendX11 *backend_x11, -- XIDeviceInfo *info) -+query_exists_device_property (ClutterBackendX11 *backend_x11, -+ XIDeviceInfo *info, -+ const gchar *property) - { - gulong nitems, bytes_after; - guint32 *data = NULL; -@@ -291,7 +292,7 @@ is_touchpad_device (ClutterBackendX11 *backend_x11, - Atom type; - Atom prop; - -- prop = XInternAtom (backend_x11->xdpy, "libinput Tapping Enabled", True); -+ prop = XInternAtom (backend_x11->xdpy, property, True); - if (prop == None) - return FALSE; - -@@ -312,6 +313,21 @@ is_touchpad_device (ClutterBackendX11 *backend_x11, - return TRUE; - } - -+static gboolean -+is_touchpad_device (ClutterBackendX11 *backend_x11, -+ XIDeviceInfo *info) -+{ -+ if (query_exists_device_property (backend_x11, info, -+ "libinput Tapping Enabled")) -+ return TRUE; -+ -+ if (query_exists_device_property (backend_x11, info, -+ "Synaptics Off")) -+ return TRUE; -+ -+ return FALSE; -+} -+ - static gboolean - get_device_ids (ClutterBackendX11 *backend_x11, - XIDeviceInfo *info, --- -2.21.0 - diff --git a/0001-clutter-Make-ClutterClickAction-independent-of-click.patch b/0001-clutter-Make-ClutterClickAction-independent-of-click.patch new file mode 100644 index 0000000000000000000000000000000000000000..35af59d7db12805b3bc2ab01a6c76640d0953d8d --- /dev/null +++ b/0001-clutter-Make-ClutterClickAction-independent-of-click.patch @@ -0,0 +1,38 @@ +From 28030178d7682ce5be03cb7273365ab628065871 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 27 Sep 2021 20:37:30 +0200 +Subject: [PATCH] clutter: Make ClutterClickAction independent of click count + +This will trigger for every button press/release that is obtained, +regardless of the click count. + +Part-of: +--- + clutter/clutter/clutter-click-action.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/clutter/clutter/clutter-click-action.c b/clutter/clutter/clutter-click-action.c +index 45d87e809..266b6da92 100644 +--- a/clutter/clutter/clutter-click-action.c ++++ b/clutter/clutter/clutter-click-action.c +@@ -306,9 +306,6 @@ on_event (ClutterActor *actor, + case CLUTTER_TOUCH_BEGIN: + has_button = FALSE; + case CLUTTER_BUTTON_PRESS: +- if (has_button && clutter_event_get_click_count (event) != 1) +- return CLUTTER_EVENT_PROPAGATE; +- + if (priv->is_held) + return CLUTTER_EVENT_STOP; + +@@ -386,7 +383,6 @@ on_captured_event (ClutterActor *stage, + return CLUTTER_EVENT_STOP; + + if ((has_button && clutter_event_get_button (event) != priv->press_button) || +- (has_button && clutter_event_get_click_count (event) != 1) || + clutter_event_get_device (event) != priv->press_device || + clutter_event_get_event_sequence (event) != priv->press_sequence) + return CLUTTER_EVENT_PROPAGATE; +-- +2.35.1 + diff --git a/0001-clutter-Only-reset-scroll-axes-on-slave-devices.patch b/0001-clutter-Only-reset-scroll-axes-on-slave-devices.patch deleted file mode 100644 index dd9eeb5b988579ef72e0d8eb90eea805f85a39f3..0000000000000000000000000000000000000000 --- a/0001-clutter-Only-reset-scroll-axes-on-slave-devices.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2259241e4e6f03bea4e9d746582a9e6a82b3c755 Mon Sep 17 00:00:00 2001 -From: Carlos Garnacho -Date: Wed, 13 Jun 2018 13:48:24 +0200 -Subject: [PATCH] clutter: Only reset scroll axes on slave devices - -As a plus, unknown source device IDs will just warn instead of crash. ---- - clutter/clutter/x11/clutter-device-manager-xi2.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/clutter/clutter/x11/clutter-device-manager-xi2.c -index 297d3acfe..76ef420ed 100644 ---- a/clutter/clutter/x11/clutter-device-manager-xi2.c -+++ b/clutter/clutter/x11/clutter-device-manager-xi2.c -@@ -1899,7 +1899,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator, - _clutter_input_device_set_stage (device, NULL); - } - -- _clutter_input_device_reset_scroll_info (source_device); -+ if (clutter_input_device_get_device_mode (source_device) == CLUTTER_INPUT_MODE_SLAVE) -+ _clutter_input_device_reset_scroll_info (source_device); - - clutter_event_set_device (event, device); - clutter_event_set_source_device (event, source_device); --- -2.21.0 - diff --git a/0001-clutter-avoid-redundant-_clutter_paint_node_init_typ.patch b/0001-clutter-avoid-redundant-_clutter_paint_node_init_typ.patch deleted file mode 100644 index 028c8bd3ef51cf9d41b56d6bca03df665664a8de..0000000000000000000000000000000000000000 --- a/0001-clutter-avoid-redundant-_clutter_paint_node_init_typ.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 4c1c3541efa37acf3a03822289a8ab8705cbbc4e Mon Sep 17 00:00:00 2001 -From: Christian Hergert -Date: Sun, 23 Feb 2020 17:27:08 -0800 -Subject: [PATCH 1/3] clutter: avoid redundant _clutter_paint_node_init_types() - -This only needs to be initialized once but is in the hot path of creating -new paint nodes (for which we create many). Instead, do this as part of -the clutter_init() workflow to keep it out of the hot path. - -https://gitlab.gnome.org/GNOME/mutter/merge_requests/1087 ---- - clutter/clutter/clutter-main.c | 4 ++++ - clutter/clutter/clutter-paint-node.c | 2 -- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c -index 71ec0d80c..645c8bceb 100644 ---- a/clutter/clutter/clutter-main.c -+++ b/clutter/clutter/clutter-main.c -@@ -61,6 +61,7 @@ - #include "clutter-main.h" - #include "clutter-master-clock.h" - #include "clutter-mutter.h" -+#include "clutter-paint-node-private.h" - #include "clutter-private.h" - #include "clutter-settings-private.h" - #include "clutter-stage-manager.h" -@@ -1366,6 +1367,9 @@ clutter_init_real (GError **error) - if (clutter_enable_accessibility) - cally_accessibility_init (); - -+ /* Initialize types required for paint nodes */ -+ _clutter_paint_node_init_types (); -+ - return CLUTTER_INIT_SUCCESS; - } - -diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c -index e731ca60a..73765a4e9 100644 ---- a/clutter/clutter/clutter-paint-node.c -+++ b/clutter/clutter/clutter-paint-node.c -@@ -1177,8 +1177,6 @@ _clutter_paint_node_create (GType gtype) - { - g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL); - -- _clutter_paint_node_init_types (); -- - return (gpointer) g_type_create_instance (gtype); - } - --- -2.26.0 - diff --git a/0001-clutter-stage-view-Hide-double-buffered-shadowfb-beh.patch b/0001-clutter-stage-view-Hide-double-buffered-shadowfb-beh.patch deleted file mode 100644 index 6d9cffde6a8ba45e82e9ca4c78ab70a17de095a9..0000000000000000000000000000000000000000 --- a/0001-clutter-stage-view-Hide-double-buffered-shadowfb-beh.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 7bcc274dbc6cb75814cce3e5c2e7f45cf25b0538 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Tue, 9 Feb 2021 17:59:08 +0100 -Subject: [PATCH 1/2] clutter/stage-view: Hide double buffered shadowfb behind - envvar - -It still results in worse performance than a single FBO based shadowfb, -so don't use it. It will need a new EGL extension for zero copy CPU -memory based FBO to be feasable. ---- - clutter/clutter/clutter-stage-view.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c -index 5e5966d06..ec18db7b8 100644 ---- a/clutter/clutter/clutter-stage-view.c -+++ b/clutter/clutter/clutter-stage-view.c -@@ -282,6 +282,14 @@ init_dma_buf_shadowfbs (ClutterStageView *view, - CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context); - CoglFramebuffer *initial_shadowfb; - -+ if (g_strcmp0 (g_getenv ("MUTTER_DEBUG_ENABLE_DOUBLE_BUFFER_SHADOWFB"), -+ "1") != 0) -+ { -+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "Double buffered shadowfb not enabled"); -+ return FALSE; -+ } -+ - if (!cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE)) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, -@@ -390,8 +398,8 @@ init_shadowfb (ClutterStageView *view) - return; - } - -- g_warning ("Failed to initialize double buffered shadow fb for %s: %s", -- priv->name, error->message); -+ g_debug ("Failed to initialize double buffered shadow fb for %s: %s", -+ priv->name, error->message); - g_clear_error (&error); - - if (!init_fallback_shadowfb (view, cogl_context, width, height, &error)) --- -2.29.2 - diff --git a/0001-cogl-Remove-unused-OFFSCREEN_BLIT-feature-flag.patch b/0001-cogl-Remove-unused-OFFSCREEN_BLIT-feature-flag.patch deleted file mode 100644 index b2965a39052fec936f04049fe9dc48b155767ead..0000000000000000000000000000000000000000 --- a/0001-cogl-Remove-unused-OFFSCREEN_BLIT-feature-flag.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 251ef4ff4bacefac211e21873e10da7fa067dd68 Mon Sep 17 00:00:00 2001 -From: Pekka Paalanen -Date: Fri, 26 Apr 2019 12:23:18 +0300 -Subject: [PATCH 01/12] cogl: Remove unused OFFSCREEN_BLIT feature flag - -This named constant is never used anywhere. - -https://gitlab.gnome.org/GNOME/mutter/merge_requests/615 - -(cherry picked from commit c08a24bb40ad7aa7746e86251c9dbe6c264b4d7c) ---- - cogl/cogl/cogl-types.h | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h -index 690daa16a..69d304cf0 100644 ---- a/cogl/cogl/cogl-types.h -+++ b/cogl/cogl/cogl-types.h -@@ -325,7 +325,6 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/ - * @COGL_FEATURE_SHADERS_GLSL: GLSL support - * @COGL_FEATURE_OFFSCREEN: FBO support - * @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs -- * @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs - * @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available - * @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support - * @COGL_FEATURE_VBOS: VBO support -@@ -368,7 +367,6 @@ typedef enum - COGL_FEATURE_SHADERS_GLSL = (1 << 5), - COGL_FEATURE_OFFSCREEN = (1 << 6), - COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7), -- COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8), - COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9), - COGL_FEATURE_STENCIL_BUFFER = (1 << 10), - COGL_FEATURE_VBOS = (1 << 11), --- -2.21.0 - diff --git a/0001-compositor-Make-sure-_NET_WM_FRAME_DRAWN-timestamp-h.patch b/0001-compositor-Make-sure-_NET_WM_FRAME_DRAWN-timestamp-h.patch deleted file mode 100644 index 2a2bb036a0fcf7ec9f5eea02cb503e3047fbf5de..0000000000000000000000000000000000000000 --- a/0001-compositor-Make-sure-_NET_WM_FRAME_DRAWN-timestamp-h.patch +++ /dev/null @@ -1,265 +0,0 @@ -From b0f3604cdb653ef133f9684adffeb6b93f6906f8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Wed, 26 Jan 2022 10:51:07 +0100 -Subject: [PATCH] compositor: Make sure _NET_WM_FRAME_DRAWN timestamp has the - right scope - -The timestamp sent with _NET_WM_FRAME_DRAWN should be in "high -resolution X server timestamps", meaning they should have the same scope -as the built in X11 32 bit unsigned integer timestamps, i.e. overflow at -the same time. - -This was not done correctly when mutter had determined the X server used -the monotonic clock, where it'd just forward the monotonic clock, -confusing any client using _NET_WM_FRAME_DRAWN and friends. - -Fix this by 1) splitting the timestamp conversiot into an X11 case and a -display server case, where the display server case simply clamps the -monotonic clock, as it is assumed Xwayland is always usign the monotonic -clock, and 2) if we're a X11 compositing manager, if the X server is -using the monotonic clock, apply the same semantics as the display -server case and always just clamp, or if not, calculate the offset every -10 seconds, and offset the monotonic clock timestamp with the calculated -X server timestamp offset. - -This fixes an issue that would occur if mutter (or rather GNOME Shell) -would have been started before a X11 timestamp overflow, after the -overflow happened. In this case, GTK3 clients would get unclamped -timestamps, and get very confused, resulting in frames queued several -weeks into the future. ---- - src/compositor/compositor-private.h | 9 +- - src/compositor/compositor.c | 117 +++++++++++++++++++------ - src/compositor/meta-window-actor-x11.c | 12 +-- - 3 files changed, 104 insertions(+), 34 deletions(-) - -diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h -index f7008751215d..4588a8af7f2f 100644 ---- a/src/compositor/compositor-private.h -+++ b/src/compositor/compositor-private.h -@@ -49,6 +49,10 @@ struct _MetaCompositor - - gboolean frame_has_updated_xsurfaces; - gboolean have_x11_sync_object; -+ -+ gboolean xserver_uses_monotonic_clock; -+ int64_t xserver_time_query_time_us; -+ int64_t xserver_time_offset_us; - }; - - /* Wait 2ms after vblank before starting to draw next frame */ -@@ -64,8 +68,9 @@ void meta_end_modal_for_plugin (MetaCompositor *compositor, - MetaPlugin *plugin, - guint32 timestamp); - --gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display, -- gint64 monotonic_time); -+int64_t -+meta_compositor_monotonic_to_high_res_xserver_time (MetaDisplay *display, -+ int64_t monotonic_time_us); - - gboolean meta_compositor_window_is_stereo (MetaDisplay *display, - Window xwindow); -diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c -index ce2c1b8a3bc1..a3fbe5d888f9 100644 ---- a/src/compositor/compositor.c -+++ b/src/compositor/compositor.c -@@ -88,6 +88,40 @@ - #include "wayland/meta-wayland-private.h" - #endif - -+static inline int64_t -+us (int64_t us) -+{ -+ return us; -+} -+ -+static inline int64_t -+ms2us (int64_t ms) -+{ -+ return us (ms * 1000); -+} -+ -+static inline int64_t -+s2us (int64_t s) -+{ -+ return ms2us(s * 1000); -+} -+ -+/* -+ * This function takes a 64 bit time stamp from the monotonic clock, and clamps -+ * it to the scope of the X server clock, without losing the granularity. -+ */ -+static inline int64_t -+meta_translate_to_high_res_xserver_time (int64_t time_us) -+{ -+ int64_t us; -+ int64_t ms; -+ -+ us = time_us % 1000; -+ ms = time_us / 1000; -+ -+ return ms2us (ms & 0xffffffff) + us; -+} -+ - static void - on_presented (ClutterStage *stage, - CoglFrameEvent event, -@@ -612,6 +646,37 @@ meta_compositor_select_stereo_notify (MetaDisplay *display, - } - } - -+static void -+determine_server_clock_source (MetaCompositor *compositor) -+{ -+ MetaDisplay *display = compositor->display; -+ MetaX11Display *x11_display = display->x11_display; -+ uint32_t server_time_ms; -+ int64_t server_time_us; -+ int64_t translated_monotonic_now_us; -+ -+ if (meta_is_wayland_compositor ()) -+ { -+ compositor->xserver_uses_monotonic_clock = TRUE; -+ return; -+ } -+ -+ server_time_ms = meta_x11_display_get_current_time_roundtrip (x11_display); -+ server_time_us = ms2us (server_time_ms); -+ translated_monotonic_now_us = -+ meta_translate_to_high_res_xserver_time (g_get_monotonic_time ()); -+ -+ /* If the server time offset is within a second of the monotonic time, we -+ * assume that they are identical. This seems like a big margin, but we want -+ * to be as robust as possible even if the system is under load and our -+ * processing of the server response is delayed. -+ */ -+ if (ABS (server_time_us - translated_monotonic_now_us) < s2us (1)) -+ compositor->xserver_uses_monotonic_clock = TRUE; -+ else -+ compositor->xserver_uses_monotonic_clock = FALSE; -+} -+ - void - meta_compositor_manage (MetaCompositor *compositor) - { -@@ -622,6 +687,9 @@ meta_compositor_manage (MetaCompositor *compositor) - if (display->x11_display) - { - xdisplay = display->x11_display->xdisplay; -+ -+ determine_server_clock_source (compositor); -+ - meta_x11_display_set_cm_selection (display->x11_display); - - compositor->stereo_tree_ext = display_has_stereo_tree_ext (display->x11_display); -@@ -1593,7 +1661,7 @@ meta_compositor_flash_window (MetaCompositor *compositor, - } - - /** -- * meta_compositor_monotonic_time_to_server_time: -+ * meta_compositor_monotonic_to_high_res_xserver_time: - * @display: a #MetaDisplay - * @monotonic_time: time in the units of g_get_monotonic_time() - * -@@ -1606,38 +1674,35 @@ meta_compositor_flash_window (MetaCompositor *compositor, - * a time representation with high accuracy. If there is not a common - * time source, then the time synchronization will be less accurate. - */ --gint64 --meta_compositor_monotonic_time_to_server_time (MetaDisplay *display, -- gint64 monotonic_time) -+int64_t -+meta_compositor_monotonic_to_high_res_xserver_time (MetaDisplay *display, -+ int64_t monotonic_time_us) - { - MetaCompositor *compositor = display->compositor; -+ int64_t now_us; -+ -+ if (compositor->xserver_uses_monotonic_clock) -+ return meta_translate_to_high_res_xserver_time (monotonic_time_us); - -- if (compositor->server_time_query_time == 0 || -- (!compositor->server_time_is_monotonic_time && -- monotonic_time > compositor->server_time_query_time + 10*1000*1000)) /* 10 seconds */ -+ now_us = g_get_monotonic_time (); -+ -+ if (compositor->xserver_time_query_time_us == 0 || -+ now_us > (compositor->xserver_time_query_time_us + s2us (10))) - { -- guint32 server_time = meta_display_get_current_time_roundtrip (display); -- gint64 server_time_usec = (gint64)server_time * 1000; -- gint64 current_monotonic_time = g_get_monotonic_time (); -- compositor->server_time_query_time = current_monotonic_time; -- -- /* If the server time is within a second of the monotonic time, -- * we assume that they are identical. This seems like a big margin, -- * but we want to be as robust as possible even if the system -- * is under load and our processing of the server response is -- * delayed. -- */ -- if (server_time_usec > current_monotonic_time - 1000*1000 && -- server_time_usec < current_monotonic_time + 1000*1000) -- compositor->server_time_is_monotonic_time = TRUE; -+ MetaDisplay *display = compositor->display; -+ MetaX11Display *x11_display = display->x11_display; -+ uint32_t xserver_time_ms; -+ int64_t xserver_time_us; - -- compositor->server_time_offset = server_time_usec - current_monotonic_time; -+ compositor->xserver_time_query_time_us = now_us; -+ -+ xserver_time_ms = -+ meta_x11_display_get_current_time_roundtrip (x11_display); -+ xserver_time_us = ms2us (xserver_time_ms); -+ compositor->xserver_time_offset_us = xserver_time_us - now_us; - } - -- if (compositor->server_time_is_monotonic_time) -- return monotonic_time; -- else -- return monotonic_time + compositor->server_time_offset; -+ return monotonic_time_us + compositor->xserver_time_offset_us; - } - - void -diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c -index a364323fe057..2b9c25510dc9 100644 ---- a/src/compositor/meta-window-actor-x11.c -+++ b/src/compositor/meta-window-actor-x11.c -@@ -105,8 +105,8 @@ do_send_frame_drawn (MetaWindowActorX11 *actor_x11, - XClientMessageEvent ev = { 0, }; - - frame->frame_drawn_time = -- meta_compositor_monotonic_time_to_server_time (display, -- g_get_monotonic_time ()); -+ meta_compositor_monotonic_to_high_res_xserver_time (display, -+ g_get_monotonic_time ()); - actor_x11->frame_drawn_time = frame->frame_drawn_time; - - ev.type = ClientMessage; -@@ -147,8 +147,8 @@ do_send_frame_timings (MetaWindowActorX11 *actor_x11, - if (presentation_time != 0) - { - int64_t presentation_time_server = -- meta_compositor_monotonic_time_to_server_time (display, -- presentation_time); -+ meta_compositor_monotonic_to_high_res_xserver_time (display, -+ presentation_time); - int64_t presentation_time_offset = presentation_time_server - frame->frame_drawn_time; - if (presentation_time_offset == 0) - presentation_time_offset = 1; -@@ -246,8 +246,8 @@ queue_send_frame_messages_timeout (MetaWindowActorX11 *actor_x11) - } - - current_time = -- meta_compositor_monotonic_time_to_server_time (display, -- g_get_monotonic_time ()); -+ meta_compositor_monotonic_to_high_res_xserver_time (display, -+ g_get_monotonic_time ()); - interval = (int) (1000000 / refresh_rate) * 6; - offset = MAX (0, actor_x11->frame_drawn_time + interval - current_time) / 1000; - --- -2.33.1 - diff --git a/deal-more-gracefully-with-oversized-windows.patch b/0001-constraints-Enforce-X11-size-limits.patch similarity index 90% rename from deal-more-gracefully-with-oversized-windows.patch rename to 0001-constraints-Enforce-X11-size-limits.patch index 9a7a36d3c0518ac5a0698b852fdd895b2309d380..a09a40b68eb5c0c749793afd9aa4c20d30fa11d3 100644 --- a/deal-more-gracefully-with-oversized-windows.patch +++ b/0001-constraints-Enforce-X11-size-limits.patch @@ -1,4 +1,4 @@ -From 575490895047e0709bc84826fe6d6a73028d7bbc Mon Sep 17 00:00:00 2001 +From 1ab51efc968d7d3c6244d9b7efcdf4bae4fc0a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 12 Mar 2014 02:04:13 +0100 Subject: [PATCH] constraints: Enforce X11 size limits @@ -10,7 +10,7 @@ to keep insanely huge windows from crashing the WM. 1 file changed, 42 insertions(+) diff --git a/src/core/constraints.c b/src/core/constraints.c -index 117131b15..379372245 100644 +index 4b1d95338a..eee16dc48f 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -109,6 +109,7 @@ typedef enum @@ -21,7 +21,7 @@ index 117131b15..379372245 100644 PRIORITY_MAXIMUM = 4 /* Dummy value used for loop end = max(all priorities) */ } ConstraintPriority; -@@ -201,6 +202,10 @@ static gboolean constrain_partially_onscreen (MetaWindow *window, +@@ -204,6 +205,10 @@ static gboolean constrain_partially_onscreen (MetaWindow *window, ConstraintInfo *info, ConstraintPriority priority, gboolean check_only); @@ -32,7 +32,7 @@ index 117131b15..379372245 100644 static void setup_constraint_info (ConstraintInfo *info, MetaWindow *window, -@@ -236,6 +241,7 @@ static const Constraint all_constraints[] = { +@@ -239,6 +244,7 @@ static const Constraint all_constraints[] = { {constrain_fully_onscreen, "constrain_fully_onscreen"}, {constrain_titlebar_visible, "constrain_titlebar_visible"}, {constrain_partially_onscreen, "constrain_partially_onscreen"}, @@ -40,7 +40,7 @@ index 117131b15..379372245 100644 {NULL, NULL} }; -@@ -1780,3 +1786,39 @@ constrain_partially_onscreen (MetaWindow *window, +@@ -1876,3 +1882,39 @@ constrain_partially_onscreen (MetaWindow *window, return retval; } @@ -81,5 +81,5 @@ index 117131b15..379372245 100644 + return TRUE; +} -- -2.21.0 +2.31.1 diff --git a/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch b/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch deleted file mode 100644 index 5ee31d1c133c304333b17741bb9bdd2422e5939c..0000000000000000000000000000000000000000 --- a/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch +++ /dev/null @@ -1,64 +0,0 @@ -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/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch b/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch deleted file mode 100644 index 29e6b884273e3c64b29d7caf531c477afb185c6f..0000000000000000000000000000000000000000 --- a/0001-crtc-xrandr-Respect-configured-RANDR-panning.patch +++ /dev/null @@ -1,73 +0,0 @@ -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/0001-display-Make-check-alive-timeout-configureable.patch b/0001-display-Make-check-alive-timeout-configureable.patch deleted file mode 100644 index e0dfabe2e564f9f959e793a5d10cf4a7bb999b14..0000000000000000000000000000000000000000 --- a/0001-display-Make-check-alive-timeout-configureable.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 7f6f326a1bb96aad0b7aea9c4d7e257bf53c026c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Fri, 21 Feb 2020 21:03:16 +0100 -Subject: [PATCH] display: Make check-alive timeout configureable - -The check-alive feature is there for the user to be able to terminate -frozen applications more easily. However, sometimes applications are -implemented in a way where they fail to be reply to ping requests in a -timely manner, resulting in that, to the compositor, they are -indistinguishable from clients that have frozen indefinitely. - -When using an application that has these issues, the GUI showed in -response to the failure to respond to ping requests can become annoying, -as it disrupts the visual presentation of the application. - -To allow users to work-around these issues, add a setting allowing them -to configure the timeout waited until an application is considered -frozen, or disabling the check completely. - -https://gitlab.gnome.org/GNOME/mutter/merge_requests/1080 ---- - data/org.gnome.mutter.gschema.xml.in | 10 ++++ - src/core/display.c | 18 ++++---- - src/core/prefs.c | 68 ++++++++++++++++++++++++++++ - src/meta/prefs.h | 3 ++ - 4 files changed, 90 insertions(+), 9 deletions(-) - -diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in -index 6cbd9c1b5..4d37b1488 100644 ---- a/data/org.gnome.mutter.gschema.xml.in -+++ b/data/org.gnome.mutter.gschema.xml.in -@@ -123,6 +123,16 @@ - - - -+ -+ 5000 -+ Timeout for check-alive ping -+ -+ Number of milliseconds a client has to respond to a ping request in -+ order to not be detected as frozen. Using 0 will disable the alive check -+ completely. -+ -+ -+ - - - -diff --git a/src/core/display.c b/src/core/display.c -index eb7dc43b6..c30a03385 100644 ---- a/src/core/display.c -+++ b/src/core/display.c -@@ -1923,12 +1923,6 @@ meta_set_syncing (gboolean setting) - } - } - --/* -- * How long, in milliseconds, we should wait after pinging a window -- * before deciding it's not going to get back to us. -- */ --#define PING_TIMEOUT_DELAY 5000 -- - /** - * meta_display_ping_timeout: - * @data: All the information about this ping. It is a #MetaPingData -@@ -1986,6 +1980,11 @@ meta_display_ping_window (MetaWindow *window, - { - MetaDisplay *display = window->display; - MetaPingData *ping_data; -+ unsigned int check_alive_timeout; -+ -+ check_alive_timeout = meta_prefs_get_check_alive_timeout (); -+ if (check_alive_timeout == 0) -+ return; - - if (serial == 0) - { -@@ -1999,9 +1998,10 @@ meta_display_ping_window (MetaWindow *window, - ping_data = g_new (MetaPingData, 1); - ping_data->window = window; - ping_data->serial = serial; -- ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY, -- meta_display_ping_timeout, -- ping_data); -+ ping_data->ping_timeout_id = -+ g_timeout_add (check_alive_timeout, -+ meta_display_ping_timeout, -+ ping_data); - g_source_set_name_by_id (ping_data->ping_timeout_id, "[mutter] meta_display_ping_timeout"); - - display->pending_pings = g_slist_prepend (display->pending_pings, ping_data); -diff --git a/src/core/prefs.c b/src/core/prefs.c -index 3f0db8afc..4892406ce 100644 ---- a/src/core/prefs.c -+++ b/src/core/prefs.c -@@ -99,6 +99,7 @@ static gboolean bell_is_visible = FALSE; - static gboolean bell_is_audible = TRUE; - static gboolean gnome_accessibility = FALSE; - static gboolean gnome_animations = TRUE; -+static unsigned int check_alive_timeout = 5000; - static char *cursor_theme = NULL; - /* cursor_size will, when running as an X11 compositing window manager, be the - * actual cursor size, multiplied with the global window scaling factor. On -@@ -213,6 +214,12 @@ typedef struct - gint *target; - } MetaIntPreference; - -+typedef struct -+{ -+ MetaBasePreference base; -+ unsigned int *target; -+} MetaUintPreference; -+ - - /* All preferences that are not keybindings must be listed here, - * plus in the GSettings schemas and the MetaPreference enum. -@@ -491,6 +498,18 @@ static MetaIntPreference preferences_int[] = - { { NULL, 0, 0 }, NULL }, - }; - -+static MetaUintPreference preferences_uint[] = -+ { -+ { -+ { "check-alive-timeout", -+ SCHEMA_MUTTER, -+ META_PREF_CHECK_ALIVE_TIMEOUT, -+ }, -+ &check_alive_timeout, -+ }, -+ { { NULL, 0, 0 }, NULL }, -+ }; -+ - static void - handle_preference_init_enum (void) - { -@@ -613,6 +632,21 @@ handle_preference_init_int (void) - } - } - -+static void -+handle_preference_init_uint (void) -+{ -+ MetaUintPreference *cursor = preferences_uint; -+ -+ while (cursor->base.key != NULL) -+ { -+ if (cursor->target) -+ *cursor->target = g_settings_get_uint (SETTINGS (cursor->base.schema), -+ cursor->base.key); -+ -+ ++cursor; -+ } -+} -+ - static void - handle_preference_update_enum (GSettings *settings, - gchar *key) -@@ -788,6 +822,28 @@ handle_preference_update_int (GSettings *settings, - } - } - -+static void -+handle_preference_update_uint (GSettings *settings, -+ char *key) -+{ -+ MetaUintPreference *cursor = preferences_uint; -+ unsigned int new_value; -+ -+ while (cursor->base.key && strcmp (key, cursor->base.key) != 0) -+ ++cursor; -+ -+ if (!cursor->base.key || !cursor->target) -+ return; -+ -+ new_value = g_settings_get_uint (SETTINGS (cursor->base.schema), key); -+ -+ if (*cursor->target != new_value) -+ { -+ *cursor->target = new_value; -+ queue_changed (cursor->base.pref); -+ } -+} -+ - - /****************************************************************************/ - /* Listeners. */ -@@ -964,6 +1020,7 @@ meta_prefs_init (void) - handle_preference_init_string (); - handle_preference_init_string_array (); - handle_preference_init_int (); -+ handle_preference_init_uint (); - - init_bindings (); - } -@@ -1017,6 +1074,8 @@ settings_changed (GSettings *settings, - handle_preference_update_bool (settings, key); - else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32)) - handle_preference_update_int (settings, key); -+ else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT32)) -+ handle_preference_update_uint (settings, key); - else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY)) - handle_preference_update_string_array (settings, key); - else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING)) -@@ -1640,6 +1699,9 @@ meta_preference_to_string (MetaPreference pref) - - case META_PREF_AUTO_MAXIMIZE: - return "AUTO_MAXIMIZE"; -+ -+ case META_PREF_CHECK_ALIVE_TIMEOUT: -+ return "CHECK_ALIVE_TIMEOUT"; - } - - return "(unknown)"; -@@ -1966,6 +2028,12 @@ meta_prefs_get_overlay_binding (MetaKeyCombo *combo) - *combo = overlay_key_combo; - } - -+unsigned int -+meta_prefs_get_check_alive_timeout (void) -+{ -+ return check_alive_timeout; -+} -+ - const char * - meta_prefs_get_iso_next_group_option (void) - { -diff --git a/src/meta/prefs.h b/src/meta/prefs.h -index 9664b5c07..f42d1c63c 100644 ---- a/src/meta/prefs.h -+++ b/src/meta/prefs.h -@@ -103,6 +103,7 @@ typedef enum - META_PREF_AUTO_MAXIMIZE, - META_PREF_CENTER_NEW_WINDOWS, - META_PREF_DRAG_THRESHOLD, -+ META_PREF_CHECK_ALIVE_TIMEOUT, - } MetaPreference; - - typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, -@@ -475,4 +476,6 @@ gboolean meta_prefs_bell_is_audible (void); - META_EXPORT - GDesktopVisualBellType meta_prefs_get_visual_bell_type (void); - -+unsigned int meta_prefs_get_check_alive_timeout (void); -+ - #endif --- -2.28.0 - diff --git a/0001-enum-types-Use-basename-in-header-comment.patch b/0001-enum-types-Use-basename-in-header-comment.patch deleted file mode 100644 index 88b3a4fe2aebfd969027577d2b7dcd54142e4961..0000000000000000000000000000000000000000 --- a/0001-enum-types-Use-basename-in-header-comment.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 62387eb649b7b33d923d5382f85c9210a3bedbe8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Florian=20M=C3=BCllner?= -Date: Thu, 30 May 2019 16:32:35 +0200 -Subject: [PATCH] enum-types: Use @basename@ in header comment - -@filename@ may contain arch-specific bits that introduce unnecessary -multi-lib issues. ---- - clutter/clutter/clutter-enum-types.h.in | 2 +- - cogl/cogl-path/cogl-path-enum-types.h.in | 2 +- - src/meta/meta-enum-types.h.in | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/clutter/clutter/clutter-enum-types.h.in b/clutter/clutter/clutter-enum-types.h.in -index 2e5b6707e..17f9ee644 100644 ---- a/clutter/clutter/clutter-enum-types.h.in -+++ b/clutter/clutter/clutter-enum-types.h.in -@@ -13,7 +13,7 @@ G_BEGIN_DECLS - /*** END file-header ***/ - - /*** BEGIN file-production ***/ --/* enumerations from "@filename@" */ -+/* enumerations from "@basename@" */ - /*** END file-production ***/ - - /*** BEGIN value-header ***/ -diff --git a/cogl/cogl-path/cogl-path-enum-types.h.in b/cogl/cogl-path/cogl-path-enum-types.h.in -index 071686acd..2b377ed18 100644 ---- a/cogl/cogl-path/cogl-path-enum-types.h.in -+++ b/cogl/cogl-path/cogl-path-enum-types.h.in -@@ -9,7 +9,7 @@ G_BEGIN_DECLS - /*** END file-header ***/ - - /*** BEGIN file-production ***/ --/* enumerations from "@filename@" */ -+/* enumerations from "@basename@" */ - /*** END file-production ***/ - - /*** BEGIN file-tail ***/ -diff --git a/src/meta/meta-enum-types.h.in b/src/meta/meta-enum-types.h.in -index 6e3b67b26..bee0196de 100644 ---- a/src/meta/meta-enum-types.h.in -+++ b/src/meta/meta-enum-types.h.in -@@ -10,7 +10,7 @@ G_BEGIN_DECLS - /*** END file-header ***/ - - /*** BEGIN file-production ***/ --/* enumerations from "@filename@" */ -+/* enumerations from "@basename@" */ - /*** END file-production ***/ - - /*** BEGIN file-tail ***/ --- -2.21.0 - diff --git a/0001-events-Don-t-move-sloppy-focus-while-buttons-are-pre.patch b/0001-events-Don-t-move-sloppy-focus-while-buttons-are-pre.patch index 69fc6ef0f1de142e1d9a446c50bd326686bc1725..2ff5f1b4544fde1b4b36b1f3b9da0d77efecbce7 100644 --- a/0001-events-Don-t-move-sloppy-focus-while-buttons-are-pre.patch +++ b/0001-events-Don-t-move-sloppy-focus-while-buttons-are-pre.patch @@ -1,4 +1,4 @@ -From f735f345ad8390a7fb09ef54ca3e0e419d395d1b Mon Sep 17 00:00:00 2001 +From 7ac5b7bad8f2d0e61700610f68282f6687cc9d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 21 Jul 2016 15:43:12 +0200 Subject: [PATCH] events: Don't move (sloppy) focus while buttons are pressed @@ -9,10 +9,10 @@ Subject: [PATCH] events: Don't move (sloppy) focus while buttons are pressed 1 file changed, 11 insertions(+) diff --git a/src/x11/events.c b/src/x11/events.c -index e363fdbb6..905b5bf9d 100644 +index efa8f9856b..388eff0ac7 100644 --- a/src/x11/events.c +++ b/src/x11/events.c -@@ -832,6 +832,16 @@ crossing_serial_is_ignored (MetaX11Display *x11_display, +@@ -839,6 +839,16 @@ crossing_serial_is_ignored (MetaX11Display *x11_display, return FALSE; } @@ -29,7 +29,7 @@ index e363fdbb6..905b5bf9d 100644 static gboolean handle_input_xevent (MetaX11Display *x11_display, XIEvent *input_event, -@@ -876,6 +886,7 @@ handle_input_xevent (MetaX11Display *x11_display, +@@ -883,6 +893,7 @@ handle_input_xevent (MetaX11Display *x11_display, * avoid races. */ if (window && !crossing_serial_is_ignored (x11_display, serial) && @@ -38,5 +38,5 @@ index e363fdbb6..905b5bf9d 100644 enter_event->mode != XINotifyUngrab && enter_event->detail != XINotifyInferior && -- -2.21.0 +2.31.1 diff --git a/0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch b/0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch new file mode 100644 index 0000000000000000000000000000000000000000..24a5bcd0fb989925bc1f123906fb07e43c34c811 --- /dev/null +++ b/0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch @@ -0,0 +1,26 @@ +From 65ffd7e4df42cd62633f93107644f87208881578 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Thu, 14 Apr 2022 18:07:41 +0200 +Subject: [PATCH] events: Pass CurrentTime to XIAllowEvents() when unfreezing + pointer + +--- + src/core/events.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/events.c b/src/core/events.c +index 0dc3a73222..dd9b4ec981 100644 +--- a/src/core/events.c ++++ b/src/core/events.c +@@ -205,7 +205,7 @@ maybe_unfreeze_pointer_events (MetaBackend *backend, + } + + xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); +- XIAllowEvents (xdisplay, device_id, event_mode, event->button.time); ++ XIAllowEvents (xdisplay, device_id, event_mode, CurrentTime); + } + + static gboolean +-- +2.34.1 + diff --git a/0001-events-Sync-pending-pointer-events-without-a-window.patch b/0001-events-Sync-pending-pointer-events-without-a-window.patch deleted file mode 100644 index 3ba3963a2063cb664dd45529f49ba912dd8f6b0b..0000000000000000000000000000000000000000 --- a/0001-events-Sync-pending-pointer-events-without-a-window.patch +++ /dev/null @@ -1,122 +0,0 @@ -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/0001-iconcache-Avoid-xrender-picture-formats-when-creatin.patch b/0001-iconcache-Avoid-xrender-picture-formats-when-creatin.patch deleted file mode 100644 index 0ed0857b0aef5c55641af3e2afc617cf26c76cfc..0000000000000000000000000000000000000000 --- a/0001-iconcache-Avoid-xrender-picture-formats-when-creatin.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 80f79e0cc7509b79b38193a006b0d98d03432044 Mon Sep 17 00:00:00 2001 -From: Ray Strode -Date: Mon, 5 Aug 2019 14:39:21 -0400 -Subject: [PATCH] iconcache: Avoid xrender picture formats when creating cairo - surface - -If an application provides its window icon via wmhints, then mutter -loads the pixmap specified by the application into a cairo xlib surface. When -creating the surface it specifies the visual, indirectly, via an XRender -picture format. - -This is suboptimal, since XRender picture formats don't have a way to specify -16bpp depth, which an application may be using. - -In particular, applications are likely to use 16bpp depth pixmaps for their -icons, if the video card offers a 16bpp framebuffer/root window. - -This commit drops the XRender middleman, and just tells cairo a visual to use -directly. - -https://gitlab.gnome.org/GNOME/mutter/merge_requests/715 ---- - src/x11/iconcache.c | 31 ++++++------------------------- - 1 file changed, 6 insertions(+), 25 deletions(-) - -diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c -index 15d72da65..521c77b8d 100644 ---- a/src/x11/iconcache.c -+++ b/src/x11/iconcache.c -@@ -261,97 +261,78 @@ get_pixmap_geometry (MetaX11Display *x11_display, - Pixmap pixmap, - int *w, - int *h, - int *d) - { - Window root_ignored; - int x_ignored, y_ignored; - guint width, height; - guint border_width_ignored; - guint depth; - - if (w) - *w = 1; - if (h) - *h = 1; - if (d) - *d = 1; - - XGetGeometry (x11_display->xdisplay, - pixmap, &root_ignored, &x_ignored, &y_ignored, - &width, &height, &border_width_ignored, &depth); - - if (w) - *w = width; - if (h) - *h = height; - if (d) - *d = depth; - } - --static int --standard_pict_format_for_depth (int depth) --{ -- switch (depth) -- { -- case 1: -- return PictStandardA1; -- case 24: -- return PictStandardRGB24; -- case 32: -- return PictStandardARGB32; -- default: -- g_assert_not_reached (); -- } -- return 0; --} -- --static XRenderPictFormat * --pict_format_for_depth (Display *xdisplay, int depth) --{ -- return XRenderFindStandardFormat (xdisplay, standard_pict_format_for_depth (depth)); --} -- - static cairo_surface_t * - surface_from_pixmap (Display *xdisplay, Pixmap xpixmap, - int width, int height) - { - Window root_return; -+ XVisualInfo visual_info; - int x_ret, y_ret; - unsigned int w_ret, h_ret, bw_ret, depth_ret; - - if (!XGetGeometry (xdisplay, xpixmap, &root_return, - &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret)) - return NULL; - -- return cairo_xlib_surface_create_with_xrender_format (xdisplay, xpixmap, DefaultScreenOfDisplay (xdisplay), -- pict_format_for_depth (xdisplay, depth_ret), w_ret, h_ret); -+ if (!XMatchVisualInfo (xdisplay, DefaultScreen (xdisplay), -+ depth_ret, TrueColor, &visual_info)) -+ return NULL; -+ -+ return cairo_xlib_surface_create (xdisplay, xpixmap, visual_info.visual, w_ret, h_ret); - } - - static gboolean - try_pixmap_and_mask (MetaX11Display *x11_display, - Pixmap src_pixmap, - Pixmap src_mask, - cairo_surface_t **iconp) - { - Display *xdisplay = x11_display->xdisplay; - cairo_surface_t *icon, *mask = NULL; - int w, h, d; - - if (src_pixmap == None) - return FALSE; - - meta_x11_error_trap_push (x11_display); - - get_pixmap_geometry (x11_display, src_pixmap, &w, &h, &d); - icon = surface_from_pixmap (xdisplay, src_pixmap, w, h); - - if (icon && src_mask != None) - { - get_pixmap_geometry (x11_display, src_mask, &w, &h, &d); - - if (d == 1) - mask = surface_from_pixmap (xdisplay, src_mask, w, h); - } - - meta_x11_error_trap_pop (x11_display); - --- -2.21.0 - diff --git a/0001-kms-Allow-passing-framebuffer-damage-metadata.patch b/0001-kms-Allow-passing-framebuffer-damage-metadata.patch new file mode 100644 index 0000000000000000000000000000000000000000..6143687daa0d784fbbcf3528d68c77c45f8728b7 --- /dev/null +++ b/0001-kms-Allow-passing-framebuffer-damage-metadata.patch @@ -0,0 +1,193 @@ +From af0460d0cedd5a66b2110ab2a99e67c647e7b6fb Mon Sep 17 00:00:00 2001 +From: Piotr Lopatka +Date: Fri, 3 Sep 2021 19:39:12 +0100 +Subject: [PATCH 1/2] kms: Allow passing framebuffer damage metadata + +This commit adds support to atomic KMS backend for optional plane property +prop_fb_damage_clips. Some drivers (e.g. EVDI) take advantage of this +property and process only updated regions of the screen instead of +processing the full frame. This can save system resources. + +Part-of: +--- + .../native/meta-kms-impl-device-atomic.c | 28 +++++++++++++++ + src/backends/native/meta-kms-plane-private.h | 1 + + src/backends/native/meta-kms-plane.c | 5 +++ + src/backends/native/meta-kms-update-private.h | 7 ++++ + src/backends/native/meta-kms-update.c | 35 +++++++++++++++++++ + src/backends/native/meta-kms-update.h | 4 +++ + 6 files changed, 80 insertions(+) + +diff --git a/src/backends/native/meta-kms-impl-device-atomic.c b/src/backends/native/meta-kms-impl-device-atomic.c +index 8e41207ee14..674a24902bd 100644 +--- a/src/backends/native/meta-kms-impl-device-atomic.c ++++ b/src/backends/native/meta-kms-impl-device-atomic.c +@@ -416,6 +416,8 @@ process_plane_assignment (MetaKmsImplDevice *impl_device, + MetaKmsPlaneAssignment *plane_assignment = update_entry; + MetaKmsPlane *plane = plane_assignment->plane; + MetaDrmBuffer *buffer; ++ MetaKmsFbDamage *fb_damage; ++ uint32_t prop_id; + + buffer = plane_assignment->buffer; + +@@ -539,6 +541,32 @@ process_plane_assignment (MetaKmsImplDevice *impl_device, + return FALSE; + } + ++ fb_damage = plane_assignment->fb_damage; ++ if (fb_damage && ++ meta_kms_plane_get_prop_id (plane, ++ META_KMS_PLANE_PROP_FB_DAMAGE_CLIPS_ID)) ++ { ++ meta_topic (META_DEBUG_KMS, ++ "[atomic] Setting %d damage clips on %u", ++ fb_damage->n_rects, ++ meta_kms_plane_get_id (plane)); ++ ++ prop_id = store_new_blob (impl_device, ++ blob_ids, ++ fb_damage->rects, ++ fb_damage->n_rects * ++ sizeof (struct drm_mode_rect), ++ error); ++ if (!prop_id) ++ return FALSE; ++ ++ if (!add_plane_property (impl_device, ++ plane, req, ++ META_KMS_PLANE_PROP_FB_DAMAGE_CLIPS_ID, ++ prop_id, ++ error)) ++ return FALSE; ++ } + return TRUE; + } + +diff --git a/src/backends/native/meta-kms-plane-private.h b/src/backends/native/meta-kms-plane-private.h +index 92f9cfcc9aa..f735c8da8f6 100644 +--- a/src/backends/native/meta-kms-plane-private.h ++++ b/src/backends/native/meta-kms-plane-private.h +@@ -41,6 +41,7 @@ typedef enum _MetaKmsPlaneProp + META_KMS_PLANE_PROP_CRTC_H, + META_KMS_PLANE_PROP_FB_ID, + META_KMS_PLANE_PROP_CRTC_ID, ++ META_KMS_PLANE_PROP_FB_DAMAGE_CLIPS_ID, + META_KMS_PLANE_N_PROPS + } MetaKmsPlaneProp; + +diff --git a/src/backends/native/meta-kms-plane.c b/src/backends/native/meta-kms-plane.c +index 73fab7d8f80..3cb58764ff3 100644 +--- a/src/backends/native/meta-kms-plane.c ++++ b/src/backends/native/meta-kms-plane.c +@@ -446,6 +446,11 @@ init_properties (MetaKmsPlane *plane, + .name = "CRTC_ID", + .type = DRM_MODE_PROP_OBJECT, + }, ++ [META_KMS_PLANE_PROP_FB_DAMAGE_CLIPS_ID] = ++ { ++ .name = "FB_DAMAGE_CLIPS", ++ .type = DRM_MODE_PROP_BLOB, ++ }, + } + }; + +diff --git a/src/backends/native/meta-kms-update-private.h b/src/backends/native/meta-kms-update-private.h +index 22491ece2d5..c89622d09a5 100644 +--- a/src/backends/native/meta-kms-update-private.h ++++ b/src/backends/native/meta-kms-update-private.h +@@ -34,6 +34,12 @@ typedef struct _MetaKmsFeedback + GError *error; + } MetaKmsFeedback; + ++typedef struct _MetaKmsFbDamage ++{ ++ struct drm_mode_rect *rects; ++ int n_rects; ++} MetaKmsFbDamage; ++ + typedef struct _MetaKmsPlaneAssignment + { + MetaKmsUpdate *update; +@@ -43,6 +49,7 @@ typedef struct _MetaKmsPlaneAssignment + MetaFixed16Rectangle src_rect; + MetaRectangle dst_rect; + MetaKmsAssignPlaneFlag flags; ++ MetaKmsFbDamage *fb_damage; + + uint64_t rotation; + +diff --git a/src/backends/native/meta-kms-update.c b/src/backends/native/meta-kms-update.c +index be6eaefcc2c..71e5b423fb7 100644 +--- a/src/backends/native/meta-kms-update.c ++++ b/src/backends/native/meta-kms-update.c +@@ -129,9 +129,17 @@ meta_kms_feedback_get_error (const MetaKmsFeedback *feedback) + return feedback->error; + } + ++static void ++meta_kms_fb_damage_free (MetaKmsFbDamage *fb_damage) ++{ ++ g_free (fb_damage->rects); ++ g_free (fb_damage); ++} ++ + static void + meta_kms_plane_assignment_free (MetaKmsPlaneAssignment *plane_assignment) + { ++ g_clear_pointer (&plane_assignment->fb_damage, meta_kms_fb_damage_free); + g_free (plane_assignment); + } + +@@ -456,6 +464,33 @@ meta_kms_update_set_custom_page_flip (MetaKmsUpdate *update, + update->custom_page_flip = custom_page_flip; + } + ++void ++meta_kms_plane_assignment_set_fb_damage (MetaKmsPlaneAssignment *plane_assignment, ++ const int *rectangles, ++ int n_rectangles) ++{ ++ MetaKmsFbDamage *fb_damage; ++ struct drm_mode_rect *mode_rects; ++ int i; ++ ++ mode_rects = g_new0 (struct drm_mode_rect, n_rectangles); ++ for (i = 0; i < n_rectangles; ++i) ++ { ++ mode_rects[i].x1 = rectangles[i * 4]; ++ mode_rects[i].y1 = rectangles[i * 4 + 1]; ++ mode_rects[i].x2 = mode_rects[i].x1 + rectangles[i * 4 + 2]; ++ mode_rects[i].y2 = mode_rects[i].y1 + rectangles[i * 4 + 3]; ++ } ++ ++ fb_damage = g_new0 (MetaKmsFbDamage, 1); ++ *fb_damage = (MetaKmsFbDamage) { ++ .rects = mode_rects, ++ .n_rects = n_rectangles, ++ }; ++ ++ plane_assignment->fb_damage = fb_damage; ++} ++ + void + meta_kms_plane_assignment_set_rotation (MetaKmsPlaneAssignment *plane_assignment, + uint64_t rotation) +diff --git a/src/backends/native/meta-kms-update.h b/src/backends/native/meta-kms-update.h +index 4a6a8bb4373..e63b6d8711d 100644 +--- a/src/backends/native/meta-kms-update.h ++++ b/src/backends/native/meta-kms-update.h +@@ -115,6 +115,10 @@ void meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update, + const uint16_t *green, + const uint16_t *blue); + ++void meta_kms_plane_assignment_set_fb_damage (MetaKmsPlaneAssignment *plane_assignment, ++ const int *rectangles, ++ int n_rectangles); ++ + MetaKmsPlaneAssignment * meta_kms_update_assign_plane (MetaKmsUpdate *update, + MetaKmsCrtc *crtc, + MetaKmsPlane *plane, +-- +2.36.1 + diff --git a/0001-kms-crtc-Add-function-meta_kms_crtc_has_gamma.patch b/0001-kms-crtc-Add-function-meta_kms_crtc_has_gamma.patch new file mode 100644 index 0000000000000000000000000000000000000000..5774e456f27774595551d0013dbc9bc6981208bf --- /dev/null +++ b/0001-kms-crtc-Add-function-meta_kms_crtc_has_gamma.patch @@ -0,0 +1,46 @@ +From de3188fcc6863b8a6e3d2443a00cf3b00f6f26ff Mon Sep 17 00:00:00 2001 +From: Daniel van Vugt +Date: Tue, 12 Apr 2022 18:34:58 +0800 +Subject: [PATCH 1/2] kms/crtc: Add function meta_kms_crtc_has_gamma + +Part-of: +--- + src/backends/native/meta-kms-crtc.c | 7 +++++++ + src/backends/native/meta-kms-crtc.h | 3 +++ + 2 files changed, 10 insertions(+) + +diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c +index 51d040b44..24f5a2d74 100644 +--- a/src/backends/native/meta-kms-crtc.c ++++ b/src/backends/native/meta-kms-crtc.c +@@ -92,6 +92,13 @@ meta_kms_crtc_is_active (MetaKmsCrtc *crtc) + return crtc->current_state.is_active; + } + ++ ++gboolean ++meta_kms_crtc_has_gamma (MetaKmsCrtc *crtc) ++{ ++ return !!meta_kms_crtc_get_prop_id (crtc, META_KMS_CRTC_PROP_GAMMA_LUT); ++} ++ + static void + read_gamma_state (MetaKmsCrtc *crtc, + MetaKmsImplDevice *impl_device, +diff --git a/src/backends/native/meta-kms-crtc.h b/src/backends/native/meta-kms-crtc.h +index 406ca3ac1..cbaeaa280 100644 +--- a/src/backends/native/meta-kms-crtc.h ++++ b/src/backends/native/meta-kms-crtc.h +@@ -66,6 +66,9 @@ uint32_t meta_kms_crtc_get_id (MetaKmsCrtc *crtc); + + int meta_kms_crtc_get_idx (MetaKmsCrtc *crtc); + ++ ++gboolean meta_kms_crtc_has_gamma (MetaKmsCrtc *crtc); ++ + gboolean meta_kms_crtc_is_active (MetaKmsCrtc *crtc); + + void meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma); +-- +2.35.1 + diff --git a/0001-main-be-more-aggressive-in-assuming-X11-backend.patch b/0001-main-be-more-aggressive-in-assuming-X11-backend.patch index 495d85905551ef37d4c124f051684445280bd323..806ad38babd2777536b443c863a5e3846fa9ae39 100644 --- a/0001-main-be-more-aggressive-in-assuming-X11-backend.patch +++ b/0001-main-be-more-aggressive-in-assuming-X11-backend.patch @@ -1,4 +1,4 @@ -From 18d4fbb1fb641e2b507b3adcd13d231145a01cd6 Mon Sep 17 00:00:00 2001 +From 99c74360451a85fca9dacad531ed22adbc1b0805 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 13 Feb 2018 09:44:50 -0500 Subject: [PATCH] main: be more aggressive in assuming X11 backend @@ -12,10 +12,10 @@ to X11 if the session type isn't set to wayland explicitly. 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/main.c b/src/core/main.c -index 629f8e94e..1e1e13367 100644 +index a07dda9ecc..0d241f952b 100644 --- a/src/core/main.c +++ b/src/core/main.c -@@ -333,7 +333,6 @@ find_session_type (void) +@@ -407,7 +407,6 @@ find_session_type (void) char *session_id; char *session_type; const char *session_type_env; @@ -23,7 +23,7 @@ index 629f8e94e..1e1e13367 100644 int ret, i; ret = sd_pid_get_session (0, &session_id); -@@ -346,8 +345,7 @@ find_session_type (void) +@@ -420,8 +419,7 @@ find_session_type (void) { if (session_type_is_supported (session_type)) goto out; @@ -33,7 +33,7 @@ index 629f8e94e..1e1e13367 100644 free (session_type); } } -@@ -379,8 +377,8 @@ find_session_type (void) +@@ -453,8 +451,8 @@ find_session_type (void) goto out; } @@ -45,5 +45,5 @@ index 629f8e94e..1e1e13367 100644 session_type = strdup ("x11"); goto out; -- -2.21.0 +2.31.1 diff --git a/0001-monitor-config-manager-Handle-multiple-builtin-panel.patch b/0001-monitor-config-manager-Handle-multiple-builtin-panel.patch deleted file mode 100644 index 73fcb7bd7bdd45ff3a191b58001e96fbc4966779..0000000000000000000000000000000000000000 --- a/0001-monitor-config-manager-Handle-multiple-builtin-panel.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 19024a5b2eff02b22cdb3fc90142f522dd361996 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Fri, 27 Nov 2020 09:03:38 +0100 -Subject: [PATCH] monitor-config-manager: Handle multiple builtin panels - gracefully - -While multiple built-in panels isn't actually supported in any -meaningful manner, if we would ever end up with such a situation, e.g. -due to kernel bugs[0], we shouldn't crash when trying to set an -'external only' without any external monitors. - -While we could handle this with more degraded functionality (e.g. don't -support the 'switch' method of monitor configuration at all), handle it -by simply not trying to switch to external-only when there are no, -according to the kernel, external monitors available. This would e.g. -still allow betwene 'mirror-all', and 'linear' switches. - -The crash itself was disguised as an arbitrary X11 BadValue error, due -to mutter trying to resize the root window to 0x0, as the monitor -configuration that was applied consisted of zero logical monitors, thus -was effectively empty. - -[0] https://bugzilla.redhat.com/show_bug.cgi?id=1896904 - -Related: https://bugzilla.redhat.com/show_bug.cgi?id=1899260 -Part-of: ---- - src/backends/meta-monitor-config-manager.c | 3 + - src/tests/monitor-unit-tests.c | 145 +++++++++++++++++++++ - 2 files changed, 148 insertions(+) - -diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c -index bc1a39db8..d62bad52d 100644 ---- a/src/backends/meta-monitor-config-manager.c -+++ b/src/backends/meta-monitor-config-manager.c -@@ -1157,6 +1157,9 @@ create_for_switch_config_external (MetaMonitorConfigManager *config_manager) - x += logical_monitor_config->layout.width; - } - -+ if (!logical_monitor_configs) -+ return NULL; -+ - return meta_monitors_config_new (monitor_manager, - logical_monitor_configs, - layout_mode, -diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c -index f47544b03..725f84173 100644 ---- a/src/tests/monitor-unit-tests.c -+++ b/src/tests/monitor-unit-tests.c -@@ -3175,6 +3175,149 @@ meta_test_monitor_non_upright_panel (void) - check_monitor_configuration (&test_case); - } - -+static void -+meta_test_monitor_switch_external_without_external (void) -+{ -+ MonitorTestCase test_case = { -+ .setup = { -+ .modes = { -+ { -+ .width = 1024, -+ .height = 768, -+ .refresh_rate = 60.0 -+ } -+ }, -+ .n_modes = 1, -+ .outputs = { -+ { -+ .crtc = 0, -+ .modes = { 0 }, -+ .n_modes = 1, -+ .preferred_mode = 0, -+ .possible_crtcs = { 0 }, -+ .n_possible_crtcs = 1, -+ .width_mm = 222, -+ .height_mm = 125, -+ .is_laptop_panel = TRUE -+ }, -+ { -+ .crtc = 1, -+ .modes = { 0 }, -+ .n_modes = 1, -+ .preferred_mode = 0, -+ .possible_crtcs = { 1 }, -+ .n_possible_crtcs = 1, -+ .width_mm = 222, -+ .height_mm = 125, -+ .is_laptop_panel = TRUE -+ } -+ }, -+ .n_outputs = 2, -+ .crtcs = { -+ { -+ .current_mode = 0 -+ }, -+ { -+ .current_mode = 0 -+ } -+ }, -+ .n_crtcs = 2 -+ }, -+ -+ .expect = { -+ .monitors = { -+ { -+ .outputs = { 0 }, -+ .n_outputs = 1, -+ .modes = { -+ { -+ .width = 1024, -+ .height = 768, -+ .refresh_rate = 60.0, -+ .crtc_modes = { -+ { -+ .output = 0, -+ .crtc_mode = 0 -+ } -+ } -+ } -+ }, -+ .n_modes = 1, -+ .current_mode = 0, -+ .width_mm = 222, -+ .height_mm = 125 -+ }, -+ { -+ .outputs = { 1 }, -+ .n_outputs = 1, -+ .modes = { -+ { -+ .width = 1024, -+ .height = 768, -+ .refresh_rate = 60.0, -+ .crtc_modes = { -+ { -+ .output = 1, -+ .crtc_mode = 0 -+ } -+ } -+ } -+ }, -+ .n_modes = 1, -+ .current_mode = 0, -+ .width_mm = 222, -+ .height_mm = 125 -+ } -+ }, -+ .n_monitors = 2, -+ .logical_monitors = { -+ { -+ .monitors = { 0 }, -+ .n_monitors = 1, -+ .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 }, -+ .scale = 1 -+ }, -+ { -+ .monitors = { 1 }, -+ .n_monitors = 1, -+ .layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 }, -+ .scale = 1 -+ } -+ }, -+ .n_logical_monitors = 2, -+ .primary_logical_monitor = 0, -+ .n_outputs = 2, -+ .crtcs = { -+ { -+ .current_mode = 0, -+ }, -+ { -+ .current_mode = 0, -+ }, -+ }, -+ .n_crtcs = 2, -+ .n_tiled_monitors = 0, -+ .screen_width = 2048, -+ .screen_height = 768 -+ } -+ }; -+ MetaMonitorTestSetup *test_setup; -+ MetaBackend *backend = meta_get_backend (); -+ MetaMonitorManager *monitor_manager = -+ meta_backend_get_monitor_manager (backend); -+ -+ test_setup = create_monitor_test_setup (&test_case.setup, -+ MONITOR_TEST_FLAG_NO_STORED); -+ emulate_hotplug (test_setup); -+ check_monitor_configuration (&test_case); -+ -+ meta_monitor_manager_switch_config (monitor_manager, -+ META_MONITOR_SWITCH_CONFIG_EXTERNAL); -+ check_monitor_configuration (&test_case); -+ -+ check_monitor_test_clients_state (); -+} -+ - static void - meta_test_monitor_custom_vertical_config (void) - { -@@ -5969,6 +6112,8 @@ init_monitor_tests (void) - meta_test_monitor_preferred_non_first_mode); - add_monitor_test ("/backends/monitor/non-upright-panel", - meta_test_monitor_non_upright_panel); -+ add_monitor_test ("/backends/monitor/switch-external-without-external", -+ meta_test_monitor_switch_external_without_external); - - add_monitor_test ("/backends/monitor/custom/vertical-config", - meta_test_monitor_custom_vertical_config); --- -2.29.2 - diff --git a/0001-monitor-manager-Add-NightLightSupported-property-to-.patch b/0001-monitor-manager-Add-NightLightSupported-property-to-.patch new file mode 100644 index 0000000000000000000000000000000000000000..9c8ec525eafdb8fb926b209f1486d0d255183084 --- /dev/null +++ b/0001-monitor-manager-Add-NightLightSupported-property-to-.patch @@ -0,0 +1,218 @@ +From f21c8614daeb70a021c128b97c000a92652cf6f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Thu, 24 Feb 2022 12:32:27 +0100 +Subject: [PATCH] monitor-manager: Add NightLightSupported property to + DisplayConfig + +This checks whether it's possible to set a CRTC GAMMA_LUT, which is what +is necessary to implement night light. +--- + src/backends/meta-monitor-manager.c | 76 ++++++++++++++++--- + .../native/meta-monitor-manager-native.c | 25 ++++-- + .../x11/meta-monitor-manager-xrandr.c | 9 ++- + src/org.gnome.Mutter.DisplayConfig.xml | 7 ++ + 4 files changed, 99 insertions(+), 18 deletions(-) + +diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c +index 75146950c3..0f30b3de25 100644 +--- a/src/backends/meta-monitor-manager.c ++++ b/src/backends/meta-monitor-manager.c +@@ -952,6 +952,59 @@ update_panel_orientation_managed (MetaMonitorManager *manager) + handle_orientation_change (orientation_manager, manager); + } + ++static void ++meta_monitor_manager_get_crtc_gamma (MetaMonitorManager *manager, ++ MetaCrtc *crtc, ++ size_t *size, ++ unsigned short **red, ++ unsigned short **green, ++ unsigned short **blue) ++{ ++ MetaMonitorManagerClass *klass = META_MONITOR_MANAGER_GET_CLASS (manager); ++ ++ if (klass->get_crtc_gamma) ++ { ++ klass->get_crtc_gamma (manager, crtc, size, red, green, blue); ++ } ++ else ++ { ++ if (size) ++ *size = 0; ++ if (red) ++ *red = NULL; ++ if (green) ++ *green = NULL; ++ if (blue) ++ *blue = NULL; ++ } ++} ++ ++static gboolean ++is_night_light_supported (MetaMonitorManager *manager) ++{ ++ GList *l; ++ ++ for (l = meta_backend_get_gpus (manager->backend); l; l = l->next) ++ { ++ MetaGpu *gpu = l->data; ++ GList *l_crtc; ++ ++ for (l_crtc = meta_gpu_get_crtcs (gpu); l_crtc; l_crtc = l_crtc->next) ++ { ++ MetaCrtc *crtc = l_crtc->data; ++ size_t gamma_lut_size; ++ ++ meta_monitor_manager_get_crtc_gamma (manager, crtc, ++ &gamma_lut_size, ++ NULL, NULL, NULL); ++ if (gamma_lut_size > 0) ++ return TRUE; ++ } ++ } ++ ++ return FALSE; ++} ++ + void + meta_monitor_manager_setup (MetaMonitorManager *manager) + { +@@ -967,7 +1020,6 @@ meta_monitor_manager_setup (MetaMonitorManager *manager) + meta_dbus_display_config_set_apply_monitors_config_allowed (manager->display_config, + policy->enable_dbus); + +- + meta_monitor_manager_read_current_state (manager); + + meta_monitor_manager_ensure_initial_config (manager); +@@ -2445,7 +2497,6 @@ meta_monitor_manager_handle_get_crtc_gamma (MetaDBusDisplayConfig *skeleton, + guint crtc_id, + MetaMonitorManager *manager) + { +- MetaMonitorManagerClass *klass; + GList *combined_crtcs; + MetaCrtc *crtc; + gsize size; +@@ -2476,14 +2527,8 @@ meta_monitor_manager_handle_get_crtc_gamma (MetaDBusDisplayConfig *skeleton, + crtc = g_list_nth_data (combined_crtcs, crtc_id); + g_list_free (combined_crtcs); + +- klass = META_MONITOR_MANAGER_GET_CLASS (manager); +- if (klass->get_crtc_gamma) +- klass->get_crtc_gamma (manager, crtc, &size, &red, &green, &blue); +- else +- { +- size = 0; +- red = green = blue = NULL; +- } ++ meta_monitor_manager_get_crtc_gamma (manager, crtc, ++ &size, &red, &green, &blue); + + red_bytes = g_bytes_new_take (red, size * sizeof (unsigned short)); + green_bytes = g_bytes_new_take (green, size * sizeof (unsigned short)); +@@ -3078,6 +3123,16 @@ meta_monitor_manager_is_transform_handled (MetaMonitorManager *manager, + return manager_class->is_transform_handled (manager, crtc, transform); + } + ++static void ++update_night_light_supported (MetaMonitorManager *manager) ++{ ++ gboolean night_light_supported; ++ ++ night_light_supported = is_night_light_supported (manager); ++ meta_dbus_display_config_set_night_light_supported (manager->display_config, ++ night_light_supported); ++} ++ + static void + meta_monitor_manager_real_read_current_state (MetaMonitorManager *manager) + { +@@ -3098,6 +3153,7 @@ meta_monitor_manager_real_read_current_state (MetaMonitorManager *manager) + } + + rebuild_monitors (manager); ++ update_night_light_supported (manager); + } + + void +diff --git a/src/backends/native/meta-monitor-manager-native.c b/src/backends/native/meta-monitor-manager-native.c +index fd5e7784ff..37a50f1d6f 100644 +--- a/src/backends/native/meta-monitor-manager-native.c ++++ b/src/backends/native/meta-monitor-manager-native.c +@@ -381,15 +381,30 @@ meta_monitor_manager_native_get_crtc_gamma (MetaMonitorManager *manager, + MetaKmsCrtc *kms_crtc; + const MetaKmsCrtcState *crtc_state; + +- g_return_if_fail (META_IS_CRTC_KMS (crtc)); ++ if (!META_IS_CRTC_KMS (crtc)) ++ { ++ if (size) ++ *size = 0; ++ if (red) ++ *red = NULL; ++ if (green) ++ *green = NULL; ++ if (blue) ++ *blue = NULL; ++ return; ++ } + + kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (crtc)); + crtc_state = meta_kms_crtc_get_current_state (kms_crtc); + +- *size = crtc_state->gamma.size; +- *red = g_memdup2 (crtc_state->gamma.red, *size * sizeof **red); +- *green = g_memdup2 (crtc_state->gamma.green, *size * sizeof **green); +- *blue = g_memdup2 (crtc_state->gamma.blue, *size * sizeof **blue); ++ if (size) ++ *size = crtc_state->gamma.size; ++ if (red) ++ *red = g_memdup2 (crtc_state->gamma.red, *size * sizeof **red); ++ if (green) ++ *green = g_memdup2 (crtc_state->gamma.green, *size * sizeof **green); ++ if (blue) ++ *blue = g_memdup2 (crtc_state->gamma.blue, *size * sizeof **blue); + } + + static char * +diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c +index 98eb080b6b..865f4e5800 100644 +--- a/src/backends/x11/meta-monitor-manager-xrandr.c ++++ b/src/backends/x11/meta-monitor-manager-xrandr.c +@@ -707,9 +707,12 @@ meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager, + (XID) meta_crtc_get_id (crtc)); + + *size = gamma->size; +- *red = g_memdup2 (gamma->red, sizeof (unsigned short) * gamma->size); +- *green = g_memdup2 (gamma->green, sizeof (unsigned short) * gamma->size); +- *blue = g_memdup2 (gamma->blue, sizeof (unsigned short) * gamma->size); ++ if (red) ++ *red = g_memdup2 (gamma->red, sizeof (unsigned short) * gamma->size); ++ if (green) ++ *green = g_memdup2 (gamma->green, sizeof (unsigned short) * gamma->size); ++ if (blue) ++ *blue = g_memdup2 (gamma->blue, sizeof (unsigned short) * gamma->size); + + XRRFreeGamma (gamma); + } +diff --git a/src/org.gnome.Mutter.DisplayConfig.xml b/src/org.gnome.Mutter.DisplayConfig.xml +index c6859c2c09..5f85c5e271 100644 +--- a/src/org.gnome.Mutter.DisplayConfig.xml ++++ b/src/org.gnome.Mutter.DisplayConfig.xml +@@ -297,6 +297,13 @@ + --> + + ++ ++ ++ + - + +