Compare commits
No commits in common. 'i10c-beta' and 'c9' have entirely different histories.
@ -1 +1 @@
|
|||||||
SOURCES/mutter-47.alpha.tar.xz
|
SOURCES/mutter-40.9.tar.xz
|
||||||
|
@ -1 +1 @@
|
|||||||
a153b8b724d2c99e6560f5ed9c107bd1af0f2582 SOURCES/mutter-47.alpha.tar.xz
|
f9b20f8330ecdb76fc887c4a99c03b406e26fd66 SOURCES/mutter-40.9.tar.xz
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
From 3899a01cd6cb00ca686946d3065d58f59f5c2099 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
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
|
||||||
|
|
@ -1,66 +0,0 @@
|
|||||||
From beff8f13ed0cf16fa0b22f69de75f83e0378fdf1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Mon, 22 Jul 2024 12:37:01 +0200
|
|
||||||
Subject: [PATCH 1/3] Revert "x11/window: Compare input shape to client rect
|
|
||||||
when undecorating"
|
|
||||||
|
|
||||||
This reverts commit 1f1538be764ec5018b29d31c4486c0649a4e5068.
|
|
||||||
---
|
|
||||||
src/x11/window-x11.c | 16 +++++++++-------
|
|
||||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
|
|
||||||
index adf5075a9b..e7c76dd674 100644
|
|
||||||
--- a/src/x11/window-x11.c
|
|
||||||
+++ b/src/x11/window-x11.c
|
|
||||||
@@ -2415,7 +2415,6 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|
||||||
g_autoptr (MtkRegion) region = NULL;
|
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
|
||||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
|
||||||
- MtkRectangle bounding_rect = { 0 };
|
|
||||||
Window xwindow;
|
|
||||||
|
|
||||||
if (window->decorated)
|
|
||||||
@@ -2427,14 +2426,10 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
xwindow = priv->frame->xwindow;
|
|
||||||
- bounding_rect.width = window->buffer_rect.width;
|
|
||||||
- bounding_rect.height = window->buffer_rect.height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xwindow = priv->xwindow;
|
|
||||||
- bounding_rect.width = priv->client_rect.width;
|
|
||||||
- bounding_rect.height = priv->client_rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
|
||||||
@@ -2478,8 +2473,8 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|
||||||
else if (n_rects == 1 &&
|
|
||||||
(rects[0].x == 0 &&
|
|
||||||
rects[0].y == 0 &&
|
|
||||||
- rects[0].width == bounding_rect.width &&
|
|
||||||
- rects[0].height == bounding_rect.height))
|
|
||||||
+ rects[0].width == window->buffer_rect.width &&
|
|
||||||
+ rects[0].height == window->buffer_rect.height))
|
|
||||||
{
|
|
||||||
/* This is the bounding region case. Keep the
|
|
||||||
* region as NULL. */
|
|
||||||
@@ -2496,6 +2491,13 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|
||||||
|
|
||||||
if (region != NULL)
|
|
||||||
{
|
|
||||||
+ MtkRectangle bounding_rect;
|
|
||||||
+
|
|
||||||
+ bounding_rect.x = 0;
|
|
||||||
+ bounding_rect.y = 0;
|
|
||||||
+ bounding_rect.width = window->buffer_rect.width;
|
|
||||||
+ bounding_rect.height = window->buffer_rect.height;
|
|
||||||
+
|
|
||||||
/* The shape we get back from the client may have coordinates
|
|
||||||
* outside of the frame. The X SHAPE Extension requires that
|
|
||||||
* the overall shape the client provides never exceeds the
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
|||||||
From c0fda823b3f0c6802afe549379135719f86c6bfc Mon Sep 17 00:00:00 2001
|
From 9d0ded3178777cd6afcdd5fff7b6f0f39a0d5236 Mon Sep 17 00:00:00 2001
|
||||||
From: Adam Williamson <awilliam@redhat.com>
|
From: Adam Williamson <awilliam@redhat.com>
|
||||||
Date: Tue, 9 Mar 2021 17:21:59 -0800
|
Date: Tue, 9 Mar 2021 17:21:59 -0800
|
||||||
Subject: [PATCH] Test: deny atomic KMS for "tegra" (RHBZ #1936991)
|
Subject: [PATCH] Test: deny atomic KMS for "tegra" (RHBZ #1936991)
|
||||||
|
|
||||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
||||||
---
|
---
|
||||||
data/61-mutter.rules | 1 +
|
data/61-mutter.rules | 1 +
|
||||||
src/backends/native/meta-kms-impl-device-atomic.c | 1 +
|
src/backends/native/meta-kms-device.c | 1 +
|
||||||
2 files changed, 2 insertions(+)
|
2 files changed, 2 insertions(+)
|
||||||
|
|
||||||
diff --git a/data/61-mutter.rules b/data/61-mutter.rules
|
diff --git a/data/61-mutter.rules b/data/61-mutter.rules
|
||||||
index 9262b152b9..24f9655b69 100644
|
index edc03e6c1..d8e3c5f00 100644
|
||||||
--- a/data/61-mutter.rules
|
--- a/data/61-mutter.rules
|
||||||
+++ b/data/61-mutter.rules
|
+++ b/data/61-mutter.rules
|
||||||
@@ -114,3 +114,4 @@ DRIVERS=="i915", SUBSYSTEM=="drm", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x9b
|
@@ -3,3 +3,4 @@ DRIVERS=="nouveau", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
|
||||||
DRIVERS=="i915", SUBSYSTEM=="drm", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x9be6", TAG+="mutter-device-disable-kms-modifiers"
|
DRIVERS=="amdgpu", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
|
||||||
DRIVERS=="i915", SUBSYSTEM=="drm", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x9bf6", 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"
|
ENV{ID_PATH}=="platform-vkms", TAG+="mutter-device-ignore"
|
||||||
+DRIVER=="tegra", SUBSYSTEM=="platform", TAG+="mutter-device-disable-atomic-kms"
|
+DRIVER=="tegra", SUBSYSTEM=="platform", TAG+="mutter-device-disable-atomic-kms"
|
||||||
diff --git a/src/backends/native/meta-kms-impl-device-atomic.c b/src/backends/native/meta-kms-impl-device-atomic.c
|
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
|
||||||
index a4ffd70b6a..9fac299e14 100644
|
index 85aded9a6..e749ab6b9 100644
|
||||||
--- a/src/backends/native/meta-kms-impl-device-atomic.c
|
--- a/src/backends/native/meta-kms-device.c
|
||||||
+++ b/src/backends/native/meta-kms-impl-device-atomic.c
|
+++ b/src/backends/native/meta-kms-device.c
|
||||||
@@ -1306,6 +1306,7 @@ requires_hotspots (const char *driver_name)
|
@@ -253,6 +253,7 @@ is_atomic_allowed (const char *driver_name)
|
||||||
"vboxvideo",
|
"vboxvideo",
|
||||||
|
"nvidia-drm",
|
||||||
"virtio_gpu",
|
"virtio_gpu",
|
||||||
"vmwgfx",
|
|
||||||
+ "tegra",
|
+ "tegra",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
--
|
--
|
||||||
2.44.0.501.g19981daefd.dirty
|
2.32.0
|
||||||
|
|
||||||
|
@ -0,0 +1,92 @@
|
|||||||
|
From ff4dc8cc8274dc5f6ed11515e05a341e4e2cec28 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,106 @@
|
|||||||
|
From 8d340beb368b3b59637c91e2e6e4adbc81ce7caf Mon Sep 17 00:00:00 2001
|
||||||
|
From: rpm-build <rpm-build>
|
||||||
|
Date: Wed, 7 Feb 2024 21:27:32 +0100
|
||||||
|
Subject: [PATCH] backends: Disambiguate output mapped to tablet with connector
|
||||||
|
name
|
||||||
|
|
||||||
|
In some circumstances, we may end up with outputs with the same
|
||||||
|
vendor/product/serial, in which case we have a hard time finding the
|
||||||
|
right one to map tablets to, since configuration only has these 3
|
||||||
|
pieces of data.
|
||||||
|
|
||||||
|
Add the handling of a 4th argument containing the output name
|
||||||
|
based on the connector (e.g. HDMI-1), so that it can be used to
|
||||||
|
disambiguate the output if necessary.
|
||||||
|
|
||||||
|
This only kicks in if there actually are multiple outputs with the
|
||||||
|
same EDID data. A goal of the configuration as it was stored was to
|
||||||
|
remain useful if the user changed how the device is physically
|
||||||
|
connected to the computer, this remains true for the vast majority
|
||||||
|
of users having a single thing of each.
|
||||||
|
---
|
||||||
|
src/backends/meta-input-mapper.c | 43 +++++++++++++++++++++++++++++---
|
||||||
|
1 file changed, 39 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
|
||||||
|
index ae4cd05..a0a4b8a 100644
|
||||||
|
--- a/src/backends/meta-input-mapper.c
|
||||||
|
+++ b/src/backends/meta-input-mapper.c
|
||||||
|
@@ -395,9 +395,33 @@ match_builtin (MetaInputMapper *mapper,
|
||||||
|
return monitor == meta_monitor_manager_get_laptop_panel (mapper->monitor_manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static gboolean
|
||||||
|
+monitor_has_twin (MetaMonitor *monitor,
|
||||||
|
+ GList *monitors)
|
||||||
|
+{
|
||||||
|
+ GList *l;
|
||||||
|
+
|
||||||
|
+ for (l = monitors; l; l = l->next)
|
||||||
|
+ {
|
||||||
|
+ if (l->data == monitor)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (g_strcmp0 (meta_monitor_get_vendor (monitor),
|
||||||
|
+ meta_monitor_get_vendor (l->data)) == 0 &&
|
||||||
|
+ g_strcmp0 (meta_monitor_get_product (monitor),
|
||||||
|
+ meta_monitor_get_product (l->data)) == 0 &&
|
||||||
|
+ g_strcmp0 (meta_monitor_get_serial (monitor),
|
||||||
|
+ meta_monitor_get_serial (l->data)) == 0)
|
||||||
|
+ return TRUE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static gboolean
|
||||||
|
match_config (MetaMapperInputInfo *info,
|
||||||
|
- MetaMonitor *monitor)
|
||||||
|
+ MetaMonitor *monitor,
|
||||||
|
+ GList *monitors)
|
||||||
|
{
|
||||||
|
gboolean match = FALSE;
|
||||||
|
char **edid;
|
||||||
|
@@ -406,10 +430,10 @@ match_config (MetaMapperInputInfo *info,
|
||||||
|
edid = g_settings_get_strv (info->settings, "output");
|
||||||
|
n_values = g_strv_length (edid);
|
||||||
|
|
||||||
|
- if (n_values != 3)
|
||||||
|
+ if (n_values < 3)
|
||||||
|
{
|
||||||
|
g_warning ("EDID configuration for device '%s' "
|
||||||
|
- "is incorrect, must have 3 values",
|
||||||
|
+ "is incorrect, must have at least 3 values",
|
||||||
|
clutter_input_device_get_device_name (info->device));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
@@ -421,6 +445,17 @@ match_config (MetaMapperInputInfo *info,
|
||||||
|
g_strcmp0 (meta_monitor_get_product (monitor), edid[1]) == 0 &&
|
||||||
|
g_strcmp0 (meta_monitor_get_serial (monitor), edid[2]) == 0);
|
||||||
|
|
||||||
|
+ if (match && n_values >= 4 && monitor_has_twin (monitor, monitors))
|
||||||
|
+ {
|
||||||
|
+ /* The 4th value if set contains the ID (e.g. HDMI-1), use it
|
||||||
|
+ * for disambiguation if multiple monitors with the same
|
||||||
|
+ * EDID data are found.
|
||||||
|
+ */
|
||||||
|
+ MetaOutput *output;
|
||||||
|
+ output = meta_monitor_get_main_output (monitor);
|
||||||
|
+ match = g_strcmp0 (meta_output_get_name (output), edid[3]) == 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
out:
|
||||||
|
g_strfreev (edid);
|
||||||
|
|
||||||
|
@@ -481,7 +516,7 @@ guess_candidates (MetaInputMapper *mapper,
|
||||||
|
if (builtin && match_builtin (mapper, l->data))
|
||||||
|
match.score |= 1 << META_MATCH_IS_BUILTIN;
|
||||||
|
|
||||||
|
- if (match_config (input, l->data))
|
||||||
|
+ if (match_config (input, l->data, monitors))
|
||||||
|
match.score |= 1 << META_MATCH_CONFIG;
|
||||||
|
|
||||||
|
if (match.score > 0)
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
@ -0,0 +1,144 @@
|
|||||||
|
From 651f5e0c6a33d9ac32c2a16735a026153a2ddf38 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2463>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
From ba25271408a32a2a73a82acc6e094a611001c9f0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
Date: Fri, 16 Dec 2022 23:06:33 +0100
|
||||||
|
Subject: [PATCH] backends: Only apply EDID-based tablet mapping heuristic on
|
||||||
|
integrated devices
|
||||||
|
|
||||||
|
These are the ones attached to a display, thus they are the ones that may need
|
||||||
|
help from this heuristic. Non-integrated tablets (e.g. Intuos) will default to
|
||||||
|
the span of all monitors.
|
||||||
|
|
||||||
|
Fixes mapping of opaque tablets if a display-integrated tablet of the same
|
||||||
|
brand is also plugged in.
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2767>
|
||||||
|
---
|
||||||
|
src/backends/meta-input-mapper.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
|
||||||
|
index cc75f14e8..71d193e5f 100644
|
||||||
|
--- a/src/backends/meta-input-mapper.c
|
||||||
|
+++ b/src/backends/meta-input-mapper.c
|
||||||
|
@@ -455,7 +455,7 @@ guess_candidates (MetaInputMapper *mapper,
|
||||||
|
|
||||||
|
g_assert (META_IS_MONITOR (l->data));
|
||||||
|
|
||||||
|
- if (match_edid (input, l->data, &edid_match))
|
||||||
|
+ if (integrated && match_edid (input, l->data, &edid_match))
|
||||||
|
match.score |= 1 << edid_match;
|
||||||
|
|
||||||
|
if (integrated && match_size (input, l->data))
|
||||||
|
--
|
||||||
|
2.38.1
|
||||||
|
|
@ -0,0 +1,260 @@
|
|||||||
|
From a1f33bdac95ba4fd0599f164ef893c05d8be123b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
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 <ebassi@linux.intel.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef META_KEYMAP_X11_H
|
||||||
|
#define META_KEYMAP_X11_H
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <pango/pango.h>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
From 28030178d7682ce5be03cb7273365ab628065871 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
From 5cd66485cdd99068dab0f57d7f64d3ef294b0037 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
||||||
|
Date: Wed, 4 Aug 2021 19:30:10 +0200
|
||||||
|
Subject: [PATCH] clutter/text: Don't query preferred size without allocation
|
||||||
|
|
||||||
|
The size request functions query the resource scale, which hits
|
||||||
|
an assert if headless. The returned sizes are already only used
|
||||||
|
when clutter_actor_has_allocation() is true, so this doesn't
|
||||||
|
change the condition for calling either redraw or relayout.
|
||||||
|
|
||||||
|
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4522
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1956>
|
||||||
|
---
|
||||||
|
clutter/clutter/clutter-text.c | 17 +++++++++++------
|
||||||
|
1 file changed, 11 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
|
||||||
|
index 45c7eac56b..80e53ea32f 100644
|
||||||
|
--- a/clutter/clutter/clutter-text.c
|
||||||
|
+++ b/clutter/clutter/clutter-text.c
|
||||||
|
@@ -4797,16 +4797,21 @@ static void
|
||||||
|
clutter_text_queue_redraw_or_relayout (ClutterText *self)
|
||||||
|
{
|
||||||
|
ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||||
|
- gfloat preferred_width;
|
||||||
|
- gfloat preferred_height;
|
||||||
|
+ float preferred_width = -1.;
|
||||||
|
+ float preferred_height = -1.;
|
||||||
|
|
||||||
|
clutter_text_dirty_cache (self);
|
||||||
|
|
||||||
|
- /* we're using our private implementations here to avoid the caching done by ClutterActor */
|
||||||
|
- clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
|
||||||
|
- clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
||||||
|
+ if (clutter_actor_has_allocation (actor))
|
||||||
|
+ {
|
||||||
|
+ /* we're using our private implementations here to avoid the caching done by ClutterActor */
|
||||||
|
+ clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
|
||||||
|
+ clutter_text_get_preferred_height (actor, preferred_width, NULL,
|
||||||
|
+ &preferred_height);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (clutter_actor_has_allocation (actor) &&
|
||||||
|
+ if (preferred_width > 0 &&
|
||||||
|
+ preferred_height > 0 &&
|
||||||
|
fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
|
||||||
|
fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
|
||||||
|
clutter_text_queue_redraw (actor);
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,85 @@
|
|||||||
|
From 1ab51efc968d7d3c6244d9b7efcdf4bae4fc0a9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
||||||
|
Date: Wed, 12 Mar 2014 02:04:13 +0100
|
||||||
|
Subject: [PATCH] constraints: Enforce X11 size limits
|
||||||
|
|
||||||
|
X11 limits windows to a maximum of 32767x32767, enforce that restriction
|
||||||
|
to keep insanely huge windows from crashing the WM.
|
||||||
|
---
|
||||||
|
src/core/constraints.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 42 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/constraints.c b/src/core/constraints.c
|
||||||
|
index 4b1d95338a..eee16dc48f 100644
|
||||||
|
--- a/src/core/constraints.c
|
||||||
|
+++ b/src/core/constraints.c
|
||||||
|
@@ -109,6 +109,7 @@ typedef enum
|
||||||
|
PRIORITY_TITLEBAR_VISIBLE = 4,
|
||||||
|
PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA = 4,
|
||||||
|
PRIORITY_CUSTOM_RULE = 4,
|
||||||
|
+ PRIORITY_XLIMITS = 4,
|
||||||
|
PRIORITY_MAXIMUM = 4 /* Dummy value used for loop end = max(all priorities) */
|
||||||
|
} ConstraintPriority;
|
||||||
|
|
||||||
|
@@ -204,6 +205,10 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
|
||||||
|
ConstraintInfo *info,
|
||||||
|
ConstraintPriority priority,
|
||||||
|
gboolean check_only);
|
||||||
|
+static gboolean constrain_xlimits (MetaWindow *window,
|
||||||
|
+ ConstraintInfo *info,
|
||||||
|
+ ConstraintPriority priority,
|
||||||
|
+ gboolean check_only);
|
||||||
|
|
||||||
|
static void setup_constraint_info (ConstraintInfo *info,
|
||||||
|
MetaWindow *window,
|
||||||
|
@@ -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"},
|
||||||
|
+ {constrain_xlimits, "constrain_xlimits"},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -1876,3 +1882,39 @@ constrain_partially_onscreen (MetaWindow *window,
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#define MAX_WINDOW_SIZE 32767
|
||||||
|
+
|
||||||
|
+static gboolean
|
||||||
|
+constrain_xlimits (MetaWindow *window,
|
||||||
|
+ ConstraintInfo *info,
|
||||||
|
+ ConstraintPriority priority,
|
||||||
|
+ gboolean check_only)
|
||||||
|
+{
|
||||||
|
+ int max_w, max_h;
|
||||||
|
+ gboolean constraint_already_satisfied;
|
||||||
|
+
|
||||||
|
+ if (priority > PRIORITY_XLIMITS)
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+ max_w = max_h = MAX_WINDOW_SIZE;
|
||||||
|
+
|
||||||
|
+ if (window->frame)
|
||||||
|
+ {
|
||||||
|
+ MetaFrameBorders borders;
|
||||||
|
+ meta_frame_calc_borders (window->frame, &borders);
|
||||||
|
+
|
||||||
|
+ max_w -= (borders.total.left + borders.total.right);
|
||||||
|
+ max_h -= (borders.total.top + borders.total.bottom);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ constraint_already_satisfied = info->current.width < max_w && info->current.height < max_h;
|
||||||
|
+ if (check_only || constraint_already_satisfied)
|
||||||
|
+ return constraint_already_satisfied;
|
||||||
|
+
|
||||||
|
+ info->current.width = MIN (info->current.width, max_w);
|
||||||
|
+ info->current.height = MIN (info->current.height, max_h);
|
||||||
|
+
|
||||||
|
+ return TRUE;
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,162 @@
|
|||||||
|
From 88b50f5a9e4b1b87e766e929a77aafdc27e335cf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
Date: Wed, 7 Jun 2023 11:04:15 +0200
|
||||||
|
Subject: [PATCH] core: Change MetaWaylandTextInput event forwarding to IMs
|
||||||
|
|
||||||
|
We need to juggle with some things here to keep key event ordering
|
||||||
|
and accounting consistent.
|
||||||
|
|
||||||
|
The keyboard internal state changes (and maybe modifier event emission)
|
||||||
|
happening through meta_wayland_seat_update() should ideally happen
|
||||||
|
from the same key events that reach the client through wl_keyboard.key,
|
||||||
|
so that wl_keyboard.modifier events are emitted in the right relative
|
||||||
|
order to other key events.
|
||||||
|
|
||||||
|
In order to fix this, we need to decide at an earlier point whether
|
||||||
|
the event will get processed through IM (and maybe be reinjected),
|
||||||
|
thus ignored in wait of IM-postprocessed events.
|
||||||
|
|
||||||
|
This means we pay less attention to whether events are first-hand
|
||||||
|
hardware events for some things and go with the event that does
|
||||||
|
eventually reach to us (hardware or IM).
|
||||||
|
|
||||||
|
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5890
|
||||||
|
---
|
||||||
|
src/core/events.c | 8 ++++++++
|
||||||
|
src/wayland/meta-wayland-keyboard.c | 8 --------
|
||||||
|
src/wayland/meta-wayland-seat.c | 30 ++++++++++++++++++++++-------
|
||||||
|
src/wayland/meta-wayland-seat.h | 3 +++
|
||||||
|
src/wayland/meta-wayland.c | 7 +++++++
|
||||||
|
src/wayland/meta-wayland.h | 3 +++
|
||||||
|
6 files changed, 44 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/events.c b/src/core/events.c
|
||||||
|
index 6bb4e90..7751042 100644
|
||||||
|
--- a/src/core/events.c
|
||||||
|
+++ b/src/core/events.c
|
||||||
|
@@ -234,6 +234,14 @@ meta_display_handle_event (MetaDisplay *display,
|
||||||
|
if (meta_is_wayland_compositor ())
|
||||||
|
{
|
||||||
|
compositor = meta_wayland_compositor_get_default ();
|
||||||
|
+
|
||||||
|
+ if (display->event_route == META_EVENT_ROUTE_NORMAL &&
|
||||||
|
+ meta_wayland_compositor_handle_text_input_event (compositor, event))
|
||||||
|
+ {
|
||||||
|
+ bypass_wayland = bypass_clutter = TRUE;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
meta_wayland_compositor_update (compositor, event);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
|
||||||
|
index 836939c..460d9e9 100644
|
||||||
|
--- a/src/wayland/meta-wayland-keyboard.c
|
||||||
|
+++ b/src/wayland/meta-wayland-keyboard.c
|
||||||
|
@@ -564,14 +564,6 @@ meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
|
||||||
|
{
|
||||||
|
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
|
||||||
|
|
||||||
|
- /* Only handle real, non-synthetic, events here. The IM is free to reemit
|
||||||
|
- * key events (incl. modifiers), handling those additionally will result
|
||||||
|
- * in doubly-pressed keys.
|
||||||
|
- */
|
||||||
|
- if ((event->flags &
|
||||||
|
- (CLUTTER_EVENT_FLAG_SYNTHETIC | CLUTTER_EVENT_FLAG_INPUT_METHOD)) != 0)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
/* If we get a key event but still have pending modifier state
|
||||||
|
* changes from a previous event that didn't get cleared, we need to
|
||||||
|
* send that state right away so that the new key event can be
|
||||||
|
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
|
||||||
|
index 25d5074..27d8fe3 100644
|
||||||
|
--- a/src/wayland/meta-wayland-seat.c
|
||||||
|
+++ b/src/wayland/meta-wayland-seat.c
|
||||||
|
@@ -376,6 +376,29 @@ meta_wayland_seat_update (MetaWaylandSeat *seat,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+gboolean
|
||||||
|
+meta_wayland_seat_handle_text_input_event (MetaWaylandSeat *seat,
|
||||||
|
+ const ClutterEvent *event)
|
||||||
|
+{
|
||||||
|
+ switch (event->type)
|
||||||
|
+ {
|
||||||
|
+ case CLUTTER_KEY_PRESS:
|
||||||
|
+ case CLUTTER_KEY_RELEASE:
|
||||||
|
+ if (meta_wayland_text_input_handle_event (seat->text_input, event))
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+ if (meta_wayland_gtk_text_input_handle_event (seat->gtk_text_input,
|
||||||
|
+ event))
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
gboolean
|
||||||
|
meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
|
||||||
|
const ClutterEvent *event)
|
||||||
|
@@ -398,13 +421,6 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
|
||||||
|
break;
|
||||||
|
case CLUTTER_KEY_PRESS:
|
||||||
|
case CLUTTER_KEY_RELEASE:
|
||||||
|
- if (meta_wayland_text_input_handle_event (seat->text_input, event))
|
||||||
|
- return TRUE;
|
||||||
|
-
|
||||||
|
- if (meta_wayland_gtk_text_input_handle_event (seat->gtk_text_input,
|
||||||
|
- event))
|
||||||
|
- return TRUE;
|
||||||
|
-
|
||||||
|
if (meta_wayland_seat_has_keyboard (seat))
|
||||||
|
return meta_wayland_keyboard_handle_event (seat->keyboard,
|
||||||
|
(const ClutterKeyEvent *) event);
|
||||||
|
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
|
||||||
|
index ae4e107..ab90106 100644
|
||||||
|
--- a/src/wayland/meta-wayland-seat.h
|
||||||
|
+++ b/src/wayland/meta-wayland-seat.h
|
||||||
|
@@ -84,4 +84,7 @@ gboolean meta_wayland_seat_has_pointer (MetaWaylandSeat *seat);
|
||||||
|
|
||||||
|
gboolean meta_wayland_seat_has_touch (MetaWaylandSeat *seat);
|
||||||
|
|
||||||
|
+gboolean meta_wayland_seat_handle_text_input_event (MetaWaylandSeat *seat,
|
||||||
|
+ const ClutterEvent *event);
|
||||||
|
+
|
||||||
|
#endif /* META_WAYLAND_SEAT_H */
|
||||||
|
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
|
||||||
|
index a3f0984..b548aa1 100644
|
||||||
|
--- a/src/wayland/meta-wayland.c
|
||||||
|
+++ b/src/wayland/meta-wayland.c
|
||||||
|
@@ -721,3 +721,10 @@ meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
|
||||||
|
meta_wayland_compositor_remove_surface_association (compositor, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+gboolean
|
||||||
|
+meta_wayland_compositor_handle_text_input_event (MetaWaylandCompositor *compositor,
|
||||||
|
+ const ClutterEvent *event)
|
||||||
|
+{
|
||||||
|
+ return meta_wayland_seat_handle_text_input_event (compositor->seat, event);
|
||||||
|
+}
|
||||||
|
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
|
||||||
|
index 6c655e4..ad82d52 100644
|
||||||
|
--- a/src/wayland/meta-wayland.h
|
||||||
|
+++ b/src/wayland/meta-wayland.h
|
||||||
|
@@ -92,6 +92,9 @@ void meta_wayland_compositor_schedule_surface_association (Me
|
||||||
|
int id,
|
||||||
|
MetaWindow *window);
|
||||||
|
|
||||||
|
+gboolean meta_wayland_compositor_handle_text_input_event (MetaWaylandCompositor *compositor,
|
||||||
|
+ const ClutterEvent *event);
|
||||||
|
+
|
||||||
|
void meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
|
||||||
|
int id,
|
||||||
|
MetaWaylandSurface *surface);
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
From 4618af58cc9046142f348d16ab1150bfde8f49c4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||||
|
Date: Wed, 20 Jul 2022 10:10:21 +0000
|
||||||
|
Subject: [PATCH] cursor-renderer-native: Don't retry forever after GBM cursor
|
||||||
|
functions fail
|
||||||
|
|
||||||
|
This avoids flooding the log with every cursor change:
|
||||||
|
```
|
||||||
|
(gnome-shell:19923): libmutter-WARNING **: 10:15:23.404: Realizing HW cursor failed: Failed to allocate gbm_bo: Invalid argument
|
||||||
|
|
||||||
|
(gnome-shell:19923): libmutter-WARNING **: 10:15:23.450: Realizing HW cursor failed: Failed to allocate gbm_bo: Invalid argument
|
||||||
|
|
||||||
|
(gnome-shell:19923): libmutter-WARNING **: 10:15:23.451: Realizing HW cursor failed: Failed to allocate gbm_bo: Invalid argument
|
||||||
|
```
|
||||||
|
|
||||||
|
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2354
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2520>
|
||||||
|
---
|
||||||
|
.../native/meta-cursor-renderer-native.c | 19 ++++++++++++++-----
|
||||||
|
1 file changed, 14 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
index 3c63a15d68..08c9819a12 100644
|
||||||
|
--- a/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
@@ -506,12 +506,9 @@ unset_crtc_cursor (MetaCursorRendererNative *native,
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-disable_hw_cursor_for_crtc (MetaKmsCrtc *kms_crtc,
|
||||||
|
- const GError *error)
|
||||||
|
+disable_hw_cursor_for_gpu (MetaGpuKms *gpu_kms,
|
||||||
|
+ const GError *error)
|
||||||
|
{
|
||||||
|
- MetaCrtcKms *crtc_kms = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
||||||
|
- MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
|
- MetaGpuKms *gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||||
|
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data =
|
||||||
|
meta_cursor_renderer_native_gpu_data_from_gpu (gpu_kms);
|
||||||
|
|
||||||
|
@@ -521,6 +518,17 @@ disable_hw_cursor_for_crtc (MetaKmsCrtc *kms_crtc,
|
||||||
|
cursor_renderer_gpu_data->hw_cursor_broken = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+disable_hw_cursor_for_crtc (MetaKmsCrtc *kms_crtc,
|
||||||
|
+ const GError *error)
|
||||||
|
+{
|
||||||
|
+ MetaCrtcKms *crtc_kms = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
||||||
|
+ MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||||
|
+ MetaGpuKms *gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||||
|
+
|
||||||
|
+ disable_hw_cursor_for_gpu (gpu_kms, error);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
meta_cursor_renderer_native_prepare_frame (MetaCursorRendererNative *cursor_renderer_native,
|
||||||
|
MetaRendererView *view)
|
||||||
|
@@ -1375,6 +1383,7 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native,
|
||||||
|
if (!buffer)
|
||||||
|
{
|
||||||
|
g_warning ("Realizing HW cursor failed: %s", error->message);
|
||||||
|
+ disable_hw_cursor_for_gpu (gpu_kms, error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 088644fb1773b64ca45dec497589517e1774eac1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 27 Aug 2024 11:33:14 +0200
|
||||||
|
Subject: [PATCH 1/5] display: Make cgroup constructor local
|
||||||
|
|
||||||
|
This silences a warning about a missing function declaration.
|
||||||
|
---
|
||||||
|
src/core/display.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/display.c b/src/core/display.c
|
||||||
|
index 4c9038e627..97f591a876 100644
|
||||||
|
--- a/src/core/display.c
|
||||||
|
+++ b/src/core/display.c
|
||||||
|
@@ -1619,7 +1619,7 @@ extract_app_id_from_cgroup (const char *cgroup)
|
||||||
|
return g_steal_pointer (&app_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
-MetaCGroup*
|
||||||
|
+static MetaCGroup*
|
||||||
|
meta_cgroup_new (const char *path)
|
||||||
|
{
|
||||||
|
MetaCGroup *cgroup;
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
From 7ac5b7bad8f2d0e61700610f68282f6687cc9d2e Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
||||||
|
Date: Thu, 21 Jul 2016 15:43:12 +0200
|
||||||
|
Subject: [PATCH] events: Don't move (sloppy) focus while buttons are pressed
|
||||||
|
|
||||||
|
(https://bugzilla.redhat.com/show_bug.cgi?id=1358535)
|
||||||
|
---
|
||||||
|
src/x11/events.c | 11 +++++++++++
|
||||||
|
1 file changed, 11 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/x11/events.c b/src/x11/events.c
|
||||||
|
index efa8f9856b..388eff0ac7 100644
|
||||||
|
--- a/src/x11/events.c
|
||||||
|
+++ b/src/x11/events.c
|
||||||
|
@@ -839,6 +839,16 @@ crossing_serial_is_ignored (MetaX11Display *x11_display,
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static gboolean
|
||||||
|
+event_has_button_mask (XIEnterEvent *enter_event)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+ for (i = 0; i < enter_event->buttons.mask_len; i++)
|
||||||
|
+ if (enter_event->buttons.mask[i] != '\0')
|
||||||
|
+ return TRUE;
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static gboolean
|
||||||
|
handle_input_xevent (MetaX11Display *x11_display,
|
||||||
|
XIEvent *input_event,
|
||||||
|
@@ -883,6 +893,7 @@ handle_input_xevent (MetaX11Display *x11_display,
|
||||||
|
* avoid races.
|
||||||
|
*/
|
||||||
|
if (window && !crossing_serial_is_ignored (x11_display, serial) &&
|
||||||
|
+ !event_has_button_mask (enter_event) &&
|
||||||
|
enter_event->mode != XINotifyGrab &&
|
||||||
|
enter_event->mode != XINotifyUngrab &&
|
||||||
|
enter_event->detail != XINotifyInferior &&
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 65ffd7e4df42cd62633f93107644f87208881578 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
From 168a47c9ebefaeca6cc25fcbc0d41ac50c16f400 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Wed, 1 Feb 2023 10:07:53 +0100
|
||||||
|
Subject: [PATCH] gpu/kms: Report that we can have outputs if we have
|
||||||
|
connectors
|
||||||
|
|
||||||
|
As part of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/525
|
||||||
|
(introduction of transactional KMS API), the logic determining whether a
|
||||||
|
GPU can have outputs was changed from whether any connectors existed to
|
||||||
|
whether any connected connectors existed. That effectively meant that we
|
||||||
|
wouldn't attempt to start at all if there were no monitors connected
|
||||||
|
while starting up.
|
||||||
|
|
||||||
|
This was unintentional, so lets revert back the expected behavior.
|
||||||
|
---
|
||||||
|
src/backends/native/meta-gpu-kms.c | 13 +------------
|
||||||
|
1 file changed, 1 insertion(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
|
||||||
|
index e81c90a022..2756bddb26 100644
|
||||||
|
--- a/src/backends/native/meta-gpu-kms.c
|
||||||
|
+++ b/src/backends/native/meta-gpu-kms.c
|
||||||
|
@@ -399,18 +399,7 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
|
||||||
|
gboolean
|
||||||
|
meta_gpu_kms_can_have_outputs (MetaGpuKms *gpu_kms)
|
||||||
|
{
|
||||||
|
- GList *l;
|
||||||
|
- int n_connected_connectors = 0;
|
||||||
|
-
|
||||||
|
- for (l = meta_kms_device_get_connectors (gpu_kms->kms_device); l; l = l->next)
|
||||||
|
- {
|
||||||
|
- MetaKmsConnector *kms_connector = l->data;
|
||||||
|
-
|
||||||
|
- if (meta_kms_connector_get_current_state (kms_connector))
|
||||||
|
- n_connected_connectors++;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return n_connected_connectors > 0;
|
||||||
|
+ return !!meta_kms_device_get_connectors (gpu_kms->kms_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaGpuKms *
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
@ -0,0 +1,193 @@
|
|||||||
|
From af0460d0cedd5a66b2110ab2a99e67c647e7b6fb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Piotr Lopatka <piotr.lopatka@gmail.com>
|
||||||
|
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1879>
|
||||||
|
---
|
||||||
|
.../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
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
From de3188fcc6863b8a6e3d2443a00cf3b00f6f26ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||||
|
Date: Tue, 12 Apr 2022 18:34:58 +0800
|
||||||
|
Subject: [PATCH 1/2] kms/crtc: Add function meta_kms_crtc_has_gamma
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,51 @@
|
|||||||
|
From 11e6100226006b5371de30310357582db64c9309 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||||
|
Date: Tue, 5 Apr 2022 17:05:17 +0800
|
||||||
|
Subject: [PATCH 1/2] kms/impl-device: Add addfb2_modifiers to
|
||||||
|
MetaKmsDeviceCaps
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
|
||||||
|
---
|
||||||
|
src/backends/native/meta-kms-impl-device.c | 6 ++++++
|
||||||
|
src/backends/native/meta-kms-impl-device.h | 1 +
|
||||||
|
2 files changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c
|
||||||
|
index 75920fe6b..d2e821338 100644
|
||||||
|
--- a/src/backends/native/meta-kms-impl-device.c
|
||||||
|
+++ b/src/backends/native/meta-kms-impl-device.c
|
||||||
|
@@ -288,6 +288,7 @@ init_caps (MetaKmsImplDevice *impl_device)
|
||||||
|
meta_kms_impl_device_get_instance_private (impl_device);
|
||||||
|
int fd = priv->fd;
|
||||||
|
uint64_t cursor_width, cursor_height;
|
||||||
|
+ uint64_t addfb2_modifiers;
|
||||||
|
|
||||||
|
if (drmGetCap (fd, DRM_CAP_CURSOR_WIDTH, &cursor_width) == 0 &&
|
||||||
|
drmGetCap (fd, DRM_CAP_CURSOR_HEIGHT, &cursor_height) == 0)
|
||||||
|
@@ -296,6 +297,11 @@ init_caps (MetaKmsImplDevice *impl_device)
|
||||||
|
priv->caps.cursor_width = cursor_width;
|
||||||
|
priv->caps.cursor_height = cursor_height;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (drmGetCap (fd, DRM_CAP_ADDFB2_MODIFIERS, &addfb2_modifiers) == 0)
|
||||||
|
+ {
|
||||||
|
+ priv->caps.addfb2_modifiers = (addfb2_modifiers != 0);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
diff --git a/src/backends/native/meta-kms-impl-device.h b/src/backends/native/meta-kms-impl-device.h
|
||||||
|
index 913ba992f..a82ad4155 100644
|
||||||
|
--- a/src/backends/native/meta-kms-impl-device.h
|
||||||
|
+++ b/src/backends/native/meta-kms-impl-device.h
|
||||||
|
@@ -36,6 +36,7 @@ typedef struct _MetaKmsDeviceCaps
|
||||||
|
gboolean has_cursor_size;
|
||||||
|
uint64_t cursor_width;
|
||||||
|
uint64_t cursor_height;
|
||||||
|
+ gboolean addfb2_modifiers;
|
||||||
|
} MetaKmsDeviceCaps;
|
||||||
|
|
||||||
|
typedef struct _MetaKmsProp MetaKmsProp;
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
From 99c74360451a85fca9dacad531ed22adbc1b0805 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Tue, 13 Feb 2018 09:44:50 -0500
|
||||||
|
Subject: [PATCH] main: be more aggressive in assuming X11 backend
|
||||||
|
|
||||||
|
If the session is started by vncserver right now, the
|
||||||
|
XDG_SESSION_TYPE won't be X11. Ideally that would be
|
||||||
|
fixed, but for backward compatibility we should default
|
||||||
|
to X11 if the session type isn't set to wayland explicitly.
|
||||||
|
---
|
||||||
|
src/core/main.c | 8 +++-----
|
||||||
|
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/main.c b/src/core/main.c
|
||||||
|
index a07dda9ecc..0d241f952b 100644
|
||||||
|
--- a/src/core/main.c
|
||||||
|
+++ b/src/core/main.c
|
||||||
|
@@ -407,7 +407,6 @@ find_session_type (void)
|
||||||
|
char *session_id;
|
||||||
|
char *session_type;
|
||||||
|
const char *session_type_env;
|
||||||
|
- gboolean is_tty = FALSE;
|
||||||
|
int ret, i;
|
||||||
|
|
||||||
|
ret = sd_pid_get_session (0, &session_id);
|
||||||
|
@@ -420,8 +419,7 @@ find_session_type (void)
|
||||||
|
{
|
||||||
|
if (session_type_is_supported (session_type))
|
||||||
|
goto out;
|
||||||
|
- else
|
||||||
|
- is_tty = g_strcmp0 (session_type, "tty") == 0;
|
||||||
|
+
|
||||||
|
free (session_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -453,8 +451,8 @@ find_session_type (void)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* Legacy support for starting through xinit */
|
||||||
|
- if (is_tty && (g_getenv ("MUTTER_DISPLAY") || g_getenv ("DISPLAY")))
|
||||||
|
+ /* Legacy support for starting through xinit or vncserver */
|
||||||
|
+ if (g_getenv ("MUTTER_DISPLAY") || g_getenv ("DISPLAY"))
|
||||||
|
{
|
||||||
|
session_type = strdup ("x11");
|
||||||
|
goto out;
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,218 @@
|
|||||||
|
From f21c8614daeb70a021c128b97c000a92652cf6f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
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 @@
|
||||||
|
-->
|
||||||
|
<property name="ApplyMonitorsConfigAllowed" type="b" access="read" />
|
||||||
|
|
||||||
|
+ <!--
|
||||||
|
+ NightLightSupported:
|
||||||
|
+
|
||||||
|
+ Whether night light is supported by this system.
|
||||||
|
+ -->
|
||||||
|
+ <property name="NightLightSupported" type="b" access="read" />
|
||||||
|
+
|
||||||
|
<!--
|
||||||
|
MonitorsChanged:
|
||||||
|
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -0,0 +1,107 @@
|
|||||||
|
From 86000c32d64cea7be2e6ed911cb9ea5df1306c0e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||||
|
Date: Thu, 18 Aug 2022 13:36:20 -0500
|
||||||
|
Subject: [PATCH 1/2] output/kms: Add more heuristics to decide when to offer
|
||||||
|
fallback modes
|
||||||
|
|
||||||
|
If the panel is connected via eDP and supports more than one mode
|
||||||
|
at different resolutions don't try to add more.
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
|
||||||
|
(cherry picked from commit 96aa0fb8536eca579ceb1b17d83e19cf9e3e9e81)
|
||||||
|
(cherry picked from commit 877cc3eb7d44e2886395151f763ec09bea350444)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-output-kms.c | 56 +++++++++++++++++++++------
|
||||||
|
1 file changed, 44 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
|
||||||
|
index f35cdf04e1..9adc20bfd9 100644
|
||||||
|
--- a/src/backends/native/meta-output-kms.c
|
||||||
|
+++ b/src/backends/native/meta-output-kms.c
|
||||||
|
@@ -224,6 +224,45 @@ compare_modes (const void *one,
|
||||||
|
meta_crtc_mode_get_name (crtc_mode_two));
|
||||||
|
}
|
||||||
|
|
||||||
|
+static gboolean
|
||||||
|
+are_all_modes_equally_sized (MetaOutputInfo *output_info)
|
||||||
|
+{
|
||||||
|
+ const MetaCrtcModeInfo *base =
|
||||||
|
+ meta_crtc_mode_get_info (output_info->modes[0]);
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = 1; i < output_info->n_modes; i++)
|
||||||
|
+ {
|
||||||
|
+ const MetaCrtcModeInfo *mode_info =
|
||||||
|
+ meta_crtc_mode_get_info (output_info->modes[i]);
|
||||||
|
+
|
||||||
|
+ if (base->width != mode_info->width ||
|
||||||
|
+ base->height != mode_info->height)
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+maybe_add_fallback_modes (const MetaKmsConnectorState *connector_state,
|
||||||
|
+ MetaOutputInfo *output_info,
|
||||||
|
+ MetaGpuKms *gpu_kms,
|
||||||
|
+ MetaKmsConnector *kms_connector)
|
||||||
|
+{
|
||||||
|
+ if (!connector_state->has_scaling)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (output_info->connector_type == DRM_MODE_CONNECTOR_eDP &&
|
||||||
|
+ !are_all_modes_equally_sized (output_info))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ meta_topic (META_DEBUG_KMS, "Adding common modes to connector %u on %s",
|
||||||
|
+ meta_kms_connector_get_id (kms_connector),
|
||||||
|
+ meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
|
+ add_common_modes (output_info, gpu_kms);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static gboolean
|
||||||
|
init_output_modes (MetaOutputInfo *output_info,
|
||||||
|
MetaGpuKms *gpu_kms,
|
||||||
|
@@ -252,14 +291,7 @@ init_output_modes (MetaOutputInfo *output_info,
|
||||||
|
output_info->preferred_mode = output_info->modes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (connector_state->has_scaling)
|
||||||
|
- {
|
||||||
|
- meta_topic (META_DEBUG_KMS, "Adding common modes to connector %u on %s",
|
||||||
|
- meta_kms_connector_get_id (kms_connector),
|
||||||
|
- meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
|
- add_common_modes (output_info, gpu_kms);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
+ maybe_add_fallback_modes (connector_state, output_info, gpu_kms, kms_connector);
|
||||||
|
if (!output_info->modes)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
@@ -322,6 +354,10 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
||||||
|
output_info->height_mm = connector_state->height_mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ drm_connector_type = meta_kms_connector_get_connector_type (kms_connector);
|
||||||
|
+ output_info->connector_type =
|
||||||
|
+ meta_kms_connector_type_from_drm (drm_connector_type);
|
||||||
|
+
|
||||||
|
if (!init_output_modes (output_info, gpu_kms, kms_connector, error))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
@@ -349,10 +385,6 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
||||||
|
|
||||||
|
meta_output_info_parse_edid (output_info, connector_state->edid_data);
|
||||||
|
|
||||||
|
- drm_connector_type = meta_kms_connector_get_connector_type (kms_connector);
|
||||||
|
- output_info->connector_type =
|
||||||
|
- meta_kms_connector_type_from_drm (drm_connector_type);
|
||||||
|
-
|
||||||
|
output_info->tile_info = connector_state->tile_info;
|
||||||
|
|
||||||
|
output = g_object_new (META_TYPE_OUTPUT_KMS,
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From cbe6fb86ce1e71c7360974a960db6bf79eb1ebde Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
||||||
Date: Fri, 2 Dec 2022 22:49:41 +0100
|
|
||||||
Subject: [PATCH] place: Always center initial-setup/fedora-welcome
|
|
||||||
|
|
||||||
---
|
|
||||||
src/core/place.c | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/core/place.c b/src/core/place.c
|
|
||||||
index 8a06ccb667..f34ae7f43d 100644
|
|
||||||
--- a/src/core/place.c
|
|
||||||
+++ b/src/core/place.c
|
|
||||||
@@ -377,6 +377,11 @@ window_place_centered (MetaWindow *window)
|
|
||||||
|
|
||||||
type = window->type;
|
|
||||||
|
|
||||||
+ if (g_strcmp0 (meta_window_get_wm_class (window), "org.gnome.InitialSetup") == 0 ||
|
|
||||||
+ g_strcmp0 (meta_window_get_wm_class (window), "org.fedoraproject.welcome-screen") == 0 ||
|
|
||||||
+ g_strcmp0 (meta_window_get_wm_class (window), "fedora-welcome") == 0)
|
|
||||||
+ return TRUE;
|
|
||||||
+
|
|
||||||
return (type == META_WINDOW_DIALOG ||
|
|
||||||
type == META_WINDOW_MODAL_DIALOG ||
|
|
||||||
type == META_WINDOW_SPLASHSCREEN ||
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
|||||||
|
From fa70ee1cd78e2b161545bc47a1c1083063030f77 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Mon, 11 Oct 2021 10:52:43 +0200
|
||||||
|
Subject: [PATCH 1/5] renderer/native: Log render mode per device
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2051>
|
||||||
|
(cherry picked from commit e8249a572d669c4c0a8464d6bce556b2cbaca4ef)
|
||||||
|
(cherry picked from commit fe0ea79b83256d80f1dee1e4a49c94a5d6fd18a6)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-renderer-native.c | 30 ++++++++++++++++++++++
|
||||||
|
1 file changed, 30 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
|
||||||
|
index 735c37202..f92f648e5 100644
|
||||||
|
--- a/src/backends/native/meta-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-renderer-native.c
|
||||||
|
@@ -1808,6 +1808,24 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static const char *
|
||||||
|
+renderer_data_mode_to_string (MetaRendererNativeMode mode)
|
||||||
|
+{
|
||||||
|
+ switch (mode)
|
||||||
|
+ {
|
||||||
|
+ case META_RENDERER_NATIVE_MODE_GBM:
|
||||||
|
+ return "gbm";
|
||||||
|
+ case META_RENDERER_NATIVE_MODE_SURFACELESS:
|
||||||
|
+ return "surfaceless";
|
||||||
|
+#ifdef HAVE_EGL_DEVICE
|
||||||
|
+ case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
|
||||||
|
+ return "egldevice";
|
||||||
|
+#endif
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ g_assert_not_reached ();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static gboolean
|
||||||
|
create_renderer_gpu_data (MetaRendererNative *renderer_native,
|
||||||
|
MetaGpuKms *gpu_kms,
|
||||||
|
@@ -1822,6 +1840,18 @@ create_renderer_gpu_data (MetaRendererNative *renderer_native,
|
||||||
|
if (!renderer_gpu_data)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
+ if (gpu_kms)
|
||||||
|
+ {
|
||||||
|
+ g_message ("Created %s renderer for '%s'",
|
||||||
|
+ renderer_data_mode_to_string (renderer_gpu_data->mode),
|
||||||
|
+ meta_gpu_kms_get_file_path (gpu_kms));
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ g_message ("Created %s renderer without GPU",
|
||||||
|
+ renderer_data_mode_to_string (renderer_gpu_data->mode));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
g_hash_table_insert (renderer_native->gpu_datas,
|
||||||
|
gpu_kms,
|
||||||
|
renderer_gpu_data);
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
From 6e2ef652cd58136aa668d0c1bd843fe83f11a0ab Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Fri, 26 Oct 2018 08:49:39 +0200
|
||||||
|
Subject: [PATCH] wayland: Allow Xwayland grabs on selected apps
|
||||||
|
|
||||||
|
Allow Xwayland grabs on a selected set of X11 applications.
|
||||||
|
---
|
||||||
|
data/org.gnome.mutter.wayland.gschema.xml.in | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/data/org.gnome.mutter.wayland.gschema.xml.in b/data/org.gnome.mutter.wayland.gschema.xml.in
|
||||||
|
index 8a1878e105..5527a46bc6 100644
|
||||||
|
--- a/data/org.gnome.mutter.wayland.gschema.xml.in
|
||||||
|
+++ b/data/org.gnome.mutter.wayland.gschema.xml.in
|
||||||
|
@@ -66,7 +66,7 @@
|
||||||
|
gettext-domain="@GETTEXT_DOMAIN@">
|
||||||
|
|
||||||
|
<key name="xwayland-allow-grabs" type="b">
|
||||||
|
- <default>false</default>
|
||||||
|
+ <default>true</default>
|
||||||
|
<summary>Allow X11 grabs to lock keyboard focus with Xwayland</summary>
|
||||||
|
<description>
|
||||||
|
Allow all keyboard events to be routed to X11 “override redirect”
|
||||||
|
@@ -86,7 +86,7 @@
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="xwayland-grab-access-rules" type="as">
|
||||||
|
- <default>[]</default>
|
||||||
|
+ <default>['@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@']</default>
|
||||||
|
<summary>Xwayland applications allowed to issue keyboard grabs</summary>
|
||||||
|
<description>
|
||||||
|
List the resource names or resource class of X11 windows either
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,192 @@
|
|||||||
|
From 5e4a1290ce75ed94e3f0f457d35a225f2ef3878c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Tue, 28 Nov 2017 10:54:08 +0100
|
||||||
|
Subject: [PATCH] wayland: Avoid a race in wl_seat capabilities
|
||||||
|
|
||||||
|
The way wl_seat capabilities work, by notifying clients of capabilities
|
||||||
|
changes, and clients consequently requesting the relevant interface
|
||||||
|
objects (pointer, keyboard, touch) is inherently racy.
|
||||||
|
|
||||||
|
On quick VT changes for example, capabilities on the seat will be added
|
||||||
|
and removed, and by the time the client receives the capability change
|
||||||
|
notification and requests the relevant keyboard, pointer or touch,
|
||||||
|
another VT switch might have occurred and the wl_pointer, wl_keyboard or
|
||||||
|
wl_touch already destroyed, leading to a protocol error which kills the
|
||||||
|
client.
|
||||||
|
|
||||||
|
To avoid this, create the objects when requested regardless of the
|
||||||
|
capabilities.
|
||||||
|
|
||||||
|
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1797
|
||||||
|
Related: https://bugzilla.gnome.org/show_bug.cgi?id=790932
|
||||||
|
---
|
||||||
|
src/wayland/meta-wayland-pointer.c | 45 ++++++++++++++++++++++++------
|
||||||
|
src/wayland/meta-wayland-seat.c | 9 ++----
|
||||||
|
src/wayland/meta-wayland-touch.c | 8 ------
|
||||||
|
3 files changed, 40 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
|
||||||
|
index 3132abfd2..abd779ad7 100644
|
||||||
|
--- a/src/wayland/meta-wayland-pointer.c
|
||||||
|
+++ b/src/wayland/meta-wayland-pointer.c
|
||||||
|
@@ -109,7 +109,7 @@ meta_wayland_pointer_client_new (void)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
|
||||||
|
+meta_wayland_pointer_make_resources_inert (MetaWaylandPointerClient *pointer_client)
|
||||||
|
{
|
||||||
|
struct wl_resource *resource, *next;
|
||||||
|
|
||||||
|
@@ -141,10 +141,25 @@ meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
|
||||||
|
wl_list_init (wl_resource_get_link (resource));
|
||||||
|
wl_resource_set_user_data (resource, NULL);
|
||||||
|
}
|
||||||
|
+}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
|
||||||
|
+{
|
||||||
|
+ meta_wayland_pointer_make_resources_inert (pointer_client);
|
||||||
|
g_free (pointer_client);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+make_resources_inert_foreach (gpointer key,
|
||||||
|
+ gpointer value,
|
||||||
|
+ gpointer data)
|
||||||
|
+{
|
||||||
|
+ MetaWaylandPointerClient *pointer_client = value;
|
||||||
|
+
|
||||||
|
+ meta_wayland_pointer_make_resources_inert (pointer_client);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static gboolean
|
||||||
|
meta_wayland_pointer_client_is_empty (MetaWaylandPointerClient *pointer_client)
|
||||||
|
{
|
||||||
|
@@ -158,8 +173,6 @@ MetaWaylandPointerClient *
|
||||||
|
meta_wayland_pointer_get_pointer_client (MetaWaylandPointer *pointer,
|
||||||
|
struct wl_client *client)
|
||||||
|
{
|
||||||
|
- if (!pointer->pointer_clients)
|
||||||
|
- return NULL;
|
||||||
|
return g_hash_table_lookup (pointer->pointer_clients, client);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -475,10 +488,6 @@ meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
|
||||||
|
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||||
|
ClutterSeat *clutter_seat;
|
||||||
|
|
||||||
|
- pointer->pointer_clients =
|
||||||
|
- g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
|
- (GDestroyNotify) meta_wayland_pointer_client_free);
|
||||||
|
-
|
||||||
|
pointer->cursor_surface = NULL;
|
||||||
|
|
||||||
|
clutter_seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||||
|
@@ -508,6 +517,10 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
|
||||||
|
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||||
|
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
|
||||||
|
|
||||||
|
+ g_hash_table_foreach (pointer->pointer_clients,
|
||||||
|
+ make_resources_inert_foreach,
|
||||||
|
+ NULL);
|
||||||
|
+
|
||||||
|
g_signal_handlers_disconnect_by_func (cursor_tracker,
|
||||||
|
(gpointer) meta_wayland_pointer_on_cursor_changed,
|
||||||
|
pointer);
|
||||||
|
@@ -531,7 +544,6 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
|
||||||
|
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||||
|
meta_wayland_pointer_set_current (pointer, NULL);
|
||||||
|
|
||||||
|
- g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
|
||||||
|
pointer->cursor_surface = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1356,11 +1368,28 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer)
|
||||||
|
pointer->default_grab.interface = &default_pointer_grab_interface;
|
||||||
|
pointer->default_grab.pointer = pointer;
|
||||||
|
pointer->grab = &pointer->default_grab;
|
||||||
|
+ pointer->pointer_clients =
|
||||||
|
+ g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
|
+ (GDestroyNotify) meta_wayland_pointer_client_free);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+meta_wayland_pointer_finalize (GObject *object)
|
||||||
|
+{
|
||||||
|
+ MetaWaylandPointer *pointer = META_WAYLAND_POINTER (object);
|
||||||
|
+
|
||||||
|
+ g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
|
||||||
|
+
|
||||||
|
+ G_OBJECT_CLASS (meta_wayland_pointer_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_pointer_class_init (MetaWaylandPointerClass *klass)
|
||||||
|
{
|
||||||
|
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
+
|
||||||
|
+ object_class->finalize = meta_wayland_pointer_finalize;
|
||||||
|
+
|
||||||
|
signals[FOCUS_SURFACE_CHANGED] = g_signal_new ("focus-surface-changed",
|
||||||
|
G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
|
||||||
|
index c6390dde7..efce6d6d6 100644
|
||||||
|
--- a/src/wayland/meta-wayland-seat.c
|
||||||
|
+++ b/src/wayland/meta-wayland-seat.c
|
||||||
|
@@ -46,8 +46,7 @@ seat_get_pointer (struct wl_client *client,
|
||||||
|
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
||||||
|
MetaWaylandPointer *pointer = seat->pointer;
|
||||||
|
|
||||||
|
- if (meta_wayland_seat_has_pointer (seat))
|
||||||
|
- meta_wayland_pointer_create_new_resource (pointer, client, resource, id);
|
||||||
|
+ meta_wayland_pointer_create_new_resource (pointer, client, resource, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -58,8 +57,7 @@ seat_get_keyboard (struct wl_client *client,
|
||||||
|
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
||||||
|
MetaWaylandKeyboard *keyboard = seat->keyboard;
|
||||||
|
|
||||||
|
- if (meta_wayland_seat_has_keyboard (seat))
|
||||||
|
- meta_wayland_keyboard_create_new_resource (keyboard, client, resource, id);
|
||||||
|
+ meta_wayland_keyboard_create_new_resource (keyboard, client, resource, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -70,8 +68,7 @@ seat_get_touch (struct wl_client *client,
|
||||||
|
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
||||||
|
MetaWaylandTouch *touch = seat->touch;
|
||||||
|
|
||||||
|
- if (meta_wayland_seat_has_touch (seat))
|
||||||
|
- meta_wayland_touch_create_new_resource (touch, client, resource, id);
|
||||||
|
+ meta_wayland_touch_create_new_resource (touch, client, resource, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
|
||||||
|
index 002ff16f7..15f0312eb 100644
|
||||||
|
--- a/src/wayland/meta-wayland-touch.c
|
||||||
|
+++ b/src/wayland/meta-wayland-touch.c
|
||||||
|
@@ -521,16 +521,8 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
|
||||||
|
struct wl_resource *seat_resource,
|
||||||
|
uint32_t id)
|
||||||
|
{
|
||||||
|
- MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
|
struct wl_resource *cr;
|
||||||
|
|
||||||
|
- if (!meta_wayland_seat_has_touch (seat))
|
||||||
|
- {
|
||||||
|
- wl_resource_post_error (seat_resource, WL_DISPLAY_ERROR_INVALID_METHOD,
|
||||||
|
- "Cannot retrieve touch interface without touch capability");
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
cr = wl_resource_create (client, &wl_touch_interface, wl_resource_get_version (seat_resource), id);
|
||||||
|
wl_resource_set_implementation (cr, &touch_interface, touch, unbind_resource);
|
||||||
|
wl_list_insert (&touch->resource_list, wl_resource_get_link (cr));
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
From 0fe26e5b6d1e6f03a99623edf6a6f4c6caa2e142 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||||
|
Date: Tue, 15 Oct 2024 14:56:33 +0200
|
||||||
|
Subject: [PATCH 1/2] wayland/wl-shell: Make sure created window has a proper
|
||||||
|
size
|
||||||
|
|
||||||
|
The wl_shell_window construction is a bit messy, and was not properly
|
||||||
|
resizing when a window was created after a buffer was attached. This,
|
||||||
|
when the window was the dummy window in wl-paste, caused a SIGFPE as the
|
||||||
|
window was incorrectly assumed to be 0x0, i.e. size being 0.
|
||||||
|
---
|
||||||
|
src/wayland/meta-wayland-wl-shell.c | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c
|
||||||
|
index 964c185b23..51d88cea2b 100644
|
||||||
|
--- a/src/wayland/meta-wayland-wl-shell.c
|
||||||
|
+++ b/src/wayland/meta-wayland-wl-shell.c
|
||||||
|
@@ -481,7 +481,7 @@ sync_wl_shell_parent_relationship (MetaWaylandSurface *surface,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void
|
||||||
|
+static MetaWindow *
|
||||||
|
create_wl_shell_surface_window (MetaWaylandSurface *surface)
|
||||||
|
{
|
||||||
|
MetaWaylandWlShellSurface *wl_shell_surface =
|
||||||
|
@@ -513,6 +513,8 @@ create_wl_shell_surface_window (MetaWaylandSurface *surface)
|
||||||
|
if (meta_wayland_surface_get_window (child))
|
||||||
|
sync_wl_shell_parent_relationship (child, surface);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -597,7 +599,7 @@ wl_shell_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||||
|
* convenient for us. */
|
||||||
|
if (surface->buffer_ref->buffer && !window)
|
||||||
|
{
|
||||||
|
- create_wl_shell_surface_window (surface);
|
||||||
|
+ window = create_wl_shell_surface_window (surface);
|
||||||
|
}
|
||||||
|
else if (!surface->buffer_ref->buffer && window)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -0,0 +1,101 @@
|
|||||||
|
From f1da6553e13e3c9a9ed91370dcf435fa4a19fb2b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Thu, 6 Jun 2024 13:01:41 -0400
|
||||||
|
Subject: [PATCH 1/6] window: Don't switch workspaces if users from forged
|
||||||
|
activation messages
|
||||||
|
|
||||||
|
---
|
||||||
|
src/core/window.c | 11 +++++++++--
|
||||||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index 7d86adece..e787dbce0 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -3687,74 +3687,81 @@ meta_window_unshade (MetaWindow *window,
|
||||||
|
"Focusing window %s after unshading it",
|
||||||
|
window->desc);
|
||||||
|
meta_window_focus (window, timestamp);
|
||||||
|
|
||||||
|
set_net_wm_state (window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
unminimize_func (MetaWindow *window,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
meta_window_unminimize (window);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unminimize_window_and_all_transient_parents (MetaWindow *window)
|
||||||
|
{
|
||||||
|
meta_window_unminimize (window);
|
||||||
|
meta_window_foreach_ancestor (window, unminimize_func, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_window_activate_full (MetaWindow *window,
|
||||||
|
guint32 timestamp,
|
||||||
|
MetaClientType source_indication,
|
||||||
|
MetaWorkspace *workspace)
|
||||||
|
{
|
||||||
|
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||||
|
- gboolean allow_workspace_switch;
|
||||||
|
+ gboolean allow_workspace_switch = FALSE;
|
||||||
|
|
||||||
|
if (window->unmanaging)
|
||||||
|
{
|
||||||
|
g_warning ("Trying to activate unmanaged window '%s'", window->desc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"_NET_ACTIVE_WINDOW message sent for %s at time %u "
|
||||||
|
"by client type %u.",
|
||||||
|
window->desc, timestamp, source_indication);
|
||||||
|
|
||||||
|
- allow_workspace_switch = (timestamp != 0);
|
||||||
|
+ if (window->display->last_user_time == timestamp)
|
||||||
|
+ {
|
||||||
|
+ /* Only allow workspace switches if this activation message uses the same
|
||||||
|
+ * timestamp as the last user interaction
|
||||||
|
+ */
|
||||||
|
+ allow_workspace_switch = TRUE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (timestamp != 0 &&
|
||||||
|
XSERVER_TIME_IS_BEFORE (timestamp, window->display->last_user_time))
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"last_user_time (%u) is more recent; ignoring "
|
||||||
|
" _NET_ACTIVE_WINDOW message.",
|
||||||
|
window->display->last_user_time);
|
||||||
|
meta_window_set_demands_attention(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timestamp == 0)
|
||||||
|
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||||
|
|
||||||
|
meta_window_set_user_time (window, timestamp);
|
||||||
|
|
||||||
|
/* disable show desktop mode unless we're a desktop component */
|
||||||
|
maybe_leave_show_desktop_mode (window);
|
||||||
|
|
||||||
|
/* Get window on current or given workspace */
|
||||||
|
if (workspace == NULL)
|
||||||
|
workspace = workspace_manager->active_workspace;
|
||||||
|
|
||||||
|
/* For non-transient windows, we just set up a pulsing indicator,
|
||||||
|
rather than move windows or workspaces.
|
||||||
|
See http://bugzilla.gnome.org/show_bug.cgi?id=482354 */
|
||||||
|
if (window->transient_for == NULL &&
|
||||||
|
!allow_workspace_switch &&
|
||||||
|
!meta_window_located_on_workspace (window, workspace))
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
@ -1,62 +0,0 @@
|
|||||||
From d1be108c729331aa169a2a0397925c7b17507857 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Fri, 20 Oct 2023 15:44:29 +0800
|
|
||||||
Subject: [PATCH 1/4] x11-display: Make subwindow redirection call mode
|
|
||||||
specific
|
|
||||||
|
|
||||||
This means that for X11 sessions we'll do it before any windows are
|
|
||||||
mapped, and before any plugin implementation is started. Doing it before
|
|
||||||
a plugin is started is important, because things that the plugin does
|
|
||||||
during startup can have consequences on how compositing on Xorg works.
|
|
||||||
|
|
||||||
For the Xwayland case, we'll do it relatively in the setup phase. It
|
|
||||||
appears to have been harmless to do it later in the post-opened signal,
|
|
||||||
but there is no harm in doing it as one of the earlier steps.
|
|
||||||
|
|
||||||
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3089
|
|
||||||
---
|
|
||||||
src/compositor/meta-compositor-x11.c | 2 ++
|
|
||||||
src/wayland/meta-xwayland.c | 1 +
|
|
||||||
src/x11/meta-x11-display.c | 1 -
|
|
||||||
3 files changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
|
|
||||||
index cbc48bcefc..760d6fdddc 100644
|
|
||||||
--- a/src/compositor/meta-compositor-x11.c
|
|
||||||
+++ b/src/compositor/meta-compositor-x11.c
|
|
||||||
@@ -188,6 +188,8 @@ meta_compositor_x11_manage (MetaCompositor *compositor,
|
|
||||||
|
|
||||||
compositor_x11->have_x11_sync_object = meta_sync_ring_init (xdisplay);
|
|
||||||
|
|
||||||
+ meta_x11_display_redirect_windows (x11_display, display);
|
|
||||||
+
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
|
|
||||||
index 3366f11adc..db0a4a271a 100644
|
|
||||||
--- a/src/wayland/meta-xwayland.c
|
|
||||||
+++ b/src/wayland/meta-xwayland.c
|
|
||||||
@@ -1179,6 +1179,7 @@ on_x11_display_setup (MetaDisplay *display,
|
|
||||||
{
|
|
||||||
MetaX11Display *x11_display = meta_display_get_x11_display (display);
|
|
||||||
|
|
||||||
+ meta_x11_display_redirect_windows (x11_display, display);
|
|
||||||
meta_xwayland_init_dnd (x11_display);
|
|
||||||
meta_xwayland_init_xrandr (manager, x11_display);
|
|
||||||
}
|
|
||||||
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
|
|
||||||
index 6b8d7faf55..6de0511dc6 100644
|
|
||||||
--- a/src/x11/meta-x11-display.c
|
|
||||||
+++ b/src/x11/meta-x11-display.c
|
|
||||||
@@ -308,7 +308,6 @@ on_x11_display_opened (MetaX11Display *x11_display,
|
|
||||||
MetaDisplay *display)
|
|
||||||
{
|
|
||||||
meta_display_manage_all_xwindows (display);
|
|
||||||
- meta_x11_display_redirect_windows (x11_display, display);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
From 3a73958f7eab973189441ec9b4a4c96ee6bb8ec7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Mon, 22 Jul 2024 12:55:30 +0200
|
|
||||||
Subject: [PATCH 2/3] Revert "x11/window: Update comment and variable name to
|
|
||||||
reflect current behavior"
|
|
||||||
|
|
||||||
This reverts commit e4763d00e8512aeb408ae118597d753f12217487.
|
|
||||||
---
|
|
||||||
src/x11/window-x11.c | 15 ++++++++-------
|
|
||||||
1 file changed, 8 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
|
|
||||||
index e7c76dd674..b358b64bf2 100644
|
|
||||||
--- a/src/x11/window-x11.c
|
|
||||||
+++ b/src/x11/window-x11.c
|
|
||||||
@@ -2491,20 +2491,21 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|
||||||
|
|
||||||
if (region != NULL)
|
|
||||||
{
|
|
||||||
- MtkRectangle bounding_rect;
|
|
||||||
+ MtkRectangle client_area;
|
|
||||||
|
|
||||||
- bounding_rect.x = 0;
|
|
||||||
- bounding_rect.y = 0;
|
|
||||||
- bounding_rect.width = window->buffer_rect.width;
|
|
||||||
- bounding_rect.height = window->buffer_rect.height;
|
|
||||||
+ client_area.x = 0;
|
|
||||||
+ client_area.y = 0;
|
|
||||||
+ client_area.width = window->buffer_rect.width;
|
|
||||||
+ client_area.height = window->buffer_rect.height;
|
|
||||||
|
|
||||||
/* The shape we get back from the client may have coordinates
|
|
||||||
* outside of the frame. The X SHAPE Extension requires that
|
|
||||||
* the overall shape the client provides never exceeds the
|
|
||||||
* "bounding rectangle" of the window -- the shape that the
|
|
||||||
- * window would have gotten if it was unshaped.
|
|
||||||
+ * window would have gotten if it was unshaped. In our case,
|
|
||||||
+ * this is simply the client area.
|
|
||||||
*/
|
|
||||||
- mtk_region_intersect_rectangle (region, &bounding_rect);
|
|
||||||
+ mtk_region_intersect_rectangle (region, &client_area);
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_window_set_input_region (window, region);
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -0,0 +1,133 @@
|
|||||||
|
From b2cf9836373a446d674ecce251e3e42bb863dc75 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Thu, 6 Jun 2024 13:32:03 -0400
|
||||||
|
Subject: [PATCH 2/6] core/events: Count shell interactions has user
|
||||||
|
interactions too
|
||||||
|
|
||||||
|
mutter keeps track of the last time the user used the system to
|
||||||
|
decide whether or not to prevent focus stealing.
|
||||||
|
|
||||||
|
Right now, it only considers user interactions with application
|
||||||
|
windows, not interactions with the compositor chrome.
|
||||||
|
|
||||||
|
That means a user could start loading an application,
|
||||||
|
switch workspaces, and get forcefully pulled back when the
|
||||||
|
application finishes loading.
|
||||||
|
|
||||||
|
This commit fixes that problem by updating the user time on shell
|
||||||
|
interactions as well.
|
||||||
|
---
|
||||||
|
src/core/events.c | 38 ++++++++++++++++++++++++--------------
|
||||||
|
1 file changed, 24 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/events.c b/src/core/events.c
|
||||||
|
index 775104229..4d25b6dc0 100644
|
||||||
|
--- a/src/core/events.c
|
||||||
|
+++ b/src/core/events.c
|
||||||
|
@@ -288,79 +288,89 @@ meta_display_handle_event (MetaDisplay *display,
|
||||||
|
if (source)
|
||||||
|
meta_backend_update_last_device (backend, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND
|
||||||
|
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
|
||||||
|
{
|
||||||
|
MetaCursorRenderer *cursor_renderer;
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
|
||||||
|
device = clutter_event_get_device (event);
|
||||||
|
cursor_renderer = meta_backend_get_cursor_renderer_for_device (backend,
|
||||||
|
device);
|
||||||
|
if (cursor_renderer)
|
||||||
|
meta_cursor_renderer_update_position (cursor_renderer);
|
||||||
|
|
||||||
|
if (device == clutter_seat_get_pointer (clutter_input_device_get_seat (device)))
|
||||||
|
{
|
||||||
|
MetaCursorTracker *cursor_tracker =
|
||||||
|
meta_backend_get_cursor_tracker (backend);
|
||||||
|
|
||||||
|
meta_cursor_tracker_invalidate_position (cursor_tracker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
window = get_window_for_event (display, event);
|
||||||
|
|
||||||
|
display->current_time = event->any.time;
|
||||||
|
|
||||||
|
- if (window && !window->override_redirect &&
|
||||||
|
- (event->type == CLUTTER_KEY_PRESS ||
|
||||||
|
- event->type == CLUTTER_BUTTON_PRESS ||
|
||||||
|
- event->type == CLUTTER_TOUCH_BEGIN))
|
||||||
|
+ if (event->type == CLUTTER_KEY_PRESS ||
|
||||||
|
+ event->type == CLUTTER_BUTTON_PRESS ||
|
||||||
|
+ event->type == CLUTTER_TOUCH_BEGIN)
|
||||||
|
{
|
||||||
|
- if (META_CURRENT_TIME == display->current_time)
|
||||||
|
+ if (window && !window->override_redirect)
|
||||||
|
{
|
||||||
|
- /* We can't use missing (i.e. invalid) timestamps to set user time,
|
||||||
|
- * nor do we want to use them to sanity check other timestamps.
|
||||||
|
- * See bug 313490 for more details.
|
||||||
|
- */
|
||||||
|
- meta_warning ("Event has no timestamp! You may be using a broken "
|
||||||
|
- "program such as xse. Please ask the authors of that "
|
||||||
|
- "program to fix it.");
|
||||||
|
+ if (META_CURRENT_TIME == display->current_time)
|
||||||
|
+ {
|
||||||
|
+ /* We can't use missing (i.e. invalid) timestamps to set user time,
|
||||||
|
+ * nor do we want to use them to sanity check other timestamps.
|
||||||
|
+ * See bug 313490 for more details.
|
||||||
|
+ */
|
||||||
|
+ meta_warning ("Event has no timestamp! You may be using a broken "
|
||||||
|
+ "program such as xse. Please ask the authors of that "
|
||||||
|
+ "program to fix it.");
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ meta_window_set_user_time (window, display->current_time);
|
||||||
|
+ meta_display_sanity_check_timestamps (display, display->current_time);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- meta_window_set_user_time (window, display->current_time);
|
||||||
|
- meta_display_sanity_check_timestamps (display, display->current_time);
|
||||||
|
+ /* Always update user time to the last time the user did an event, even
|
||||||
|
+ * if it was to shell chrome or a notification or something.
|
||||||
|
+ */
|
||||||
|
+ if (XSERVER_TIME_IS_BEFORE (display->last_user_time, display->current_time))
|
||||||
|
+ display->last_user_time = display->current_time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gesture_tracker = meta_display_get_gesture_tracker (display);
|
||||||
|
|
||||||
|
if (meta_gesture_tracker_handle_event (gesture_tracker, event))
|
||||||
|
{
|
||||||
|
bypass_wayland = bypass_clutter = TRUE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (display->event_route == META_EVENT_ROUTE_WINDOW_OP)
|
||||||
|
{
|
||||||
|
if (meta_window_handle_mouse_grab_op_event (window, event))
|
||||||
|
{
|
||||||
|
bypass_clutter = TRUE;
|
||||||
|
bypass_wayland = TRUE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For key events, it's important to enforce single-handling, or
|
||||||
|
* we can get into a confused state. So if a keybinding is
|
||||||
|
* handled (because it's one of our hot-keys, or because we are
|
||||||
|
* in a keyboard-grabbed mode like moving a window, we don't
|
||||||
|
* want to pass the key event to the compositor or Wayland at all.
|
||||||
|
*/
|
||||||
|
if (meta_keybindings_process_event (display, window, event))
|
||||||
|
{
|
||||||
|
bypass_clutter = TRUE;
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
From 69c40c6d126a5c804db54ce0afe581362e4fd33b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||||
|
Date: Tue, 12 Apr 2022 18:37:29 +0800
|
||||||
|
Subject: [PATCH 2/2] crtc/kms: Don't add gamma to the update if unsupported by
|
||||||
|
the CRTC
|
||||||
|
|
||||||
|
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2197
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
|
||||||
|
---
|
||||||
|
src/backends/native/meta-crtc-kms.c | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
|
||||||
|
index f1bc79146..953f023ce 100644
|
||||||
|
--- a/src/backends/native/meta-crtc-kms.c
|
||||||
|
+++ b/src/backends/native/meta-crtc-kms.c
|
||||||
|
@@ -201,10 +201,14 @@ meta_crtc_kms_maybe_set_gamma (MetaCrtcKms *crtc_kms,
|
||||||
|
MetaKms *kms = meta_kms_device_get_kms (kms_device);
|
||||||
|
MetaKmsUpdate *kms_update;
|
||||||
|
MetaKmsCrtcGamma *gamma;
|
||||||
|
+ MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||||
|
|
||||||
|
if (crtc_kms->is_gamma_valid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ if (!meta_kms_crtc_has_gamma (kms_crtc))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
gamma = meta_monitor_manager_native_get_cached_crtc_gamma (monitor_manager_native,
|
||||||
|
crtc_kms);
|
||||||
|
if (!gamma)
|
||||||
|
@@ -212,7 +216,7 @@ meta_crtc_kms_maybe_set_gamma (MetaCrtcKms *crtc_kms,
|
||||||
|
|
||||||
|
kms_update = meta_kms_ensure_pending_update (kms, kms_device);
|
||||||
|
meta_kms_update_set_crtc_gamma (kms_update,
|
||||||
|
- meta_crtc_kms_get_kms_crtc (crtc_kms),
|
||||||
|
+ kms_crtc,
|
||||||
|
gamma->size,
|
||||||
|
gamma->red,
|
||||||
|
gamma->green,
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From 37b4b8dd63851e97b507008fe1028a259c0419c7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 27 Aug 2024 11:33:22 +0200
|
||||||
|
Subject: [PATCH 2/5] display: Also set window cgroup on cgroup creation
|
||||||
|
|
||||||
|
We'd register the cgroup for a window twice, because the firs time
|
||||||
|
didn't update the MetaWindow::cgroup pointer. This meant the cgroups
|
||||||
|
were never removed.
|
||||||
|
---
|
||||||
|
src/core/display.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/display.c b/src/core/display.c
|
||||||
|
index 97f591a876..e99e787fbe 100644
|
||||||
|
--- a/src/core/display.c
|
||||||
|
+++ b/src/core/display.c
|
||||||
|
@@ -1704,6 +1704,7 @@ meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
|
||||||
|
cgroup = meta_cgroup_new (path);
|
||||||
|
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||||
|
+ window->cgroup = cgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -1,112 +0,0 @@
|
|||||||
From c6a74d8f4161440a530bea5ca3b5cf199beb046b Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Fri, 20 Oct 2023 17:03:31 +0800
|
|
||||||
Subject: [PATCH 2/4] display: Move X11 initial focus handling to
|
|
||||||
MetaX11Display
|
|
||||||
|
|
||||||
It's X11 specific, so put it in the X11 display manager object.
|
|
||||||
---
|
|
||||||
src/core/display.c | 34 ----------------------------------
|
|
||||||
src/x11/meta-x11-display.c | 25 +++++++++++++++++++++++++
|
|
||||||
2 files changed, 25 insertions(+), 34 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/core/display.c b/src/core/display.c
|
|
||||||
index bd09082ed2..ddd475f457 100644
|
|
||||||
--- a/src/core/display.c
|
|
||||||
+++ b/src/core/display.c
|
|
||||||
@@ -945,9 +945,6 @@ meta_display_new (MetaContext *context,
|
|
||||||
MetaDisplay *display;
|
|
||||||
MetaDisplayPrivate *priv;
|
|
||||||
guint32 timestamp;
|
|
||||||
-#ifdef HAVE_X11_CLIENT
|
|
||||||
- Window old_active_xwindow = None;
|
|
||||||
-#endif
|
|
||||||
MetaMonitorManager *monitor_manager;
|
|
||||||
MetaSettings *settings;
|
|
||||||
MetaInputCapture *input_capture;
|
|
||||||
@@ -1065,14 +1062,6 @@ meta_display_new (MetaContext *context,
|
|
||||||
display->last_focus_time = timestamp;
|
|
||||||
display->last_user_time = timestamp;
|
|
||||||
|
|
||||||
-#ifdef HAVE_X11
|
|
||||||
- if (!meta_is_wayland_compositor ())
|
|
||||||
- meta_prop_get_window (display->x11_display,
|
|
||||||
- display->x11_display->xroot,
|
|
||||||
- display->x11_display->atom__NET_ACTIVE_WINDOW,
|
|
||||||
- &old_active_xwindow);
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
if (!meta_compositor_manage (display->compositor, error))
|
|
||||||
{
|
|
||||||
g_object_unref (display);
|
|
||||||
@@ -1093,30 +1082,7 @@ meta_display_new (MetaContext *context,
|
|
||||||
g_signal_connect (display->gesture_tracker, "state-changed",
|
|
||||||
G_CALLBACK (gesture_tracker_state_changed), display);
|
|
||||||
|
|
||||||
- /* We know that if mutter is running as a Wayland compositor,
|
|
||||||
- * we start out with no windows.
|
|
||||||
- */
|
|
||||||
-#ifdef HAVE_X11_CLIENT
|
|
||||||
- if (!meta_is_wayland_compositor ())
|
|
||||||
- meta_display_manage_all_xwindows (display);
|
|
||||||
-
|
|
||||||
- if (old_active_xwindow != None)
|
|
||||||
- {
|
|
||||||
- MetaWindow *old_active_window;
|
|
||||||
- old_active_window = meta_x11_display_lookup_x_window (display->x11_display,
|
|
||||||
- old_active_xwindow);
|
|
||||||
- if (old_active_window)
|
|
||||||
- meta_window_focus (old_active_window, timestamp);
|
|
||||||
- else
|
|
||||||
- meta_display_unset_input_focus (display, timestamp);
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- meta_display_unset_input_focus (display, timestamp);
|
|
||||||
- }
|
|
||||||
-#else
|
|
||||||
meta_display_unset_input_focus (display, timestamp);
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
g_signal_connect (stage, "notify::is-grabbed",
|
|
||||||
G_CALLBACK (on_is_grabbed_changed), display);
|
|
||||||
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
|
|
||||||
index 6de0511dc6..267fa1b835 100644
|
|
||||||
--- a/src/x11/meta-x11-display.c
|
|
||||||
+++ b/src/x11/meta-x11-display.c
|
|
||||||
@@ -307,7 +307,32 @@ static void
|
|
||||||
on_x11_display_opened (MetaX11Display *x11_display,
|
|
||||||
MetaDisplay *display)
|
|
||||||
{
|
|
||||||
+ Window old_active_xwindow = None;
|
|
||||||
+
|
|
||||||
+ if (!meta_is_wayland_compositor ())
|
|
||||||
+ {
|
|
||||||
+ meta_prop_get_window (display->x11_display,
|
|
||||||
+ display->x11_display->xroot,
|
|
||||||
+ display->x11_display->atom__NET_ACTIVE_WINDOW,
|
|
||||||
+ &old_active_xwindow);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
meta_display_manage_all_xwindows (display);
|
|
||||||
+
|
|
||||||
+ if (old_active_xwindow != None)
|
|
||||||
+ {
|
|
||||||
+ MetaWindow *old_active_window;
|
|
||||||
+
|
|
||||||
+ old_active_window = meta_x11_display_lookup_x_window (x11_display,
|
|
||||||
+ old_active_xwindow);
|
|
||||||
+ if (old_active_window)
|
|
||||||
+ {
|
|
||||||
+ uint32_t timestamp;
|
|
||||||
+
|
|
||||||
+ timestamp = display->x11_display->timestamp;
|
|
||||||
+ meta_window_focus (old_active_window, timestamp);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
From dd94c448e94b1033b90749d77c5dc587c3b8f9f4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||||
|
Date: Tue, 5 Apr 2022 17:06:21 +0800
|
||||||
|
Subject: [PATCH 2/2] kms/device: Disable modifiers when
|
||||||
|
!DRM_CAP_ADDFB2_MODIFIERS
|
||||||
|
|
||||||
|
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2210
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
|
||||||
|
---
|
||||||
|
src/backends/native/meta-kms-device.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
|
||||||
|
index bef1e2065..7c84f14f5 100644
|
||||||
|
--- a/src/backends/native/meta-kms-device.c
|
||||||
|
+++ b/src/backends/native/meta-kms-device.c
|
||||||
|
@@ -490,6 +490,9 @@ meta_kms_device_new (MetaKms *kms,
|
||||||
|
free (device->path);
|
||||||
|
device->path = data.out_path;
|
||||||
|
|
||||||
|
+ if (!device->caps.addfb2_modifiers)
|
||||||
|
+ device->flags |= META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS;
|
||||||
|
+
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
@ -0,0 +1,120 @@
|
|||||||
|
From b328c8cc8b0b31a4afe2bfc857c6ea5a2b837ef2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Piotr Lopatka <piotr.lopatka@gmail.com>
|
||||||
|
Date: Fri, 3 Sep 2021 20:01:59 +0100
|
||||||
|
Subject: [PATCH 2/2] onscreen/native: Pass damage rectangles when page
|
||||||
|
flipping
|
||||||
|
|
||||||
|
This commit passes damage rectangles metadata to the (KMS) primary
|
||||||
|
plane.
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1879>
|
||||||
|
---
|
||||||
|
src/backends/native/meta-crtc-kms.c | 4 +++-
|
||||||
|
src/backends/native/meta-crtc-kms.h | 6 +++---
|
||||||
|
src/backends/native/meta-onscreen-native.c | 22 ++++++++++++++++++----
|
||||||
|
3 files changed, 24 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
|
||||||
|
index f1bc79146af..fde64817532 100644
|
||||||
|
--- a/src/backends/native/meta-crtc-kms.c
|
||||||
|
+++ b/src/backends/native/meta-crtc-kms.c
|
||||||
|
@@ -115,7 +115,7 @@ meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
|
||||||
|
hw_transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void
|
||||||
|
+MetaKmsPlaneAssignment *
|
||||||
|
meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
|
||||||
|
MetaDrmBuffer *buffer,
|
||||||
|
MetaKmsUpdate *kms_update)
|
||||||
|
@@ -161,6 +161,8 @@ meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
|
||||||
|
dst_rect,
|
||||||
|
flags);
|
||||||
|
meta_crtc_kms_apply_transform (crtc_kms, plane_assignment);
|
||||||
|
+
|
||||||
|
+ return plane_assignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h
|
||||||
|
index f8d241bbb51..bd80835f986 100644
|
||||||
|
--- a/src/backends/native/meta-crtc-kms.h
|
||||||
|
+++ b/src/backends/native/meta-crtc-kms.h
|
||||||
|
@@ -48,9 +48,9 @@ void meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms *crtc_kms,
|
||||||
|
void meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
|
||||||
|
MetaKmsPlaneAssignment *kms_plane_assignment);
|
||||||
|
|
||||||
|
-void meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
|
||||||
|
- MetaDrmBuffer *buffer,
|
||||||
|
- MetaKmsUpdate *kms_update);
|
||||||
|
+MetaKmsPlaneAssignment * meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
|
||||||
|
+ MetaDrmBuffer *buffer,
|
||||||
|
+ MetaKmsUpdate *kms_update);
|
||||||
|
|
||||||
|
void meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms,
|
||||||
|
MetaKmsUpdate *kms_update);
|
||||||
|
diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c
|
||||||
|
index 112bd0d438b..00b2d9f89cc 100644
|
||||||
|
--- a/src/backends/native/meta-onscreen-native.c
|
||||||
|
+++ b/src/backends/native/meta-onscreen-native.c
|
||||||
|
@@ -416,7 +416,9 @@ static void
|
||||||
|
meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
||||||
|
MetaRendererView *view,
|
||||||
|
MetaCrtc *crtc,
|
||||||
|
- MetaKmsPageFlipListenerFlag flags)
|
||||||
|
+ MetaKmsPageFlipListenerFlag flags,
|
||||||
|
+ const int *rectangles,
|
||||||
|
+ int n_rectangles)
|
||||||
|
{
|
||||||
|
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
|
||||||
|
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
|
||||||
|
@@ -430,6 +432,7 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
||||||
|
MetaKmsUpdate *kms_update;
|
||||||
|
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state = NULL;
|
||||||
|
MetaDrmBuffer *buffer;
|
||||||
|
+ MetaKmsPlaneAssignment *plane_assignment;
|
||||||
|
|
||||||
|
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs,
|
||||||
|
"Onscreen (flip CRTCs)");
|
||||||
|
@@ -456,8 +459,15 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
||||||
|
buffer = secondary_gpu_state->gbm.next_fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
- meta_crtc_kms_assign_primary_plane (crtc_kms, buffer, kms_update);
|
||||||
|
+ plane_assignment = meta_crtc_kms_assign_primary_plane (crtc_kms,
|
||||||
|
+ buffer,
|
||||||
|
+ kms_update);
|
||||||
|
|
||||||
|
+ if (rectangles != NULL && n_rectangles != 0)
|
||||||
|
+ {
|
||||||
|
+ meta_kms_plane_assignment_set_fb_damage (plane_assignment,
|
||||||
|
+ rectangles, n_rectangles);
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
case META_RENDERER_NATIVE_MODE_SURFACELESS:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
@@ -1081,7 +1091,9 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||||
|
meta_onscreen_native_flip_crtc (onscreen,
|
||||||
|
onscreen_native->view,
|
||||||
|
onscreen_native->crtc,
|
||||||
|
- META_KMS_PAGE_FLIP_LISTENER_FLAG_NONE);
|
||||||
|
+ META_KMS_PAGE_FLIP_LISTENER_FLAG_NONE,
|
||||||
|
+ rectangles,
|
||||||
|
+ n_rectangles);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@@ -1299,7 +1311,9 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||||
|
meta_onscreen_native_flip_crtc (onscreen,
|
||||||
|
onscreen_native->view,
|
||||||
|
onscreen_native->crtc,
|
||||||
|
- META_KMS_PAGE_FLIP_LISTENER_FLAG_DROP_ON_ERROR);
|
||||||
|
+ META_KMS_PAGE_FLIP_LISTENER_FLAG_DROP_ON_ERROR,
|
||||||
|
+ NULL,
|
||||||
|
+ 0);
|
||||||
|
|
||||||
|
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (onscreen_native->crtc));
|
||||||
|
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
From cd8b90a7a7185c3f177469d1a37654a9e8539cd1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Thu, 29 Sep 2022 14:23:55 +0200
|
||||||
|
Subject: [PATCH 2/2] output/kms: Don't attemp to add common modes on
|
||||||
|
connectors without modes
|
||||||
|
|
||||||
|
We have no way to sanely add safe modes if there are no modes we can
|
||||||
|
compare with, thus don't try.
|
||||||
|
|
||||||
|
Fixes the following crash:
|
||||||
|
|
||||||
|
#0 are_all_modes_equally_sized at ../src/backends/native/meta-output-kms.c:284
|
||||||
|
#1 maybe_add_fallback_modes at ../src/backends/native/meta-output-kms.c:310
|
||||||
|
#2 init_output_modes at ../src/backends/native/meta-output-kms.c:347
|
||||||
|
#3 meta_output_kms_new at ../src/backends/native/meta-output-kms.c:414
|
||||||
|
#4 init_outputs at ../src/backends/native/meta-gpu-kms.c:332
|
||||||
|
#5 meta_gpu_kms_read_current at ../src/backends/native/meta-gpu-kms.c:368
|
||||||
|
#6 meta_gpu_kms_new at ../src/backends/native/meta-gpu-kms.c:403
|
||||||
|
#7 create_gpu_from_udev_device at ../src/backends/native/meta-backend-native.c:461
|
||||||
|
#8 init_gpus at ../src/backends/native/meta-backend-native.c:551
|
||||||
|
#9 meta_backend_native_initable_init at ../src/backends/native/meta-backend-native.c:632
|
||||||
|
|
||||||
|
Fixes: 877cc3eb7d44e2886395151f763ec09bea350444
|
||||||
|
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2127801
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2646>
|
||||||
|
(cherry picked from commit 2c8adb19660cb2cd53381372833e088962437d3b)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-output-kms.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
|
||||||
|
index 9adc20bfd9..058ab7c053 100644
|
||||||
|
--- a/src/backends/native/meta-output-kms.c
|
||||||
|
+++ b/src/backends/native/meta-output-kms.c
|
||||||
|
@@ -250,6 +250,9 @@ maybe_add_fallback_modes (const MetaKmsConnectorState *connector_state,
|
||||||
|
MetaGpuKms *gpu_kms,
|
||||||
|
MetaKmsConnector *kms_connector)
|
||||||
|
{
|
||||||
|
+ if (!connector_state->modes)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (!connector_state->has_scaling)
|
||||||
|
return;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -0,0 +1,94 @@
|
|||||||
|
From 425710866438a62843b96272a6cbc6c22174f10c Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Mon, 11 Oct 2021 10:39:43 +0200
|
||||||
|
Subject: [PATCH 2/5] renderer/native: Try the gbm renderer before the
|
||||||
|
EGLDevice renderer
|
||||||
|
|
||||||
|
This switches the order of what renderer mode is tried first, so that
|
||||||
|
the gbm renderer mode is preferred on an NVIDIA driver where it is
|
||||||
|
supported.
|
||||||
|
|
||||||
|
We fall back to still try the EGLDevice renderer mode if the created gbm
|
||||||
|
renderer is not hardware accelerated.
|
||||||
|
|
||||||
|
The last fallback is still to use the gbm renderer, even if it is not
|
||||||
|
hardware accelerated, as this is needed when hardware acceleration isn't
|
||||||
|
available at all. The original reason for the old order was due to the
|
||||||
|
fact that a gbm renderer without hardware acceleration would succeed
|
||||||
|
even on NVIDIA driver that didn't support gbm.
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2051>
|
||||||
|
(cherry picked from commit 8fc1325e8e713dfa05a12c47e6e981e50d3cda61)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-renderer-native.c | 44 +++++++++++-----------
|
||||||
|
1 file changed, 23 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
|
||||||
|
index f92f648e5..c851619a1 100644
|
||||||
|
--- a/src/backends/native/meta-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-renderer-native.c
|
||||||
|
@@ -1754,38 +1754,40 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
||||||
|
MetaGpuKms *gpu_kms,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
- MetaRendererNativeGpuData *renderer_gpu_data;
|
||||||
|
+ MetaRendererNativeGpuData *gbm_renderer_gpu_data;
|
||||||
|
GError *gbm_error = NULL;
|
||||||
|
#ifdef HAVE_EGL_DEVICE
|
||||||
|
+ MetaRendererNativeGpuData *egl_stream_renderer_gpu_data;
|
||||||
|
GError *egl_device_error = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!gpu_kms)
|
||||||
|
return create_renderer_gpu_data_surfaceless (renderer_native, error);
|
||||||
|
|
||||||
|
-#ifdef HAVE_EGL_DEVICE
|
||||||
|
- /* Try to initialize the EGLDevice backend first. Whenever we use a
|
||||||
|
- * non-NVIDIA GPU, the EGLDevice enumeration function won't find a match, and
|
||||||
|
- * we'll fall back to GBM (which will always succeed as it has a software
|
||||||
|
- * rendering fallback)
|
||||||
|
- */
|
||||||
|
- renderer_gpu_data = create_renderer_gpu_data_egl_device (renderer_native,
|
||||||
|
- gpu_kms,
|
||||||
|
- &egl_device_error);
|
||||||
|
- if (renderer_gpu_data)
|
||||||
|
- return renderer_gpu_data;
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
- renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
||||||
|
- gpu_kms,
|
||||||
|
- &gbm_error);
|
||||||
|
- if (renderer_gpu_data)
|
||||||
|
+ gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
||||||
|
+ gpu_kms,
|
||||||
|
+ &gbm_error);
|
||||||
|
+ if (gbm_renderer_gpu_data)
|
||||||
|
{
|
||||||
|
+ if (gbm_renderer_gpu_data->secondary.is_hardware_rendering)
|
||||||
|
+ return gbm_renderer_gpu_data;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
#ifdef HAVE_EGL_DEVICE
|
||||||
|
- g_error_free (egl_device_error);
|
||||||
|
-#endif
|
||||||
|
- return renderer_gpu_data;
|
||||||
|
+ egl_stream_renderer_gpu_data =
|
||||||
|
+ create_renderer_gpu_data_egl_device (renderer_native,
|
||||||
|
+ gpu_kms,
|
||||||
|
+ &egl_device_error);
|
||||||
|
+ if (egl_stream_renderer_gpu_data)
|
||||||
|
+ {
|
||||||
|
+ g_clear_pointer (&gbm_renderer_gpu_data,
|
||||||
|
+ meta_renderer_native_gpu_data_free);
|
||||||
|
+ return egl_stream_renderer_gpu_data;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ if (gbm_renderer_gpu_data)
|
||||||
|
+ return gbm_renderer_gpu_data;
|
||||||
|
|
||||||
|
g_set_error (error, G_IO_ERROR,
|
||||||
|
G_IO_ERROR_FAILED,
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
From e434615ed1d4ba506e0282ad5cdc94303310c682 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||||
|
Date: Wed, 16 Oct 2024 14:26:28 +0200
|
||||||
|
Subject: [PATCH 2/2] window: Avoid SIGFPE on bogus window size
|
||||||
|
|
||||||
|
---
|
||||||
|
src/core/window.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index 512ef9312f..142aa0eca1 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -2393,6 +2393,7 @@ window_would_mostly_be_covered_by_always_above_window (MetaWindow *window)
|
||||||
|
}
|
||||||
|
|
||||||
|
window_area = window->rect.width * window->rect.height;
|
||||||
|
+ g_return_val_if_fail (window_area > 0, FALSE);
|
||||||
|
|
||||||
|
cairo_region_intersect_rectangle (region, &window->rect);
|
||||||
|
intersection_area = calculate_region_area (region);
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From 3e6ba58c875055037e45f651bbcf866d2d47d82f Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Mon, 22 Jul 2024 12:55:44 +0200
|
|
||||||
Subject: [PATCH 3/3] Revert "x11/window: Use correct bounding rect to
|
|
||||||
determine NULL input region"
|
|
||||||
|
|
||||||
This reverts commit 6bd920b355d12395dbf00b99374fc1f23783caaf.
|
|
||||||
---
|
|
||||||
src/x11/window-x11.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
|
|
||||||
index b358b64bf2..16dc57eec2 100644
|
|
||||||
--- a/src/x11/window-x11.c
|
|
||||||
+++ b/src/x11/window-x11.c
|
|
||||||
@@ -2473,8 +2473,8 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|
||||||
else if (n_rects == 1 &&
|
|
||||||
(rects[0].x == 0 &&
|
|
||||||
rects[0].y == 0 &&
|
|
||||||
- rects[0].width == window->buffer_rect.width &&
|
|
||||||
- rects[0].height == window->buffer_rect.height))
|
|
||||||
+ rects[0].width == priv->client_rect.width &&
|
|
||||||
+ rects[0].height == priv->client_rect.height))
|
|
||||||
{
|
|
||||||
/* This is the bounding region case. Keep the
|
|
||||||
* region as NULL. */
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -0,0 +1,816 @@
|
|||||||
|
From 0c104d85654318978d10d0fadf33ceea92e29c0a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Thu, 13 Jun 2024 12:58:21 -0400
|
||||||
|
Subject: [PATCH 3/6] core/window: Split cgroup out to separate struct
|
||||||
|
|
||||||
|
We're going to need to attach other information to the cgroup,
|
||||||
|
aside from the cgroup path, so this commit separates it out
|
||||||
|
to its own struct, shared with other windows using the same
|
||||||
|
cgroup.
|
||||||
|
---
|
||||||
|
src/core/display-private.h | 17 +++++++++
|
||||||
|
src/core/display.c | 70 ++++++++++++++++++++++++++++++++++++++
|
||||||
|
src/core/window-private.h | 2 ++
|
||||||
|
src/core/window.c | 44 ++++++++++++++++++++++++
|
||||||
|
4 files changed, 133 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
||||||
|
index 3d690fcb6..fb17d20a6 100644
|
||||||
|
--- a/src/core/display-private.h
|
||||||
|
+++ b/src/core/display-private.h
|
||||||
|
@@ -78,98 +78,106 @@ typedef enum
|
||||||
|
META_TILE_LEFT,
|
||||||
|
META_TILE_RIGHT,
|
||||||
|
META_TILE_MAXIMIZED
|
||||||
|
} MetaTileMode;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
/* Normal interaction where you're interacting with windows.
|
||||||
|
* Events go to windows normally. */
|
||||||
|
META_EVENT_ROUTE_NORMAL,
|
||||||
|
|
||||||
|
/* In a window operation like moving or resizing. All events
|
||||||
|
* goes to MetaWindow, but not to the actual client window. */
|
||||||
|
META_EVENT_ROUTE_WINDOW_OP,
|
||||||
|
|
||||||
|
/* In a compositor grab operation. All events go to the
|
||||||
|
* compositor plugin. */
|
||||||
|
META_EVENT_ROUTE_COMPOSITOR_GRAB,
|
||||||
|
|
||||||
|
/* A Wayland application has a popup open. All events go to
|
||||||
|
* the Wayland application. */
|
||||||
|
META_EVENT_ROUTE_WAYLAND_POPUP,
|
||||||
|
|
||||||
|
/* The user is clicking on a window button. */
|
||||||
|
META_EVENT_ROUTE_FRAME_BUTTON,
|
||||||
|
} MetaEventRoute;
|
||||||
|
|
||||||
|
typedef void (* MetaDisplayWindowFunc) (MetaWindow *window,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
+typedef struct _MetaCGroup MetaCGroup;
|
||||||
|
+struct _MetaCGroup {
|
||||||
|
+ GFile *path;
|
||||||
|
+
|
||||||
|
+ grefcount ref_count;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct _MetaDisplay
|
||||||
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
MetaX11Display *x11_display;
|
||||||
|
|
||||||
|
int clutter_event_filter;
|
||||||
|
|
||||||
|
/* Our best guess as to the "currently" focused window (that is, the
|
||||||
|
* window that we expect will be focused at the point when the X
|
||||||
|
* server processes our next request), and the serial of the request
|
||||||
|
* or event that caused this.
|
||||||
|
*/
|
||||||
|
MetaWindow *focus_window;
|
||||||
|
|
||||||
|
/* last timestamp passed to XSetInputFocus */
|
||||||
|
guint32 last_focus_time;
|
||||||
|
|
||||||
|
/* last user interaction time in any app */
|
||||||
|
guint32 last_user_time;
|
||||||
|
|
||||||
|
/* whether we're using mousenav (only relevant for sloppy&mouse focus modes;
|
||||||
|
* !mouse_mode means "keynav mode")
|
||||||
|
*/
|
||||||
|
guint mouse_mode : 1;
|
||||||
|
|
||||||
|
/* Helper var used when focus_new_windows setting is 'strict'; only
|
||||||
|
* relevant in 'strict' mode and if the focus window is a terminal.
|
||||||
|
* In that case, we don't allow new windows to take focus away from
|
||||||
|
* a terminal, but if the user explicitly did something that should
|
||||||
|
* allow a different window to gain focus (e.g. global keybinding or
|
||||||
|
* clicking on a dock), then we will allow the transfer.
|
||||||
|
*/
|
||||||
|
guint allow_terminal_deactivation : 1;
|
||||||
|
|
||||||
|
/*< private-ish >*/
|
||||||
|
GHashTable *stamps;
|
||||||
|
GHashTable *wayland_windows;
|
||||||
|
+ GHashTable *cgroups;
|
||||||
|
|
||||||
|
/* serials of leave/unmap events that may
|
||||||
|
* correspond to an enter event we should
|
||||||
|
* ignore
|
||||||
|
*/
|
||||||
|
unsigned long ignored_crossing_serials[N_IGNORED_CROSSING_SERIALS];
|
||||||
|
|
||||||
|
guint32 current_time;
|
||||||
|
|
||||||
|
/* We maintain a sequence counter, incremented for each #MetaWindow
|
||||||
|
* created. This is exposed by meta_window_get_stable_sequence()
|
||||||
|
* but is otherwise not used inside mutter.
|
||||||
|
*
|
||||||
|
* It can be useful to plugins which want to sort windows in a
|
||||||
|
* stable fashion.
|
||||||
|
*/
|
||||||
|
guint32 window_sequence_counter;
|
||||||
|
|
||||||
|
/* Pings which we're waiting for a reply from */
|
||||||
|
GSList *pending_pings;
|
||||||
|
|
||||||
|
/* Pending focus change */
|
||||||
|
guint focus_timeout_id;
|
||||||
|
|
||||||
|
/* Pending autoraise */
|
||||||
|
guint autoraise_timeout_id;
|
||||||
|
MetaWindow* autoraise_window;
|
||||||
|
|
||||||
|
/* Event routing */
|
||||||
|
MetaEventRoute event_route;
|
||||||
|
@@ -254,60 +262,69 @@ struct _MetaDisplayClass
|
||||||
|
*
|
||||||
|
* See the docs for meta_display_xserver_time_is_before().
|
||||||
|
*/
|
||||||
|
#define XSERVER_TIME_IS_BEFORE(time1, time2) \
|
||||||
|
( (time1) == 0 || \
|
||||||
|
(XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) && \
|
||||||
|
(time2) != 0) \
|
||||||
|
)
|
||||||
|
|
||||||
|
gboolean meta_display_open (void);
|
||||||
|
|
||||||
|
void meta_display_manage_all_xwindows (MetaDisplay *display);
|
||||||
|
void meta_display_unmanage_windows (MetaDisplay *display,
|
||||||
|
guint32 timestamp);
|
||||||
|
|
||||||
|
/* Utility function to compare the stacking of two windows */
|
||||||
|
int meta_display_stack_cmp (const void *a,
|
||||||
|
const void *b);
|
||||||
|
|
||||||
|
/* Each MetaWindow is uniquely identified by a 64-bit "stamp"; unlike a
|
||||||
|
* a MetaWindow *, a stamp will never be recycled
|
||||||
|
*/
|
||||||
|
MetaWindow* meta_display_lookup_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp);
|
||||||
|
void meta_display_register_stamp (MetaDisplay *display,
|
||||||
|
guint64 *stampp,
|
||||||
|
MetaWindow *window);
|
||||||
|
void meta_display_unregister_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp);
|
||||||
|
|
||||||
|
+void meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
+ MetaWindow *window,
|
||||||
|
+ const char *path);
|
||||||
|
+void meta_display_unregister_cgroup (MetaDisplay *display,
|
||||||
|
+ MetaWindow *window);
|
||||||
|
+
|
||||||
|
+MetaCGroup* meta_cgroup_ref (MetaCGroup *cgroup);
|
||||||
|
+gboolean meta_cgroup_unref (MetaCGroup *cgroup);
|
||||||
|
+
|
||||||
|
/* A "stack id" is a XID or a stamp */
|
||||||
|
#define META_STACK_ID_IS_X11(id) ((id) < G_GUINT64_CONSTANT(0x100000000))
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaWindow* meta_display_lookup_stack_id (MetaDisplay *display,
|
||||||
|
guint64 stack_id);
|
||||||
|
|
||||||
|
/* for debug logging only; returns a human-description of the stack
|
||||||
|
* ID - a small number of buffers are recycled, so the result must
|
||||||
|
* be used immediately or copied */
|
||||||
|
const char *meta_display_describe_stack_id (MetaDisplay *display,
|
||||||
|
guint64 stack_id);
|
||||||
|
|
||||||
|
void meta_display_register_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
void meta_display_unregister_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
|
||||||
|
void meta_display_notify_window_created (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
GSList* meta_display_list_windows (MetaDisplay *display,
|
||||||
|
MetaListWindowsFlags flags);
|
||||||
|
|
||||||
|
MetaDisplay* meta_display_for_x_display (Display *xdisplay);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaDisplay* meta_get_display (void);
|
||||||
|
|
||||||
|
diff --git a/src/core/display.c b/src/core/display.c
|
||||||
|
index 4b58a5d2f..937defd2c 100644
|
||||||
|
--- a/src/core/display.c
|
||||||
|
+++ b/src/core/display.c
|
||||||
|
@@ -833,60 +833,61 @@ meta_display_open (void)
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < N_IGNORED_CROSSING_SERIALS)
|
||||||
|
{
|
||||||
|
display->ignored_crossing_serials[i] = 0;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
display->current_time = META_CURRENT_TIME;
|
||||||
|
|
||||||
|
display->grab_resize_timeout_id = 0;
|
||||||
|
display->grab_have_keyboard = FALSE;
|
||||||
|
|
||||||
|
display->grab_op = META_GRAB_OP_NONE;
|
||||||
|
display->grab_window = NULL;
|
||||||
|
display->grab_tile_mode = META_TILE_NONE;
|
||||||
|
display->grab_tile_monitor_number = -1;
|
||||||
|
|
||||||
|
meta_display_cleanup_edges (display);
|
||||||
|
|
||||||
|
meta_display_init_keys (display);
|
||||||
|
|
||||||
|
meta_prefs_add_listener (prefs_changed_callback, display);
|
||||||
|
|
||||||
|
/* Get events */
|
||||||
|
meta_display_init_events (display);
|
||||||
|
|
||||||
|
display->stamps = g_hash_table_new (g_int64_hash,
|
||||||
|
g_int64_equal);
|
||||||
|
display->wayland_windows = g_hash_table_new (NULL, NULL);
|
||||||
|
+ display->cgroups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||||
|
|
||||||
|
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||||
|
g_signal_connect (monitor_manager, "monitors-changed-internal",
|
||||||
|
G_CALLBACK (on_monitors_changed_internal), display);
|
||||||
|
|
||||||
|
display->pad_action_mapper = meta_pad_action_mapper_new (monitor_manager);
|
||||||
|
|
||||||
|
settings = meta_backend_get_settings (backend);
|
||||||
|
g_signal_connect (settings, "ui-scaling-factor-changed",
|
||||||
|
G_CALLBACK (on_ui_scaling_factor_changed), display);
|
||||||
|
|
||||||
|
display->compositor = create_compositor (display);
|
||||||
|
|
||||||
|
meta_display_set_cursor (display, META_CURSOR_DEFAULT);
|
||||||
|
|
||||||
|
display->stack = meta_stack_new (display);
|
||||||
|
display->stack_tracker = meta_stack_tracker_new (display);
|
||||||
|
|
||||||
|
display->workspace_manager = meta_workspace_manager_new (display);
|
||||||
|
|
||||||
|
display->startup_notification = meta_startup_notification_new (display);
|
||||||
|
|
||||||
|
display->bell = meta_bell_new (display);
|
||||||
|
|
||||||
|
display->selection = meta_selection_new (display);
|
||||||
|
meta_clipboard_manager_init (display);
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND
|
||||||
|
if (meta_is_wayland_compositor ())
|
||||||
|
{
|
||||||
|
@@ -1095,60 +1096,61 @@ meta_display_close (MetaDisplay *display,
|
||||||
|
meta_prefs_remove_listener (prefs_changed_callback, display);
|
||||||
|
|
||||||
|
meta_display_remove_autoraise_callback (display);
|
||||||
|
|
||||||
|
g_clear_object (&display->gesture_tracker);
|
||||||
|
|
||||||
|
g_clear_handle_id (&display->focus_timeout_id, g_source_remove);
|
||||||
|
g_clear_handle_id (&display->tile_preview_timeout_id, g_source_remove);
|
||||||
|
|
||||||
|
if (display->work_area_later != 0)
|
||||||
|
meta_later_remove (display->work_area_later);
|
||||||
|
if (display->check_fullscreen_later != 0)
|
||||||
|
meta_later_remove (display->check_fullscreen_later);
|
||||||
|
|
||||||
|
/* Stop caring about events */
|
||||||
|
meta_display_free_events (display);
|
||||||
|
|
||||||
|
g_clear_pointer (&display->compositor, meta_compositor_destroy);
|
||||||
|
|
||||||
|
meta_display_shutdown_x11 (display);
|
||||||
|
|
||||||
|
g_clear_object (&display->stack);
|
||||||
|
g_clear_pointer (&display->stack_tracker,
|
||||||
|
meta_stack_tracker_free);
|
||||||
|
|
||||||
|
/* Must be after all calls to meta_window_unmanage() since they
|
||||||
|
* unregister windows
|
||||||
|
*/
|
||||||
|
g_hash_table_destroy (display->wayland_windows);
|
||||||
|
g_hash_table_destroy (display->stamps);
|
||||||
|
+ g_hash_table_destroy (display->cgroups);
|
||||||
|
|
||||||
|
meta_display_shutdown_keys (display);
|
||||||
|
|
||||||
|
g_clear_object (&display->bell);
|
||||||
|
g_clear_object (&display->startup_notification);
|
||||||
|
g_clear_object (&display->workspace_manager);
|
||||||
|
g_clear_object (&display->sound_player);
|
||||||
|
|
||||||
|
meta_clipboard_manager_shutdown (display);
|
||||||
|
g_clear_object (&display->selection);
|
||||||
|
g_clear_object (&display->pad_action_mapper);
|
||||||
|
|
||||||
|
g_object_unref (display);
|
||||||
|
the_display = NULL;
|
||||||
|
|
||||||
|
meta_quit (META_EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_display_for_x_display:
|
||||||
|
* @xdisplay: An X display
|
||||||
|
*
|
||||||
|
* Returns the singleton MetaDisplay if @xdisplay matches the X display it's
|
||||||
|
* managing; otherwise gives a warning and returns %NULL. When we were claiming
|
||||||
|
* to be able to manage multiple displays, this was supposed to find the
|
||||||
|
* display out of the list which matched that display. Now it's merely an
|
||||||
|
* extra sanity check.
|
||||||
|
*
|
||||||
|
* Returns: The singleton X display, or %NULL if @xdisplay isn't the one
|
||||||
|
* we're managing.
|
||||||
|
@@ -1491,60 +1493,128 @@ meta_display_set_input_focus (MetaDisplay *display,
|
||||||
|
|
||||||
|
meta_display_update_focus_window (display, window);
|
||||||
|
|
||||||
|
display->last_focus_time = timestamp;
|
||||||
|
|
||||||
|
if (window == NULL || window != display->autoraise_window)
|
||||||
|
meta_display_remove_autoraise_callback (display);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unset_input_focus (MetaDisplay *display,
|
||||||
|
guint32 timestamp)
|
||||||
|
{
|
||||||
|
meta_display_set_input_focus (display, NULL, FALSE, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_register_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_hash_table_add (display->wayland_windows, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unregister_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_hash_table_remove (display->wayland_windows, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
+MetaCGroup*
|
||||||
|
+meta_cgroup_new (const char *path)
|
||||||
|
+{
|
||||||
|
+ MetaCGroup *cgroup;
|
||||||
|
+
|
||||||
|
+ cgroup = g_new0 (MetaCGroup, 1);
|
||||||
|
+ cgroup->path = g_file_new_for_path (path);
|
||||||
|
+ g_ref_count_init (&cgroup->ref_count);
|
||||||
|
+
|
||||||
|
+ return cgroup;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+MetaCGroup*
|
||||||
|
+meta_cgroup_ref (MetaCGroup *cgroup)
|
||||||
|
+{
|
||||||
|
+ g_ref_count_inc (&cgroup->ref_count);
|
||||||
|
+ return cgroup;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+gboolean
|
||||||
|
+meta_cgroup_unref (MetaCGroup *cgroup)
|
||||||
|
+{
|
||||||
|
+ if (!g_ref_count_dec (&cgroup->ref_count))
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
+ g_clear_object (&cgroup->path);
|
||||||
|
+ g_free (cgroup);
|
||||||
|
+
|
||||||
|
+ return TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
+ MetaWindow *window,
|
||||||
|
+ const char *path)
|
||||||
|
+{
|
||||||
|
+ MetaCGroup *cgroup;
|
||||||
|
+
|
||||||
|
+ cgroup = g_hash_table_lookup (display->cgroups, path);
|
||||||
|
+
|
||||||
|
+ if (cgroup)
|
||||||
|
+ {
|
||||||
|
+ window->cgroup = meta_cgroup_ref (cgroup);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ cgroup = meta_cgroup_new (path);
|
||||||
|
+ g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+meta_display_unregister_cgroup (MetaDisplay *display,
|
||||||
|
+ MetaWindow *window)
|
||||||
|
+{
|
||||||
|
+ g_autofree const char *path = NULL;
|
||||||
|
+ MetaCGroup *cgroup = g_steal_pointer (&window->cgroup);
|
||||||
|
+
|
||||||
|
+ if (!cgroup)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ path = g_file_get_path (cgroup->path);
|
||||||
|
+
|
||||||
|
+ if (!meta_cgroup_unref (cgroup))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ g_hash_table_remove (display->cgroups, path);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
MetaWindow*
|
||||||
|
meta_display_lookup_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp)
|
||||||
|
{
|
||||||
|
return g_hash_table_lookup (display->stamps, &stamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_register_stamp (MetaDisplay *display,
|
||||||
|
guint64 *stampp,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_return_if_fail (g_hash_table_lookup (display->stamps, stampp) == NULL);
|
||||||
|
|
||||||
|
g_hash_table_insert (display->stamps, stampp, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unregister_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp)
|
||||||
|
{
|
||||||
|
g_return_if_fail (g_hash_table_lookup (display->stamps, &stamp) != NULL);
|
||||||
|
|
||||||
|
g_hash_table_remove (display->stamps, &stamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaWindow*
|
||||||
|
meta_display_lookup_stack_id (MetaDisplay *display,
|
||||||
|
guint64 stack_id)
|
||||||
|
{
|
||||||
|
diff --git a/src/core/window-private.h b/src/core/window-private.h
|
||||||
|
index d1730c988..8a0aebb38 100644
|
||||||
|
--- a/src/core/window-private.h
|
||||||
|
+++ b/src/core/window-private.h
|
||||||
|
@@ -193,60 +193,62 @@ struct _MetaWindow
|
||||||
|
* binary data
|
||||||
|
*/
|
||||||
|
char *res_class;
|
||||||
|
char *res_name;
|
||||||
|
char *role;
|
||||||
|
char *sm_client_id;
|
||||||
|
char *wm_client_machine;
|
||||||
|
|
||||||
|
char *startup_id;
|
||||||
|
char *mutter_hints;
|
||||||
|
char *sandboxed_app_id;
|
||||||
|
char *gtk_theme_variant;
|
||||||
|
char *gtk_application_id;
|
||||||
|
char *gtk_unique_bus_name;
|
||||||
|
char *gtk_application_object_path;
|
||||||
|
char *gtk_window_object_path;
|
||||||
|
char *gtk_app_menu_object_path;
|
||||||
|
char *gtk_menubar_object_path;
|
||||||
|
|
||||||
|
Window xtransient_for;
|
||||||
|
Window xgroup_leader;
|
||||||
|
Window xclient_leader;
|
||||||
|
MetaWindow *transient_for;
|
||||||
|
|
||||||
|
/* Initial workspace property */
|
||||||
|
int initial_workspace;
|
||||||
|
|
||||||
|
/* Initial timestamp property */
|
||||||
|
guint32 initial_timestamp;
|
||||||
|
|
||||||
|
+ MetaCGroup *cgroup;
|
||||||
|
+
|
||||||
|
/* Whether this is an override redirect window or not */
|
||||||
|
guint override_redirect : 1;
|
||||||
|
|
||||||
|
/* Whether we're maximized */
|
||||||
|
guint maximized_horizontally : 1;
|
||||||
|
guint maximized_vertically : 1;
|
||||||
|
|
||||||
|
/* Whether we have to maximize/minimize after placement */
|
||||||
|
guint maximize_horizontally_after_placement : 1;
|
||||||
|
guint maximize_vertically_after_placement : 1;
|
||||||
|
guint minimize_after_placement : 1;
|
||||||
|
|
||||||
|
/* The current tile mode */
|
||||||
|
MetaTileMode tile_mode;
|
||||||
|
|
||||||
|
/* The last "full" maximized/unmaximized state. We need to keep track of
|
||||||
|
* that to toggle between normal/tiled or maximized/tiled states. */
|
||||||
|
guint saved_maximize : 1;
|
||||||
|
int tile_monitor_number;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
MetaEdgeConstraint top;
|
||||||
|
MetaEdgeConstraint right;
|
||||||
|
MetaEdgeConstraint bottom;
|
||||||
|
MetaEdgeConstraint left;
|
||||||
|
} edge_constraints;
|
||||||
|
|
||||||
|
double tile_hfraction;
|
||||||
|
|
||||||
|
uint64_t preferred_output_winsys_id;
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index e787dbce0..f5ecd6438 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -70,60 +70,65 @@
|
||||||
|
#include "cogl/cogl.h"
|
||||||
|
#include "core/boxes-private.h"
|
||||||
|
#include "core/constraints.h"
|
||||||
|
#include "core/edge-resistance.h"
|
||||||
|
#include "core/frame.h"
|
||||||
|
#include "core/keybindings-private.h"
|
||||||
|
#include "core/meta-workspace-manager-private.h"
|
||||||
|
#include "core/place.h"
|
||||||
|
#include "core/stack.h"
|
||||||
|
#include "core/util-private.h"
|
||||||
|
#include "core/workspace-private.h"
|
||||||
|
#include "meta/compositor-mutter.h"
|
||||||
|
#include "meta/group.h"
|
||||||
|
#include "meta/meta-cursor-tracker.h"
|
||||||
|
#include "meta/meta-enum-types.h"
|
||||||
|
#include "meta/meta-x11-errors.h"
|
||||||
|
#include "meta/prefs.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
#include "x11/meta-x11-display-private.h"
|
||||||
|
#include "x11/window-props.h"
|
||||||
|
#include "x11/window-x11.h"
|
||||||
|
#include "x11/xprops.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND
|
||||||
|
#include "wayland/meta-wayland-private.h"
|
||||||
|
#include "wayland/meta-wayland-surface.h"
|
||||||
|
#include "wayland/meta-window-wayland.h"
|
||||||
|
#include "wayland/meta-window-xwayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifdef HAVE_LIBSYSTEMD
|
||||||
|
+#include <systemd/sd-login.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
/* Windows that unmaximize to a size bigger than that fraction of the workarea
|
||||||
|
* will be scaled down to that size (while maintaining aspect ratio).
|
||||||
|
* Windows that cover an area greater then this size are automaximized on map.
|
||||||
|
*/
|
||||||
|
#define MAX_UNMAXIMIZED_WINDOW_AREA .8
|
||||||
|
|
||||||
|
#define SNAP_SECURITY_LABEL_PREFIX "snap."
|
||||||
|
|
||||||
|
static int destroying_windows_disallowed = 0;
|
||||||
|
|
||||||
|
/* Each window has a "stamp" which is a non-recycled 64-bit ID. They
|
||||||
|
* start after the end of the XID space so that, for stacking
|
||||||
|
* we can keep a guint64 that represents one or the other
|
||||||
|
*/
|
||||||
|
static guint64 next_window_stamp = G_GUINT64_CONSTANT(0x100000000);
|
||||||
|
|
||||||
|
static void invalidate_work_areas (MetaWindow *window);
|
||||||
|
static void set_wm_state (MetaWindow *window);
|
||||||
|
static void set_net_wm_state (MetaWindow *window);
|
||||||
|
static void meta_window_set_above (MetaWindow *window,
|
||||||
|
gboolean new_value);
|
||||||
|
|
||||||
|
static void meta_window_show (MetaWindow *window);
|
||||||
|
static void meta_window_hide (MetaWindow *window);
|
||||||
|
|
||||||
|
static void meta_window_save_rect (MetaWindow *window);
|
||||||
|
|
||||||
|
static void ensure_mru_position_after (MetaWindow *window,
|
||||||
|
MetaWindow *after_this_one);
|
||||||
|
|
||||||
|
@@ -303,60 +308,63 @@ meta_window_real_get_client_pid (MetaWindow *window)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_window_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
MetaWindow *window = META_WINDOW (object);
|
||||||
|
|
||||||
|
if (window->icon)
|
||||||
|
cairo_surface_destroy (window->icon);
|
||||||
|
|
||||||
|
if (window->mini_icon)
|
||||||
|
cairo_surface_destroy (window->mini_icon);
|
||||||
|
|
||||||
|
if (window->frame_bounds)
|
||||||
|
cairo_region_destroy (window->frame_bounds);
|
||||||
|
|
||||||
|
if (window->shape_region)
|
||||||
|
cairo_region_destroy (window->shape_region);
|
||||||
|
|
||||||
|
if (window->opaque_region)
|
||||||
|
cairo_region_destroy (window->opaque_region);
|
||||||
|
|
||||||
|
if (window->input_region)
|
||||||
|
cairo_region_destroy (window->input_region);
|
||||||
|
|
||||||
|
if (window->transient_for)
|
||||||
|
g_object_unref (window->transient_for);
|
||||||
|
|
||||||
|
g_free (window->sm_client_id);
|
||||||
|
g_free (window->wm_client_machine);
|
||||||
|
+
|
||||||
|
+ meta_display_unregister_cgroup (window->display, window);
|
||||||
|
+
|
||||||
|
g_free (window->startup_id);
|
||||||
|
g_free (window->role);
|
||||||
|
g_free (window->res_class);
|
||||||
|
g_free (window->res_name);
|
||||||
|
g_free (window->title);
|
||||||
|
g_free (window->desc);
|
||||||
|
g_free (window->sandboxed_app_id);
|
||||||
|
g_free (window->gtk_theme_variant);
|
||||||
|
g_free (window->gtk_application_id);
|
||||||
|
g_free (window->gtk_unique_bus_name);
|
||||||
|
g_free (window->gtk_application_object_path);
|
||||||
|
g_free (window->gtk_window_object_path);
|
||||||
|
g_free (window->gtk_app_menu_object_path);
|
||||||
|
g_free (window->gtk_menubar_object_path);
|
||||||
|
g_free (window->placement.rule);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (meta_window_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_window_get_property(GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MetaWindow *win = META_WINDOW (object);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_TITLE:
|
||||||
|
@@ -1129,60 +1137,61 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||||
|
window->has_minimize_func = TRUE;
|
||||||
|
window->has_maximize_func = TRUE;
|
||||||
|
window->has_move_func = TRUE;
|
||||||
|
window->has_resize_func = TRUE;
|
||||||
|
|
||||||
|
window->has_shade_func = TRUE;
|
||||||
|
|
||||||
|
window->has_fullscreen_func = TRUE;
|
||||||
|
|
||||||
|
window->always_sticky = FALSE;
|
||||||
|
|
||||||
|
window->skip_taskbar = FALSE;
|
||||||
|
window->skip_pager = FALSE;
|
||||||
|
window->skip_from_window_list = FALSE;
|
||||||
|
window->wm_state_above = FALSE;
|
||||||
|
window->wm_state_below = FALSE;
|
||||||
|
window->wm_state_demands_attention = FALSE;
|
||||||
|
|
||||||
|
window->res_class = NULL;
|
||||||
|
window->res_name = NULL;
|
||||||
|
window->role = NULL;
|
||||||
|
window->sm_client_id = NULL;
|
||||||
|
window->wm_client_machine = NULL;
|
||||||
|
window->is_remote = FALSE;
|
||||||
|
window->startup_id = NULL;
|
||||||
|
|
||||||
|
window->client_pid = 0;
|
||||||
|
|
||||||
|
window->xtransient_for = None;
|
||||||
|
window->xclient_leader = None;
|
||||||
|
+ window->cgroup = NULL;
|
||||||
|
|
||||||
|
window->type = META_WINDOW_NORMAL;
|
||||||
|
|
||||||
|
window->struts = NULL;
|
||||||
|
|
||||||
|
window->layer = META_LAYER_LAST; /* invalid value */
|
||||||
|
window->stack_position = -1;
|
||||||
|
window->initial_workspace = 0; /* not used */
|
||||||
|
window->initial_timestamp = 0; /* not used */
|
||||||
|
|
||||||
|
window->compositor_private = NULL;
|
||||||
|
|
||||||
|
window->monitor = meta_window_calculate_main_logical_monitor (window);
|
||||||
|
if (window->monitor)
|
||||||
|
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
||||||
|
else
|
||||||
|
window->preferred_output_winsys_id = UINT_MAX;
|
||||||
|
|
||||||
|
window->tile_match = NULL;
|
||||||
|
|
||||||
|
/* Assign this #MetaWindow a sequence number which can be used
|
||||||
|
* for sorting.
|
||||||
|
*/
|
||||||
|
window->stable_sequence = ++display->window_sequence_counter;
|
||||||
|
|
||||||
|
window->opacity = 0xFF;
|
||||||
|
|
||||||
|
if (window->override_redirect)
|
||||||
|
{
|
||||||
|
window->decorated = FALSE;
|
||||||
|
@@ -7640,60 +7649,95 @@ meta_window_get_transient_for (MetaWindow *window)
|
||||||
|
else if (window->xtransient_for)
|
||||||
|
return meta_x11_display_lookup_x_window (window->display->x11_display,
|
||||||
|
window->xtransient_for);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_window_get_pid:
|
||||||
|
* @window: a #MetaWindow
|
||||||
|
*
|
||||||
|
* Returns the pid of the process that created this window, if available
|
||||||
|
* to the windowing system.
|
||||||
|
*
|
||||||
|
* Note that the value returned by this is vulnerable to spoofing attacks
|
||||||
|
* by the client.
|
||||||
|
*
|
||||||
|
* Return value: the pid, or 0 if not known.
|
||||||
|
*/
|
||||||
|
pid_t
|
||||||
|
meta_window_get_pid (MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (META_IS_WINDOW (window), 0);
|
||||||
|
|
||||||
|
if (window->client_pid == 0)
|
||||||
|
window->client_pid = META_WINDOW_GET_CLASS (window)->get_client_pid (window);
|
||||||
|
|
||||||
|
return window->client_pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+meta_window_read_cgroup (MetaWindow *window)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_LIBSYSTEMD
|
||||||
|
+ g_autofree char *contents = NULL;
|
||||||
|
+ g_autofree char *complete_path = NULL;
|
||||||
|
+ g_autofree char *unit_name = NULL;
|
||||||
|
+ g_autofree char *unit_path = NULL;
|
||||||
|
+ char *unit_end;
|
||||||
|
+ pid_t pid;
|
||||||
|
+
|
||||||
|
+ if (window->cgroup)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ pid = meta_window_get_pid (window);
|
||||||
|
+ if (pid < 1)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (sd_pid_get_cgroup (pid, &contents) < 0)
|
||||||
|
+ return;
|
||||||
|
+ g_strstrip (contents);
|
||||||
|
+
|
||||||
|
+ complete_path = g_strdup_printf ("%s%s", "/sys/fs/cgroup", contents);
|
||||||
|
+
|
||||||
|
+ if (sd_pid_get_user_unit (pid, &unit_name) < 0)
|
||||||
|
+ return;
|
||||||
|
+ g_strstrip (unit_name);
|
||||||
|
+
|
||||||
|
+ unit_end = strstr (complete_path, unit_name) + strlen (unit_name);
|
||||||
|
+ *unit_end = '\0';
|
||||||
|
+
|
||||||
|
+ meta_display_register_cgroup (window->display, window, complete_path);
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* meta_window_get_client_machine:
|
||||||
|
* @window: a #MetaWindow
|
||||||
|
*
|
||||||
|
* Returns name of the client machine from which this windows was created,
|
||||||
|
* if known (obtained from the WM_CLIENT_MACHINE property).
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): the machine name, or NULL; the string is
|
||||||
|
* owned by the window manager and should not be freed or modified by the
|
||||||
|
* caller.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
meta_window_get_client_machine (MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (META_IS_WINDOW (window), NULL);
|
||||||
|
|
||||||
|
return window->wm_client_machine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_window_is_remote:
|
||||||
|
* @window: a #MetaWindow
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if this window originates from a host
|
||||||
|
* different from the one running mutter.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
meta_window_is_remote (MetaWindow *window)
|
||||||
|
{
|
||||||
|
return window->is_remote;
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 8d6e41fc9b5194fb24523c939de54a2af46b5d07 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Fri, 27 May 2022 18:19:27 +0200
|
||||||
|
Subject: [PATCH] kms/crtc: Determine gamma support given the gamma length
|
||||||
|
|
||||||
|
The property doesn't necessarily exist when using drivers that doesn't
|
||||||
|
support atomic mode setting, and the way it worked will break night
|
||||||
|
light and other gamma related features. This makes things use the gamma
|
||||||
|
length; if it is higher than 0, it definitely supports it one way or the
|
||||||
|
other, i.e. GAMMA_LUT with the atomic backend, and drmModeCrtcSetGamma()
|
||||||
|
with the legacy/simple backend.
|
||||||
|
|
||||||
|
Fixes: 364572b95c8354ac66674064a8058aa98bc0bbef
|
||||||
|
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2287
|
||||||
|
(cherry picked from commit a2ebd10f049d888e451938e23a035ed97e0c8eff)
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2452>
|
||||||
|
---
|
||||||
|
src/backends/native/meta-kms-crtc.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c
|
||||||
|
index 24f5a2d7400..0513af947c9 100644
|
||||||
|
--- a/src/backends/native/meta-kms-crtc.c
|
||||||
|
+++ b/src/backends/native/meta-kms-crtc.c
|
||||||
|
@@ -96,7 +96,7 @@ meta_kms_crtc_is_active (MetaKmsCrtc *crtc)
|
||||||
|
gboolean
|
||||||
|
meta_kms_crtc_has_gamma (MetaKmsCrtc *crtc)
|
||||||
|
{
|
||||||
|
- return !!meta_kms_crtc_get_prop_id (crtc, META_KMS_CRTC_PROP_GAMMA_LUT);
|
||||||
|
+ return crtc->current_state.gamma.size > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From cc450c372358bc32960102ffdb2769a9f70cb6d5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Tue, 17 Oct 2023 15:46:00 +0800
|
|
||||||
Subject: [PATCH 3/4] tests/x11: Fix replace test to catch the second instance
|
|
||||||
failing
|
|
||||||
|
|
||||||
The test never noticed that the second instance never actually managed
|
|
||||||
to load; it was looping a multi second retry session trying to redirect
|
|
||||||
windows, meaning it failed to catch https://gitlab.gnome.org/GNOME/mutter/-/issues/3089.
|
|
||||||
|
|
||||||
Fix the test so that it always waits for mutter to finish loading
|
|
||||||
successfully, just like it waits fro the first.
|
|
||||||
---
|
|
||||||
src/tests/x11-test.sh | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/tests/x11-test.sh b/src/tests/x11-test.sh
|
|
||||||
index 59e460fc33..d95b2460f6 100755
|
|
||||||
--- a/src/tests/x11-test.sh
|
|
||||||
+++ b/src/tests/x11-test.sh
|
|
||||||
@@ -34,6 +34,9 @@ echo \# Launched with pid $MUTTER2_PID
|
|
||||||
MUTTER2_PID=$!
|
|
||||||
wait $MUTTER1_PID
|
|
||||||
|
|
||||||
+echo \# Waiting for the second mutter to finish loading
|
|
||||||
+gdbus wait --session org.gnome.Mutter.IdleMonitor
|
|
||||||
+
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
echo \# Terminating clients > /dev/stderr
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
|||||||
|
From 07f63ad466b66cc02b49a326789686bce9325201 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Thu, 14 Oct 2021 18:36:43 +0200
|
||||||
|
Subject: [PATCH 3/5] wayland: Only init EGLStream controller if we didn't end
|
||||||
|
up with gbm
|
||||||
|
|
||||||
|
When we use gbm together with the NVIDIA driver, we want the EGL/Vulkan
|
||||||
|
clients to do the same, instead of using the EGLStream paths. To achieve
|
||||||
|
that, make sure to only initialize the EGLStream controller when we
|
||||||
|
didn't end up using gbm as the renderer backend.
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2052>
|
||||||
|
(cherry picked from commit ac907119ae0f415c099976635c3b1dff4d2d7201)
|
||||||
|
(cherry picked from commit e3931f7b8cbd44072137c5dc9de9041486daeade)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-renderer-native.c | 11 +++++++++
|
||||||
|
src/backends/native/meta-renderer-native.h | 2 ++
|
||||||
|
src/wayland/meta-wayland.c | 26 ++++++++++++++++++++--
|
||||||
|
3 files changed, 37 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
|
||||||
|
index c851619a1..e7460fbf1 100644
|
||||||
|
--- a/src/backends/native/meta-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-renderer-native.c
|
||||||
|
@@ -201,6 +201,17 @@ meta_renderer_native_has_pending_mode_set (MetaRendererNative *renderer_native)
|
||||||
|
return renderer_native->pending_mode_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
+MetaRendererNativeMode
|
||||||
|
+meta_renderer_native_get_mode (MetaRendererNative *renderer_native)
|
||||||
|
+{
|
||||||
|
+ MetaGpuKms *primary_gpu = renderer_native->primary_gpu_kms;
|
||||||
|
+ MetaRendererNativeGpuData *primary_gpu_data;
|
||||||
|
+
|
||||||
|
+ primary_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
||||||
|
+ primary_gpu);
|
||||||
|
+ return primary_gpu_data->mode;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
meta_renderer_native_disconnect (CoglRenderer *cogl_renderer)
|
||||||
|
{
|
||||||
|
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
|
||||||
|
index 9475e1857..8c06c2473 100644
|
||||||
|
--- a/src/backends/native/meta-renderer-native.h
|
||||||
|
+++ b/src/backends/native/meta-renderer-native.h
|
||||||
|
@@ -66,4 +66,6 @@ void meta_renderer_native_reset_modes (MetaRendererNative *renderer_native);
|
||||||
|
|
||||||
|
gboolean meta_renderer_native_use_modifiers (MetaRendererNative *renderer_native);
|
||||||
|
|
||||||
|
+MetaRendererNativeMode meta_renderer_native_get_mode (MetaRendererNative *renderer_native);
|
||||||
|
+
|
||||||
|
#endif /* META_RENDERER_NATIVE_H */
|
||||||
|
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
|
||||||
|
index 8f16aa429..a3f098410 100644
|
||||||
|
--- a/src/wayland/meta-wayland.c
|
||||||
|
+++ b/src/wayland/meta-wayland.c
|
||||||
|
@@ -50,6 +50,10 @@
|
||||||
|
#include "wayland/meta-xwayland-private.h"
|
||||||
|
#include "wayland/meta-xwayland.h"
|
||||||
|
|
||||||
|
+#ifdef HAVE_NATIVE_BACKEND
|
||||||
|
+#include "backends/native/meta-renderer-native.h"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static char *_display_name_override;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MetaWaylandCompositor, meta_wayland_compositor, G_TYPE_OBJECT)
|
||||||
|
@@ -521,8 +525,26 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
|
||||||
|
compositor);
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND_EGLSTREAM
|
||||||
|
- meta_wayland_eglstream_controller_init (compositor);
|
||||||
|
-#endif
|
||||||
|
+ {
|
||||||
|
+ gboolean should_enable_eglstream_controller = TRUE;
|
||||||
|
+#if defined(HAVE_EGL_DEVICE) && defined(HAVE_NATIVE_BACKEND)
|
||||||
|
+ MetaBackend *backend = meta_get_backend ();
|
||||||
|
+ MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||||
|
+
|
||||||
|
+ if (META_IS_RENDERER_NATIVE (renderer))
|
||||||
|
+ {
|
||||||
|
+ MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
|
||||||
|
+
|
||||||
|
+ if (meta_renderer_native_get_mode (renderer_native) ==
|
||||||
|
+ META_RENDERER_NATIVE_MODE_GBM)
|
||||||
|
+ should_enable_eglstream_controller = FALSE;
|
||||||
|
+ }
|
||||||
|
+#endif /* defined(HAVE_EGL_DEVICE) && defined(HAVE_NATIVE_BACKEND) */
|
||||||
|
+
|
||||||
|
+ if (should_enable_eglstream_controller)
|
||||||
|
+ meta_wayland_eglstream_controller_init (compositor);
|
||||||
|
+ }
|
||||||
|
+#endif /* HAVE_WAYLAND_EGLSTREAM */
|
||||||
|
|
||||||
|
if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From dd887dcf4770309fca127217660c5142a463e2c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 27 Aug 2024 11:33:23 +0200
|
||||||
|
Subject: [PATCH 3/5] window: Unregister cgroup on unmanage()
|
||||||
|
|
||||||
|
This means any potential reference held by gjs will not hold the cgroup
|
||||||
|
alive longer than necessary.
|
||||||
|
---
|
||||||
|
src/core/window.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index 142aa0eca1..272d664965 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -339,8 +339,6 @@ meta_window_finalize (GObject *object)
|
||||||
|
g_free (window->sm_client_id);
|
||||||
|
g_free (window->wm_client_machine);
|
||||||
|
|
||||||
|
- meta_display_unregister_cgroup (window->display, window);
|
||||||
|
-
|
||||||
|
g_free (window->startup_id);
|
||||||
|
g_free (window->role);
|
||||||
|
g_free (window->res_class);
|
||||||
|
@@ -1467,6 +1465,8 @@ meta_window_unmanage (MetaWindow *window,
|
||||||
|
meta_verbose ("Unmanaging %s", window->desc);
|
||||||
|
window->unmanaging = TRUE;
|
||||||
|
|
||||||
|
+ meta_display_unregister_cgroup (window->display, window);
|
||||||
|
+
|
||||||
|
g_clear_handle_id (&window->unmanage_idle_id, g_source_remove);
|
||||||
|
|
||||||
|
g_signal_emit (window, window_signals[UNMANAGING], 0);
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
From 5b589b298680bd394dd6a1ee7bef3d7def1a96c8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
||||||
Date: Mon, 23 Oct 2023 14:47:33 +0800
|
|
||||||
Subject: [PATCH 4/4] display: Rename mandatory X11 initialization function
|
|
||||||
|
|
||||||
Simply to make it clear that the renamed function is specific to a
|
|
||||||
particular X11 initialization mode (mandatory Xwayland), put that in the
|
|
||||||
name, so that it's easier to understand when this function is relevant.
|
|
||||||
---
|
|
||||||
src/core/display.c | 8 ++++----
|
|
||||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/core/display.c b/src/core/display.c
|
|
||||||
index ddd475f457..e4f623ff9d 100644
|
|
||||||
--- a/src/core/display.c
|
|
||||||
+++ b/src/core/display.c
|
|
||||||
@@ -910,9 +910,9 @@ meta_display_init_x11 (MetaDisplay *display,
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
-on_x11_initialized (MetaDisplay *display,
|
|
||||||
- GAsyncResult *result,
|
|
||||||
- gpointer user_data)
|
|
||||||
+on_mandatory_x11_initialized (MetaDisplay *display,
|
|
||||||
+ GAsyncResult *result,
|
|
||||||
+ gpointer user_data)
|
|
||||||
{
|
|
||||||
g_autoptr (GError) error = NULL;
|
|
||||||
|
|
||||||
@@ -1035,7 +1035,7 @@ meta_display_new (MetaContext *context,
|
|
||||||
if (x11_display_policy == META_X11_DISPLAY_POLICY_MANDATORY)
|
|
||||||
{
|
|
||||||
meta_display_init_x11 (display, NULL,
|
|
||||||
- (GAsyncReadyCallback) on_x11_initialized,
|
|
||||||
+ (GAsyncReadyCallback) on_mandatory_x11_initialized,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
#endif /* HAVE_XWAYLAND */
|
|
||||||
--
|
|
||||||
2.44.0.501.g19981daefd.dirty
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
|||||||
|
From 4c23158f81c3c4b91353150fd4c28246ce1e692f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Fri, 3 Dec 2021 11:07:00 +0100
|
||||||
|
Subject: [PATCH 4/5] renderer/native: Allow forcing EGLStream backend
|
||||||
|
|
||||||
|
The GBM support in the NVIDIA driver is fairly new, and to make it
|
||||||
|
easier to identify whether a problem encountered is related to using GBM
|
||||||
|
instead of EGLStreams, add a debug environment variable to force using
|
||||||
|
EGLStream instead of GBM.
|
||||||
|
|
||||||
|
To force using EGLStream instead of GBM, use
|
||||||
|
|
||||||
|
MUTTER_DEBUG_FORCE_EGL_STREAM=1
|
||||||
|
|
||||||
|
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2045
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2132>
|
||||||
|
(cherry picked from commit d43cc776ef733251fc02e8e62669ea4ba7e68e2c)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-renderer-native.c | 26 ++++++++++++++++------
|
||||||
|
1 file changed, 19 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
|
||||||
|
index e7460fbf1..0cd7a27d6 100644
|
||||||
|
--- a/src/backends/native/meta-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-renderer-native.c
|
||||||
|
@@ -1765,7 +1765,7 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
||||||
|
MetaGpuKms *gpu_kms,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
- MetaRendererNativeGpuData *gbm_renderer_gpu_data;
|
||||||
|
+ MetaRendererNativeGpuData *gbm_renderer_gpu_data = NULL;
|
||||||
|
GError *gbm_error = NULL;
|
||||||
|
#ifdef HAVE_EGL_DEVICE
|
||||||
|
MetaRendererNativeGpuData *egl_stream_renderer_gpu_data;
|
||||||
|
@@ -1775,14 +1775,26 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
||||||
|
if (!gpu_kms)
|
||||||
|
return create_renderer_gpu_data_surfaceless (renderer_native, error);
|
||||||
|
|
||||||
|
- gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
||||||
|
- gpu_kms,
|
||||||
|
- &gbm_error);
|
||||||
|
- if (gbm_renderer_gpu_data)
|
||||||
|
+#ifdef HAVE_EGL_DEVICE
|
||||||
|
+ if (g_strcmp0 (getenv ("MUTTER_DEBUG_FORCE_EGL_STREAM"), "1") != 0)
|
||||||
|
+#endif
|
||||||
|
+ {
|
||||||
|
+ gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
||||||
|
+ gpu_kms,
|
||||||
|
+ &gbm_error);
|
||||||
|
+ if (gbm_renderer_gpu_data)
|
||||||
|
+ {
|
||||||
|
+ if (gbm_renderer_gpu_data->secondary.is_hardware_rendering)
|
||||||
|
+ return gbm_renderer_gpu_data;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#ifdef HAVE_EGL_DEVICE
|
||||||
|
+ else
|
||||||
|
{
|
||||||
|
- if (gbm_renderer_gpu_data->secondary.is_hardware_rendering)
|
||||||
|
- return gbm_renderer_gpu_data;
|
||||||
|
+ g_set_error (&gbm_error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
+ "GBM backend was disabled using env var");
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_EGL_DEVICE
|
||||||
|
egl_stream_renderer_gpu_data =
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
From 6cdfc8abe25fccfd06cac99ae82c0f2acbbdb7c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||||
|
Date: Thu, 17 Oct 2024 11:49:26 +0200
|
||||||
|
Subject: [PATCH 4/5] window: Don't use cgroup workspace if there already is
|
||||||
|
one
|
||||||
|
|
||||||
|
This fixes a re-entry issue where calling 'meta_window_activate()'
|
||||||
|
assumed it'd activate on the current workspace.
|
||||||
|
---
|
||||||
|
src/core/window.c | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index 272d664965..8ad8e5c4c4 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -3812,7 +3812,9 @@ meta_window_activate_full (MetaWindow *window,
|
||||||
|
if (workspace == NULL)
|
||||||
|
{
|
||||||
|
meta_window_read_cgroup (window);
|
||||||
|
- if (window->cgroup &&
|
||||||
|
+ if (!window->workspace &&
|
||||||
|
+ !window->on_all_workspaces &&
|
||||||
|
+ window->cgroup &&
|
||||||
|
window->cgroup->last_active_workspace != NULL &&
|
||||||
|
!window->cgroup->has_startup_sequence &&
|
||||||
|
(!window->cgroup->app_info ||
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -0,0 +1,685 @@
|
|||||||
|
From 9befece38b28581958d87d9393ff9c788213d2fb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Thu, 13 Jun 2024 13:47:01 -0400
|
||||||
|
Subject: [PATCH 4/6] window: Track workspace per-cgroup
|
||||||
|
|
||||||
|
If an application doesn't tell us what workspace to start on we
|
||||||
|
need to guess. Currently our guess is "currently active workspace",
|
||||||
|
but that's not really always the best choice.
|
||||||
|
|
||||||
|
This commit adds code to track the workspace other windows in the
|
||||||
|
same cgroup (~application) are running on and uses that to decide
|
||||||
|
which workspace to start on instead.
|
||||||
|
---
|
||||||
|
src/core/display-private.h | 6 ++++++
|
||||||
|
src/core/display.c | 31 +++++++++++++++++++++++++++++++
|
||||||
|
src/core/window-private.h | 1 +
|
||||||
|
src/core/window.c | 36 ++++++++++++++++++++++++++++++++----
|
||||||
|
4 files changed, 70 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
||||||
|
index fb17d20a6..2b8d9e0d0 100644
|
||||||
|
--- a/src/core/display-private.h
|
||||||
|
+++ b/src/core/display-private.h
|
||||||
|
@@ -81,60 +81,63 @@ typedef enum
|
||||||
|
} MetaTileMode;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
/* Normal interaction where you're interacting with windows.
|
||||||
|
* Events go to windows normally. */
|
||||||
|
META_EVENT_ROUTE_NORMAL,
|
||||||
|
|
||||||
|
/* In a window operation like moving or resizing. All events
|
||||||
|
* goes to MetaWindow, but not to the actual client window. */
|
||||||
|
META_EVENT_ROUTE_WINDOW_OP,
|
||||||
|
|
||||||
|
/* In a compositor grab operation. All events go to the
|
||||||
|
* compositor plugin. */
|
||||||
|
META_EVENT_ROUTE_COMPOSITOR_GRAB,
|
||||||
|
|
||||||
|
/* A Wayland application has a popup open. All events go to
|
||||||
|
* the Wayland application. */
|
||||||
|
META_EVENT_ROUTE_WAYLAND_POPUP,
|
||||||
|
|
||||||
|
/* The user is clicking on a window button. */
|
||||||
|
META_EVENT_ROUTE_FRAME_BUTTON,
|
||||||
|
} MetaEventRoute;
|
||||||
|
|
||||||
|
typedef void (* MetaDisplayWindowFunc) (MetaWindow *window,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
typedef struct _MetaCGroup MetaCGroup;
|
||||||
|
struct _MetaCGroup {
|
||||||
|
GFile *path;
|
||||||
|
+ guint32 user_time;
|
||||||
|
+ MetaWorkspace *last_active_workspace;
|
||||||
|
+ gboolean has_startup_sequence;
|
||||||
|
|
||||||
|
grefcount ref_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MetaDisplay
|
||||||
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
MetaX11Display *x11_display;
|
||||||
|
|
||||||
|
int clutter_event_filter;
|
||||||
|
|
||||||
|
/* Our best guess as to the "currently" focused window (that is, the
|
||||||
|
* window that we expect will be focused at the point when the X
|
||||||
|
* server processes our next request), and the serial of the request
|
||||||
|
* or event that caused this.
|
||||||
|
*/
|
||||||
|
MetaWindow *focus_window;
|
||||||
|
|
||||||
|
/* last timestamp passed to XSetInputFocus */
|
||||||
|
guint32 last_focus_time;
|
||||||
|
|
||||||
|
/* last user interaction time in any app */
|
||||||
|
guint32 last_user_time;
|
||||||
|
|
||||||
|
/* whether we're using mousenav (only relevant for sloppy&mouse focus modes;
|
||||||
|
* !mouse_mode means "keynav mode")
|
||||||
|
*/
|
||||||
|
guint mouse_mode : 1;
|
||||||
|
|
||||||
|
@@ -270,60 +273,63 @@ struct _MetaDisplayClass
|
||||||
|
|
||||||
|
gboolean meta_display_open (void);
|
||||||
|
|
||||||
|
void meta_display_manage_all_xwindows (MetaDisplay *display);
|
||||||
|
void meta_display_unmanage_windows (MetaDisplay *display,
|
||||||
|
guint32 timestamp);
|
||||||
|
|
||||||
|
/* Utility function to compare the stacking of two windows */
|
||||||
|
int meta_display_stack_cmp (const void *a,
|
||||||
|
const void *b);
|
||||||
|
|
||||||
|
/* Each MetaWindow is uniquely identified by a 64-bit "stamp"; unlike a
|
||||||
|
* a MetaWindow *, a stamp will never be recycled
|
||||||
|
*/
|
||||||
|
MetaWindow* meta_display_lookup_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp);
|
||||||
|
void meta_display_register_stamp (MetaDisplay *display,
|
||||||
|
guint64 *stampp,
|
||||||
|
MetaWindow *window);
|
||||||
|
void meta_display_unregister_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp);
|
||||||
|
|
||||||
|
void meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
MetaWindow *window,
|
||||||
|
const char *path);
|
||||||
|
void meta_display_unregister_cgroup (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
|
||||||
|
MetaCGroup* meta_cgroup_ref (MetaCGroup *cgroup);
|
||||||
|
gboolean meta_cgroup_unref (MetaCGroup *cgroup);
|
||||||
|
+void meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||||
|
+ MetaWorkspace *workspace,
|
||||||
|
+ guint32 timestamp);
|
||||||
|
|
||||||
|
/* A "stack id" is a XID or a stamp */
|
||||||
|
#define META_STACK_ID_IS_X11(id) ((id) < G_GUINT64_CONSTANT(0x100000000))
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaWindow* meta_display_lookup_stack_id (MetaDisplay *display,
|
||||||
|
guint64 stack_id);
|
||||||
|
|
||||||
|
/* for debug logging only; returns a human-description of the stack
|
||||||
|
* ID - a small number of buffers are recycled, so the result must
|
||||||
|
* be used immediately or copied */
|
||||||
|
const char *meta_display_describe_stack_id (MetaDisplay *display,
|
||||||
|
guint64 stack_id);
|
||||||
|
|
||||||
|
void meta_display_register_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
void meta_display_unregister_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
|
||||||
|
void meta_display_notify_window_created (MetaDisplay *display,
|
||||||
|
MetaWindow *window);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
GSList* meta_display_list_windows (MetaDisplay *display,
|
||||||
|
MetaListWindowsFlags flags);
|
||||||
|
|
||||||
|
MetaDisplay* meta_display_for_x_display (Display *xdisplay);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaDisplay* meta_get_display (void);
|
||||||
|
diff --git a/src/core/display.c b/src/core/display.c
|
||||||
|
index 937defd2c..f30f9a268 100644
|
||||||
|
--- a/src/core/display.c
|
||||||
|
+++ b/src/core/display.c
|
||||||
|
@@ -1524,94 +1524,121 @@ MetaCGroup*
|
||||||
|
meta_cgroup_new (const char *path)
|
||||||
|
{
|
||||||
|
MetaCGroup *cgroup;
|
||||||
|
|
||||||
|
cgroup = g_new0 (MetaCGroup, 1);
|
||||||
|
cgroup->path = g_file_new_for_path (path);
|
||||||
|
g_ref_count_init (&cgroup->ref_count);
|
||||||
|
|
||||||
|
return cgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaCGroup*
|
||||||
|
meta_cgroup_ref (MetaCGroup *cgroup)
|
||||||
|
{
|
||||||
|
g_ref_count_inc (&cgroup->ref_count);
|
||||||
|
return cgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_cgroup_unref (MetaCGroup *cgroup)
|
||||||
|
{
|
||||||
|
if (!g_ref_count_dec (&cgroup->ref_count))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_clear_object (&cgroup->path);
|
||||||
|
g_free (cgroup);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||||
|
+ MetaWorkspace *workspace,
|
||||||
|
+ guint32 timestamp)
|
||||||
|
+{
|
||||||
|
+ if (!cgroup)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (!XSERVER_TIME_IS_BEFORE (cgroup->user_time, timestamp))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ cgroup->user_time = timestamp;
|
||||||
|
+
|
||||||
|
+ if (cgroup->last_active_workspace)
|
||||||
|
+ g_object_remove_weak_pointer (G_OBJECT (cgroup->last_active_workspace),
|
||||||
|
+ (gpointer *) &cgroup->last_active_workspace);
|
||||||
|
+
|
||||||
|
+ cgroup->last_active_workspace = workspace;
|
||||||
|
+
|
||||||
|
+ g_object_add_weak_pointer (G_OBJECT (workspace),
|
||||||
|
+ (gpointer *) &cgroup->last_active_workspace);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
MetaWindow *window,
|
||||||
|
const char *path)
|
||||||
|
{
|
||||||
|
MetaCGroup *cgroup;
|
||||||
|
|
||||||
|
cgroup = g_hash_table_lookup (display->cgroups, path);
|
||||||
|
|
||||||
|
if (cgroup)
|
||||||
|
{
|
||||||
|
window->cgroup = meta_cgroup_ref (cgroup);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cgroup = meta_cgroup_new (path);
|
||||||
|
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unregister_cgroup (MetaDisplay *display,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_autofree const char *path = NULL;
|
||||||
|
MetaCGroup *cgroup = g_steal_pointer (&window->cgroup);
|
||||||
|
|
||||||
|
if (!cgroup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
path = g_file_get_path (cgroup->path);
|
||||||
|
|
||||||
|
if (!meta_cgroup_unref (cgroup))
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ if (cgroup->last_active_workspace)
|
||||||
|
+ g_object_remove_weak_pointer (G_OBJECT (cgroup->last_active_workspace),
|
||||||
|
+ (gpointer *) &cgroup->last_active_workspace);
|
||||||
|
+
|
||||||
|
g_hash_table_remove (display->cgroups, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaWindow*
|
||||||
|
meta_display_lookup_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp)
|
||||||
|
{
|
||||||
|
return g_hash_table_lookup (display->stamps, &stamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_register_stamp (MetaDisplay *display,
|
||||||
|
guint64 *stampp,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_return_if_fail (g_hash_table_lookup (display->stamps, stampp) == NULL);
|
||||||
|
|
||||||
|
g_hash_table_insert (display->stamps, stampp, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unregister_stamp (MetaDisplay *display,
|
||||||
|
guint64 stamp)
|
||||||
|
{
|
||||||
|
g_return_if_fail (g_hash_table_lookup (display->stamps, &stamp) != NULL);
|
||||||
|
|
||||||
|
g_hash_table_remove (display->stamps, &stamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaWindow*
|
||||||
|
@@ -3374,60 +3401,64 @@ meta_display_apply_startup_properties (MetaDisplay *display,
|
||||||
|
meta_startup_sequence_get_id (sequence),
|
||||||
|
window->desc);
|
||||||
|
|
||||||
|
meta_startup_sequence_complete (sequence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Still no startup ID? Bail. */
|
||||||
|
if (!startup_id)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* We might get this far and not know the sequence ID (if the window
|
||||||
|
* already had a startup ID stored), so let's look for one if we don't
|
||||||
|
* already know it.
|
||||||
|
*/
|
||||||
|
if (sequence == NULL)
|
||||||
|
{
|
||||||
|
sequence =
|
||||||
|
meta_startup_notification_lookup_sequence (display->startup_notification,
|
||||||
|
startup_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sequence != NULL)
|
||||||
|
{
|
||||||
|
gboolean changed_something = FALSE;
|
||||||
|
|
||||||
|
meta_topic (META_DEBUG_STARTUP,
|
||||||
|
"Found startup sequence for window %s ID \"%s\"",
|
||||||
|
window->desc, startup_id);
|
||||||
|
|
||||||
|
+ meta_window_read_cgroup (window);
|
||||||
|
+ if (window->cgroup)
|
||||||
|
+ window->cgroup->has_startup_sequence = TRUE;
|
||||||
|
+
|
||||||
|
if (!window->initial_workspace_set)
|
||||||
|
{
|
||||||
|
int space = meta_startup_sequence_get_workspace (sequence);
|
||||||
|
if (space >= 0)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_STARTUP,
|
||||||
|
"Setting initial window workspace to %d based on startup info",
|
||||||
|
space);
|
||||||
|
|
||||||
|
window->initial_workspace_set = TRUE;
|
||||||
|
window->initial_workspace = space;
|
||||||
|
changed_something = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window->initial_timestamp_set)
|
||||||
|
{
|
||||||
|
guint32 timestamp = meta_startup_sequence_get_timestamp (sequence);
|
||||||
|
meta_topic (META_DEBUG_STARTUP,
|
||||||
|
"Setting initial window timestamp to %u based on startup info",
|
||||||
|
timestamp);
|
||||||
|
|
||||||
|
window->initial_timestamp_set = TRUE;
|
||||||
|
window->initial_timestamp = timestamp;
|
||||||
|
changed_something = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed_something;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
diff --git a/src/core/window-private.h b/src/core/window-private.h
|
||||||
|
index 8a0aebb38..41782aa99 100644
|
||||||
|
--- a/src/core/window-private.h
|
||||||
|
+++ b/src/core/window-private.h
|
||||||
|
@@ -860,31 +860,32 @@ void meta_window_update_resize (MetaWindow *window,
|
||||||
|
MetaEdgeResistanceFlags flags,
|
||||||
|
int x, int y,
|
||||||
|
gboolean force);
|
||||||
|
|
||||||
|
void meta_window_move_resize_internal (MetaWindow *window,
|
||||||
|
MetaMoveResizeFlags flags,
|
||||||
|
MetaGravity gravity,
|
||||||
|
MetaRectangle frame_rect);
|
||||||
|
|
||||||
|
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);
|
||||||
|
void meta_window_grab_op_ended (MetaWindow *window, MetaGrabOp op);
|
||||||
|
|
||||||
|
void meta_window_set_alive (MetaWindow *window, gboolean is_alive);
|
||||||
|
|
||||||
|
gboolean meta_window_has_pointer (MetaWindow *window);
|
||||||
|
|
||||||
|
void meta_window_emit_size_changed (MetaWindow *window);
|
||||||
|
|
||||||
|
MetaPlacementRule *meta_window_get_placement_rule (MetaWindow *window);
|
||||||
|
|
||||||
|
void meta_window_force_placement (MetaWindow *window,
|
||||||
|
gboolean force_move);
|
||||||
|
|
||||||
|
void meta_window_force_restore_shortcuts (MetaWindow *window,
|
||||||
|
ClutterInputDevice *source);
|
||||||
|
|
||||||
|
gboolean meta_window_shortcuts_inhibited (MetaWindow *window,
|
||||||
|
ClutterInputDevice *source);
|
||||||
|
gboolean meta_window_is_stackable (MetaWindow *window);
|
||||||
|
gboolean meta_window_is_focus_async (MetaWindow *window);
|
||||||
|
+void meta_window_read_cgroup (MetaWindow *window);
|
||||||
|
#endif
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index f5ecd6438..5c7b2e8cf 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -1296,79 +1296,88 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||||
|
* added to all the MRU lists
|
||||||
|
*/
|
||||||
|
window->on_all_workspaces_requested = TRUE;
|
||||||
|
|
||||||
|
on_all_workspaces = TRUE;
|
||||||
|
}
|
||||||
|
else if (!on_all_workspaces)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Window %s is initially on space %d",
|
||||||
|
window->desc, window->initial_workspace);
|
||||||
|
|
||||||
|
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager,
|
||||||
|
window->initial_workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ignore when a window requests to be placed on a non-existent workspace
|
||||||
|
*/
|
||||||
|
if (on_all_workspaces || workspace != NULL)
|
||||||
|
set_workspace_state (window, on_all_workspaces, workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* override-redirect windows are subtly different from other windows
|
||||||
|
* with window->on_all_workspaces == TRUE. Other windows are part of
|
||||||
|
* some workspace (so they can return to that if the flag is turned off),
|
||||||
|
* but appear on other workspaces. override-redirect windows are part
|
||||||
|
* of no workspace.
|
||||||
|
*/
|
||||||
|
if (!window->override_redirect && window->workspace == NULL)
|
||||||
|
{
|
||||||
|
+ meta_window_read_cgroup (window);
|
||||||
|
if (window->transient_for != NULL)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on same workspace as parent %s",
|
||||||
|
window->desc, window->transient_for->desc);
|
||||||
|
|
||||||
|
g_warn_if_fail (!window->transient_for->override_redirect);
|
||||||
|
set_workspace_state (window,
|
||||||
|
window->transient_for->on_all_workspaces,
|
||||||
|
window->transient_for->workspace);
|
||||||
|
}
|
||||||
|
else if (window->on_all_workspaces)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on all workspaces",
|
||||||
|
window->desc);
|
||||||
|
|
||||||
|
set_workspace_state (window, TRUE, NULL);
|
||||||
|
}
|
||||||
|
+ else if (window->cgroup && window->cgroup->last_active_workspace != NULL &&
|
||||||
|
+ !window->cgroup->has_startup_sequence)
|
||||||
|
+ {
|
||||||
|
+ meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
+ "Putting window %s on active workspace",
|
||||||
|
+ window->desc);
|
||||||
|
+ set_workspace_state (window, FALSE, window->cgroup->last_active_workspace);
|
||||||
|
+ }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on active workspace",
|
||||||
|
window->desc);
|
||||||
|
|
||||||
|
set_workspace_state (window, FALSE, workspace_manager->active_workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_window_update_struts (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_window_main_monitor_changed (window, NULL);
|
||||||
|
|
||||||
|
/* Must add window to stack before doing move/resize, since the
|
||||||
|
* window might have fullscreen size (i.e. should have been
|
||||||
|
* fullscreen'd; acrobat is one such braindead case; it withdraws
|
||||||
|
* and remaps its window whenever trying to become fullscreen...)
|
||||||
|
* and thus constraints may try to auto-fullscreen it which also
|
||||||
|
* means restacking it.
|
||||||
|
*/
|
||||||
|
if (meta_window_is_stackable (window))
|
||||||
|
meta_stack_add (window->display->stack,
|
||||||
|
window);
|
||||||
|
else if (window->override_redirect)
|
||||||
|
window->layer = META_LAYER_OVERRIDE_REDIRECT; /* otherwise set by MetaStack */
|
||||||
|
|
||||||
|
if (!window->override_redirect)
|
||||||
|
{
|
||||||
|
/* FIXME we have a tendency to set this then immediately
|
||||||
|
@@ -3736,63 +3745,71 @@ meta_window_activate_full (MetaWindow *window,
|
||||||
|
"by client type %u.",
|
||||||
|
window->desc, timestamp, source_indication);
|
||||||
|
|
||||||
|
if (window->display->last_user_time == timestamp)
|
||||||
|
{
|
||||||
|
/* Only allow workspace switches if this activation message uses the same
|
||||||
|
* timestamp as the last user interaction
|
||||||
|
*/
|
||||||
|
allow_workspace_switch = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timestamp != 0 &&
|
||||||
|
XSERVER_TIME_IS_BEFORE (timestamp, window->display->last_user_time))
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"last_user_time (%u) is more recent; ignoring "
|
||||||
|
" _NET_ACTIVE_WINDOW message.",
|
||||||
|
window->display->last_user_time);
|
||||||
|
meta_window_set_demands_attention(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timestamp == 0)
|
||||||
|
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||||
|
|
||||||
|
meta_window_set_user_time (window, timestamp);
|
||||||
|
|
||||||
|
/* disable show desktop mode unless we're a desktop component */
|
||||||
|
maybe_leave_show_desktop_mode (window);
|
||||||
|
|
||||||
|
- /* Get window on current or given workspace */
|
||||||
|
- if (workspace == NULL)
|
||||||
|
- workspace = workspace_manager->active_workspace;
|
||||||
|
+ /* Get window on last active, current, or given workspace */
|
||||||
|
+ if (workspace == NULL)
|
||||||
|
+ {
|
||||||
|
+ meta_window_read_cgroup (window);
|
||||||
|
+ if (window->cgroup &&
|
||||||
|
+ window->cgroup->last_active_workspace != NULL &&
|
||||||
|
+ !window->cgroup->has_startup_sequence)
|
||||||
|
+ workspace = window->cgroup->last_active_workspace;
|
||||||
|
+ else
|
||||||
|
+ workspace = workspace_manager->active_workspace;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* For non-transient windows, we just set up a pulsing indicator,
|
||||||
|
rather than move windows or workspaces.
|
||||||
|
See http://bugzilla.gnome.org/show_bug.cgi?id=482354 */
|
||||||
|
if (window->transient_for == NULL &&
|
||||||
|
!allow_workspace_switch &&
|
||||||
|
!meta_window_located_on_workspace (window, workspace))
|
||||||
|
{
|
||||||
|
meta_window_set_demands_attention (window);
|
||||||
|
/* We've marked it as demanding, don't need to do anything else. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (window->transient_for != NULL)
|
||||||
|
{
|
||||||
|
/* Move transients to current workspace - preference dialogs should appear over
|
||||||
|
the source window. */
|
||||||
|
meta_window_change_workspace (window, workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->shaded)
|
||||||
|
meta_window_unshade (window, timestamp);
|
||||||
|
|
||||||
|
unminimize_window_and_all_transient_parents (window);
|
||||||
|
|
||||||
|
if (meta_prefs_get_raise_on_click () ||
|
||||||
|
source_indication == META_CLIENT_TYPE_PAGER)
|
||||||
|
meta_window_raise (window);
|
||||||
|
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"Focusing window %s due to activation",
|
||||||
|
@@ -7165,60 +7182,71 @@ meta_window_set_user_time (MetaWindow *window,
|
||||||
|
g_return_if_fail (!window->override_redirect);
|
||||||
|
|
||||||
|
/* Only update the time if this timestamp is newer... */
|
||||||
|
if (window->net_wm_user_time_set &&
|
||||||
|
XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time))
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_STARTUP,
|
||||||
|
"Window %s _NET_WM_USER_TIME not updated to %u, because it "
|
||||||
|
"is less than %u",
|
||||||
|
window->desc, timestamp, window->net_wm_user_time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_STARTUP,
|
||||||
|
"Window %s has _NET_WM_USER_TIME of %u",
|
||||||
|
window->desc, timestamp);
|
||||||
|
window->net_wm_user_time_set = TRUE;
|
||||||
|
window->net_wm_user_time = timestamp;
|
||||||
|
if (XSERVER_TIME_IS_BEFORE (window->display->last_user_time, timestamp))
|
||||||
|
window->display->last_user_time = timestamp;
|
||||||
|
|
||||||
|
/* If this is a terminal, user interaction with it means the user likely
|
||||||
|
* doesn't want to have focus transferred for now due to new windows.
|
||||||
|
*/
|
||||||
|
if (meta_prefs_get_focus_new_windows () == G_DESKTOP_FOCUS_NEW_WINDOWS_STRICT &&
|
||||||
|
window_is_terminal (window))
|
||||||
|
window->display->allow_terminal_deactivation = FALSE;
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_USER_TIME]);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (!window->cgroup)
|
||||||
|
+ meta_window_read_cgroup (window);
|
||||||
|
+
|
||||||
|
+ if (window->cgroup)
|
||||||
|
+ {
|
||||||
|
+ MetaWorkspace *workspace = meta_window_get_workspace (window);
|
||||||
|
+
|
||||||
|
+ if (workspace)
|
||||||
|
+ meta_cgroup_update_workspace (window->cgroup, workspace, timestamp);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_window_get_stable_sequence:
|
||||||
|
* @window: A #MetaWindow
|
||||||
|
*
|
||||||
|
* The stable sequence number is a monotonicially increasing
|
||||||
|
* unique integer assigned to each #MetaWindow upon creation.
|
||||||
|
*
|
||||||
|
* This number can be useful for sorting windows in a stable
|
||||||
|
* fashion.
|
||||||
|
*
|
||||||
|
* Returns: Internal sequence number for this window
|
||||||
|
*/
|
||||||
|
guint32
|
||||||
|
meta_window_get_stable_sequence (MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (META_IS_WINDOW (window), 0);
|
||||||
|
|
||||||
|
return window->stable_sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sets the demands_attention hint on a window, but only
|
||||||
|
* if it's at least partially obscured (see #305882).
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
meta_window_set_demands_attention (MetaWindow *window)
|
||||||
|
{
|
||||||
|
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||||
|
MetaRectangle candidate_rect, other_rect;
|
||||||
|
@@ -7649,61 +7677,61 @@ meta_window_get_transient_for (MetaWindow *window)
|
||||||
|
else if (window->xtransient_for)
|
||||||
|
return meta_x11_display_lookup_x_window (window->display->x11_display,
|
||||||
|
window->xtransient_for);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_window_get_pid:
|
||||||
|
* @window: a #MetaWindow
|
||||||
|
*
|
||||||
|
* Returns the pid of the process that created this window, if available
|
||||||
|
* to the windowing system.
|
||||||
|
*
|
||||||
|
* Note that the value returned by this is vulnerable to spoofing attacks
|
||||||
|
* by the client.
|
||||||
|
*
|
||||||
|
* Return value: the pid, or 0 if not known.
|
||||||
|
*/
|
||||||
|
pid_t
|
||||||
|
meta_window_get_pid (MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (META_IS_WINDOW (window), 0);
|
||||||
|
|
||||||
|
if (window->client_pid == 0)
|
||||||
|
window->client_pid = META_WINDOW_GET_CLASS (window)->get_client_pid (window);
|
||||||
|
|
||||||
|
return window->client_pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void
|
||||||
|
+void
|
||||||
|
meta_window_read_cgroup (MetaWindow *window)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_LIBSYSTEMD
|
||||||
|
g_autofree char *contents = NULL;
|
||||||
|
g_autofree char *complete_path = NULL;
|
||||||
|
g_autofree char *unit_name = NULL;
|
||||||
|
g_autofree char *unit_path = NULL;
|
||||||
|
char *unit_end;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
if (window->cgroup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pid = meta_window_get_pid (window);
|
||||||
|
if (pid < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (sd_pid_get_cgroup (pid, &contents) < 0)
|
||||||
|
return;
|
||||||
|
g_strstrip (contents);
|
||||||
|
|
||||||
|
complete_path = g_strdup_printf ("%s%s", "/sys/fs/cgroup", contents);
|
||||||
|
|
||||||
|
if (sd_pid_get_user_unit (pid, &unit_name) < 0)
|
||||||
|
return;
|
||||||
|
g_strstrip (unit_name);
|
||||||
|
|
||||||
|
unit_end = strstr (complete_path, unit_name) + strlen (unit_name);
|
||||||
|
*unit_end = '\0';
|
||||||
|
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
@ -0,0 +1,166 @@
|
|||||||
|
From 50d0355bda637a2b214e14c23e767e80066c1084 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||||
|
Date: Fri, 18 Oct 2024 13:23:01 +0200
|
||||||
|
Subject: [PATCH 5/5] cgroup: Get app info from gnome-shell when possible
|
||||||
|
|
||||||
|
Using cgroups alone for getting the app-id is flawed, as there are many
|
||||||
|
situations where the cgroup isn't set up properly, e.g. opening via
|
||||||
|
xdg-open or equivalent. gnome-shell already has a system for associating
|
||||||
|
windows with apps, so reuse this for the cgroup app info.
|
||||||
|
---
|
||||||
|
src/core/display-private.h | 2 ++
|
||||||
|
src/core/display.c | 56 +++++++++++++++++++++++++++++++-------
|
||||||
|
src/core/window.c | 6 ++++
|
||||||
|
3 files changed, 54 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
||||||
|
index 3c7e0898bf..9836e560b3 100644
|
||||||
|
--- a/src/core/display-private.h
|
||||||
|
+++ b/src/core/display-private.h
|
||||||
|
@@ -304,6 +304,8 @@ gboolean meta_cgroup_unref (MetaCGroup *cgroup);
|
||||||
|
void meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||||
|
MetaWorkspace *workspace,
|
||||||
|
guint32 timestamp);
|
||||||
|
+void meta_cgroup_update_app_info (MetaCGroup *cgroup,
|
||||||
|
+ MetaWindow *window);
|
||||||
|
|
||||||
|
/* A "stack id" is a XID or a stamp */
|
||||||
|
#define META_STACK_ID_IS_X11(id) ((id) < G_GUINT64_CONSTANT(0x100000000))
|
||||||
|
diff --git a/src/core/display.c b/src/core/display.c
|
||||||
|
index e99e787fbe..637bc006d8 100644
|
||||||
|
--- a/src/core/display.c
|
||||||
|
+++ b/src/core/display.c
|
||||||
|
@@ -162,6 +162,7 @@ enum
|
||||||
|
WORKAREAS_CHANGED,
|
||||||
|
CLOSING,
|
||||||
|
INIT_XSERVER,
|
||||||
|
+ FIND_APP_INFO,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -515,6 +516,12 @@ meta_display_class_init (MetaDisplayClass *klass)
|
||||||
|
0, g_signal_accumulator_first_wins,
|
||||||
|
NULL, NULL,
|
||||||
|
G_TYPE_BOOLEAN, 1, G_TYPE_TASK);
|
||||||
|
+ display_signals[FIND_APP_INFO] =
|
||||||
|
+ g_signal_new ("find-app-info",
|
||||||
|
+ G_TYPE_FROM_CLASS (klass),
|
||||||
|
+ G_SIGNAL_RUN_LAST,
|
||||||
|
+ 0, NULL, NULL, NULL,
|
||||||
|
+ G_TYPE_DESKTOP_APP_INFO, 1, META_TYPE_WINDOW);
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_COMPOSITOR_MODIFIERS,
|
||||||
|
@@ -1620,25 +1627,32 @@ extract_app_id_from_cgroup (const char *cgroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
static MetaCGroup*
|
||||||
|
-meta_cgroup_new (const char *path)
|
||||||
|
+meta_cgroup_new (const char *path,
|
||||||
|
+ GAppInfo *app_info)
|
||||||
|
{
|
||||||
|
MetaCGroup *cgroup;
|
||||||
|
- g_autofree char *app_id = NULL;
|
||||||
|
|
||||||
|
cgroup = g_new0 (MetaCGroup, 1);
|
||||||
|
cgroup->path = g_file_new_for_path (path);
|
||||||
|
g_ref_count_init (&cgroup->ref_count);
|
||||||
|
|
||||||
|
- app_id = extract_app_id_from_cgroup (path);
|
||||||
|
-
|
||||||
|
- if (app_id)
|
||||||
|
+ if (!app_info)
|
||||||
|
{
|
||||||
|
- g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||||
|
+ g_autofree char *app_id = NULL;
|
||||||
|
|
||||||
|
- app_info = g_desktop_app_info_new (app_id);
|
||||||
|
+ app_id = extract_app_id_from_cgroup (path);
|
||||||
|
+ if (app_id)
|
||||||
|
+ {
|
||||||
|
+ GDesktopAppInfo *desktop_app_info;
|
||||||
|
|
||||||
|
- if (app_info)
|
||||||
|
- cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||||
|
+ desktop_app_info = g_desktop_app_info_new (app_id);
|
||||||
|
+ if (desktop_app_info)
|
||||||
|
+ cgroup->app_info = G_APP_INFO (desktop_app_info);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else if (app_info)
|
||||||
|
+ {
|
||||||
|
+ cgroup->app_info = g_object_ref (app_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cgroup;
|
||||||
|
@@ -1687,12 +1701,30 @@ meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||||
|
(gpointer *) &cgroup->last_active_workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+meta_cgroup_update_app_info (MetaCGroup *cgroup,
|
||||||
|
+ MetaWindow *window)
|
||||||
|
+{
|
||||||
|
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||||
|
+
|
||||||
|
+ g_signal_emit (window->display,
|
||||||
|
+ display_signals[FIND_APP_INFO], 0,
|
||||||
|
+ window, &app_info);
|
||||||
|
+
|
||||||
|
+ if (app_info)
|
||||||
|
+ {
|
||||||
|
+ g_clear_object (&cgroup->app_info);
|
||||||
|
+ cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
MetaWindow *window,
|
||||||
|
const char *path)
|
||||||
|
{
|
||||||
|
MetaCGroup *cgroup;
|
||||||
|
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||||
|
|
||||||
|
cgroup = g_hash_table_lookup (display->cgroups, path);
|
||||||
|
|
||||||
|
@@ -1702,7 +1734,11 @@ meta_display_register_cgroup (MetaDisplay *display,
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- cgroup = meta_cgroup_new (path);
|
||||||
|
+ g_signal_emit (display,
|
||||||
|
+ display_signals[FIND_APP_INFO], 0,
|
||||||
|
+ window, &app_info);
|
||||||
|
+
|
||||||
|
+ cgroup = meta_cgroup_new (path, app_info ? G_APP_INFO (app_info) : NULL);
|
||||||
|
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||||
|
window->cgroup = cgroup;
|
||||||
|
}
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index 8ad8e5c4c4..6de815839f 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -8131,6 +8131,9 @@ meta_window_set_wm_class (MetaWindow *window,
|
||||||
|
window->res_class = g_strdup (wm_class);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_WM_CLASS]);
|
||||||
|
+
|
||||||
|
+ if (window->cgroup)
|
||||||
|
+ meta_cgroup_update_app_info (window->cgroup, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -8169,6 +8172,9 @@ meta_window_set_gtk_dbus_properties (MetaWindow *window,
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_GTK_WINDOW_OBJECT_PATH]);
|
||||||
|
|
||||||
|
g_object_thaw_notify (G_OBJECT (window));
|
||||||
|
+
|
||||||
|
+ if (window->cgroup)
|
||||||
|
+ meta_cgroup_update_app_info (window->cgroup, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
--
|
||||||
|
2.44.0.501.g19981daefd.dirty
|
||||||
|
|
@ -0,0 +1,556 @@
|
|||||||
|
From 62e4f7153738b404b05b1ee59d088bc52fd86bc0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Mon, 8 Jul 2024 09:54:01 -0400
|
||||||
|
Subject: [PATCH 5/6] core/display: Avoid placement heuristcs for apps that can
|
||||||
|
do startup notification
|
||||||
|
|
||||||
|
We recently introduced heuristics to decide which workspace to put an an
|
||||||
|
application window on. Those heuristics are only used if an application
|
||||||
|
doesn't support startup notification (since startup notification
|
||||||
|
provides a means to give that information without heuristics).
|
||||||
|
|
||||||
|
Unfortunately, sometimes applications that support startup notification
|
||||||
|
aren't started with it. In those cases, it's wrong to fall back to
|
||||||
|
heuristics, because those heuristics are a big change in behavior, and
|
||||||
|
cause applications to break (like terminals launched from the desktop
|
||||||
|
starting on the wrong workspace)
|
||||||
|
|
||||||
|
This commit adds code to try to deduce the application from its cgroup,
|
||||||
|
and then check if it supports startup notification, even if it's not
|
||||||
|
started with it in any given instance.
|
||||||
|
---
|
||||||
|
src/core/display-private.h | 1 +
|
||||||
|
src/core/display.c | 113 +++++++++++++++++++++++++++++++++++++
|
||||||
|
src/core/window.c | 10 +++-
|
||||||
|
3 files changed, 122 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
||||||
|
index 2b8d9e0d0..3c7e0898b 100644
|
||||||
|
--- a/src/core/display-private.h
|
||||||
|
+++ b/src/core/display-private.h
|
||||||
|
@@ -81,60 +81,61 @@ typedef enum
|
||||||
|
} MetaTileMode;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
/* Normal interaction where you're interacting with windows.
|
||||||
|
* Events go to windows normally. */
|
||||||
|
META_EVENT_ROUTE_NORMAL,
|
||||||
|
|
||||||
|
/* In a window operation like moving or resizing. All events
|
||||||
|
* goes to MetaWindow, but not to the actual client window. */
|
||||||
|
META_EVENT_ROUTE_WINDOW_OP,
|
||||||
|
|
||||||
|
/* In a compositor grab operation. All events go to the
|
||||||
|
* compositor plugin. */
|
||||||
|
META_EVENT_ROUTE_COMPOSITOR_GRAB,
|
||||||
|
|
||||||
|
/* A Wayland application has a popup open. All events go to
|
||||||
|
* the Wayland application. */
|
||||||
|
META_EVENT_ROUTE_WAYLAND_POPUP,
|
||||||
|
|
||||||
|
/* The user is clicking on a window button. */
|
||||||
|
META_EVENT_ROUTE_FRAME_BUTTON,
|
||||||
|
} MetaEventRoute;
|
||||||
|
|
||||||
|
typedef void (* MetaDisplayWindowFunc) (MetaWindow *window,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
typedef struct _MetaCGroup MetaCGroup;
|
||||||
|
struct _MetaCGroup {
|
||||||
|
GFile *path;
|
||||||
|
+ GAppInfo *app_info;
|
||||||
|
guint32 user_time;
|
||||||
|
MetaWorkspace *last_active_workspace;
|
||||||
|
gboolean has_startup_sequence;
|
||||||
|
|
||||||
|
grefcount ref_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MetaDisplay
|
||||||
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
MetaX11Display *x11_display;
|
||||||
|
|
||||||
|
int clutter_event_filter;
|
||||||
|
|
||||||
|
/* Our best guess as to the "currently" focused window (that is, the
|
||||||
|
* window that we expect will be focused at the point when the X
|
||||||
|
* server processes our next request), and the serial of the request
|
||||||
|
* or event that caused this.
|
||||||
|
*/
|
||||||
|
MetaWindow *focus_window;
|
||||||
|
|
||||||
|
/* last timestamp passed to XSetInputFocus */
|
||||||
|
guint32 last_focus_time;
|
||||||
|
|
||||||
|
/* last user interaction time in any app */
|
||||||
|
guint32 last_user_time;
|
||||||
|
|
||||||
|
/* whether we're using mousenav (only relevant for sloppy&mouse focus modes;
|
||||||
|
* !mouse_mode means "keynav mode")
|
||||||
|
diff --git a/src/core/display.c b/src/core/display.c
|
||||||
|
index f30f9a268..4c9038e62 100644
|
||||||
|
--- a/src/core/display.c
|
||||||
|
+++ b/src/core/display.c
|
||||||
|
@@ -65,60 +65,62 @@
|
||||||
|
#include "core/meta-clipboard-manager.h"
|
||||||
|
#include "core/meta-workspace-manager-private.h"
|
||||||
|
#include "core/util-private.h"
|
||||||
|
#include "core/window-private.h"
|
||||||
|
#include "core/workspace-private.h"
|
||||||
|
#include "meta/compositor-mutter.h"
|
||||||
|
#include "meta/compositor.h"
|
||||||
|
#include "meta/main.h"
|
||||||
|
#include "meta/meta-backend.h"
|
||||||
|
#include "meta/meta-enum-types.h"
|
||||||
|
#include "meta/meta-sound-player.h"
|
||||||
|
#include "meta/meta-x11-errors.h"
|
||||||
|
#include "meta/prefs.h"
|
||||||
|
#include "x11/meta-startup-notification-x11.h"
|
||||||
|
#include "x11/meta-x11-display-private.h"
|
||||||
|
#include "x11/window-x11.h"
|
||||||
|
#include "x11/xprops.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND
|
||||||
|
#include "compositor/meta-compositor-native.h"
|
||||||
|
#include "compositor/meta-compositor-server.h"
|
||||||
|
#include "wayland/meta-xwayland-private.h"
|
||||||
|
#include "wayland/meta-wayland-tablet-seat.h"
|
||||||
|
#include "wayland/meta-wayland-tablet-pad.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NATIVE_BACKEND
|
||||||
|
#include "backends/native/meta-backend-native.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#include <gio/gdesktopappinfo.h>
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* SECTION:pings
|
||||||
|
*
|
||||||
|
* Sometimes we want to see whether a window is responding,
|
||||||
|
* so we send it a "ping" message and see whether it sends us back a "pong"
|
||||||
|
* message within a reasonable time. Here we have a system which lets us
|
||||||
|
* nominate one function to be called if we get the pong in time and another
|
||||||
|
* function if we don't. The system is rather more complicated than it needs
|
||||||
|
* to be, since we only ever use it to destroy windows which are asked to
|
||||||
|
* close themselves and don't do so within a reasonable amount of time, and
|
||||||
|
* therefore we always use the same callbacks. It's possible that we might
|
||||||
|
* use it for other things in future, or on the other hand we might decide
|
||||||
|
* that we're never going to do so and simplify it a bit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MetaPingData:
|
||||||
|
*
|
||||||
|
* Describes a ping on a window. When we send a ping to a window, we build
|
||||||
|
* one of these structs, and it eventually gets passed to the timeout function
|
||||||
|
* or to the function which handles the response from the window. If the window
|
||||||
|
* does or doesn't respond to the ping, we use this information to deal with
|
||||||
|
* these facts; we have a handler function for each.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
MetaWindow *window;
|
||||||
|
guint32 serial;
|
||||||
|
guint ping_timeout_id;
|
||||||
|
} MetaPingData;
|
||||||
|
@@ -1493,85 +1495,196 @@ meta_display_set_input_focus (MetaDisplay *display,
|
||||||
|
|
||||||
|
meta_display_update_focus_window (display, window);
|
||||||
|
|
||||||
|
display->last_focus_time = timestamp;
|
||||||
|
|
||||||
|
if (window == NULL || window != display->autoraise_window)
|
||||||
|
meta_display_remove_autoraise_callback (display);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unset_input_focus (MetaDisplay *display,
|
||||||
|
guint32 timestamp)
|
||||||
|
{
|
||||||
|
meta_display_set_input_focus (display, NULL, FALSE, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_register_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_hash_table_add (display->wayland_windows, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_unregister_wayland_window (MetaDisplay *display,
|
||||||
|
MetaWindow *window)
|
||||||
|
{
|
||||||
|
g_hash_table_remove (display->wayland_windows, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+unescape_app_id (char **app_id)
|
||||||
|
+{
|
||||||
|
+ char *p = *app_id;
|
||||||
|
+ char *q = *app_id;
|
||||||
|
+
|
||||||
|
+ while (*p != '\0')
|
||||||
|
+ {
|
||||||
|
+ if (*p == '\\' &&
|
||||||
|
+ p[1] == 'x' &&
|
||||||
|
+ g_ascii_isxdigit (p[2]) &&
|
||||||
|
+ g_ascii_isxdigit (p[3]))
|
||||||
|
+ {
|
||||||
|
+ char escape_code[3] = { p[2], p[3], '\0' };
|
||||||
|
+ *q = (char) g_ascii_strtoll (escape_code, NULL, 16);
|
||||||
|
+ p += strlen ("\\xAA");
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ *q = *p;
|
||||||
|
+ p++;
|
||||||
|
+ }
|
||||||
|
+ q++;
|
||||||
|
+ }
|
||||||
|
+ *q = '\0';
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* The possible formats are:
|
||||||
|
+ *
|
||||||
|
+ * /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/app-dbus\x2d:1.2\x2dorg.gnome.Totem.slice/dbus-:1.2-org.gnome.Totem@0.service
|
||||||
|
+ * /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/gnome-terminal-server.service
|
||||||
|
+ * /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/app-gnome-org.gnome.Evince-12345.scope
|
||||||
|
+ */
|
||||||
|
+static char *
|
||||||
|
+extract_app_id_from_cgroup (const char *cgroup)
|
||||||
|
+{
|
||||||
|
+ g_auto (GStrv) path_components = NULL;
|
||||||
|
+ const char *unit_name = NULL;
|
||||||
|
+ size_t i;
|
||||||
|
+ g_autofree char *app_id = NULL;
|
||||||
|
+ char *start_delimiter = NULL;
|
||||||
|
+ char *end_delimiter = NULL;
|
||||||
|
+ int app_id_length;
|
||||||
|
+
|
||||||
|
+ path_components = g_strsplit (cgroup, G_DIR_SEPARATOR_S, -1);
|
||||||
|
+
|
||||||
|
+ for (i = 0; path_components[i]; i++)
|
||||||
|
+ {
|
||||||
|
+ if (!g_str_equal (path_components[i], "app.slice"))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ unit_name = path_components[i + 1];
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!unit_name)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if (!g_str_has_prefix (unit_name, "app-"))
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ end_delimiter = g_strrstr (unit_name, ".slice");
|
||||||
|
+
|
||||||
|
+ if (!end_delimiter)
|
||||||
|
+ end_delimiter = strrchr (unit_name, '-');
|
||||||
|
+
|
||||||
|
+ if (end_delimiter == NULL || end_delimiter == unit_name)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ start_delimiter = end_delimiter - 1;
|
||||||
|
+ while (start_delimiter > cgroup && *start_delimiter != '-')
|
||||||
|
+ start_delimiter--;
|
||||||
|
+
|
||||||
|
+ if (start_delimiter == NULL || start_delimiter == unit_name)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ app_id_length = end_delimiter - (start_delimiter + 1);
|
||||||
|
+ app_id = g_strdup_printf ("%.*s.desktop", app_id_length, start_delimiter + 1);
|
||||||
|
+
|
||||||
|
+ unescape_app_id (&app_id);
|
||||||
|
+
|
||||||
|
+ if (g_str_has_prefix (app_id, "dbus-"))
|
||||||
|
+ {
|
||||||
|
+ const char *dbus_prefix;
|
||||||
|
+ dbus_prefix = strchr (app_id + strlen ("dbus-") + 1, '-');
|
||||||
|
+
|
||||||
|
+ if (dbus_prefix)
|
||||||
|
+ {
|
||||||
|
+ char *stripped_app_id = strdup (dbus_prefix + 1);
|
||||||
|
+ g_clear_pointer (&app_id, g_free);
|
||||||
|
+ app_id = g_steal_pointer (&stripped_app_id);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return g_steal_pointer (&app_id);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
MetaCGroup*
|
||||||
|
meta_cgroup_new (const char *path)
|
||||||
|
{
|
||||||
|
MetaCGroup *cgroup;
|
||||||
|
+ g_autofree char *app_id = NULL;
|
||||||
|
|
||||||
|
cgroup = g_new0 (MetaCGroup, 1);
|
||||||
|
cgroup->path = g_file_new_for_path (path);
|
||||||
|
g_ref_count_init (&cgroup->ref_count);
|
||||||
|
|
||||||
|
+ app_id = extract_app_id_from_cgroup (path);
|
||||||
|
+
|
||||||
|
+ if (app_id)
|
||||||
|
+ {
|
||||||
|
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||||
|
+
|
||||||
|
+ app_info = g_desktop_app_info_new (app_id);
|
||||||
|
+
|
||||||
|
+ if (app_info)
|
||||||
|
+ cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return cgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaCGroup*
|
||||||
|
meta_cgroup_ref (MetaCGroup *cgroup)
|
||||||
|
{
|
||||||
|
g_ref_count_inc (&cgroup->ref_count);
|
||||||
|
return cgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_cgroup_unref (MetaCGroup *cgroup)
|
||||||
|
{
|
||||||
|
if (!g_ref_count_dec (&cgroup->ref_count))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
+ g_clear_object (&cgroup->app_info);
|
||||||
|
g_clear_object (&cgroup->path);
|
||||||
|
g_free (cgroup);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||||
|
MetaWorkspace *workspace,
|
||||||
|
guint32 timestamp)
|
||||||
|
{
|
||||||
|
if (!cgroup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!XSERVER_TIME_IS_BEFORE (cgroup->user_time, timestamp))
|
||||||
|
return;
|
||||||
|
|
||||||
|
cgroup->user_time = timestamp;
|
||||||
|
|
||||||
|
if (cgroup->last_active_workspace)
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (cgroup->last_active_workspace),
|
||||||
|
(gpointer *) &cgroup->last_active_workspace);
|
||||||
|
|
||||||
|
cgroup->last_active_workspace = workspace;
|
||||||
|
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (workspace),
|
||||||
|
(gpointer *) &cgroup->last_active_workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
diff --git a/src/core/window.c b/src/core/window.c
|
||||||
|
index 5c7b2e8cf..d36e45992 100644
|
||||||
|
--- a/src/core/window.c
|
||||||
|
+++ b/src/core/window.c
|
||||||
|
@@ -74,60 +74,62 @@
|
||||||
|
#include "core/frame.h"
|
||||||
|
#include "core/keybindings-private.h"
|
||||||
|
#include "core/meta-workspace-manager-private.h"
|
||||||
|
#include "core/place.h"
|
||||||
|
#include "core/stack.h"
|
||||||
|
#include "core/util-private.h"
|
||||||
|
#include "core/workspace-private.h"
|
||||||
|
#include "meta/compositor-mutter.h"
|
||||||
|
#include "meta/group.h"
|
||||||
|
#include "meta/meta-cursor-tracker.h"
|
||||||
|
#include "meta/meta-enum-types.h"
|
||||||
|
#include "meta/meta-x11-errors.h"
|
||||||
|
#include "meta/prefs.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
#include "x11/meta-x11-display-private.h"
|
||||||
|
#include "x11/window-props.h"
|
||||||
|
#include "x11/window-x11.h"
|
||||||
|
#include "x11/xprops.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND
|
||||||
|
#include "wayland/meta-wayland-private.h"
|
||||||
|
#include "wayland/meta-wayland-surface.h"
|
||||||
|
#include "wayland/meta-window-wayland.h"
|
||||||
|
#include "wayland/meta-window-xwayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSYSTEMD
|
||||||
|
#include <systemd/sd-login.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#include <gio/gdesktopappinfo.h>
|
||||||
|
+
|
||||||
|
|
||||||
|
/* Windows that unmaximize to a size bigger than that fraction of the workarea
|
||||||
|
* will be scaled down to that size (while maintaining aspect ratio).
|
||||||
|
* Windows that cover an area greater then this size are automaximized on map.
|
||||||
|
*/
|
||||||
|
#define MAX_UNMAXIMIZED_WINDOW_AREA .8
|
||||||
|
|
||||||
|
#define SNAP_SECURITY_LABEL_PREFIX "snap."
|
||||||
|
|
||||||
|
static int destroying_windows_disallowed = 0;
|
||||||
|
|
||||||
|
/* Each window has a "stamp" which is a non-recycled 64-bit ID. They
|
||||||
|
* start after the end of the XID space so that, for stacking
|
||||||
|
* we can keep a guint64 that represents one or the other
|
||||||
|
*/
|
||||||
|
static guint64 next_window_stamp = G_GUINT64_CONSTANT(0x100000000);
|
||||||
|
|
||||||
|
static void invalidate_work_areas (MetaWindow *window);
|
||||||
|
static void set_wm_state (MetaWindow *window);
|
||||||
|
static void set_net_wm_state (MetaWindow *window);
|
||||||
|
static void meta_window_set_above (MetaWindow *window,
|
||||||
|
gboolean new_value);
|
||||||
|
|
||||||
|
static void meta_window_show (MetaWindow *window);
|
||||||
|
static void meta_window_hide (MetaWindow *window);
|
||||||
|
|
||||||
|
static void meta_window_save_rect (MetaWindow *window);
|
||||||
|
|
||||||
|
static void ensure_mru_position_after (MetaWindow *window,
|
||||||
|
MetaWindow *after_this_one);
|
||||||
|
@@ -1317,61 +1319,63 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||||
|
|
||||||
|
/* override-redirect windows are subtly different from other windows
|
||||||
|
* with window->on_all_workspaces == TRUE. Other windows are part of
|
||||||
|
* some workspace (so they can return to that if the flag is turned off),
|
||||||
|
* but appear on other workspaces. override-redirect windows are part
|
||||||
|
* of no workspace.
|
||||||
|
*/
|
||||||
|
if (!window->override_redirect && window->workspace == NULL)
|
||||||
|
{
|
||||||
|
meta_window_read_cgroup (window);
|
||||||
|
if (window->transient_for != NULL)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on same workspace as parent %s",
|
||||||
|
window->desc, window->transient_for->desc);
|
||||||
|
|
||||||
|
g_warn_if_fail (!window->transient_for->override_redirect);
|
||||||
|
set_workspace_state (window,
|
||||||
|
window->transient_for->on_all_workspaces,
|
||||||
|
window->transient_for->workspace);
|
||||||
|
}
|
||||||
|
else if (window->on_all_workspaces)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on all workspaces",
|
||||||
|
window->desc);
|
||||||
|
|
||||||
|
set_workspace_state (window, TRUE, NULL);
|
||||||
|
}
|
||||||
|
else if (window->cgroup && window->cgroup->last_active_workspace != NULL &&
|
||||||
|
- !window->cgroup->has_startup_sequence)
|
||||||
|
+ !window->cgroup->has_startup_sequence &&
|
||||||
|
+ (!window->cgroup->app_info ||
|
||||||
|
+ !g_desktop_app_info_get_boolean (G_DESKTOP_APP_INFO (window->cgroup->app_info), "StartupNotify")))
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on active workspace",
|
||||||
|
window->desc);
|
||||||
|
set_workspace_state (window, FALSE, window->cgroup->last_active_workspace);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_PLACEMENT,
|
||||||
|
"Putting window %s on active workspace",
|
||||||
|
window->desc);
|
||||||
|
|
||||||
|
set_workspace_state (window, FALSE, workspace_manager->active_workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_window_update_struts (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_window_main_monitor_changed (window, NULL);
|
||||||
|
|
||||||
|
/* Must add window to stack before doing move/resize, since the
|
||||||
|
* window might have fullscreen size (i.e. should have been
|
||||||
|
* fullscreen'd; acrobat is one such braindead case; it withdraws
|
||||||
|
* and remaps its window whenever trying to become fullscreen...)
|
||||||
|
* and thus constraints may try to auto-fullscreen it which also
|
||||||
|
* means restacking it.
|
||||||
|
*/
|
||||||
|
if (meta_window_is_stackable (window))
|
||||||
|
meta_stack_add (window->display->stack,
|
||||||
|
window);
|
||||||
|
@@ -3751,61 +3755,63 @@ meta_window_activate_full (MetaWindow *window,
|
||||||
|
* timestamp as the last user interaction
|
||||||
|
*/
|
||||||
|
allow_workspace_switch = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timestamp != 0 &&
|
||||||
|
XSERVER_TIME_IS_BEFORE (timestamp, window->display->last_user_time))
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"last_user_time (%u) is more recent; ignoring "
|
||||||
|
" _NET_ACTIVE_WINDOW message.",
|
||||||
|
window->display->last_user_time);
|
||||||
|
meta_window_set_demands_attention(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timestamp == 0)
|
||||||
|
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||||
|
|
||||||
|
meta_window_set_user_time (window, timestamp);
|
||||||
|
|
||||||
|
/* disable show desktop mode unless we're a desktop component */
|
||||||
|
maybe_leave_show_desktop_mode (window);
|
||||||
|
|
||||||
|
/* Get window on last active, current, or given workspace */
|
||||||
|
if (workspace == NULL)
|
||||||
|
{
|
||||||
|
meta_window_read_cgroup (window);
|
||||||
|
if (window->cgroup &&
|
||||||
|
window->cgroup->last_active_workspace != NULL &&
|
||||||
|
- !window->cgroup->has_startup_sequence)
|
||||||
|
+ !window->cgroup->has_startup_sequence &&
|
||||||
|
+ (!window->cgroup->app_info ||
|
||||||
|
+ !g_desktop_app_info_get_boolean (G_DESKTOP_APP_INFO (window->cgroup->app_info), "StartupNotify")))
|
||||||
|
workspace = window->cgroup->last_active_workspace;
|
||||||
|
else
|
||||||
|
workspace = workspace_manager->active_workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For non-transient windows, we just set up a pulsing indicator,
|
||||||
|
rather than move windows or workspaces.
|
||||||
|
See http://bugzilla.gnome.org/show_bug.cgi?id=482354 */
|
||||||
|
if (window->transient_for == NULL &&
|
||||||
|
!allow_workspace_switch &&
|
||||||
|
!meta_window_located_on_workspace (window, workspace))
|
||||||
|
{
|
||||||
|
meta_window_set_demands_attention (window);
|
||||||
|
/* We've marked it as demanding, don't need to do anything else. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (window->transient_for != NULL)
|
||||||
|
{
|
||||||
|
/* Move transients to current workspace - preference dialogs should appear over
|
||||||
|
the source window. */
|
||||||
|
meta_window_change_workspace (window, workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->shaded)
|
||||||
|
meta_window_unshade (window, timestamp);
|
||||||
|
|
||||||
|
unminimize_window_and_all_transient_parents (window);
|
||||||
|
|
||||||
|
if (meta_prefs_get_raise_on_click () ||
|
||||||
|
source_indication == META_CLIENT_TYPE_PAGER)
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From f5ae26bb44c42369cbcf0a9b7da049222b5ecbf8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||||
|
Date: Fri, 10 Dec 2021 10:57:29 +0100
|
||||||
|
Subject: [PATCH 5/5] cursor-renderer/native: Add a means to disable HW cursors
|
||||||
|
|
||||||
|
When dealing with a faulty hardware or bugs in the driver, it might be
|
||||||
|
interesting to force the use of software cursors for debugging purposes.
|
||||||
|
|
||||||
|
Add a debug environment variable MUTTER_DEBUG_DISABLE_HW_CURSORS to
|
||||||
|
disable hardware cursors and force using software cursors.
|
||||||
|
|
||||||
|
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2046
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2150>
|
||||||
|
(cherry picked from commit 56939abd2f1691eea9edf85cb715ebf275944e7e)
|
||||||
|
---
|
||||||
|
src/backends/native/meta-cursor-renderer-native.c | 5 ++++-
|
||||||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
index fcfe8eb98..237f9a3d5 100644
|
||||||
|
--- a/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
@@ -1828,7 +1828,10 @@ meta_cursor_renderer_native_new (MetaBackend *backend,
|
||||||
|
|
||||||
|
priv->backend = backend;
|
||||||
|
|
||||||
|
- init_hw_cursor_support (cursor_renderer_native);
|
||||||
|
+ if (g_strcmp0 (getenv ("MUTTER_DEBUG_DISABLE_HW_CURSORS"), "1"))
|
||||||
|
+ init_hw_cursor_support (cursor_renderer_native);
|
||||||
|
+ else
|
||||||
|
+ g_message ("Disabling hardware cursors because MUTTER_DEBUG_DISABLE_HW_CURSORS is set");
|
||||||
|
|
||||||
|
return cursor_renderer_native;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,370 @@
|
|||||||
|
From 63c529fc5a8db1a82fd6b988aa44e3e6a1e417bf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nishal Kulkarni <nishalkulkarni@gmail.com>
|
||||||
|
Date: Thu, 5 Aug 2021 19:37:28 +0530
|
||||||
|
Subject: [PATCH 6/6] meson: Add optional libsystemd dependency
|
||||||
|
|
||||||
|
To utilize the API provided by libsystemd it would be better to
|
||||||
|
create a separate HAVE_LIBSYSTEMD configuration option instead of
|
||||||
|
having to rely on HAVE_NATIVE_BACKEND.
|
||||||
|
|
||||||
|
For now this will be utilized for getting the control group of a
|
||||||
|
MetaWindow.
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1960>
|
||||||
|
---
|
||||||
|
config.h.meson | 3 +++
|
||||||
|
meson.build | 5 ++++-
|
||||||
|
meson_options.txt | 6 ++++++
|
||||||
|
src/meson.build | 6 ++++++
|
||||||
|
4 files changed, 19 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/config.h.meson b/config.h.meson
|
||||||
|
index 26e13b9ca..b7ca736df 100644
|
||||||
|
--- a/config.h.meson
|
||||||
|
+++ b/config.h.meson
|
||||||
|
@@ -7,60 +7,63 @@
|
||||||
|
/* Version number of package */
|
||||||
|
#mesondefine PACKAGE_VERSION
|
||||||
|
|
||||||
|
/* Search path for plugins */
|
||||||
|
#mesondefine MUTTER_PLUGIN_DIR
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#mesondefine MUTTER_LOCALEDIR
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#mesondefine MUTTER_LIBEXECDIR
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#mesondefine MUTTER_PKGDATADIR
|
||||||
|
|
||||||
|
/* Defined if EGL support is enabled */
|
||||||
|
#mesondefine HAVE_EGL
|
||||||
|
|
||||||
|
/* Defined if EGLDevice support is enabled */
|
||||||
|
#mesondefine HAVE_EGL_DEVICE
|
||||||
|
|
||||||
|
/* Defined if EGLStream support is enabled */
|
||||||
|
#mesondefine HAVE_WAYLAND_EGLSTREAM
|
||||||
|
|
||||||
|
/* Building with gudev for device type detection */
|
||||||
|
#mesondefine HAVE_LIBGUDEV
|
||||||
|
|
||||||
|
/* Building with libwacom for advanced tablet management */
|
||||||
|
#mesondefine HAVE_LIBWACOM
|
||||||
|
|
||||||
|
+/* Building with libsystemd */
|
||||||
|
+#mesondefine HAVE_LIBSYSTEMD
|
||||||
|
+
|
||||||
|
/* Define if you want to enable the native (KMS) backend based on systemd */
|
||||||
|
#mesondefine HAVE_NATIVE_BACKEND
|
||||||
|
|
||||||
|
/* Define if you want to enable Wayland support */
|
||||||
|
#mesondefine HAVE_WAYLAND
|
||||||
|
|
||||||
|
/* Defined if screen cast and remote desktop support is enabled */
|
||||||
|
#mesondefine HAVE_REMOTE_DESKTOP
|
||||||
|
|
||||||
|
/* Building with SM support */
|
||||||
|
#mesondefine HAVE_SM
|
||||||
|
|
||||||
|
/* Building with startup notification support */
|
||||||
|
#mesondefine HAVE_STARTUP_NOTIFICATION
|
||||||
|
|
||||||
|
/* Building with Sysprof profiling support */
|
||||||
|
#mesondefine HAVE_PROFILER
|
||||||
|
|
||||||
|
/* Path to Xwayland executable */
|
||||||
|
#mesondefine XWAYLAND_PATH
|
||||||
|
|
||||||
|
/* Xwayland applications allowed to issue keyboard grabs */
|
||||||
|
#mesondefine XWAYLAND_GRAB_DEFAULT_ACCESS_RULES
|
||||||
|
|
||||||
|
/* XKB base prefix */
|
||||||
|
#mesondefine XKB_BASE
|
||||||
|
|
||||||
|
/* Whether <sys/prctl.h> exists and it defines prctl() */
|
||||||
|
#mesondefine HAVE_SYS_PRCTL
|
||||||
|
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index 39ad5bcd1..613aa6779 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -161,67 +161,69 @@ if have_gles2
|
||||||
|
if not have_egl
|
||||||
|
error('GLESv2 support requires EGL to be enabled')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
have_wayland = get_option('wayland')
|
||||||
|
if have_wayland
|
||||||
|
wayland_server_dep = dependency('wayland-server', version: wayland_server_req)
|
||||||
|
wayland_client_dep = dependency('wayland-client', version: wayland_server_req)
|
||||||
|
wayland_protocols_dep = dependency('wayland-protocols',
|
||||||
|
version: wayland_protocols_req)
|
||||||
|
wayland_egl_dep = dependency('wayland-egl')
|
||||||
|
|
||||||
|
if not have_egl
|
||||||
|
error('Wayland support requires EGL to be enabled')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
have_libgudev = get_option('udev')
|
||||||
|
if have_libgudev
|
||||||
|
libudev_dep = dependency('libudev', version: udev_req)
|
||||||
|
gudev_dep = dependency('gudev-1.0', version: gudev_req)
|
||||||
|
udev_dep = dependency('udev')
|
||||||
|
|
||||||
|
udev_dir = get_option('udev_dir')
|
||||||
|
if udev_dir == ''
|
||||||
|
udev_dir = udev_dep.get_pkgconfig_variable('udevdir')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
+have_libsystemd = get_option('systemd')
|
||||||
|
+libsystemd_dep = dependency('libsystemd', required: have_libsystemd)
|
||||||
|
+
|
||||||
|
have_native_backend = get_option('native_backend')
|
||||||
|
if have_native_backend
|
||||||
|
libdrm_dep = dependency('libdrm')
|
||||||
|
libgbm_dep = dependency('gbm', version: gbm_req)
|
||||||
|
libinput_dep = dependency('libinput', version: libinput_req)
|
||||||
|
|
||||||
|
- libsystemd_dep = dependency('libsystemd', required: false)
|
||||||
|
if libsystemd_dep.found()
|
||||||
|
logind_provider_dep = libsystemd_dep
|
||||||
|
else
|
||||||
|
logind_provider_dep = dependency('libelogind')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not have_egl
|
||||||
|
error('The native backend requires EGL to be enabled')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not have_gles2
|
||||||
|
error('The native backend requires GLESv2 to be enabled')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if not have_libgudev
|
||||||
|
error('The native backend requires udev to be enabled')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
have_egl_device = get_option('egl_device')
|
||||||
|
|
||||||
|
have_wayland_eglstream = get_option('wayland_eglstream')
|
||||||
|
if have_wayland_eglstream
|
||||||
|
wayland_eglstream_protocols_dep = dependency('wayland-eglstream-protocols')
|
||||||
|
dl_dep = cc.find_library('dl', required: true)
|
||||||
|
|
||||||
|
if not have_wayland
|
||||||
|
error('Wayland EGLStream support requires Wayland to be enabled')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
@@ -359,60 +361,61 @@ if buildtype != 'plain'
|
||||||
|
'-Werror=array-bounds',
|
||||||
|
'-Werror=write-strings',
|
||||||
|
'-Werror=address',
|
||||||
|
'-Werror=int-to-pointer-cast',
|
||||||
|
'-Werror=pointer-to-int-cast',
|
||||||
|
'-Werror=empty-body',
|
||||||
|
'-Werror=write-strings',
|
||||||
|
]
|
||||||
|
supported_warnings = cc.get_supported_arguments(all_warnings)
|
||||||
|
add_project_arguments(supported_warnings, language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('debug')
|
||||||
|
debug_c_args = [
|
||||||
|
'-DG_ENABLE_DEBUG',
|
||||||
|
'-fno-omit-frame-pointer'
|
||||||
|
]
|
||||||
|
supported_debug_c_args = cc.get_supported_arguments(debug_c_args)
|
||||||
|
add_project_arguments(supported_debug_c_args, language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
cc.compiles('void main (void) { __builtin_ffsl (0); __builtin_popcountl (0); }')
|
||||||
|
|
||||||
|
cdata = configuration_data()
|
||||||
|
cdata.set_quoted('GETTEXT_PACKAGE', gettext_package)
|
||||||
|
cdata.set_quoted('VERSION', meson.project_version())
|
||||||
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||||
|
|
||||||
|
cdata.set('HAVE_EGL', have_egl)
|
||||||
|
cdata.set('HAVE_WAYLAND', have_wayland)
|
||||||
|
+cdata.set('HAVE_LIBSYSTEMD', have_libsystemd)
|
||||||
|
cdata.set('HAVE_NATIVE_BACKEND', have_native_backend)
|
||||||
|
cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop)
|
||||||
|
cdata.set('HAVE_EGL_DEVICE', have_egl_device)
|
||||||
|
cdata.set('HAVE_WAYLAND_EGLSTREAM', have_wayland_eglstream)
|
||||||
|
cdata.set('HAVE_LIBGUDEV', have_libgudev)
|
||||||
|
cdata.set('HAVE_LIBWACOM', have_libwacom)
|
||||||
|
cdata.set('HAVE_SM', have_sm)
|
||||||
|
cdata.set('HAVE_STARTUP_NOTIFICATION', have_startup_notification)
|
||||||
|
cdata.set('HAVE_INTROSPECTION', have_introspection)
|
||||||
|
cdata.set('HAVE_PROFILER', have_profiler)
|
||||||
|
|
||||||
|
xkb_base = xkeyboard_config_dep.get_pkgconfig_variable('xkb_base')
|
||||||
|
cdata.set_quoted('XKB_BASE', xkb_base)
|
||||||
|
|
||||||
|
if cc.has_header_symbol('sys/prctl.h', 'prctl')
|
||||||
|
cdata.set('HAVE_SYS_PRCTL', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
have_xwayland_initfd = false
|
||||||
|
have_xwayland_listenfd = false
|
||||||
|
if have_wayland
|
||||||
|
xwayland_dep = dependency('xwayland', required: false)
|
||||||
|
|
||||||
|
xwayland_path = get_option('xwayland_path')
|
||||||
|
if xwayland_path == ''
|
||||||
|
if xwayland_dep.found()
|
||||||
|
xwayland_path = xwayland_dep.get_pkgconfig_variable('xwayland')
|
||||||
|
else
|
||||||
|
xwayland_path = find_program('Xwayland').path()
|
||||||
|
endif
|
||||||
|
diff --git a/meson_options.txt b/meson_options.txt
|
||||||
|
index 61d9cb48d..6609e4332 100644
|
||||||
|
--- a/meson_options.txt
|
||||||
|
+++ b/meson_options.txt
|
||||||
|
@@ -12,60 +12,66 @@ option('opengl_libname',
|
||||||
|
|
||||||
|
option('gles2_libname',
|
||||||
|
type: 'string',
|
||||||
|
value: 'libGLESv2.so.2',
|
||||||
|
description: 'GLESv2 library file name'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('gles2',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable GLES2 support'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('egl',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable EGL support'
|
||||||
|
)
|
||||||
|
option('glx',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable GLX support'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('wayland',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable Wayland support'
|
||||||
|
)
|
||||||
|
|
||||||
|
+option('systemd',
|
||||||
|
+ type: 'boolean',
|
||||||
|
+ value: true,
|
||||||
|
+ description: 'Enable systemd support'
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
option('native_backend',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable the native backend'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('remote_desktop',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable remote desktop and screen cast support'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('egl_device',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false,
|
||||||
|
description: 'Enable EGLDevice and EGLStream renderer support'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('wayland_eglstream',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false,
|
||||||
|
description: 'Enable Wayland EGLStream support client support'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('udev',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Enable udev support when using the X11 backend'
|
||||||
|
)
|
||||||
|
|
||||||
|
diff --git a/src/meson.build b/src/meson.build
|
||||||
|
index 47633498e..9ac6afa1a 100644
|
||||||
|
--- a/src/meson.build
|
||||||
|
+++ b/src/meson.build
|
||||||
|
@@ -91,60 +91,66 @@ if have_x11
|
||||||
|
xinerama_dep,
|
||||||
|
xext_dep,
|
||||||
|
ice_dep,
|
||||||
|
xcomposite_dep,
|
||||||
|
xcursor_dep,
|
||||||
|
xdamage_dep,
|
||||||
|
xkbfile_dep,
|
||||||
|
xkeyboard_config_dep,
|
||||||
|
xkbcommon_x11_dep,
|
||||||
|
xrender_dep,
|
||||||
|
x11_xcb_dep,
|
||||||
|
xcb_randr_dep,
|
||||||
|
xcb_res_dep,
|
||||||
|
xau_dep,
|
||||||
|
xtst_dep,
|
||||||
|
]
|
||||||
|
|
||||||
|
if have_sm
|
||||||
|
mutter_pkg_private_deps += [
|
||||||
|
sm_dep,
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if have_wayland
|
||||||
|
mutter_pkg_deps += [
|
||||||
|
wayland_server_dep,
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
|
+if have_libsystemd
|
||||||
|
+ mutter_pkg_private_deps += [
|
||||||
|
+ libsystemd_dep,
|
||||||
|
+ ]
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
if have_native_backend
|
||||||
|
mutter_pkg_private_deps += [
|
||||||
|
libdrm_dep,
|
||||||
|
libinput_dep,
|
||||||
|
gudev_dep,
|
||||||
|
libgbm_dep,
|
||||||
|
logind_provider_dep,
|
||||||
|
libudev_dep,
|
||||||
|
xkbcommon_dep,
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if have_wayland_eglstream
|
||||||
|
mutter_lib_deps += [
|
||||||
|
dl_dep,
|
||||||
|
]
|
||||||
|
mutter_pkg_private_deps += [
|
||||||
|
wayland_eglstream_protocols_dep,
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
|
mutter_deps = [
|
||||||
|
mutter_pkg_deps,
|
||||||
|
mutter_pkg_private_deps,
|
||||||
|
mutter_lib_deps,
|
||||||
|
]
|
||||||
|
|
||||||
|
mutter_c_args = [
|
||||||
|
'-DCLUTTER_ENABLE_COMPOSITOR_API',
|
||||||
|
'-DCOGL_ENABLE_EXPERIMENTAL_API',
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
@ -0,0 +1,213 @@
|
|||||||
|
From d89c71ed2bdb18e9b01891d6b999c44f955778dc Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
||||||
|
Date: Wed, 1 Sep 2021 21:12:03 +0200
|
||||||
|
Subject: [PATCH 1/2] context: Add :unsafe-mode property
|
||||||
|
|
||||||
|
We are going to restrict several sensitive D-Bus APIs to a set
|
||||||
|
of allowed callers (like Settings or portal implementations).
|
||||||
|
|
||||||
|
Add an :unsafe-mode property to the context to allow turning off
|
||||||
|
those restrictions temporarily, in order to not get in the way
|
||||||
|
of development/debugging.
|
||||||
|
|
||||||
|
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1983>
|
||||||
|
---
|
||||||
|
src/backends/meta-backend-private.h | 4 ++
|
||||||
|
src/backends/meta-backend.c | 83 +++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 87 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h
|
||||||
|
index b930462b2..583d4e151 100644
|
||||||
|
--- a/src/backends/meta-backend-private.h
|
||||||
|
+++ b/src/backends/meta-backend-private.h
|
||||||
|
@@ -133,6 +133,10 @@ void meta_backend_foreach_device_monitor (MetaBackend *backend,
|
||||||
|
GFunc func,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
+gboolean meta_backend_get_unsafe_mode (MetaBackend *backend);
|
||||||
|
+void meta_backend_set_unsafe_mode (MetaBackend *backend,
|
||||||
|
+ gboolean enable);
|
||||||
|
+
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
|
||||||
|
MetaOrientationManager * meta_backend_get_orientation_manager (MetaBackend *backend);
|
||||||
|
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
|
||||||
|
index ff84bfe6a..18bee2484 100644
|
||||||
|
--- a/src/backends/meta-backend.c
|
||||||
|
+++ b/src/backends/meta-backend.c
|
||||||
|
@@ -88,6 +88,17 @@
|
||||||
|
#include "wayland/meta-wayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+enum
|
||||||
|
+{
|
||||||
|
+ PROP_0,
|
||||||
|
+
|
||||||
|
+ PROP_UNSAFE_MODE,
|
||||||
|
+
|
||||||
|
+ N_PROPS
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static GParamSpec *obj_props[N_PROPS];
|
||||||
|
+
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
KEYMAP_CHANGED,
|
||||||
|
@@ -158,6 +169,8 @@ struct _MetaBackendPrivate
|
||||||
|
|
||||||
|
gboolean is_pointer_position_initialized;
|
||||||
|
|
||||||
|
+ gboolean unsafe_mode;
|
||||||
|
+
|
||||||
|
guint device_update_idle_id;
|
||||||
|
|
||||||
|
GHashTable *device_monitors;
|
||||||
|
@@ -814,6 +827,64 @@ upower_vanished (GDBusConnection *connection,
|
||||||
|
g_clear_object (&priv->upower_proxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
+gboolean
|
||||||
|
+meta_backend_get_unsafe_mode (MetaBackend *backend)
|
||||||
|
+{
|
||||||
|
+ MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||||
|
+
|
||||||
|
+ return priv->unsafe_mode;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+meta_backend_set_unsafe_mode (MetaBackend *backend,
|
||||||
|
+ gboolean enable)
|
||||||
|
+{
|
||||||
|
+ MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||||
|
+
|
||||||
|
+ if (priv->unsafe_mode == enable)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ priv->unsafe_mode = enable;
|
||||||
|
+ g_object_notify_by_pspec (G_OBJECT (backend), obj_props[PROP_UNSAFE_MODE]);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+meta_backend_get_property (GObject *object,
|
||||||
|
+ guint prop_id,
|
||||||
|
+ GValue *value,
|
||||||
|
+ GParamSpec *pspec)
|
||||||
|
+{
|
||||||
|
+ MetaBackend *backend = META_BACKEND (object);
|
||||||
|
+ MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||||
|
+
|
||||||
|
+ switch (prop_id)
|
||||||
|
+ {
|
||||||
|
+ case PROP_UNSAFE_MODE:
|
||||||
|
+ g_value_set_boolean (value, priv->unsafe_mode);
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+meta_backend_set_property (GObject *object,
|
||||||
|
+ guint prop_id,
|
||||||
|
+ const GValue *value,
|
||||||
|
+ GParamSpec *pspec)
|
||||||
|
+{
|
||||||
|
+ MetaBackend *backend = META_BACKEND (object);
|
||||||
|
+
|
||||||
|
+ switch (prop_id)
|
||||||
|
+ {
|
||||||
|
+ case PROP_UNSAFE_MODE:
|
||||||
|
+ meta_backend_set_unsafe_mode (backend, g_value_get_boolean (value));
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
meta_backend_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
@@ -851,6 +922,8 @@ meta_backend_class_init (MetaBackendClass *klass)
|
||||||
|
|
||||||
|
object_class->dispose = meta_backend_dispose;
|
||||||
|
object_class->constructed = meta_backend_constructed;
|
||||||
|
+ object_class->get_property = meta_backend_get_property;
|
||||||
|
+ object_class->set_property = meta_backend_set_property;
|
||||||
|
|
||||||
|
klass->post_init = meta_backend_real_post_init;
|
||||||
|
klass->grab_device = meta_backend_real_grab_device;
|
||||||
|
@@ -907,6 +980,16 @@ meta_backend_class_init (MetaBackendClass *klass)
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
+ obj_props[PROP_UNSAFE_MODE] =
|
||||||
|
+ g_param_spec_boolean ("unsafe-mode",
|
||||||
|
+ "unsafe mode",
|
||||||
|
+ "Unsafe mode",
|
||||||
|
+ FALSE,
|
||||||
|
+ G_PARAM_READWRITE |
|
||||||
|
+ G_PARAM_EXPLICIT_NOTIFY |
|
||||||
|
+ G_PARAM_STATIC_STRINGS);
|
||||||
|
+ g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||||
|
+
|
||||||
|
mutter_stage_views = g_getenv ("MUTTER_STAGE_VIEWS");
|
||||||
|
stage_views_disabled = g_strcmp0 (mutter_stage_views, "0") == 0;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
||||||
|
|
||||||
|
From dc69aa57be79fa7f371788c852f6e23cf0d261cb Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
||||||
|
Date: Thu, 2 Sep 2021 18:41:16 +0200
|
||||||
|
Subject: [PATCH 2/2] context: Add (hidden) --unsafe-mode option
|
||||||
|
|
||||||
|
When running gnome-shell, it is possible to toggle unsafe-mode in
|
||||||
|
looking glass. We'll eventually start using the property in mutter
|
||||||
|
as well, so to make stand-alone debugging easier, also expose it
|
||||||
|
as a hidden command line option.
|
||||||
|
|
||||||
|
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
|
||||||
|
|
||||||
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1983>
|
||||||
|
---
|
||||||
|
src/core/main.c | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/main.c b/src/core/main.c
|
||||||
|
index 0d241f952..991d583a0 100644
|
||||||
|
--- a/src/core/main.c
|
||||||
|
+++ b/src/core/main.c
|
||||||
|
@@ -218,6 +218,7 @@ static char *opt_wayland_display;
|
||||||
|
static gboolean opt_display_server;
|
||||||
|
static gboolean opt_headless;
|
||||||
|
#endif
|
||||||
|
+static gboolean opt_unsafe_mode;
|
||||||
|
static gboolean opt_x11;
|
||||||
|
|
||||||
|
#ifdef HAVE_NATIVE_BACKEND
|
||||||
|
@@ -306,6 +307,11 @@ static GOptionEntry meta_options[] = {
|
||||||
|
N_("Add persistent virtual monitor (WxH or WxH@R)")
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
+ {
|
||||||
|
+ "unsafe-mode", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE,
|
||||||
|
+ &opt_unsafe_mode,
|
||||||
|
+ "Run in unsafe mode"
|
||||||
|
+ },
|
||||||
|
{
|
||||||
|
"x11", 0, 0, G_OPTION_ARG_NONE,
|
||||||
|
&opt_x11,
|
||||||
|
@@ -865,6 +871,7 @@ meta_init (void)
|
||||||
|
add_persistent_virtual_monitors ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ meta_backend_set_unsafe_mode (meta_get_backend(), opt_unsafe_mode);
|
||||||
|
meta_set_syncing (opt_sync || (g_getenv ("MUTTER_SYNC") != NULL));
|
||||||
|
|
||||||
|
if (opt_replace_wm)
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -0,0 +1,324 @@
|
|||||||
|
From d3d8ab8eabc3178f3c31ee71dcc926297ff1c1b0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 8 Feb 2022 17:14:06 +0100
|
||||||
|
Subject: [PATCH 1/2] shaped-texture: Pass along the snippet to the texture
|
||||||
|
tower
|
||||||
|
|
||||||
|
The snippet is used make sure the right source is sampled in the shader.
|
||||||
|
This wasn't done in the texture tower, meaning the textures from the
|
||||||
|
tower were not correct.
|
||||||
|
|
||||||
|
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
|
||||||
|
---
|
||||||
|
src/compositor/meta-shaped-texture.c | 2 ++
|
||||||
|
src/compositor/meta-texture-tower.c | 27 +++++++++++++++++++++++++++
|
||||||
|
src/compositor/meta-texture-tower.h | 3 +++
|
||||||
|
3 files changed, 32 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
|
||||||
|
index 095dd246f0c0..68919c5f1c5c 100644
|
||||||
|
--- a/src/compositor/meta-shaped-texture.c
|
||||||
|
+++ b/src/compositor/meta-shaped-texture.c
|
||||||
|
@@ -1242,6 +1242,8 @@ meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
|
||||||
|
g_clear_pointer (&stex->snippet, cogl_object_unref);
|
||||||
|
if (snippet)
|
||||||
|
stex->snippet = cogl_object_ref (snippet);
|
||||||
|
+
|
||||||
|
+ meta_texture_tower_set_snippet (stex->paint_tower, snippet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c
|
||||||
|
index 1fc4623e5e54..0ae717abe4d4 100644
|
||||||
|
--- a/src/compositor/meta-texture-tower.c
|
||||||
|
+++ b/src/compositor/meta-texture-tower.c
|
||||||
|
@@ -62,6 +62,7 @@ struct _MetaTextureTower
|
||||||
|
CoglOffscreen *fbos[MAX_TEXTURE_LEVELS];
|
||||||
|
Box invalid[MAX_TEXTURE_LEVELS];
|
||||||
|
CoglPipeline *pipeline_template;
|
||||||
|
+ CoglSnippet *snippet;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -97,6 +98,7 @@ meta_texture_tower_free (MetaTextureTower *tower)
|
||||||
|
cogl_object_unref (tower->pipeline_template);
|
||||||
|
|
||||||
|
meta_texture_tower_set_base_texture (tower, NULL);
|
||||||
|
+ cogl_clear_object (&tower->snippet);
|
||||||
|
|
||||||
|
g_free (tower);
|
||||||
|
}
|
||||||
|
@@ -216,6 +218,28 @@ meta_texture_tower_update_area (MetaTextureTower *tower,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+meta_texture_tower_set_snippet (MetaTextureTower *tower,
|
||||||
|
+ CoglSnippet *snippet)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (tower->snippet == snippet)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ g_clear_pointer (&tower->snippet, cogl_object_unref);
|
||||||
|
+
|
||||||
|
+ if (snippet)
|
||||||
|
+ tower->snippet = cogl_object_ref (snippet);
|
||||||
|
+
|
||||||
|
+ for (i = 1; i < tower->n_levels; i++)
|
||||||
|
+ {
|
||||||
|
+ cogl_clear_object (&tower->textures[i]);
|
||||||
|
+ g_clear_object (&tower->fbos[i]);
|
||||||
|
+ }
|
||||||
|
+ cogl_clear_object (&tower->pipeline_template);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* It generally looks worse if we scale up a window texture by even a
|
||||||
|
* small amount than if we scale it down using bilinear filtering, so
|
||||||
|
* we always pick the *larger* adjacent level. */
|
||||||
|
@@ -408,6 +432,9 @@ texture_tower_revalidate (MetaTextureTower *tower,
|
||||||
|
pipeline = cogl_pipeline_copy (tower->pipeline_template);
|
||||||
|
cogl_pipeline_set_layer_texture (pipeline, 0, tower->textures[level - 1]);
|
||||||
|
|
||||||
|
+ if (tower->snippet && level == 1)
|
||||||
|
+ cogl_pipeline_add_layer_snippet (pipeline, 0, tower->snippet);
|
||||||
|
+
|
||||||
|
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
|
||||||
|
invalid->x1, invalid->y1,
|
||||||
|
invalid->x2, invalid->y2,
|
||||||
|
diff --git a/src/compositor/meta-texture-tower.h b/src/compositor/meta-texture-tower.h
|
||||||
|
index 1f5b371467c9..5522dfbb16ac 100644
|
||||||
|
--- a/src/compositor/meta-texture-tower.h
|
||||||
|
+++ b/src/compositor/meta-texture-tower.h
|
||||||
|
@@ -63,6 +63,9 @@ void meta_texture_tower_update_area (MetaTextureTower *tower,
|
||||||
|
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower,
|
||||||
|
ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
|
+void meta_texture_tower_set_snippet (MetaTextureTower *tower,
|
||||||
|
+ CoglSnippet *snippet);
|
||||||
|
+
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __META_TEXTURE_TOWER_H__ */
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
||||||
|
From b78a24dfebf56b04538058ff731890ee997d0d10 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Wed, 9 Feb 2022 12:41:14 +0100
|
||||||
|
Subject: [PATCH 2/2] shaped-texture: Paint with the right layer snippet
|
||||||
|
|
||||||
|
When we get passed a "snippet" to the shaped texture, it's added as a
|
||||||
|
pipeline layer snippet to change how the source texture is sampled. When
|
||||||
|
we draw from a texture tower however we have allocated regular textures
|
||||||
|
which doesn't need any special layer snippet, so create separate
|
||||||
|
pipelines for those that doesn't use that snippet.
|
||||||
|
|
||||||
|
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
|
||||||
|
---
|
||||||
|
src/compositor/meta-shaped-texture.c | 126 +++++++++++++++++++++------
|
||||||
|
1 file changed, 98 insertions(+), 28 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
|
||||||
|
index 68919c5f1c5c..0d09f2f4e164 100644
|
||||||
|
--- a/src/compositor/meta-shaped-texture.c
|
||||||
|
+++ b/src/compositor/meta-shaped-texture.c
|
||||||
|
@@ -91,8 +91,12 @@ struct _MetaShapedTexture
|
||||||
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
|
CoglPipeline *base_pipeline;
|
||||||
|
+ CoglPipeline *unmasked_pipeline;
|
||||||
|
+ CoglPipeline *unmasked_tower_pipeline;
|
||||||
|
CoglPipeline *masked_pipeline;
|
||||||
|
+ CoglPipeline *masked_tower_pipeline;
|
||||||
|
CoglPipeline *unblended_pipeline;
|
||||||
|
+ CoglPipeline *unblended_tower_pipeline;
|
||||||
|
|
||||||
|
gboolean is_y_inverted;
|
||||||
|
|
||||||
|
@@ -243,8 +247,12 @@ static void
|
||||||
|
meta_shaped_texture_reset_pipelines (MetaShapedTexture *stex)
|
||||||
|
{
|
||||||
|
g_clear_pointer (&stex->base_pipeline, cogl_object_unref);
|
||||||
|
+ g_clear_pointer (&stex->unmasked_pipeline, cogl_object_unref);
|
||||||
|
+ g_clear_pointer (&stex->unmasked_tower_pipeline, cogl_object_unref);
|
||||||
|
g_clear_pointer (&stex->masked_pipeline, cogl_object_unref);
|
||||||
|
+ g_clear_pointer (&stex->masked_tower_pipeline, cogl_object_unref);
|
||||||
|
g_clear_pointer (&stex->unblended_pipeline, cogl_object_unref);
|
||||||
|
+ g_clear_pointer (&stex->unblended_tower_pipeline, cogl_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -381,9 +389,6 @@ get_base_pipeline (MetaShapedTexture *stex,
|
||||||
|
|
||||||
|
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
|
||||||
|
|
||||||
|
- if (stex->snippet)
|
||||||
|
- cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
|
||||||
|
-
|
||||||
|
stex->base_pipeline = pipeline;
|
||||||
|
|
||||||
|
return stex->base_pipeline;
|
||||||
|
@@ -391,47 +396,112 @@ get_base_pipeline (MetaShapedTexture *stex,
|
||||||
|
|
||||||
|
static CoglPipeline *
|
||||||
|
get_unmasked_pipeline (MetaShapedTexture *stex,
|
||||||
|
- CoglContext *ctx)
|
||||||
|
+ CoglContext *ctx,
|
||||||
|
+ CoglTexture *tex)
|
||||||
|
{
|
||||||
|
- return get_base_pipeline (stex, ctx);
|
||||||
|
+ if (stex->texture == tex)
|
||||||
|
+ {
|
||||||
|
+ CoglPipeline *pipeline;
|
||||||
|
+
|
||||||
|
+ if (stex->unmasked_pipeline)
|
||||||
|
+ return stex->unmasked_pipeline;
|
||||||
|
+
|
||||||
|
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
+ if (stex->snippet)
|
||||||
|
+ cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
|
||||||
|
+
|
||||||
|
+ stex->unmasked_pipeline = pipeline;
|
||||||
|
+ return pipeline;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ CoglPipeline *pipeline;
|
||||||
|
+
|
||||||
|
+ if (stex->unmasked_tower_pipeline)
|
||||||
|
+ return stex->unmasked_tower_pipeline;
|
||||||
|
+
|
||||||
|
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
+ stex->unmasked_tower_pipeline = pipeline;
|
||||||
|
+ return pipeline;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static CoglPipeline *
|
||||||
|
get_masked_pipeline (MetaShapedTexture *stex,
|
||||||
|
- CoglContext *ctx)
|
||||||
|
+ CoglContext *ctx,
|
||||||
|
+ CoglTexture *tex)
|
||||||
|
{
|
||||||
|
- CoglPipeline *pipeline;
|
||||||
|
+ if (stex->texture == tex)
|
||||||
|
+ {
|
||||||
|
+ CoglPipeline *pipeline;
|
||||||
|
|
||||||
|
- if (stex->masked_pipeline)
|
||||||
|
- return stex->masked_pipeline;
|
||||||
|
+ if (stex->masked_pipeline)
|
||||||
|
+ return stex->masked_pipeline;
|
||||||
|
|
||||||
|
- pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
- cogl_pipeline_set_layer_combine (pipeline, 1,
|
||||||
|
- "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
|
||||||
|
- NULL);
|
||||||
|
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
+ cogl_pipeline_set_layer_combine (pipeline, 1,
|
||||||
|
+ "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
|
||||||
|
+ NULL);
|
||||||
|
+ if (stex->snippet)
|
||||||
|
+ cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
|
||||||
|
|
||||||
|
- stex->masked_pipeline = pipeline;
|
||||||
|
+ stex->masked_pipeline = pipeline;
|
||||||
|
+ return pipeline;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ CoglPipeline *pipeline;
|
||||||
|
|
||||||
|
- return pipeline;
|
||||||
|
+ if (stex->masked_tower_pipeline)
|
||||||
|
+ return stex->masked_tower_pipeline;
|
||||||
|
+
|
||||||
|
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
+ cogl_pipeline_set_layer_combine (pipeline, 1,
|
||||||
|
+ "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
|
||||||
|
+ NULL);
|
||||||
|
+
|
||||||
|
+ stex->masked_tower_pipeline = pipeline;
|
||||||
|
+ return pipeline;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static CoglPipeline *
|
||||||
|
get_unblended_pipeline (MetaShapedTexture *stex,
|
||||||
|
- CoglContext *ctx)
|
||||||
|
+ CoglContext *ctx,
|
||||||
|
+ CoglTexture *tex)
|
||||||
|
{
|
||||||
|
- CoglPipeline *pipeline;
|
||||||
|
+ if (stex->texture == tex)
|
||||||
|
+ {
|
||||||
|
+ CoglPipeline *pipeline;
|
||||||
|
|
||||||
|
- if (stex->unblended_pipeline)
|
||||||
|
- return stex->unblended_pipeline;
|
||||||
|
+ if (stex->unblended_pipeline)
|
||||||
|
+ return stex->unblended_pipeline;
|
||||||
|
|
||||||
|
- pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
- cogl_pipeline_set_layer_combine (pipeline, 0,
|
||||||
|
- "RGBA = REPLACE (TEXTURE)",
|
||||||
|
- NULL);
|
||||||
|
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
+ cogl_pipeline_set_layer_combine (pipeline, 0,
|
||||||
|
+ "RGBA = REPLACE (TEXTURE)",
|
||||||
|
+ NULL);
|
||||||
|
+ if (stex->snippet)
|
||||||
|
+ cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
|
||||||
|
|
||||||
|
- stex->unblended_pipeline = pipeline;
|
||||||
|
+ stex->unblended_pipeline = pipeline;
|
||||||
|
+ return pipeline;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ CoglPipeline *pipeline;
|
||||||
|
|
||||||
|
- return pipeline;
|
||||||
|
+ if (stex->unblended_tower_pipeline)
|
||||||
|
+ return stex->unblended_tower_pipeline;
|
||||||
|
+
|
||||||
|
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
|
+ cogl_pipeline_set_layer_combine (pipeline, 0,
|
||||||
|
+ "RGBA = REPLACE (TEXTURE)",
|
||||||
|
+ NULL);
|
||||||
|
+
|
||||||
|
+ stex->unblended_tower_pipeline = pipeline;
|
||||||
|
+ return pipeline;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static CoglPipeline *
|
||||||
|
@@ -742,7 +812,7 @@ do_paint_content (MetaShapedTexture *stex,
|
||||||
|
{
|
||||||
|
CoglPipeline *opaque_pipeline;
|
||||||
|
|
||||||
|
- opaque_pipeline = get_unblended_pipeline (stex, ctx);
|
||||||
|
+ opaque_pipeline = get_unblended_pipeline (stex, ctx, paint_tex);
|
||||||
|
cogl_pipeline_set_layer_texture (opaque_pipeline, 0, paint_tex);
|
||||||
|
cogl_pipeline_set_layer_filters (opaque_pipeline, 0, filter, filter);
|
||||||
|
|
||||||
|
@@ -786,11 +856,11 @@ do_paint_content (MetaShapedTexture *stex,
|
||||||
|
|
||||||
|
if (stex->mask_texture == NULL)
|
||||||
|
{
|
||||||
|
- blended_pipeline = get_unmasked_pipeline (stex, ctx);
|
||||||
|
+ blended_pipeline = get_unmasked_pipeline (stex, ctx, paint_tex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- blended_pipeline = get_masked_pipeline (stex, ctx);
|
||||||
|
+ blended_pipeline = get_masked_pipeline (stex, ctx, paint_tex);
|
||||||
|
cogl_pipeline_set_layer_texture (blended_pipeline, 1, stex->mask_texture);
|
||||||
|
cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,490 @@
|
|||||||
|
From acb3e966b26ea55019a148d6482f5aa4c05275a9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 8 Feb 2022 15:58:33 +0100
|
||||||
|
Subject: [PATCH 1/4] drm-buffer: Keep track of handle as well
|
||||||
|
|
||||||
|
This handle is used by the legacy KMS API; lets avoid having to have GBM
|
||||||
|
specific code where this is done by letting the MetaDrmBuffer API, that
|
||||||
|
already has this information, expose it.
|
||||||
|
---
|
||||||
|
src/backends/native/meta-drm-buffer-dumb.c | 1 +
|
||||||
|
src/backends/native/meta-drm-buffer-gbm.c | 1 +
|
||||||
|
src/backends/native/meta-drm-buffer-import.c | 1 +
|
||||||
|
src/backends/native/meta-drm-buffer-private.h | 1 +
|
||||||
|
src/backends/native/meta-drm-buffer.c | 10 ++++++++++
|
||||||
|
src/backends/native/meta-drm-buffer.h | 2 ++
|
||||||
|
6 files changed, 16 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-drm-buffer-dumb.c b/src/backends/native/meta-drm-buffer-dumb.c
|
||||||
|
index 373eb5c73581..b5e15528a1c6 100644
|
||||||
|
--- a/src/backends/native/meta-drm-buffer-dumb.c
|
||||||
|
+++ b/src/backends/native/meta-drm-buffer-dumb.c
|
||||||
|
@@ -194,6 +194,7 @@ init_dumb_buffer_in_impl (MetaKmsImpl *impl,
|
||||||
|
.width = data->width,
|
||||||
|
.height = data->height,
|
||||||
|
.format = data->format,
|
||||||
|
+ .handle = create_arg.handle,
|
||||||
|
.handles = { create_arg.handle },
|
||||||
|
.strides = { create_arg.pitch },
|
||||||
|
};
|
||||||
|
diff --git a/src/backends/native/meta-drm-buffer-gbm.c b/src/backends/native/meta-drm-buffer-gbm.c
|
||||||
|
index 48ee9eb048ba..fa45dd98b91e 100644
|
||||||
|
--- a/src/backends/native/meta-drm-buffer-gbm.c
|
||||||
|
+++ b/src/backends/native/meta-drm-buffer-gbm.c
|
||||||
|
@@ -119,6 +119,7 @@ init_fb_id (MetaDrmBufferGbm *buffer_gbm,
|
||||||
|
fb_args.width = gbm_bo_get_width (bo);
|
||||||
|
fb_args.height = gbm_bo_get_height (bo);
|
||||||
|
fb_args.format = gbm_bo_get_format (bo);
|
||||||
|
+ fb_args.handle = gbm_bo_get_handle (bo).u32;
|
||||||
|
|
||||||
|
if (!meta_drm_buffer_ensure_fb_id (META_DRM_BUFFER (buffer_gbm),
|
||||||
|
use_modifiers, &fb_args, error))
|
||||||
|
diff --git a/src/backends/native/meta-drm-buffer-import.c b/src/backends/native/meta-drm-buffer-import.c
|
||||||
|
index 1e5a38246172..ea744953cb9b 100644
|
||||||
|
--- a/src/backends/native/meta-drm-buffer-import.c
|
||||||
|
+++ b/src/backends/native/meta-drm-buffer-import.c
|
||||||
|
@@ -125,6 +125,7 @@ import_gbm_buffer (MetaDrmBufferImport *buffer_import,
|
||||||
|
fb_args.width = gbm_bo_get_width (primary_bo);
|
||||||
|
fb_args.height = gbm_bo_get_height (primary_bo);
|
||||||
|
fb_args.format = gbm_bo_get_format (primary_bo);
|
||||||
|
+ fb_args.handle = gbm_bo_get_handle (primary_bo).u32;
|
||||||
|
|
||||||
|
imported_bo = dmabuf_to_gbm_bo (importer,
|
||||||
|
dmabuf_fd,
|
||||||
|
diff --git a/src/backends/native/meta-drm-buffer-private.h b/src/backends/native/meta-drm-buffer-private.h
|
||||||
|
index 2c77eb957948..f660d3a7f363 100644
|
||||||
|
--- a/src/backends/native/meta-drm-buffer-private.h
|
||||||
|
+++ b/src/backends/native/meta-drm-buffer-private.h
|
||||||
|
@@ -33,6 +33,7 @@ typedef struct _MetaDrmFbArgs
|
||||||
|
uint32_t offsets[4];
|
||||||
|
uint32_t strides[4];
|
||||||
|
uint64_t modifiers[4];
|
||||||
|
+ uint32_t handle;
|
||||||
|
} MetaDrmFbArgs;
|
||||||
|
|
||||||
|
struct _MetaDrmBufferClass
|
||||||
|
diff --git a/src/backends/native/meta-drm-buffer.c b/src/backends/native/meta-drm-buffer.c
|
||||||
|
index 81a36196e528..a0f8055b3107 100644
|
||||||
|
--- a/src/backends/native/meta-drm-buffer.c
|
||||||
|
+++ b/src/backends/native/meta-drm-buffer.c
|
||||||
|
@@ -50,6 +50,7 @@ typedef struct _MetaDrmBufferPrivate
|
||||||
|
{
|
||||||
|
MetaKmsDevice *device;
|
||||||
|
uint32_t fb_id;
|
||||||
|
+ uint32_t handle;
|
||||||
|
} MetaDrmBufferPrivate;
|
||||||
|
|
||||||
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaDrmBuffer, meta_drm_buffer,
|
||||||
|
@@ -139,6 +140,7 @@ meta_drm_buffer_ensure_fb_in_impl (MetaDrmBuffer *buffer,
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->fb_id = fb_id;
|
||||||
|
+ priv->handle = fb_args->handle;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
@@ -242,6 +244,14 @@ meta_drm_buffer_get_fb_id (MetaDrmBuffer *buffer)
|
||||||
|
return priv->fb_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
+uint32_t
|
||||||
|
+meta_drm_buffer_get_handle (MetaDrmBuffer *buffer)
|
||||||
|
+{
|
||||||
|
+ MetaDrmBufferPrivate *priv = meta_drm_buffer_get_instance_private (buffer);
|
||||||
|
+
|
||||||
|
+ return priv->handle;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
meta_drm_buffer_get_width (MetaDrmBuffer *buffer)
|
||||||
|
{
|
||||||
|
diff --git a/src/backends/native/meta-drm-buffer.h b/src/backends/native/meta-drm-buffer.h
|
||||||
|
index 1647d399e7f2..476264ce753e 100644
|
||||||
|
--- a/src/backends/native/meta-drm-buffer.h
|
||||||
|
+++ b/src/backends/native/meta-drm-buffer.h
|
||||||
|
@@ -34,6 +34,8 @@ G_DECLARE_DERIVABLE_TYPE (MetaDrmBuffer,
|
||||||
|
|
||||||
|
uint32_t meta_drm_buffer_get_fb_id (MetaDrmBuffer *buffer);
|
||||||
|
|
||||||
|
+uint32_t meta_drm_buffer_get_handle (MetaDrmBuffer *buffer);
|
||||||
|
+
|
||||||
|
int meta_drm_buffer_get_width (MetaDrmBuffer *buffer);
|
||||||
|
|
||||||
|
int meta_drm_buffer_get_height (MetaDrmBuffer *buffer);
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
||||||
|
From bdd2f1dd0a67743085c84f6e060160fbd28122df Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 8 Feb 2022 16:00:17 +0100
|
||||||
|
Subject: [PATCH 2/4] kms/impl-device/simple: Get the buffer handle from
|
||||||
|
MetaDrmBuffer
|
||||||
|
|
||||||
|
This avoids buffer implementation specific code where it shouldn't
|
||||||
|
matter.
|
||||||
|
---
|
||||||
|
src/backends/native/meta-kms-impl-device-simple.c | 15 ++-------------
|
||||||
|
1 file changed, 2 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-kms-impl-device-simple.c b/src/backends/native/meta-kms-impl-device-simple.c
|
||||||
|
index 1519962b8ed7..1663a2e9cacd 100644
|
||||||
|
--- a/src/backends/native/meta-kms-impl-device-simple.c
|
||||||
|
+++ b/src/backends/native/meta-kms-impl-device-simple.c
|
||||||
|
@@ -1182,20 +1182,9 @@ process_cursor_plane_assignment (MetaKmsImplDevice *impl_device,
|
||||||
|
height = plane_assignment->dst_rect.height;
|
||||||
|
|
||||||
|
if (plane_assignment->buffer)
|
||||||
|
- {
|
||||||
|
- MetaDrmBufferGbm *buffer_gbm =
|
||||||
|
- META_DRM_BUFFER_GBM (plane_assignment->buffer);
|
||||||
|
- struct gbm_bo *bo;
|
||||||
|
- union gbm_bo_handle handle;
|
||||||
|
-
|
||||||
|
- bo = meta_drm_buffer_gbm_get_bo (buffer_gbm);
|
||||||
|
- handle = gbm_bo_get_handle (bo);
|
||||||
|
- handle_u32 = handle.u32;
|
||||||
|
- }
|
||||||
|
+ handle_u32 = meta_drm_buffer_get_handle (plane_assignment->buffer);
|
||||||
|
else
|
||||||
|
- {
|
||||||
|
- handle_u32 = 0;
|
||||||
|
- }
|
||||||
|
+ handle_u32 = 0;
|
||||||
|
|
||||||
|
meta_topic (META_DEBUG_KMS,
|
||||||
|
"[simple] Setting HW cursor of CRTC %u (%s) to %u "
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
||||||
|
From d781f140b7197d3c9cd67f8fded4e2b58a4eda92 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 8 Feb 2022 15:05:32 +0100
|
||||||
|
Subject: [PATCH 3/4] cursor-renderer/native: Move buffer creation to helper
|
||||||
|
|
||||||
|
---
|
||||||
|
.../native/meta-cursor-renderer-native.c | 134 ++++++++++++------
|
||||||
|
1 file changed, 89 insertions(+), 45 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
index 098ef24bdf2e..2bcbe6b2c8b0 100644
|
||||||
|
--- a/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
@@ -1215,6 +1215,81 @@ ensure_cursor_priv (MetaCursorSprite *cursor_sprite)
|
||||||
|
return cursor_priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static MetaDrmBuffer *
|
||||||
|
+create_cursor_drm_buffer_gbm (MetaGpuKms *gpu_kms,
|
||||||
|
+ uint8_t *pixels,
|
||||||
|
+ int width,
|
||||||
|
+ int height,
|
||||||
|
+ int stride,
|
||||||
|
+ int cursor_width,
|
||||||
|
+ int cursor_height,
|
||||||
|
+ uint32_t format,
|
||||||
|
+ GError **error)
|
||||||
|
+{
|
||||||
|
+ MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
|
+ struct gbm_device *gbm_device;
|
||||||
|
+ struct gbm_bo *bo;
|
||||||
|
+ uint8_t buf[4 * cursor_width * cursor_height];
|
||||||
|
+ int i;
|
||||||
|
+ MetaDrmBufferGbm *buffer_gbm;
|
||||||
|
+
|
||||||
|
+ gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
||||||
|
+ if (!gbm_device_is_format_supported (gbm_device, format,
|
||||||
|
+ GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE))
|
||||||
|
+ {
|
||||||
|
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||||
|
+ "Buffer format not supported");
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ bo = gbm_bo_create (gbm_device, cursor_width, cursor_height,
|
||||||
|
+ format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
||||||
|
+ if (!bo)
|
||||||
|
+ {
|
||||||
|
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||||
|
+ "Failed to allocate gbm_bo: %s", g_strerror (errno));
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ memset (buf, 0, sizeof (buf));
|
||||||
|
+ for (i = 0; i < height; i++)
|
||||||
|
+ memcpy (buf + i * 4 * cursor_width, pixels + i * stride, width * 4);
|
||||||
|
+ if (gbm_bo_write (bo, buf, cursor_width * cursor_height * 4) != 0)
|
||||||
|
+ {
|
||||||
|
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||||
|
+ "Failed write to gbm_bo: %s", g_strerror (errno));
|
||||||
|
+ gbm_bo_destroy (bo);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ buffer_gbm = meta_drm_buffer_gbm_new_take (kms_device, bo, FALSE, error);
|
||||||
|
+ if (!buffer_gbm)
|
||||||
|
+ {
|
||||||
|
+ gbm_bo_destroy (bo);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return META_DRM_BUFFER (buffer_gbm);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static MetaDrmBuffer *
|
||||||
|
+create_cursor_drm_buffer (MetaGpuKms *gpu_kms,
|
||||||
|
+ uint8_t *pixels,
|
||||||
|
+ int width,
|
||||||
|
+ int height,
|
||||||
|
+ int stride,
|
||||||
|
+ int cursor_width,
|
||||||
|
+ int cursor_height,
|
||||||
|
+ uint32_t format,
|
||||||
|
+ GError **error)
|
||||||
|
+{
|
||||||
|
+ return create_cursor_drm_buffer_gbm (gpu_kms, pixels,
|
||||||
|
+ width, height, stride,
|
||||||
|
+ cursor_width, cursor_height,
|
||||||
|
+ format,
|
||||||
|
+ error);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native,
|
||||||
|
MetaGpuKms *gpu_kms,
|
||||||
|
@@ -1226,8 +1301,9 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native,
|
||||||
|
uint32_t gbm_format)
|
||||||
|
{
|
||||||
|
uint64_t cursor_width, cursor_height;
|
||||||
|
+ MetaDrmBuffer *buffer;
|
||||||
|
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data;
|
||||||
|
- struct gbm_device *gbm_device;
|
||||||
|
+ g_autoptr (GError) error = NULL;
|
||||||
|
|
||||||
|
cursor_renderer_gpu_data =
|
||||||
|
meta_cursor_renderer_native_gpu_data_from_gpu (gpu_kms);
|
||||||
|
@@ -1244,52 +1320,20 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native,
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
||||||
|
- if (gbm_device_is_format_supported (gbm_device, gbm_format,
|
||||||
|
- GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE))
|
||||||
|
- {
|
||||||
|
- MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
|
- struct gbm_bo *bo;
|
||||||
|
- uint8_t buf[4 * cursor_width * cursor_height];
|
||||||
|
- uint i;
|
||||||
|
- g_autoptr (GError) error = NULL;
|
||||||
|
- MetaDrmBufferGbm *buffer_gbm;
|
||||||
|
-
|
||||||
|
- bo = gbm_bo_create (gbm_device, cursor_width, cursor_height,
|
||||||
|
- gbm_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
||||||
|
- if (!bo)
|
||||||
|
- {
|
||||||
|
- meta_warning ("Failed to allocate HW cursor buffer");
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- memset (buf, 0, sizeof(buf));
|
||||||
|
- for (i = 0; i < height; i++)
|
||||||
|
- memcpy (buf + i * 4 * cursor_width, pixels + i * rowstride, width * 4);
|
||||||
|
- if (gbm_bo_write (bo, buf, cursor_width * cursor_height * 4) != 0)
|
||||||
|
- {
|
||||||
|
- meta_warning ("Failed to write cursors buffer data: %s",
|
||||||
|
- g_strerror (errno));
|
||||||
|
- gbm_bo_destroy (bo);
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- buffer_gbm = meta_drm_buffer_gbm_new_take (kms_device, bo, FALSE, &error);
|
||||||
|
- if (!buffer_gbm)
|
||||||
|
- {
|
||||||
|
- meta_warning ("Failed to create DRM buffer wrapper: %s",
|
||||||
|
- error->message);
|
||||||
|
- gbm_bo_destroy (bo);
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- set_pending_cursor_sprite_buffer (cursor_sprite, gpu_kms,
|
||||||
|
- META_DRM_BUFFER (buffer_gbm));
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
+ buffer = create_cursor_drm_buffer (gpu_kms,
|
||||||
|
+ pixels,
|
||||||
|
+ width, height, rowstride,
|
||||||
|
+ cursor_width,
|
||||||
|
+ cursor_height,
|
||||||
|
+ gbm_format,
|
||||||
|
+ &error);
|
||||||
|
+ if (!buffer)
|
||||||
|
{
|
||||||
|
- meta_warning ("HW cursor for format %d not supported", gbm_format);
|
||||||
|
+ g_warning ("Realizing HW cursor failed: %s", error->message);
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ set_pending_cursor_sprite_buffer (cursor_sprite, gpu_kms, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
||||||
|
From 717baf8dc1dd2f043350dd354bc4905285ba3337 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Tue, 8 Feb 2022 15:38:37 +0100
|
||||||
|
Subject: [PATCH 4/4] cursor-renderer/native: Support allocating dumb buffers
|
||||||
|
|
||||||
|
---
|
||||||
|
.../native/meta-cursor-renderer-native.c | 88 ++++++++++++++-----
|
||||||
|
1 file changed, 67 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
index 2bcbe6b2c8b0..18ffdf37dac4 100644
|
||||||
|
--- a/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
+++ b/src/backends/native/meta-cursor-renderer-native.c
|
||||||
|
@@ -39,6 +39,7 @@
|
||||||
|
#include "backends/meta-monitor-manager-private.h"
|
||||||
|
#include "backends/meta-output.h"
|
||||||
|
#include "backends/native/meta-crtc-kms.h"
|
||||||
|
+#include "backends/native/meta-drm-buffer-dumb.h"
|
||||||
|
#include "backends/native/meta-drm-buffer-gbm.h"
|
||||||
|
#include "backends/native/meta-kms-device.h"
|
||||||
|
#include "backends/native/meta-kms-plane.h"
|
||||||
|
@@ -1216,24 +1217,23 @@ ensure_cursor_priv (MetaCursorSprite *cursor_sprite)
|
||||||
|
}
|
||||||
|
|
||||||
|
static MetaDrmBuffer *
|
||||||
|
-create_cursor_drm_buffer_gbm (MetaGpuKms *gpu_kms,
|
||||||
|
- uint8_t *pixels,
|
||||||
|
- int width,
|
||||||
|
- int height,
|
||||||
|
- int stride,
|
||||||
|
- int cursor_width,
|
||||||
|
- int cursor_height,
|
||||||
|
- uint32_t format,
|
||||||
|
- GError **error)
|
||||||
|
+create_cursor_drm_buffer_gbm (MetaGpuKms *gpu_kms,
|
||||||
|
+ struct gbm_device *gbm_device,
|
||||||
|
+ uint8_t *pixels,
|
||||||
|
+ int width,
|
||||||
|
+ int height,
|
||||||
|
+ int stride,
|
||||||
|
+ int cursor_width,
|
||||||
|
+ int cursor_height,
|
||||||
|
+ uint32_t format,
|
||||||
|
+ GError **error)
|
||||||
|
{
|
||||||
|
MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
|
- struct gbm_device *gbm_device;
|
||||||
|
struct gbm_bo *bo;
|
||||||
|
uint8_t buf[4 * cursor_width * cursor_height];
|
||||||
|
int i;
|
||||||
|
MetaDrmBufferGbm *buffer_gbm;
|
||||||
|
|
||||||
|
- gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
||||||
|
if (!gbm_device_is_format_supported (gbm_device, format,
|
||||||
|
GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE))
|
||||||
|
{
|
||||||
|
@@ -1272,6 +1272,38 @@ create_cursor_drm_buffer_gbm (MetaGpuKms *gpu_kms,
|
||||||
|
return META_DRM_BUFFER (buffer_gbm);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static MetaDrmBuffer *
|
||||||
|
+create_cursor_drm_buffer_dumb (MetaGpuKms *gpu_kms,
|
||||||
|
+ uint8_t *pixels,
|
||||||
|
+ int width,
|
||||||
|
+ int height,
|
||||||
|
+ int stride,
|
||||||
|
+ int cursor_width,
|
||||||
|
+ int cursor_height,
|
||||||
|
+ uint32_t format,
|
||||||
|
+ GError **error)
|
||||||
|
+{
|
||||||
|
+ MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
|
+ MetaDrmBufferDumb *buffer_dumb;
|
||||||
|
+ int i;
|
||||||
|
+ uint8_t *data;
|
||||||
|
+
|
||||||
|
+ buffer_dumb = meta_drm_buffer_dumb_new (kms_device,
|
||||||
|
+ cursor_width, cursor_height,
|
||||||
|
+ format,
|
||||||
|
+ error);
|
||||||
|
+ if (!buffer_dumb)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ data = meta_drm_buffer_dumb_get_data (buffer_dumb);
|
||||||
|
+
|
||||||
|
+ memset (data, 0, cursor_width * cursor_height * 4);
|
||||||
|
+ for (i = 0; i < height; i++)
|
||||||
|
+ memcpy (data + i * 4 * cursor_width, pixels + i * stride, width * 4);
|
||||||
|
+
|
||||||
|
+ return META_DRM_BUFFER (buffer_dumb);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static MetaDrmBuffer *
|
||||||
|
create_cursor_drm_buffer (MetaGpuKms *gpu_kms,
|
||||||
|
uint8_t *pixels,
|
||||||
|
@@ -1283,11 +1315,27 @@ create_cursor_drm_buffer (MetaGpuKms *gpu_kms,
|
||||||
|
uint32_t format,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
- return create_cursor_drm_buffer_gbm (gpu_kms, pixels,
|
||||||
|
- width, height, stride,
|
||||||
|
- cursor_width, cursor_height,
|
||||||
|
- format,
|
||||||
|
- error);
|
||||||
|
+ struct gbm_device *gbm_device;
|
||||||
|
+
|
||||||
|
+ gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
||||||
|
+ if (gbm_device)
|
||||||
|
+ {
|
||||||
|
+ return create_cursor_drm_buffer_gbm (gpu_kms, gbm_device,
|
||||||
|
+ pixels,
|
||||||
|
+ width, height, stride,
|
||||||
|
+ cursor_width, cursor_height,
|
||||||
|
+ format,
|
||||||
|
+ error);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ return create_cursor_drm_buffer_dumb (gpu_kms,
|
||||||
|
+ pixels,
|
||||||
|
+ width, height, stride,
|
||||||
|
+ cursor_width, cursor_height,
|
||||||
|
+ format,
|
||||||
|
+ error);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -1629,6 +1677,9 @@ realize_cursor_sprite_from_wl_buffer_for_gpu (MetaCursorRenderer *renderer,
|
||||||
|
}
|
||||||
|
|
||||||
|
gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
||||||
|
+ if (!gbm_device)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
bo = gbm_bo_import (gbm_device,
|
||||||
|
GBM_BO_IMPORT_WL_BUFFER,
|
||||||
|
buffer,
|
||||||
|
@@ -1807,13 +1858,8 @@ init_hw_cursor_support_for_gpu (MetaGpuKms *gpu_kms)
|
||||||
|
{
|
||||||
|
MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
||||||
|
MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data;
|
||||||
|
- struct gbm_device *gbm_device;
|
||||||
|
uint64_t width, height;
|
||||||
|
|
||||||
|
- gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
||||||
|
- if (!gbm_device)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
cursor_renderer_gpu_data =
|
||||||
|
meta_create_cursor_renderer_native_gpu_data (gpu_kms);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
@ -0,0 +1,817 @@
|
|||||||
|
From 22fe64732e11199901d4a35f9d3c63d5d6deb3a3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
Date: Tue, 1 Jun 2021 11:44:20 +0200
|
||||||
|
Subject: [PATCH 1/6] 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 | 274 +++++++++++++++++++++
|
||||||
|
1 file changed, 274 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
index 371e2f60e..426056390 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 <gdk/gdkx.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/extensions/XInput2.h>
|
||||||
|
@@ -165,6 +166,183 @@ 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 ();
|
||||||
|
+ MetaBackend *backend = meta_get_backend ();
|
||||||
|
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||||
|
+ int device_id;
|
||||||
|
+ XDevice *xdevice;
|
||||||
|
+ guchar *tap_action, *buttons;
|
||||||
|
+ guint buttons_capacity = 16, n_buttons;
|
||||||
|
+
|
||||||
|
+ device_id = meta_input_device_x11_get_device_id (device);
|
||||||
|
+ xdevice = XOpenDevice (xdisplay, device_id);
|
||||||
|
+ 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);
|
||||||
|
+
|
||||||
|
+ clutter_x11_trap_x_errors();
|
||||||
|
+ 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 (clutter_x11_untrap_x_errors())
|
||||||
|
+ {
|
||||||
|
+ 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 ();
|
||||||
|
+ MetaBackend *backend = meta_get_backend ();
|
||||||
|
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||||
|
+ int device_id;
|
||||||
|
+ XDevice *xdevice;
|
||||||
|
+ XPtrFeedbackControl feedback;
|
||||||
|
+ XFeedbackState *states, *state;
|
||||||
|
+ int i, num_feedbacks, motion_threshold, numerator, denominator;
|
||||||
|
+ gfloat motion_acceleration;
|
||||||
|
+
|
||||||
|
+ device_id = meta_input_device_x11_get_device_id (device);
|
||||||
|
+ xdevice = XOpenDevice (xdisplay, device_id);
|
||||||
|
+ if (!xdevice)
|
||||||
|
+ return;
|
||||||
|
+ /* Get the list of feedbacks for the device */
|
||||||
|
+ clutter_x11_trap_x_errors();
|
||||||
|
+ states = XGetFeedbackControl (xdisplay, xdevice, &num_feedbacks);
|
||||||
|
+ if (clutter_x11_untrap_x_errors())
|
||||||
|
+ return;
|
||||||
|
+ 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;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ clutter_x11_trap_x_errors();
|
||||||
|
+
|
||||||
|
+ 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 (clutter_x11_untrap_x_errors())
|
||||||
|
+ {
|
||||||
|
+ 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,
|
||||||
|
@@ -173,6 +351,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)
|
||||||
|
@@ -225,6 +410,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);
|
||||||
|
@@ -251,6 +442,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);
|
||||||
|
}
|
||||||
|
@@ -274,6 +478,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);
|
||||||
|
}
|
||||||
|
@@ -307,6 +525,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);
|
||||||
|
}
|
||||||
|
@@ -320,6 +559,41 @@ change_scroll_method (ClutterInputDevice *device,
|
||||||
|
guchar *current = NULL;
|
||||||
|
guchar *available = NULL;
|
||||||
|
|
||||||
|
+ if (is_device_synaptics (device))
|
||||||
|
+ {
|
||||||
|
+ switch (method)
|
||||||
|
+ {
|
||||||
|
+ case SCROLL_METHOD_FIELD_EDGE:
|
||||||
|
+ current = get_property (device, "Synaptics Edge Scrolling",
|
||||||
|
+ XA_INTEGER, 8, 3);
|
||||||
|
+ if (current)
|
||||||
|
+ {
|
||||||
|
+ current[0] = enabled;
|
||||||
|
+ current[1] = enabled;
|
||||||
|
+ change_property (device, "Synaptics Edge Scrolling",
|
||||||
|
+ XA_INTEGER, 8, current, 3);
|
||||||
|
+ meta_XFree (current);
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case SCROLL_METHOD_FIELD_2FG:
|
||||||
|
+ current = get_property (device, "Synaptics Two-Finger Scrolling",
|
||||||
|
+ XA_INTEGER, 8, 2);
|
||||||
|
+ if (current)
|
||||||
|
+ {
|
||||||
|
+ current[0] = enabled;
|
||||||
|
+ current[1] = enabled;
|
||||||
|
+ change_property (device, "Synaptics Two-Finger Scrolling",
|
||||||
|
+ XA_INTEGER, 8, current, 2);
|
||||||
|
+ meta_XFree (current);
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
available = get_property (device, "libinput Scroll Methods Available",
|
||||||
|
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
|
||||||
|
if (!available || !available[method])
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
||||||
|
|
||||||
|
From 963ff120898e7e42d80d5761753e76adcf16c132 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
Date: Tue, 13 Feb 2018 11:44:40 +0100
|
||||||
|
Subject: [PATCH 2/6] 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.
|
||||||
|
---
|
||||||
|
src/backends/x11/meta-seat-x11.c | 17 +++++++++++++++--
|
||||||
|
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
|
||||||
|
index d43834bd7..73938e22e 100644
|
||||||
|
--- a/src/backends/x11/meta-seat-x11.c
|
||||||
|
+++ b/src/backends/x11/meta-seat-x11.c
|
||||||
|
@@ -246,7 +246,8 @@ is_touch_device (XIAnyClassInfo **classes,
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
-is_touchpad_device (XIDeviceInfo *info)
|
||||||
|
+query_exists_device_property (XIDeviceInfo *info,
|
||||||
|
+ const char *property)
|
||||||
|
{
|
||||||
|
gulong nitems, bytes_after;
|
||||||
|
uint32_t *data = NULL;
|
||||||
|
@@ -254,7 +255,7 @@ is_touchpad_device (XIDeviceInfo *info)
|
||||||
|
Atom type;
|
||||||
|
Atom prop;
|
||||||
|
|
||||||
|
- prop = XInternAtom (clutter_x11_get_default_display (), "libinput Tapping Enabled", True);
|
||||||
|
+ prop = XInternAtom (clutter_x11_get_default_display (), property, True);
|
||||||
|
if (prop == None)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
@@ -275,6 +276,18 @@ is_touchpad_device (XIDeviceInfo *info)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static gboolean
|
||||||
|
+is_touchpad_device (XIDeviceInfo *info)
|
||||||
|
+{
|
||||||
|
+ if (query_exists_device_property (info, "libinput Tapping Enabled"))
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+ if (query_exists_device_property (info, "Synaptics Off"))
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static gboolean
|
||||||
|
get_device_ids (XIDeviceInfo *info,
|
||||||
|
char **vendor_id,
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
||||||
|
|
||||||
|
From 86cc1b46dae01da619980af826eb9bf81cf31143 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rui Matos <tiagomatos@gmail.com>
|
||||||
|
Date: Mon, 9 Oct 2017 18:39:52 +0200
|
||||||
|
Subject: [PATCH 3/6] backends/x11: Add a synaptics check for two finger scroll
|
||||||
|
availability
|
||||||
|
|
||||||
|
Commit "backends/x11: Support synaptics configuration" added support
|
||||||
|
for synaptics two finger scrolling but didn't add the code to check
|
||||||
|
that it is available resulting in the upper layer always assuming it
|
||||||
|
isn't.
|
||||||
|
---
|
||||||
|
src/backends/x11/meta-input-settings-x11.c | 11 +++++++++++
|
||||||
|
1 file changed, 11 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
index 426056390..db2b2a4fb 100644
|
||||||
|
--- a/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
+++ b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
@@ -637,6 +637,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
|
||||||
|
guchar *available = NULL;
|
||||||
|
gboolean has_two_finger = TRUE;
|
||||||
|
|
||||||
|
+ if (is_device_synaptics (device))
|
||||||
|
+ {
|
||||||
|
+ available = get_property (device, "Synaptics Capabilities",
|
||||||
|
+ XA_INTEGER, 8, 4);
|
||||||
|
+ if (!available || !available[3])
|
||||||
|
+ has_two_finger = FALSE;
|
||||||
|
+
|
||||||
|
+ meta_XFree (available);
|
||||||
|
+ return has_two_finger;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
available = get_property (device, "libinput Scroll Methods Available",
|
||||||
|
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
|
||||||
|
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
||||||
|
|
||||||
|
From 32e2da07eeb1f9edcf03751285a756ab1acca6a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rui Matos <tiagomatos@gmail.com>
|
||||||
|
Date: Mon, 9 Oct 2017 18:55:56 +0200
|
||||||
|
Subject: [PATCH 4/6] backends/x11: Add disable while typing support for
|
||||||
|
synaptics
|
||||||
|
|
||||||
|
This is basically a copy of the old g-s-d mouse plugin code to manage
|
||||||
|
syndaemon when the synaptics driver is being used.
|
||||||
|
---
|
||||||
|
src/backends/x11/meta-input-settings-x11.c | 112 +++++++++++++++++++++
|
||||||
|
1 file changed, 112 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
index db2b2a4fb..bf9d769e9 100644
|
||||||
|
--- a/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
+++ b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
@@ -35,6 +35,9 @@
|
||||||
|
#ifdef HAVE_LIBGUDEV
|
||||||
|
#include <gudev/gudev.h>
|
||||||
|
#endif
|
||||||
|
+#ifdef __linux
|
||||||
|
+#include <sys/prctl.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "backends/x11/meta-backend-x11.h"
|
||||||
|
#include "backends/x11/meta-input-device-x11.h"
|
||||||
|
@@ -46,6 +49,8 @@ typedef struct _MetaInputSettingsX11Private
|
||||||
|
#ifdef HAVE_LIBGUDEV
|
||||||
|
GUdevClient *udev_client;
|
||||||
|
#endif
|
||||||
|
+ gboolean syndaemon_spawned;
|
||||||
|
+ GPid syndaemon_pid;
|
||||||
|
} MetaInputSettingsX11Private;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
|
||||||
|
@@ -343,6 +348,107 @@ change_synaptics_speed (ClutterInputDevice *device,
|
||||||
|
XCloseDevice (xdisplay, xdevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Ensure that syndaemon dies together with us, to avoid running several of
|
||||||
|
+ * them */
|
||||||
|
+static void
|
||||||
|
+setup_syndaemon (gpointer user_data)
|
||||||
|
+{
|
||||||
|
+#ifdef __linux
|
||||||
|
+ prctl (PR_SET_PDEATHSIG, SIGHUP);
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static gboolean
|
||||||
|
+have_program_in_path (const char *name)
|
||||||
|
+{
|
||||||
|
+ gchar *path;
|
||||||
|
+ gboolean result;
|
||||||
|
+
|
||||||
|
+ path = g_find_program_in_path (name);
|
||||||
|
+ result = (path != NULL);
|
||||||
|
+ g_free (path);
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+syndaemon_died (GPid pid,
|
||||||
|
+ gint status,
|
||||||
|
+ gpointer user_data)
|
||||||
|
+{
|
||||||
|
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (user_data);
|
||||||
|
+ MetaInputSettingsX11Private *priv =
|
||||||
|
+ meta_input_settings_x11_get_instance_private (settings_x11);
|
||||||
|
+ GError *error = NULL;
|
||||||
|
+
|
||||||
|
+ if (!g_spawn_check_exit_status (status, &error))
|
||||||
|
+ {
|
||||||
|
+ if ((WIFSIGNALED (status) && WTERMSIG (status) != SIGHUP) ||
|
||||||
|
+ error->domain == G_SPAWN_EXIT_ERROR)
|
||||||
|
+ g_warning ("Syndaemon exited unexpectedly: %s", error->message);
|
||||||
|
+ g_error_free (error);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ g_spawn_close_pid (pid);
|
||||||
|
+ priv->syndaemon_spawned = FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+set_synaptics_disable_w_typing (MetaInputSettings *settings,
|
||||||
|
+ gboolean state)
|
||||||
|
+{
|
||||||
|
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (settings);
|
||||||
|
+ MetaInputSettingsX11Private *priv =
|
||||||
|
+ meta_input_settings_x11_get_instance_private (settings_x11);
|
||||||
|
+
|
||||||
|
+ if (state)
|
||||||
|
+ {
|
||||||
|
+ GError *error = NULL;
|
||||||
|
+ GPtrArray *args;
|
||||||
|
+
|
||||||
|
+ if (priv->syndaemon_spawned)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (!have_program_in_path ("syndaemon"))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ args = g_ptr_array_new ();
|
||||||
|
+
|
||||||
|
+ g_ptr_array_add (args, (gpointer)"syndaemon");
|
||||||
|
+ g_ptr_array_add (args, (gpointer)"-i");
|
||||||
|
+ g_ptr_array_add (args, (gpointer)"1.0");
|
||||||
|
+ g_ptr_array_add (args, (gpointer)"-t");
|
||||||
|
+ g_ptr_array_add (args, (gpointer)"-K");
|
||||||
|
+ g_ptr_array_add (args, (gpointer)"-R");
|
||||||
|
+ g_ptr_array_add (args, NULL);
|
||||||
|
+
|
||||||
|
+ /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid
|
||||||
|
+ * double-forking, otherwise syndaemon will immediately get
|
||||||
|
+ * killed again through (PR_SET_PDEATHSIG when the intermediate
|
||||||
|
+ * process dies */
|
||||||
|
+ g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL,
|
||||||
|
+ G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL,
|
||||||
|
+ &priv->syndaemon_pid, &error);
|
||||||
|
+
|
||||||
|
+ priv->syndaemon_spawned = (error == NULL);
|
||||||
|
+ g_ptr_array_free (args, TRUE);
|
||||||
|
+
|
||||||
|
+ if (error)
|
||||||
|
+ {
|
||||||
|
+ g_warning ("Failed to launch syndaemon: %s", error->message);
|
||||||
|
+ g_error_free (error);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ g_child_watch_add (priv->syndaemon_pid, syndaemon_died, settings);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else if (priv->syndaemon_spawned)
|
||||||
|
+ {
|
||||||
|
+ kill (priv->syndaemon_pid, SIGHUP);
|
||||||
|
+ priv->syndaemon_spawned = FALSE;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
@@ -467,6 +573,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
|
||||||
|
{
|
||||||
|
guchar value = (enabled) ? 1 : 0;
|
||||||
|
|
||||||
|
+ if (is_device_synaptics (device))
|
||||||
|
+ {
|
||||||
|
+ set_synaptics_disable_w_typing (settings, enabled);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
change_property (device, "libinput Disable While Typing Enabled",
|
||||||
|
XA_INTEGER, 8, &value, 1);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
||||||
|
|
||||||
|
From 6da0bfe86f416d3cfc5cc6993e8e2f6ca255e85a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
Date: Wed, 13 Jun 2018 13:48:24 +0200
|
||||||
|
Subject: [PATCH 5/6] clutter: Only reset scroll axes on slave devices
|
||||||
|
|
||||||
|
As a plus, unknown source device IDs will just warn instead of crash.
|
||||||
|
---
|
||||||
|
src/backends/x11/meta-seat-x11.c | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
|
||||||
|
index 73938e22e..6d2c7d374 100644
|
||||||
|
--- a/src/backends/x11/meta-seat-x11.c
|
||||||
|
+++ b/src/backends/x11/meta-seat-x11.c
|
||||||
|
@@ -2362,7 +2362,9 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||||
|
seat->has_pointer_focus = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
- meta_input_device_x11_reset_scroll_info (source_device);
|
||||||
|
+ if (clutter_input_device_get_device_mode (source_device) ==
|
||||||
|
+ CLUTTER_INPUT_MODE_PHYSICAL)
|
||||||
|
+ meta_input_device_x11_reset_scroll_info (source_device);
|
||||||
|
|
||||||
|
clutter_event_set_device (event, device);
|
||||||
|
clutter_event_set_source_device (event, source_device);
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
||||||
|
|
||||||
|
From da60cf38c7fcec68f8e79a8a3a174e551c07a64a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rui Matos <tiagomatos@gmail.com>
|
||||||
|
Date: Tue, 10 Oct 2017 19:07:27 +0200
|
||||||
|
Subject: [PATCH 6/6] backends/x11: Support plain old X device configuration
|
||||||
|
|
||||||
|
We re-use part of the code added to support synaptics and add a few
|
||||||
|
bits specific for xorg-x11-drv-evdev devices.
|
||||||
|
---
|
||||||
|
src/backends/x11/meta-input-settings-x11.c | 98 +++++++++++++++++-----
|
||||||
|
1 file changed, 75 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
index bf9d769e9..49dcb74f1 100644
|
||||||
|
--- a/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
+++ b/src/backends/x11/meta-input-settings-x11.c
|
||||||
|
@@ -185,17 +185,30 @@ is_device_synaptics (ClutterInputDevice *device)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static gboolean
|
||||||
|
+is_device_libinput (ClutterInputDevice *device)
|
||||||
|
+{
|
||||||
|
+ guchar *has_setting;
|
||||||
|
+
|
||||||
|
+ /* We just need looking for a synaptics-specific property */
|
||||||
|
+ has_setting = get_property (device, "libinput Send Events Modes Available", XA_INTEGER, 8, 2);
|
||||||
|
+ 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)
|
||||||
|
+change_x_device_left_handed (ClutterInputDevice *device,
|
||||||
|
+ gboolean left_handed)
|
||||||
|
{
|
||||||
|
MetaDisplay *display = meta_get_display ();
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||||
|
int device_id;
|
||||||
|
XDevice *xdevice;
|
||||||
|
- guchar *tap_action, *buttons;
|
||||||
|
+ guchar *buttons;
|
||||||
|
guint buttons_capacity = 16, n_buttons;
|
||||||
|
|
||||||
|
device_id = meta_input_device_x11_get_device_id (device);
|
||||||
|
@@ -203,19 +216,6 @@ change_synaptics_tap_left_handed (ClutterInputDevice *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);
|
||||||
|
-
|
||||||
|
clutter_x11_trap_x_errors();
|
||||||
|
buttons = g_new (guchar, buttons_capacity);
|
||||||
|
n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
|
||||||
|
@@ -238,17 +238,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
|
||||||
|
|
||||||
|
if (clutter_x11_untrap_x_errors())
|
||||||
|
{
|
||||||
|
- g_warning ("Could not set synaptics touchpad left-handed for %s",
|
||||||
|
+ g_warning ("Could not set left-handed for %s",
|
||||||
|
clutter_input_device_get_device_name (device));
|
||||||
|
}
|
||||||
|
|
||||||
|
- out:
|
||||||
|
XCloseDevice (xdisplay, xdevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-change_synaptics_speed (ClutterInputDevice *device,
|
||||||
|
- gdouble speed)
|
||||||
|
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
|
||||||
|
+ gboolean tap_enabled,
|
||||||
|
+ gboolean left_handed)
|
||||||
|
+{
|
||||||
|
+ guchar *tap_action;
|
||||||
|
+
|
||||||
|
+ tap_action = get_property (device, "Synaptics Tap Action",
|
||||||
|
+ XA_INTEGER, 8, 7);
|
||||||
|
+ if (!tap_action)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ 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);
|
||||||
|
+
|
||||||
|
+ change_x_device_left_handed (device, left_handed);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+change_x_device_speed (ClutterInputDevice *device,
|
||||||
|
+ gdouble speed)
|
||||||
|
{
|
||||||
|
MetaDisplay *display = meta_get_display ();
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
@@ -348,6 +370,23 @@ change_synaptics_speed (ClutterInputDevice *device,
|
||||||
|
XCloseDevice (xdisplay, xdevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+change_x_device_scroll_button (ClutterInputDevice *device,
|
||||||
|
+ guint button)
|
||||||
|
+{
|
||||||
|
+ guchar value;
|
||||||
|
+
|
||||||
|
+ value = button > 0 ? 1 : 0;
|
||||||
|
+ change_property (device, "Evdev Wheel Emulation",
|
||||||
|
+ XA_INTEGER, 8, &value, 1);
|
||||||
|
+ if (button > 0)
|
||||||
|
+ {
|
||||||
|
+ value = button;
|
||||||
|
+ change_property (device, "Evdev Wheel Emulation Button",
|
||||||
|
+ XA_INTEGER, 8, &value, 1);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Ensure that syndaemon dies together with us, to avoid running several of
|
||||||
|
* them */
|
||||||
|
static void
|
||||||
|
@@ -516,9 +555,10 @@ 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))
|
||||||
|
+ if (is_device_synaptics (device) ||
|
||||||
|
+ !is_device_libinput (device))
|
||||||
|
{
|
||||||
|
- change_synaptics_speed (device, speed);
|
||||||
|
+ change_x_device_speed (device, speed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -560,6 +600,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
|
||||||
|
g_object_unref (settings);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+ else if (!is_device_libinput (device) && device_type != CLUTTER_PAD_DEVICE)
|
||||||
|
+ {
|
||||||
|
+ change_x_device_left_handed (device, enabled);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
change_property (device, "libinput Left Handed Enabled",
|
||||||
|
XA_INTEGER, 8, &value, 1);
|
||||||
|
@@ -777,7 +822,14 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
|
||||||
|
{
|
||||||
|
gchar lock = button_lock;
|
||||||
|
|
||||||
|
+ if (!is_device_libinput (device))
|
||||||
|
+ {
|
||||||
|
+ change_x_device_scroll_button (device, button);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
change_scroll_method (device, SCROLL_METHOD_FIELD_BUTTON, button != 0);
|
||||||
|
+
|
||||||
|
change_property (device, "libinput Button Scrolling Button",
|
||||||
|
XA_CARDINAL, 32, &button, 1);
|
||||||
|
change_property (device, "libinput Button Scrolling Button Lock Enabled",
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue