Compare commits

...

11 Commits

Author SHA1 Message Date
eabdullin 37f54985fd Import from AlmaLinux stable repository 2024-05-31 17:55:33 +00:00
eabdullin 116fdf7355 Fix release to match upstream 2023-11-15 11:05:16 +03:00
eabdullin 253b53fd8c import CS mutter-3.32.2-72.el8 2023-11-15 08:04:15 +00:00
Andrew Lukoshko 8fc44febdf import CS mutter-3.32.2-69.el8 2023-06-28 15:00:54 +00:00
CentOS Sources 0c3a8ebce2 import mutter-3.32.2-68.el8 2023-05-16 07:15:49 +00:00
CentOS Sources 443a0d9f34 import mutter-3.32.2-67.el8_7 2022-11-08 13:53:00 +00:00
CentOS Sources 64719ccbd0 import mutter-3.32.2-66.el8 2022-11-08 10:44:07 +00:00
CentOS Sources ab739033fc import mutter-3.32.2-64.el8_6 2022-06-28 10:59:44 +00:00
CentOS Sources c9991e0b85 import mutter-3.32.2-63.el8 2022-05-10 07:32:03 +00:00
CentOS Sources 0d3173ceb7 import mutter-3.32.2-60.el8 2021-12-07 18:15:50 +00:00
CentOS Sources 894db4eba5 import mutter-3.32.2-57.el8 2021-09-09 22:33:21 +00:00
28 changed files with 12071 additions and 51 deletions

View File

@ -1 +0,0 @@
5068f43514a6212e4b5b5f7f856b7713cbc3d420 SOURCES/mutter-3.32.2.tar.xz

View File

@ -1,4 +1,4 @@
From 6108e0175932f74733c46ebe13db06998f26d4ba Mon Sep 17 00:00:00 2001
From fd67e75df470b50510b68ccf0f52b0b98d05c63f Mon Sep 17 00:00:00 2001
From: "Owen W. Taylor" <otaylor@fishsoup.net>
Date: Thu, 8 May 2014 18:44:15 -0400
Subject: [PATCH] Add support for quad-buffer stereo

View File

@ -1,4 +1,4 @@
From 471174ba6cf517baf8ff73e903202e1c73b6ec74 Mon Sep 17 00:00:00 2001
From 01803de944153694501cb64bb4250ba76ed945f5 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 19 Jan 2017 15:03:41 +0100
Subject: [PATCH] backends/x11: Support synaptics configuration
@ -6,11 +6,11 @@ Subject: [PATCH] backends/x11: Support synaptics configuration
The code is taken mostly as-is from g-s-d, so we can drag the
dead horse a bit longer.
---
src/backends/x11/meta-input-settings-x11.c | 268 +++++++++++++++++++++
1 file changed, 268 insertions(+)
src/backends/x11/meta-input-settings-x11.c | 267 +++++++++++++++++++++
1 file changed, 267 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 89f07ee1f..051a1c605 100644
index 89f07ee1f..b2f5ca060 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -26,6 +26,7 @@
@ -21,7 +21,7 @@ index 89f07ee1f..051a1c605 100644
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput2.h>
@@ -162,6 +163,180 @@ change_property (ClutterInputDevice *device,
@@ -162,6 +163,179 @@ change_property (ClutterInputDevice *device,
meta_XFree (data_ret);
}
@ -45,7 +45,6 @@ index 89f07ee1f..051a1c605 100644
+ gboolean left_handed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaX11Display *x11_display = display ? display->x11_display : NULL;
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XDevice *xdevice;
@ -69,8 +68,7 @@ index 89f07ee1f..051a1c605 100644
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+ clutter_x11_trap_x_errors();
+ buttons = g_new (guchar, buttons_capacity);
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
@ -90,7 +88,7 @@ index 89f07ee1f..051a1c605 100644
+ XSetDeviceButtonMapping (xdisplay, xdevice, buttons, n_buttons);
+ g_free (buttons);
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ if (clutter_x11_untrap_x_errors())
+ {
+ g_warning ("Could not set synaptics touchpad left-handed for %s",
+ clutter_input_device_get_device_name (device));
@ -105,7 +103,6 @@ index 89f07ee1f..051a1c605 100644
+ gdouble speed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaX11Display *x11_display = display ? display->x11_display : NULL;
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XDevice *xdevice;
@ -118,7 +115,10 @@ index 89f07ee1f..051a1c605 100644
+ 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;
+
@ -163,8 +163,7 @@ index 89f07ee1f..051a1c605 100644
+ denominator = -1;
+ }
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+ clutter_x11_trap_x_errors();
+
+ state = (XFeedbackState *) states;
+
@ -189,7 +188,7 @@ index 89f07ee1f..051a1c605 100644
+ state = (XFeedbackState *) ((char *) state + state->length);
+ }
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ if (clutter_x11_untrap_x_errors())
+ {
+ g_warning ("Could not set synaptics touchpad acceleration for %s",
+ clutter_input_device_get_device_name (device));
@ -202,7 +201,7 @@ index 89f07ee1f..051a1c605 100644
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -170,6 +345,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
@@ -170,6 +344,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */
guchar *available;
@ -216,7 +215,7 @@ index 89f07ee1f..051a1c605 100644
available = get_property (device, "libinput Send Events Modes Available",
XA_INTEGER, 8, 2);
if (!available)
@@ -222,6 +404,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
@@ -222,6 +403,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
@ -229,7 +228,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Accel Speed",
XInternAtom (xdisplay, "FLOAT", False),
32, &value, 1);
@@ -248,6 +436,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
@@ -248,6 +435,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
else
{
value = enabled ? 1 : 0;
@ -249,7 +248,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -271,6 +472,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
@@ -271,6 +471,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
@ -270,7 +269,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Tapping Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -293,6 +508,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
@@ -293,6 +507,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
{
guchar value = (inverted) ? 1 : 0;
@ -298,7 +297,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Natural Scrolling Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -306,6 +542,22 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
@@ -306,6 +541,22 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
guchar *current = NULL;
guchar *available = NULL;
@ -321,7 +320,7 @@ index 89f07ee1f..051a1c605 100644
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_EDGE])
@@ -335,6 +587,22 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
@@ -335,6 +586,22 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
guchar *current = NULL;
guchar *available = NULL;
@ -345,5 +344,5 @@ index 89f07ee1f..051a1c605 100644
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.21.0
2.36.1

View File

@ -0,0 +1,357 @@
From 2a2e870c139e2130b00d582546616269bca27458 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 4 Sep 2020 17:11:36 +0200
Subject: [PATCH] clutter: Backport of ::touch-mode
In upstream/master this is a ClutterSeat readonly property. Add it to
ClutterDeviceManager here, the mechanism and triggering is the same
though.
---
clutter/clutter/clutter-device-manager.c | 24 +++
clutter/clutter/clutter-device-manager.h | 2 +
.../evdev/clutter-device-manager-evdev.c | 179 ++++++++++++++++++
3 files changed, 205 insertions(+)
diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c
index c676384..e1cc455 100644
--- a/clutter/clutter/clutter-device-manager.c
+++ b/clutter/clutter/clutter-device-manager.c
@@ -62,6 +62,7 @@ enum
PROP_0,
PROP_BACKEND,
+ PROP_TOUCH_MODE,
PROP_LAST
};
@@ -108,6 +109,7 @@ clutter_device_manager_set_property (GObject *gobject,
priv->backend = g_value_get_object (value);
break;
+ case PROP_TOUCH_MODE:
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@@ -127,6 +129,10 @@ clutter_device_manager_get_property (GObject *gobject,
g_value_set_object (value, priv->backend);
break;
+ case PROP_TOUCH_MODE:
+ g_value_set_boolean (value, FALSE);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@@ -143,6 +149,12 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
P_("The ClutterBackend of the device manager"),
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+ obj_props[PROP_TOUCH_MODE] =
+ g_param_spec_boolean ("touch-mode",
+ P_("Touch mode"),
+ P_("Touch mode"),
+ FALSE,
+ CLUTTER_PARAM_READABLE);
gobject_class->set_property = clutter_device_manager_set_property;
gobject_class->get_property = clutter_device_manager_get_property;
@@ -579,3 +591,15 @@ clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_man
*settings = device_manager->priv->kbd_a11y_settings;
}
+
+gboolean
+clutter_device_manager_get_touch_mode (ClutterDeviceManager *device_manager)
+{
+ gboolean touch_mode;
+
+ g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), FALSE);
+
+ g_object_get (G_OBJECT (device_manager), "touch-mode", &touch_mode, NULL);
+
+ return touch_mode;
+}
diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h
index 1cbf030..a4a6271 100644
--- a/clutter/clutter/clutter-device-manager.h
+++ b/clutter/clutter/clutter-device-manager.h
@@ -155,6 +155,8 @@ void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *devic
CLUTTER_EXPORT
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
+CLUTTER_EXPORT
+gboolean clutter_device_manager_get_touch_mode (ClutterDeviceManager *device_manager);
G_END_DECLS
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index 84b0aad..78b5b64 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -108,6 +108,19 @@ struct _ClutterDeviceManagerEvdevPrivate
gint device_id_next;
GList *free_device_ids;
+
+ guint tablet_mode_switch_state : 1;
+ guint has_touchscreen : 1;
+ guint has_tablet_switch : 1;
+ guint has_pointer : 1;
+ guint touch_mode : 1;
+};
+
+enum
+{
+ PROP_0,
+ PROP_TOUCH_MODE,
+ N_PROPS
};
static void clutter_device_manager_evdev_event_extender_init (ClutterEventExtenderInterface *iface);
@@ -765,6 +778,34 @@ clutter_event_source_free (ClutterEventSource *source)
g_source_unref (g_source);
}
+static void
+update_touch_mode (ClutterDeviceManagerEvdev *manager_evdev)
+{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ gboolean touch_mode;
+
+ /* No touch mode if we don't have a touchscreen, easy */
+ if (!priv->has_touchscreen)
+ touch_mode = FALSE;
+ /* If we have a tablet mode switch, honor it being unset */
+ else if (priv->has_tablet_switch && !priv->tablet_mode_switch_state)
+ touch_mode = FALSE;
+ /* If tablet mode is enabled, go for it */
+ else if (priv->has_tablet_switch && priv->tablet_mode_switch_state)
+ touch_mode = TRUE;
+ /* If there is no tablet mode switch (eg. kiosk machines),
+ * assume touch-mode is mutually exclusive with pointers.
+ */
+ else
+ touch_mode = !priv->has_pointer;
+
+ if (priv->touch_mode != touch_mode)
+ {
+ priv->touch_mode = touch_mode;
+ g_object_notify (G_OBJECT (manager_evdev), "touch-mode");
+ }
+}
+
static void
evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev,
struct libinput_device *libinput_device)
@@ -942,19 +983,81 @@ flush_event_queue (void)
}
}
+static gboolean
+has_touchscreen (ClutterDeviceManagerEvdev *manager_evdev)
+{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ GSList *l;
+
+ for (l = priv->devices; l; l = l->next)
+ {
+ ClutterInputDeviceType device_type;
+
+ device_type = clutter_input_device_get_device_type (l->data);
+
+ if (device_type == CLUTTER_TOUCHSCREEN_DEVICE)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+device_type_is_pointer (ClutterInputDeviceType device_type)
+{
+ return (device_type == CLUTTER_POINTER_DEVICE ||
+ device_type == CLUTTER_TOUCHPAD_DEVICE);
+}
+
+static gboolean
+has_pointer (ClutterDeviceManagerEvdev *manager_evdev)
+{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ GSList *l;
+
+ for (l = priv->devices; l; l = l->next)
+ {
+ ClutterInputDeviceType device_type;
+
+ device_type = clutter_input_device_get_device_type (l->data);
+
+ if (device_type_is_pointer (device_type))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
process_base_event (ClutterDeviceManagerEvdev *manager_evdev,
struct libinput_event *event)
{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
ClutterInputDevice *device;
struct libinput_device *libinput_device;
gboolean handled = TRUE;
+ gboolean check_touch_mode;
switch (libinput_event_get_type (event))
{
case LIBINPUT_EVENT_DEVICE_ADDED:
libinput_device = libinput_event_get_device (event);
+ priv->has_touchscreen |=
+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_TOUCH);
+ priv->has_pointer |=
+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_POINTER);
+ check_touch_mode = priv->has_touchscreen | priv->has_pointer;
+
+ if (libinput_device_has_capability (libinput_device,
+ LIBINPUT_DEVICE_CAP_SWITCH) &&
+ libinput_device_switch_has_switch (libinput_device,
+ LIBINPUT_SWITCH_TABLET_MODE))
+ {
+ priv->has_tablet_switch = TRUE;
+ check_touch_mode = TRUE;
+ }
+
evdev_add_device (manager_evdev, libinput_device);
break;
@@ -966,7 +1069,17 @@ process_base_event (ClutterDeviceManagerEvdev *manager_evdev,
libinput_device = libinput_event_get_device (event);
+ check_touch_mode =
+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_TOUCH);
device = libinput_device_get_user_data (libinput_device);
+ if (check_touch_mode)
+ priv->has_touchscreen = has_touchscreen (manager_evdev);
+ if (device_type_is_pointer (clutter_input_device_get_device_type (device)))
+ {
+ priv->has_pointer = has_pointer (manager_evdev);
+ check_touch_mode = TRUE;
+ }
+
evdev_remove_device (manager_evdev,
CLUTTER_INPUT_DEVICE_EVDEV (device));
break;
@@ -975,6 +1088,9 @@ process_base_event (ClutterDeviceManagerEvdev *manager_evdev,
handled = FALSE;
}
+ if (check_touch_mode)
+ update_touch_mode (manager_evdev);
+
return handled;
}
@@ -1752,6 +1868,23 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
notify_pad_ring (device, time, number, source, group, mode, angle);
break;
}
+ case LIBINPUT_EVENT_SWITCH_TOGGLE:
+ {
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ struct libinput_event_switch *switch_event =
+ libinput_event_get_switch_event (event);
+ enum libinput_switch sw =
+ libinput_event_switch_get_switch (switch_event);
+ enum libinput_switch_state state =
+ libinput_event_switch_get_switch_state (switch_event);
+
+ if (sw == LIBINPUT_SWITCH_TABLET_MODE)
+ {
+ priv->tablet_mode_switch_state = (state == LIBINPUT_SWITCH_STATE_ON);
+ update_touch_mode (manager_evdev);
+ }
+ break;
+ }
default:
handled = FALSE;
}
@@ -1967,6 +2100,10 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
source = clutter_event_source_new (manager_evdev);
priv->event_source = source;
+
+ priv->has_touchscreen = has_touchscreen (manager_evdev);
+ priv->has_pointer = has_pointer (manager_evdev);
+ update_touch_mode (manager_evdev);
}
static void
@@ -2001,6 +2138,43 @@ clutter_device_manager_evdev_dispose (GObject *object)
G_OBJECT_CLASS (clutter_device_manager_evdev_parent_class)->dispose (object);
}
+static void
+clutter_device_manager_evdev_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_TOUCH_MODE:
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+clutter_device_manager_evdev_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ClutterDeviceManagerEvdev *manager_evdev;
+ ClutterDeviceManagerEvdevPrivate *priv;
+
+ manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (object);
+ priv = manager_evdev->priv;
+
+ switch (prop_id)
+ {
+ case PROP_TOUCH_MODE:
+ g_value_set_boolean (value, priv->touch_mode);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+
static void
clutter_device_manager_evdev_finalize (GObject *object)
{
@@ -2036,6 +2210,8 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass)
gobject_class->constructed = clutter_device_manager_evdev_constructed;
gobject_class->finalize = clutter_device_manager_evdev_finalize;
gobject_class->dispose = clutter_device_manager_evdev_dispose;
+ gobject_class->set_property = clutter_device_manager_evdev_set_property;
+ gobject_class->get_property = clutter_device_manager_evdev_get_property;
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
manager_class->add_device = clutter_device_manager_evdev_add_device;
@@ -2047,6 +2223,9 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass)
manager_class->get_supported_virtual_device_types = clutter_device_manager_evdev_get_supported_virtual_device_types;
manager_class->compress_motion = clutter_device_manager_evdev_compress_motion;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings;
+
+ g_object_class_override_property (gobject_class, PROP_TOUCH_MODE,
+ "touch-mode");
}
static void
--
2.29.2

View File

@ -0,0 +1,46 @@
From 7bcc274dbc6cb75814cce3e5c2e7f45cf25b0538 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 9 Feb 2021 17:59:08 +0100
Subject: [PATCH 1/2] clutter/stage-view: Hide double buffered shadowfb behind
envvar
It still results in worse performance than a single FBO based shadowfb,
so don't use it. It will need a new EGL extension for zero copy CPU
memory based FBO to be feasable.
---
clutter/clutter/clutter-stage-view.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index 5e5966d06..ec18db7b8 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -282,6 +282,14 @@ init_dma_buf_shadowfbs (ClutterStageView *view,
CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context);
CoglFramebuffer *initial_shadowfb;
+ if (g_strcmp0 (g_getenv ("MUTTER_DEBUG_ENABLE_DOUBLE_BUFFER_SHADOWFB"),
+ "1") != 0)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Double buffered shadowfb not enabled");
+ return FALSE;
+ }
+
if (!cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
@@ -390,8 +398,8 @@ init_shadowfb (ClutterStageView *view)
return;
}
- g_warning ("Failed to initialize double buffered shadow fb for %s: %s",
- priv->name, error->message);
+ g_debug ("Failed to initialize double buffered shadow fb for %s: %s",
+ priv->name, error->message);
g_clear_error (&error);
if (!init_fallback_shadowfb (view, cogl_context, width, height, &error))
--
2.29.2

View File

@ -0,0 +1,265 @@
From b0f3604cdb653ef133f9684adffeb6b93f6906f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 26 Jan 2022 10:51:07 +0100
Subject: [PATCH] compositor: Make sure _NET_WM_FRAME_DRAWN timestamp has the
right scope
The timestamp sent with _NET_WM_FRAME_DRAWN should be in "high
resolution X server timestamps", meaning they should have the same scope
as the built in X11 32 bit unsigned integer timestamps, i.e. overflow at
the same time.
This was not done correctly when mutter had determined the X server used
the monotonic clock, where it'd just forward the monotonic clock,
confusing any client using _NET_WM_FRAME_DRAWN and friends.
Fix this by 1) splitting the timestamp conversiot into an X11 case and a
display server case, where the display server case simply clamps the
monotonic clock, as it is assumed Xwayland is always usign the monotonic
clock, and 2) if we're a X11 compositing manager, if the X server is
using the monotonic clock, apply the same semantics as the display
server case and always just clamp, or if not, calculate the offset every
10 seconds, and offset the monotonic clock timestamp with the calculated
X server timestamp offset.
This fixes an issue that would occur if mutter (or rather GNOME Shell)
would have been started before a X11 timestamp overflow, after the
overflow happened. In this case, GTK3 clients would get unclamped
timestamps, and get very confused, resulting in frames queued several
weeks into the future.
---
src/compositor/compositor-private.h | 9 +-
src/compositor/compositor.c | 117 +++++++++++++++++++------
src/compositor/meta-window-actor-x11.c | 12 +--
3 files changed, 104 insertions(+), 34 deletions(-)
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index f7008751215d..4588a8af7f2f 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -49,6 +49,10 @@ struct _MetaCompositor
gboolean frame_has_updated_xsurfaces;
gboolean have_x11_sync_object;
+
+ gboolean xserver_uses_monotonic_clock;
+ int64_t xserver_time_query_time_us;
+ int64_t xserver_time_offset_us;
};
/* Wait 2ms after vblank before starting to draw next frame */
@@ -64,8 +68,9 @@ void meta_end_modal_for_plugin (MetaCompositor *compositor,
MetaPlugin *plugin,
guint32 timestamp);
-gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
- gint64 monotonic_time);
+int64_t
+meta_compositor_monotonic_to_high_res_xserver_time (MetaDisplay *display,
+ int64_t monotonic_time_us);
gboolean meta_compositor_window_is_stereo (MetaDisplay *display,
Window xwindow);
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index ce2c1b8a3bc1..a3fbe5d888f9 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -88,6 +88,40 @@
#include "wayland/meta-wayland-private.h"
#endif
+static inline int64_t
+us (int64_t us)
+{
+ return us;
+}
+
+static inline int64_t
+ms2us (int64_t ms)
+{
+ return us (ms * 1000);
+}
+
+static inline int64_t
+s2us (int64_t s)
+{
+ return ms2us(s * 1000);
+}
+
+/*
+ * This function takes a 64 bit time stamp from the monotonic clock, and clamps
+ * it to the scope of the X server clock, without losing the granularity.
+ */
+static inline int64_t
+meta_translate_to_high_res_xserver_time (int64_t time_us)
+{
+ int64_t us;
+ int64_t ms;
+
+ us = time_us % 1000;
+ ms = time_us / 1000;
+
+ return ms2us (ms & 0xffffffff) + us;
+}
+
static void
on_presented (ClutterStage *stage,
CoglFrameEvent event,
@@ -612,6 +646,37 @@ meta_compositor_select_stereo_notify (MetaDisplay *display,
}
}
+static void
+determine_server_clock_source (MetaCompositor *compositor)
+{
+ MetaDisplay *display = compositor->display;
+ MetaX11Display *x11_display = display->x11_display;
+ uint32_t server_time_ms;
+ int64_t server_time_us;
+ int64_t translated_monotonic_now_us;
+
+ if (meta_is_wayland_compositor ())
+ {
+ compositor->xserver_uses_monotonic_clock = TRUE;
+ return;
+ }
+
+ server_time_ms = meta_x11_display_get_current_time_roundtrip (x11_display);
+ server_time_us = ms2us (server_time_ms);
+ translated_monotonic_now_us =
+ meta_translate_to_high_res_xserver_time (g_get_monotonic_time ());
+
+ /* If the server time offset is within a second of the monotonic time, we
+ * assume that they are identical. This seems like a big margin, but we want
+ * to be as robust as possible even if the system is under load and our
+ * processing of the server response is delayed.
+ */
+ if (ABS (server_time_us - translated_monotonic_now_us) < s2us (1))
+ compositor->xserver_uses_monotonic_clock = TRUE;
+ else
+ compositor->xserver_uses_monotonic_clock = FALSE;
+}
+
void
meta_compositor_manage (MetaCompositor *compositor)
{
@@ -622,6 +687,9 @@ meta_compositor_manage (MetaCompositor *compositor)
if (display->x11_display)
{
xdisplay = display->x11_display->xdisplay;
+
+ determine_server_clock_source (compositor);
+
meta_x11_display_set_cm_selection (display->x11_display);
compositor->stereo_tree_ext = display_has_stereo_tree_ext (display->x11_display);
@@ -1593,7 +1661,7 @@ meta_compositor_flash_window (MetaCompositor *compositor,
}
/**
- * meta_compositor_monotonic_time_to_server_time:
+ * meta_compositor_monotonic_to_high_res_xserver_time:
* @display: a #MetaDisplay
* @monotonic_time: time in the units of g_get_monotonic_time()
*
@@ -1606,38 +1674,35 @@ meta_compositor_flash_window (MetaCompositor *compositor,
* a time representation with high accuracy. If there is not a common
* time source, then the time synchronization will be less accurate.
*/
-gint64
-meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
- gint64 monotonic_time)
+int64_t
+meta_compositor_monotonic_to_high_res_xserver_time (MetaDisplay *display,
+ int64_t monotonic_time_us)
{
MetaCompositor *compositor = display->compositor;
+ int64_t now_us;
+
+ if (compositor->xserver_uses_monotonic_clock)
+ return meta_translate_to_high_res_xserver_time (monotonic_time_us);
- if (compositor->server_time_query_time == 0 ||
- (!compositor->server_time_is_monotonic_time &&
- monotonic_time > compositor->server_time_query_time + 10*1000*1000)) /* 10 seconds */
+ now_us = g_get_monotonic_time ();
+
+ if (compositor->xserver_time_query_time_us == 0 ||
+ now_us > (compositor->xserver_time_query_time_us + s2us (10)))
{
- guint32 server_time = meta_display_get_current_time_roundtrip (display);
- gint64 server_time_usec = (gint64)server_time * 1000;
- gint64 current_monotonic_time = g_get_monotonic_time ();
- compositor->server_time_query_time = current_monotonic_time;
-
- /* If the server time is within a second of the monotonic time,
- * we assume that they are identical. This seems like a big margin,
- * but we want to be as robust as possible even if the system
- * is under load and our processing of the server response is
- * delayed.
- */
- if (server_time_usec > current_monotonic_time - 1000*1000 &&
- server_time_usec < current_monotonic_time + 1000*1000)
- compositor->server_time_is_monotonic_time = TRUE;
+ MetaDisplay *display = compositor->display;
+ MetaX11Display *x11_display = display->x11_display;
+ uint32_t xserver_time_ms;
+ int64_t xserver_time_us;
- compositor->server_time_offset = server_time_usec - current_monotonic_time;
+ compositor->xserver_time_query_time_us = now_us;
+
+ xserver_time_ms =
+ meta_x11_display_get_current_time_roundtrip (x11_display);
+ xserver_time_us = ms2us (xserver_time_ms);
+ compositor->xserver_time_offset_us = xserver_time_us - now_us;
}
- if (compositor->server_time_is_monotonic_time)
- return monotonic_time;
- else
- return monotonic_time + compositor->server_time_offset;
+ return monotonic_time_us + compositor->xserver_time_offset_us;
}
void
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index a364323fe057..2b9c25510dc9 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -105,8 +105,8 @@ do_send_frame_drawn (MetaWindowActorX11 *actor_x11,
XClientMessageEvent ev = { 0, };
frame->frame_drawn_time =
- meta_compositor_monotonic_time_to_server_time (display,
- g_get_monotonic_time ());
+ meta_compositor_monotonic_to_high_res_xserver_time (display,
+ g_get_monotonic_time ());
actor_x11->frame_drawn_time = frame->frame_drawn_time;
ev.type = ClientMessage;
@@ -147,8 +147,8 @@ do_send_frame_timings (MetaWindowActorX11 *actor_x11,
if (presentation_time != 0)
{
int64_t presentation_time_server =
- meta_compositor_monotonic_time_to_server_time (display,
- presentation_time);
+ meta_compositor_monotonic_to_high_res_xserver_time (display,
+ presentation_time);
int64_t presentation_time_offset = presentation_time_server - frame->frame_drawn_time;
if (presentation_time_offset == 0)
presentation_time_offset = 1;
@@ -246,8 +246,8 @@ queue_send_frame_messages_timeout (MetaWindowActorX11 *actor_x11)
}
current_time =
- meta_compositor_monotonic_time_to_server_time (display,
- g_get_monotonic_time ());
+ meta_compositor_monotonic_to_high_res_xserver_time (display,
+ g_get_monotonic_time ());
interval = (int) (1000000 / refresh_rate) * 6;
offset = MAX (0, actor_x11->frame_drawn_time + interval - current_time) / 1000;
--
2.33.1

View File

@ -0,0 +1,163 @@
From bfd49687aa862a7e69d0d7fe76f803ae180d40c2 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 | 4 ++++
6 files changed, 45 insertions(+), 15 deletions(-)
diff --git a/src/core/events.c b/src/core/events.c
index 5b8e49fc79..19d701779b 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -207,6 +207,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 8b23d76ce7..84f46bcf8e 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -753,14 +753,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 91fe376ffe..dcf420201f 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -362,6 +362,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)
@@ -384,13 +407,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 3a744d0580..da20e69d8d 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -82,4 +82,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 a593f0a7b7..24a68f1e06 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -565,3 +565,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 2a0aa11400..b5281d2014 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -87,6 +87,10 @@ META_EXPORT_TEST
void meta_wayland_compositor_schedule_surface_association (MetaWaylandCompositor *compositor,
int id,
MetaWindow *window);
+
+gboolean meta_wayland_compositor_handle_text_input_event (MetaWaylandCompositor *compositor,
+ const ClutterEvent *event);
+
META_EXPORT_TEST
void meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
int id,
--
2.40.1

View File

@ -0,0 +1,248 @@
From 7f6f326a1bb96aad0b7aea9c4d7e257bf53c026c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 21 Feb 2020 21:03:16 +0100
Subject: [PATCH] display: Make check-alive timeout configureable
The check-alive feature is there for the user to be able to terminate
frozen applications more easily. However, sometimes applications are
implemented in a way where they fail to be reply to ping requests in a
timely manner, resulting in that, to the compositor, they are
indistinguishable from clients that have frozen indefinitely.
When using an application that has these issues, the GUI showed in
response to the failure to respond to ping requests can become annoying,
as it disrupts the visual presentation of the application.
To allow users to work-around these issues, add a setting allowing them
to configure the timeout waited until an application is considered
frozen, or disabling the check completely.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1080
---
data/org.gnome.mutter.gschema.xml.in | 10 ++++
src/core/display.c | 18 ++++----
src/core/prefs.c | 68 ++++++++++++++++++++++++++++
src/meta/prefs.h | 3 ++
4 files changed, 90 insertions(+), 9 deletions(-)
diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in
index 6cbd9c1b5..4d37b1488 100644
--- a/data/org.gnome.mutter.gschema.xml.in
+++ b/data/org.gnome.mutter.gschema.xml.in
@@ -123,6 +123,16 @@
</description>
</key>
+ <key name="check-alive-timeout" type="u">
+ <default>5000</default>
+ <summary>Timeout for check-alive ping</summary>
+ <description>
+ Number of milliseconds a client has to respond to a ping request in
+ order to not be detected as frozen. Using 0 will disable the alive check
+ completely.
+ </description>
+ </key>
+
<child name="keybindings" schema="org.gnome.mutter.keybindings"/>
</schema>
diff --git a/src/core/display.c b/src/core/display.c
index eb7dc43b6..c30a03385 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1923,12 +1923,6 @@ meta_set_syncing (gboolean setting)
}
}
-/*
- * How long, in milliseconds, we should wait after pinging a window
- * before deciding it's not going to get back to us.
- */
-#define PING_TIMEOUT_DELAY 5000
-
/**
* meta_display_ping_timeout:
* @data: All the information about this ping. It is a #MetaPingData
@@ -1986,6 +1980,11 @@ meta_display_ping_window (MetaWindow *window,
{
MetaDisplay *display = window->display;
MetaPingData *ping_data;
+ unsigned int check_alive_timeout;
+
+ check_alive_timeout = meta_prefs_get_check_alive_timeout ();
+ if (check_alive_timeout == 0)
+ return;
if (serial == 0)
{
@@ -1999,9 +1998,10 @@ meta_display_ping_window (MetaWindow *window,
ping_data = g_new (MetaPingData, 1);
ping_data->window = window;
ping_data->serial = serial;
- ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
- meta_display_ping_timeout,
- ping_data);
+ ping_data->ping_timeout_id =
+ g_timeout_add (check_alive_timeout,
+ meta_display_ping_timeout,
+ ping_data);
g_source_set_name_by_id (ping_data->ping_timeout_id, "[mutter] meta_display_ping_timeout");
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 3f0db8afc..4892406ce 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -99,6 +99,7 @@ static gboolean bell_is_visible = FALSE;
static gboolean bell_is_audible = TRUE;
static gboolean gnome_accessibility = FALSE;
static gboolean gnome_animations = TRUE;
+static unsigned int check_alive_timeout = 5000;
static char *cursor_theme = NULL;
/* cursor_size will, when running as an X11 compositing window manager, be the
* actual cursor size, multiplied with the global window scaling factor. On
@@ -213,6 +214,12 @@ typedef struct
gint *target;
} MetaIntPreference;
+typedef struct
+{
+ MetaBasePreference base;
+ unsigned int *target;
+} MetaUintPreference;
+
/* All preferences that are not keybindings must be listed here,
* plus in the GSettings schemas and the MetaPreference enum.
@@ -491,6 +498,18 @@ static MetaIntPreference preferences_int[] =
{ { NULL, 0, 0 }, NULL },
};
+static MetaUintPreference preferences_uint[] =
+ {
+ {
+ { "check-alive-timeout",
+ SCHEMA_MUTTER,
+ META_PREF_CHECK_ALIVE_TIMEOUT,
+ },
+ &check_alive_timeout,
+ },
+ { { NULL, 0, 0 }, NULL },
+ };
+
static void
handle_preference_init_enum (void)
{
@@ -613,6 +632,21 @@ handle_preference_init_int (void)
}
}
+static void
+handle_preference_init_uint (void)
+{
+ MetaUintPreference *cursor = preferences_uint;
+
+ while (cursor->base.key != NULL)
+ {
+ if (cursor->target)
+ *cursor->target = g_settings_get_uint (SETTINGS (cursor->base.schema),
+ cursor->base.key);
+
+ ++cursor;
+ }
+}
+
static void
handle_preference_update_enum (GSettings *settings,
gchar *key)
@@ -788,6 +822,28 @@ handle_preference_update_int (GSettings *settings,
}
}
+static void
+handle_preference_update_uint (GSettings *settings,
+ char *key)
+{
+ MetaUintPreference *cursor = preferences_uint;
+ unsigned int new_value;
+
+ while (cursor->base.key && strcmp (key, cursor->base.key) != 0)
+ ++cursor;
+
+ if (!cursor->base.key || !cursor->target)
+ return;
+
+ new_value = g_settings_get_uint (SETTINGS (cursor->base.schema), key);
+
+ if (*cursor->target != new_value)
+ {
+ *cursor->target = new_value;
+ queue_changed (cursor->base.pref);
+ }
+}
+
/****************************************************************************/
/* Listeners. */
@@ -964,6 +1020,7 @@ meta_prefs_init (void)
handle_preference_init_string ();
handle_preference_init_string_array ();
handle_preference_init_int ();
+ handle_preference_init_uint ();
init_bindings ();
}
@@ -1017,6 +1074,8 @@ settings_changed (GSettings *settings,
handle_preference_update_bool (settings, key);
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32))
handle_preference_update_int (settings, key);
+ else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT32))
+ handle_preference_update_uint (settings, key);
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY))
handle_preference_update_string_array (settings, key);
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
@@ -1640,6 +1699,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_AUTO_MAXIMIZE:
return "AUTO_MAXIMIZE";
+
+ case META_PREF_CHECK_ALIVE_TIMEOUT:
+ return "CHECK_ALIVE_TIMEOUT";
}
return "(unknown)";
@@ -1966,6 +2028,12 @@ meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
*combo = overlay_key_combo;
}
+unsigned int
+meta_prefs_get_check_alive_timeout (void)
+{
+ return check_alive_timeout;
+}
+
const char *
meta_prefs_get_iso_next_group_option (void)
{
diff --git a/src/meta/prefs.h b/src/meta/prefs.h
index 9664b5c07..f42d1c63c 100644
--- a/src/meta/prefs.h
+++ b/src/meta/prefs.h
@@ -103,6 +103,7 @@ typedef enum
META_PREF_AUTO_MAXIMIZE,
META_PREF_CENTER_NEW_WINDOWS,
META_PREF_DRAG_THRESHOLD,
+ META_PREF_CHECK_ALIVE_TIMEOUT,
} MetaPreference;
typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
@@ -475,4 +476,6 @@ gboolean meta_prefs_bell_is_audible (void);
META_EXPORT
GDesktopVisualBellType meta_prefs_get_visual_bell_type (void);
+unsigned int meta_prefs_get_check_alive_timeout (void);
+
#endif
--
2.28.0

View File

@ -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

View File

@ -0,0 +1,211 @@
From 19024a5b2eff02b22cdb3fc90142f522dd361996 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 27 Nov 2020 09:03:38 +0100
Subject: [PATCH] monitor-config-manager: Handle multiple builtin panels
gracefully
While multiple built-in panels isn't actually supported in any
meaningful manner, if we would ever end up with such a situation, e.g.
due to kernel bugs[0], we shouldn't crash when trying to set an
'external only' without any external monitors.
While we could handle this with more degraded functionality (e.g. don't
support the 'switch' method of monitor configuration at all), handle it
by simply not trying to switch to external-only when there are no,
according to the kernel, external monitors available. This would e.g.
still allow betwene 'mirror-all', and 'linear' switches.
The crash itself was disguised as an arbitrary X11 BadValue error, due
to mutter trying to resize the root window to 0x0, as the monitor
configuration that was applied consisted of zero logical monitors, thus
was effectively empty.
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1896904
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1899260
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1607>
---
src/backends/meta-monitor-config-manager.c | 3 +
src/tests/monitor-unit-tests.c | 145 +++++++++++++++++++++
2 files changed, 148 insertions(+)
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index bc1a39db8..d62bad52d 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1157,6 +1157,9 @@ create_for_switch_config_external (MetaMonitorConfigManager *config_manager)
x += logical_monitor_config->layout.width;
}
+ if (!logical_monitor_configs)
+ return NULL;
+
return meta_monitors_config_new (monitor_manager,
logical_monitor_configs,
layout_mode,
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index f47544b03..725f84173 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -3175,6 +3175,149 @@ meta_test_monitor_non_upright_panel (void)
check_monitor_configuration (&test_case);
}
+static void
+meta_test_monitor_switch_external_without_external (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = 0,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_laptop_panel = TRUE
+ },
+ {
+ .crtc = 1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 1 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_laptop_panel = TRUE
+ }
+ },
+ .n_outputs = 2,
+ .crtcs = {
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ }
+ },
+ .n_crtcs = 2
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 1 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 1,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ }
+ },
+ .n_monitors = 2,
+ .logical_monitors = {
+ {
+ .monitors = { 0 },
+ .n_monitors = 1,
+ .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
+ .scale = 1
+ },
+ {
+ .monitors = { 1 },
+ .n_monitors = 1,
+ .layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
+ .scale = 1
+ }
+ },
+ .n_logical_monitors = 2,
+ .primary_logical_monitor = 0,
+ .n_outputs = 2,
+ .crtcs = {
+ {
+ .current_mode = 0,
+ },
+ {
+ .current_mode = 0,
+ },
+ },
+ .n_crtcs = 2,
+ .n_tiled_monitors = 0,
+ .screen_width = 2048,
+ .screen_height = 768
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+ MetaBackend *backend = meta_get_backend ();
+ MetaMonitorManager *monitor_manager =
+ meta_backend_get_monitor_manager (backend);
+
+ test_setup = create_monitor_test_setup (&test_case.setup,
+ MONITOR_TEST_FLAG_NO_STORED);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
+
+ meta_monitor_manager_switch_config (monitor_manager,
+ META_MONITOR_SWITCH_CONFIG_EXTERNAL);
+ check_monitor_configuration (&test_case);
+
+ check_monitor_test_clients_state ();
+}
+
static void
meta_test_monitor_custom_vertical_config (void)
{
@@ -5969,6 +6112,8 @@ init_monitor_tests (void)
meta_test_monitor_preferred_non_first_mode);
add_monitor_test ("/backends/monitor/non-upright-panel",
meta_test_monitor_non_upright_panel);
+ add_monitor_test ("/backends/monitor/switch-external-without-external",
+ meta_test_monitor_switch_external_without_external);
add_monitor_test ("/backends/monitor/custom/vertical-config",
meta_test_monitor_custom_vertical_config);
--
2.29.2

View File

@ -0,0 +1,81 @@
From cf16c0d16b42215f35dcede6163235ad5ec1734b 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] 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)
---
src/backends/native/meta-output-kms.c | 45 ++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
index f3cc543c4d..44c25c5648 100644
--- a/src/backends/native/meta-output-kms.c
+++ b/src/backends/native/meta-output-kms.c
@@ -505,6 +505,43 @@ compare_modes (const void *one,
return g_strcmp0 (b->name, a->name);
}
+static gboolean
+are_all_modes_equally_sized (MetaOutput *output)
+{
+ MetaCrtcMode *base = output->modes[0];
+ int i;
+
+ for (i = 1; i < output->n_modes; i++)
+ {
+ MetaCrtcMode *crtc_mode = output->modes[i];
+
+ if (base->width != crtc_mode->width ||
+ base->height != crtc_mode->height)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+maybe_add_fallback_modes (MetaOutput *output,
+ MetaGpuKms *gpu_kms)
+{
+ MetaOutputKms *output_kms = output->driver_private;
+
+ if (!output_kms->has_scaling)
+ return;
+
+ if (output->n_modes == 0)
+ return;
+
+ if (output_kms->connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
+ !are_all_modes_equally_sized (output))
+ return;
+
+ add_common_modes (output, gpu_kms);
+}
+
static gboolean
init_output_modes (MetaOutput *output,
MetaGpuKms *gpu_kms,
@@ -528,13 +565,7 @@ init_output_modes (MetaOutput *output,
output->preferred_mode = output->modes[i];
}
- /* FIXME: MSC feature bit? */
- /* Presume that if the output supports scaling, then we have
- * a panel fitter capable of adjusting any mode to suit.
- */
- if (output_kms->has_scaling)
- add_common_modes (output, gpu_kms);
-
+ maybe_add_fallback_modes (output, gpu_kms);
if (!output->modes)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--
2.37.1

View File

@ -0,0 +1,172 @@
From 66e2e438b8796351a72bfec2024ee41bbde77780 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 6 Apr 2023 18:40:41 +0200
Subject: [PATCH] renderer-native: Queue fail safe callbacks when mode set
failed
This allows to recover, e.g. Ctrl-Alt-F# and using any other monitor
that managed to turn on.
---
src/backends/native/meta-crtc-kms.c | 19 ++++++++++
src/backends/native/meta-crtc-kms.h | 5 +++
src/backends/native/meta-gpu-kms.c | 10 +++++
src/backends/native/meta-renderer-native.c | 43 ++++++++++++++++++++++
4 files changed, 77 insertions(+)
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
index 8374376d5..44f271eb5 100644
--- a/src/backends/native/meta-crtc-kms.c
+++ b/src/backends/native/meta-crtc-kms.c
@@ -52,6 +52,8 @@ typedef struct _MetaCrtcKms
* value: owned GArray* (uint64_t modifier), or NULL
*/
GHashTable *formats_modifiers;
+
+ gboolean is_active;
} MetaCrtcKms;
/**
@@ -540,3 +542,20 @@ meta_create_kms_crtc (MetaGpuKms *gpu_kms,
return crtc;
}
+
+void
+meta_crtc_kms_set_active (MetaCrtc *crtc,
+ gboolean is_active)
+{
+ MetaCrtcKms *crtc_kms = crtc->driver_private;
+
+ crtc_kms->is_active = is_active;
+}
+
+gboolean
+meta_crtc_kms_is_active (MetaCrtc *crtc)
+{
+ MetaCrtcKms *crtc_kms = crtc->driver_private;
+
+ return crtc_kms->is_active;
+}
diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h
index 456f4400a..666aebcaf 100644
--- a/src/backends/native/meta-crtc-kms.h
+++ b/src/backends/native/meta-crtc-kms.h
@@ -58,4 +58,9 @@ MetaCrtc * meta_create_kms_crtc (MetaGpuKms *gpu_kms,
drmModeCrtc *drm_crtc,
unsigned int crtc_index);
+void meta_crtc_kms_set_active (MetaCrtc *crtc,
+ gboolean is_active);
+
+gboolean meta_crtc_kms_is_active (MetaCrtc *crtc);
+
#endif /* META_CRTC_KMS_H */
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index dc93abb7b..5f7a48730 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -169,9 +169,12 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
else
g_warning ("Failed to disable CRTC");
g_free (connectors);
+ meta_crtc_kms_set_active (crtc, FALSE);
return FALSE;
}
+ meta_crtc_kms_set_active (crtc, !!mode);
+
g_free (connectors);
return TRUE;
@@ -278,6 +281,13 @@ meta_gpu_kms_flip_crtc (MetaGpuKms *gpu_kms,
g_assert (meta_monitor_manager_get_power_save_mode (monitor_manager) ==
META_POWER_SAVE_ON);
+ if (!meta_crtc_kms_is_active (crtc))
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+ "CRTC is not active");
+ return FALSE;
+ }
+
get_crtc_drm_connectors (gpu, crtc, &connectors, &n_connectors);
g_assert (n_connectors > 0);
g_free (connectors);
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 62ca4bcbd..76e311508 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -217,6 +217,9 @@ struct _MetaRendererNative
GList *power_save_page_flip_closures;
guint power_save_page_flip_source_id;
+
+ GList *fail_safe_page_flip_closures;
+ guint fail_safe_page_flip_source_id;
};
static void
@@ -2048,6 +2051,34 @@ flip_crtc (MetaLogicalMonitor *logical_monitor,
}
}
+static gboolean
+fail_safe_page_flip_cb (gpointer user_data)
+{
+ MetaRendererNative *renderer_native = user_data;
+
+ g_list_free_full (renderer_native->fail_safe_page_flip_closures,
+ (GDestroyNotify) g_closure_unref);
+ renderer_native->fail_safe_page_flip_closures = NULL;
+ renderer_native->fail_safe_page_flip_source_id = 0;
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+queue_fail_safe_page_flip (MetaRendererNative *renderer_native,
+ GClosure *flip_closure)
+{
+ if (!renderer_native->fail_safe_page_flip_source_id)
+ {
+ renderer_native->fail_safe_page_flip_source_id =
+ g_idle_add (fail_safe_page_flip_cb, renderer_native);
+ }
+
+ renderer_native->fail_safe_page_flip_closures =
+ g_list_prepend (renderer_native->fail_safe_page_flip_closures,
+ g_closure_ref (flip_closure));
+}
+
static void
meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
{
@@ -2093,6 +2124,11 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
*/
if (!data.did_flip && data.did_mode_set)
meta_onscreen_native_swap_drm_fb (onscreen);
+ else if (!data.did_flip)
+ {
+ meta_onscreen_native_swap_drm_fb (onscreen);
+ queue_fail_safe_page_flip (renderer_native, flip_closure);
+ }
}
else
{
@@ -4549,6 +4585,13 @@ meta_renderer_native_finalize (GObject *object)
g_source_remove (renderer_native->power_save_page_flip_source_id);
}
+ if (renderer_native->fail_safe_page_flip_closures)
+ {
+ g_list_free_full (renderer_native->fail_safe_page_flip_closures,
+ (GDestroyNotify) g_closure_unref);
+ g_source_remove (renderer_native->fail_safe_page_flip_source_id);
+ }
+
g_hash_table_destroy (renderer_native->gpu_datas);
g_clear_object (&renderer_native->gles3);
--
2.39.2

View File

@ -0,0 +1,150 @@
From 9269b09028ae51c7bb74e9cc9aefafd8eaa882d6 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Tue, 16 Apr 2019 23:35:28 +0200
Subject: [PATCH 1/2] wayland: Move check for present window out of the
actor-surface class
All child classes of `MetaWaylandShellSurface` as well as
`MetaWaylandSurfaceRoleXWayland` should only sync their actor if
their toplevel surface has a window. Currently this check is done
in the actor-surface class, but not all surface classes have a
toplevel window, e.g. dnd-surfaces.
Move the check to the right places.
For subsurfaces this assumes that the subsurface is not the child of
a window-less surface (like, as stated above, e.g. a dnd-surface).
If we want to support subsurfaces of window-less surfaces in the future
we have to extend the check here.
But as this is not a regression, ignore this case for now.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
(cherry picked from commit 7e2a0ede16bed5671fe55d3d81ccc9f82eebd94b)
---
src/wayland/meta-wayland-actor-surface.c | 7 -------
src/wayland/meta-wayland-shell-surface.c | 20 ++++++++++++++++++++
src/wayland/meta-wayland-subsurface.c | 5 ++++-
src/wayland/meta-xwayland.c | 18 ++++++++++++++++++
4 files changed, 42 insertions(+), 8 deletions(-)
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 037dd901ab..e2143e51f1 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -295,9 +295,6 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
META_WAYLAND_ACTOR_SURFACE (surface_role);
MetaWaylandActorSurfacePrivate *priv =
meta_wayland_actor_surface_get_instance_private (actor_surface);
- MetaWaylandSurface *surface =
- meta_wayland_surface_role_get_surface (surface_role);
- MetaWaylandSurface *toplevel_surface;
if (!wl_list_empty (&pending->frame_callback_list) &&
priv->actor &&
@@ -311,10 +308,6 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_actor_surface_queue_frame_callbacks (actor_surface, pending);
- toplevel_surface = meta_wayland_surface_get_toplevel (surface);
- if (!toplevel_surface || !toplevel_surface->window)
- return;
-
meta_wayland_actor_surface_sync_actor_state (actor_surface);
}
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
index 04f2aaeea8..f8354ab7c5 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -175,6 +175,22 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role
window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
}
+static void
+meta_wayland_shell_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
+{
+ MetaWaylandSurfaceRole *surface_role =
+ META_WAYLAND_SURFACE_ROLE (actor_surface);
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_shell_surface_parent_class);
+ MetaWaylandSurface *toplevel_surface;
+
+ toplevel_surface = meta_wayland_surface_get_toplevel (surface);
+ if (toplevel_surface && toplevel_surface->window)
+ actor_surface_class->sync_actor_state (actor_surface);
+}
+
static void
meta_wayland_shell_surface_init (MetaWaylandShellSurface *role)
{
@@ -185,6 +201,10 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
{
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (klass);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
surface_role_class->commit = meta_wayland_shell_surface_surface_commit;
+ actor_surface_class->sync_actor_state =
+ meta_wayland_shell_surface_sync_actor_state;
}
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c
index c7059b99a2..9a7ff3ec12 100644
--- a/src/wayland/meta-wayland-subsurface.c
+++ b/src/wayland/meta-wayland-subsurface.c
@@ -199,8 +199,11 @@ meta_wayland_subsurface_sync_actor_state (MetaWaylandActorSurface *actor_surface
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_subsurface_parent_class);
+ MetaWaylandSurface *toplevel_surface;
- actor_surface_class->sync_actor_state (actor_surface);
+ toplevel_surface = meta_wayland_surface_get_toplevel (surface);
+ if (toplevel_surface && toplevel_surface->window)
+ actor_surface_class->sync_actor_state (actor_surface);
sync_actor_subsurface_state (surface);
}
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 6e4b9a8ffd..b71c638d93 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -794,6 +794,20 @@ xwayland_surface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
return meta_wayland_surface_role_get_surface (surface_role);
}
+static void
+xwayland_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
+{
+ MetaWaylandSurfaceRole *surface_role =
+ META_WAYLAND_SURFACE_ROLE (actor_surface);
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_surface_role_xwayland_parent_class);
+
+ if (surface->window)
+ actor_surface_class->sync_actor_state (actor_surface);
+}
+
static void
meta_wayland_surface_role_xwayland_init (MetaWaylandSurfaceRoleXWayland *role)
{
@@ -804,9 +818,13 @@ meta_wayland_surface_role_xwayland_class_init (MetaWaylandSurfaceRoleXWaylandCla
{
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (klass);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
surface_role_class->get_toplevel = xwayland_surface_get_toplevel;
+ actor_surface_class->sync_actor_state = xwayland_surface_sync_actor_state;
+
xwayland_surface_signals[XWAYLAND_SURFACE_WINDOW_ASSOCIATED] =
g_signal_new ("window-associated",
G_TYPE_FROM_CLASS (klass),
--
2.31.1

View File

@ -0,0 +1,33 @@
From d33a244603d1dd63e2e25255af98f489c65645f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 29 Aug 2022 16:01:48 +0200
Subject: [PATCH] workspace: Downgrade assert to warning when adding window
An extension can by accident cause us to end up in a state where we try
to add the same window to a workspace twice. When this happens we
shouldn't crash, but instead complain loudly.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/992
Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/157
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1692>
---
src/core/workspace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 58fcfa78c5..ed16a83098 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -370,7 +370,8 @@ void
meta_workspace_add_window (MetaWorkspace *workspace,
MetaWindow *window)
{
- g_assert (g_list_find (workspace->mru_list, window) == NULL);
+ g_return_if_fail (g_list_find (workspace->mru_list, window) == NULL);
+
workspace->mru_list = g_list_prepend (workspace->mru_list, window);
workspace->windows = g_list_prepend (workspace->windows, window);
--
2.37.1

View File

@ -0,0 +1,304 @@
From d366b2bc4e89ed5807f0221afc25e66cb3d289ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 9 Dec 2020 11:23:37 +0100
Subject: [PATCH 1/2] xwayland: Don't spew warnings when looking for X11
displays
It's not important, so only show it when doing MUTTER_DEBUG=wayland.
Instead report what display numbers were eventually found.
---
src/wayland/meta-xwayland.c | 123 +++++++++++++++++++++++++++---------
1 file changed, 92 insertions(+), 31 deletions(-)
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 15c85df69..699d5561c 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -146,9 +146,10 @@ meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface)
}
static gboolean
-try_display (int display,
- char **filename_out,
- int *fd_out)
+try_display (int display,
+ char **filename_out,
+ int *fd_out,
+ GError **error)
{
gboolean ret = FALSE;
char *filename;
@@ -164,11 +165,32 @@ try_display (int display,
char pid[11];
char *end;
pid_t other;
+ int read_bytes;
fd = open (filename, O_CLOEXEC, O_RDONLY);
- if (fd < 0 || read (fd, pid, 11) != 11)
+ if (fd < 0)
{
- g_warning ("can't read lock file %s: %m", filename);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to open lock file %s: %s",
+ filename, g_strerror (errno));
+ goto out;
+ }
+
+ read_bytes = read (fd, pid, 11);
+ if (read_bytes != 11)
+ {
+ if (read_bytes < 0)
+ {
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to read lock file %s: %s",
+ filename, g_strerror (errno));
+ }
+ else
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to read lock file %s",
+ filename);
+ }
goto out;
}
close (fd);
@@ -178,7 +200,8 @@ try_display (int display,
other = strtol (pid, &end, 0);
if (end != pid + 10)
{
- g_warning ("can't parse lock file %s", filename);
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "Can't parse lock file %s", filename);
goto out;
}
@@ -187,18 +210,23 @@ try_display (int display,
/* Process is dead. Try unlinking the lock file and trying again. */
if (unlink (filename) < 0)
{
- g_warning ("failed to unlink stale lock file %s: %m", filename);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to unlink stale lock file %s: %m", filename);
goto out;
}
goto again;
}
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Lock file %s already occupied", filename);
goto out;
}
else if (fd < 0)
{
- g_warning ("failed to create lock file %s: %m", filename);
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to create lock file %s: %s",
+ filename, g_strerror (errno));
goto out;
}
@@ -223,24 +251,34 @@ try_display (int display,
}
static char *
-create_lock_file (int display, int *display_out)
+create_lock_file (int display,
+ int *display_out,
+ GError **error)
{
+ g_autoptr (GError) local_error = NULL;
char *filename;
int fd;
-
char pid[12];
int size;
int number_of_tries = 0;
- while (!try_display (display, &filename, &fd))
+ while (!try_display (display, &filename, &fd, &local_error))
{
+ meta_verbose ("Failed to open display %d: %s\n",
+ display, local_error->message);
+ g_clear_error (&local_error);
+
display++;
number_of_tries++;
/* If we can't get a display after 50 times, then something's wrong. Just
* abort in this case. */
if (number_of_tries >= 50)
- return NULL;
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Tried to bind 50 display numbers, giving up");
+ return NULL;
+ }
}
/* Subtle detail: we use the pid of the wayland compositor, not the xserver
@@ -248,11 +286,22 @@ create_lock_file (int display, int *display_out)
* it _would've_ written without either the NUL or the size clamping, hence
* the disparity in size. */
size = snprintf (pid, 12, "%10d\n", getpid ());
+ errno = 0;
if (size != 11 || write (fd, pid, 11) != 11)
{
+ if (errno != 0)
+ {
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to write pid to lock file: %s",
+ g_strerror (errno));
+ }
+ else
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to write pid to lock file");
+ }
unlink (filename);
close (fd);
- g_warning ("failed to write pid to lock file %s", filename);
g_free (filename);
return NULL;
}
@@ -264,8 +313,8 @@ create_lock_file (int display, int *display_out)
}
static int
-bind_to_abstract_socket (int display,
- gboolean *fatal)
+bind_to_abstract_socket (int display,
+ GError **error)
{
struct sockaddr_un addr;
socklen_t size, name_size;
@@ -274,8 +323,8 @@ bind_to_abstract_socket (int display,
fd = socket (PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (fd < 0)
{
- *fatal = TRUE;
- g_warning ("Failed to create socket: %m");
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to create socket: %s", g_strerror (errno));
return -1;
}
@@ -285,17 +334,18 @@ bind_to_abstract_socket (int display,
size = offsetof (struct sockaddr_un, sun_path) + name_size;
if (bind (fd, (struct sockaddr *) &addr, size) < 0)
{
- *fatal = errno != EADDRINUSE;
- g_warning ("failed to bind to @%s: %m", addr.sun_path + 1);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to bind to @%s: %s",
+ addr.sun_path + 1, g_strerror (errno));
close (fd);
return -1;
}
if (listen (fd, 1) < 0)
{
- *fatal = errno != EADDRINUSE;
- g_warning ("Failed to listen on abstract socket @%s: %m",
- addr.sun_path + 1);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to listen on abstract socket @%s: %s",
+ addr.sun_path + 1, g_strerror (errno));
close (fd);
return -1;
}
@@ -304,7 +354,8 @@ bind_to_abstract_socket (int display,
}
static int
-bind_to_unix_socket (int display)
+bind_to_unix_socket (int display,
+ GError **error)
{
struct sockaddr_un addr;
socklen_t size, name_size;
@@ -321,13 +372,18 @@ bind_to_unix_socket (int display)
unlink (addr.sun_path);
if (bind (fd, (struct sockaddr *) &addr, size) < 0)
{
- g_warning ("failed to bind to %s: %m\n", addr.sun_path);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to bind to %s: %s",
+ addr.sun_path, g_strerror (errno));
close (fd);
return -1;
}
if (listen (fd, 1) < 0)
{
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to listen on %s: %s",
+ addr.sun_path, g_strerror (errno));
unlink (addr.sun_path);
close (fd);
return -1;
@@ -385,7 +441,6 @@ choose_xdisplay (MetaXWaylandManager *manager)
{
int display = 0;
char *lock_file = NULL;
- gboolean fatal = FALSE;
if (display_number_override != -1)
display = display_number_override;
@@ -394,33 +449,37 @@ choose_xdisplay (MetaXWaylandManager *manager)
do
{
- lock_file = create_lock_file (display, &display);
+ g_autoptr (GError) error = NULL;
+
+ lock_file = create_lock_file (display, &display, &error);
if (!lock_file)
{
- g_warning ("Failed to create an X lock file");
+ g_warning ("Failed to create an X lock file: %s", error->message);
return FALSE;
}
- manager->abstract_fd = bind_to_abstract_socket (display, &fatal);
+ manager->abstract_fd = bind_to_abstract_socket (display, &error);
if (manager->abstract_fd < 0)
{
unlink (lock_file);
- if (!fatal)
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ADDRESS_IN_USE))
{
+ meta_verbose ("Failed to bind abstract socket: %s\n", error->message);
display++;
continue;
}
else
{
- g_warning ("Failed to bind abstract socket");
+ g_warning ("Failed to bind abstract socket: %s", error->message);
return FALSE;
}
}
- manager->unix_fd = bind_to_unix_socket (display);
+ manager->unix_fd = bind_to_unix_socket (display, &error);
if (manager->unix_fd < 0)
{
+ meta_verbose ("Failed to bind unix socket: %s\n", error->message);
unlink (lock_file);
close (manager->abstract_fd);
display++;
@@ -435,6 +494,8 @@ choose_xdisplay (MetaXWaylandManager *manager)
manager->display_name = g_strdup_printf (":%d", manager->display_index);
manager->lock_file = lock_file;
+ g_message ("Using X11 display %s for Xwayland", manager->display_name);
+
return TRUE;
}
--
2.29.2

View File

@ -0,0 +1,27 @@
From 03c30b76bae4c2e3f51a6689ebb7c0c60bd7b29a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 9 Feb 2021 18:00:26 +0100
Subject: [PATCH 2/2] cogl/gpu-info: Fix software acceleration detection
The string used to match mesa changed; update to fix software rendering
detection.
---
cogl/cogl/cogl-gpu-info.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cogl/cogl/cogl-gpu-info.c b/cogl/cogl/cogl-gpu-info.c
index f44319e96..c1817b3b0 100644
--- a/cogl/cogl/cogl-gpu-info.c
+++ b/cogl/cogl/cogl-gpu-info.c
@@ -192,6 +192,8 @@ check_mesa_vendor (const CoglGpuInfoStrings *strings)
return TRUE;
else if (strcmp (strings->vendor_string, "Mesa Project") == 0)
return TRUE;
+ else if (strcmp (strings->vendor_string, "Mesa/X.org") == 0)
+ return TRUE;
return FALSE;
}
--
2.29.2

View File

@ -0,0 +1,38 @@
From f37ef55525777f742051cb988341fa1bab403666 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Mon, 15 Apr 2019 02:02:10 +0200
Subject: [PATCH 2/2] wayland/dnd-surface: Propagate commit to parent class
We need to call the underlying actor-surface so the actor
state is synced, otherwise surface state like the scale factor
does not get applied.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/550
https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
(cherry picked from commit 01d0316fd703872a2470a351f906ffa4605a647e)
---
src/wayland/meta-wayland-dnd-surface.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/wayland/meta-wayland-dnd-surface.c b/src/wayland/meta-wayland-dnd-surface.c
index 8ddeb2a7bd..7aa7e3be2f 100644
--- a/src/wayland/meta-wayland-dnd-surface.c
+++ b/src/wayland/meta-wayland-dnd-surface.c
@@ -51,9 +51,13 @@ dnd_surface_commit (MetaWaylandSurfaceRole *surface_role,
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandSurfaceRoleClass *surface_role_class =
+ META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_surface_role_dnd_parent_class);
meta_wayland_compositor_add_frame_callback_surface (surface->compositor,
surface);
+
+ surface_role_class->commit (surface_role, pending);
}
static void
--
2.31.1

View File

@ -0,0 +1,90 @@
From 56c2e4efdcef14531dcf752e89117d22a21ec8ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 9 Dec 2020 15:18:29 +0100
Subject: [PATCH 2/2] xwayland: Make sure /tmp/.X11-unix/ exists
When we're running under a polyinstantiated SELinux environment, we'll
likely start with an isolated and empty /tmp, meannig no /tmp/.X11-unix
directory to add things to. To make it possible to still function in
this kind of setup, make sure said directory exists.
---
src/wayland/meta-xwayland.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 699d5561c..f3df9766e 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -30,6 +30,7 @@
#include <glib-unix.h>
#include <glib.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include "compositor/meta-surface-actor-wayland.h"
@@ -436,9 +437,27 @@ meta_xwayland_override_display_number (int number)
display_number_override = number;
}
+static gboolean
+ensure_x11_unix_dir (GError **error)
+{
+ if (mkdir ("/tmp/.X11-unix", 01777) != 0)
+ {
+ if (errno == EEXIST)
+ return TRUE;
+
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to create directory \"/tmp/.X11-unix\": %s",
+ g_strerror (errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static gboolean
choose_xdisplay (MetaXWaylandManager *manager)
{
+ g_autoptr (GError) error = NULL;
int display = 0;
char *lock_file = NULL;
@@ -447,10 +466,15 @@ choose_xdisplay (MetaXWaylandManager *manager)
else if (g_getenv ("RUNNING_UNDER_GDM"))
display = 1024;
- do
+ if (!ensure_x11_unix_dir (&error))
{
- g_autoptr (GError) error = NULL;
+ g_warning ("Failed to ensure X11 socket directory: %s",
+ error->message);
+ return FALSE;
+ }
+ do
+ {
lock_file = create_lock_file (display, &display, &error);
if (!lock_file)
{
@@ -466,6 +490,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ADDRESS_IN_USE))
{
meta_verbose ("Failed to bind abstract socket: %s\n", error->message);
+ g_clear_error (&error);
display++;
continue;
}
@@ -480,6 +505,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
if (manager->unix_fd < 0)
{
meta_verbose ("Failed to bind unix socket: %s\n", error->message);
+ g_clear_error (&error);
unlink (lock_file);
close (manager->abstract_fd);
display++;
--
2.29.2

View File

@ -1,4 +1,4 @@
From 3f7ba6739773f43a3ad2a5d26cb8c3365f77cc00 Mon Sep 17 00:00:00 2001
From 08734c2df6bee5426cf75cdf1fa3013af1664d94 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:39:52 +0200
Subject: [PATCH 1/3] backends/x11: Add a synaptics check for two finger scroll
@ -13,10 +13,10 @@ isn't.
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 051a1c605..887bc8b42 100644
index 16a3ff33d..7ad304704 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -630,6 +630,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
@@ -626,6 +626,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
guchar *available = NULL;
gboolean has_two_finger = TRUE;
@ -35,10 +35,9 @@ index 051a1c605..887bc8b42 100644
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.21.0
2.36.1
From 717561b28f35e05d40fb941baba781436a0abf68 Mon Sep 17 00:00:00 2001
From 11a8b8b33582a68e037e7b9e8396af0748bba67a Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:55:56 +0200
Subject: [PATCH 2/3] backends/x11: Add disable while typing support for
@ -51,7 +50,7 @@ syndaemon when the synaptics driver is being used.
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 887bc8b42..12a592c75 100644
index 7ad304704..743f4a7ce 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -35,6 +35,9 @@
@ -73,7 +72,7 @@ index 887bc8b42..12a592c75 100644
} MetaInputSettingsX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
@@ -337,6 +342,107 @@ change_synaptics_speed (ClutterInputDevice *device,
@@ -333,6 +338,107 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
@ -181,7 +180,7 @@ index 887bc8b42..12a592c75 100644
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -461,6 +567,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
@@ -457,6 +563,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
@ -195,10 +194,9 @@ index 887bc8b42..12a592c75 100644
XA_INTEGER, 8, &value, 1);
}
--
2.21.0
2.36.1
From 0afa6d0940ca4f5ffafd24effd2c414963a44277 Mon Sep 17 00:00:00 2001
From fd2923d5c79a60bbd80bf231adf5e1ae7f83d264 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Tue, 10 Oct 2017 19:07:27 +0200
Subject: [PATCH 3/3] backends/x11: Support plain old X device configuration
@ -210,10 +208,10 @@ bits specific for xorg-x11-drv-evdev devices.
1 file changed, 74 insertions(+), 23 deletions(-)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 12a592c75..80e5ed10e 100644
index 743f4a7ce..85f24e92b 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -182,36 +182,36 @@ is_device_synaptics (ClutterInputDevice *device)
@@ -182,35 +182,35 @@ is_device_synaptics (ClutterInputDevice *device)
return TRUE;
}
@ -239,7 +237,6 @@ index 12a592c75..80e5ed10e 100644
+ gboolean left_handed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdevice;
@ -264,12 +261,12 @@ index 12a592c75..80e5ed10e 100644
- XA_INTEGER, 8, tap_action, 7);
- meta_XFree (tap_action);
-
if (x11_display)
meta_x11_error_trap_push (x11_display);
clutter_x11_trap_x_errors();
buttons = g_new (guchar, buttons_capacity);
@@ -235,17 +235,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
@@ -233,17 +233,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
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",
@ -310,8 +307,8 @@ index 12a592c75..80e5ed10e 100644
+ gdouble speed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
@@ -342,6 +364,23 @@ change_synaptics_speed (ClutterInputDevice *device,
MetaBackend *backend = meta_get_backend ();
@@ -338,6 +360,23 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
@ -335,7 +332,7 @@ index 12a592c75..80e5ed10e 100644
/* Ensure that syndaemon dies together with us, to avoid running several of
* them */
static void
@@ -510,9 +549,10 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
@@ -506,9 +545,10 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
@ -348,7 +345,7 @@ index 12a592c75..80e5ed10e 100644
return;
}
@@ -554,6 +594,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
@@ -550,6 +590,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
g_object_unref (settings);
return;
}
@ -360,7 +357,7 @@ index 12a592c75..80e5ed10e 100644
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
@@ -767,6 +812,12 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
@@ -763,6 +808,12 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
ClutterInputDevice *device,
guint button)
{
@ -374,5 +371,5 @@ index 12a592c75..80e5ed10e 100644
XA_INTEGER, 32, &button, 1);
}
--
2.21.0
2.36.1

View File

@ -0,0 +1,333 @@
From 529eb8fa3a15e0ae5bf131b1855a117c8a1a026e 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 9cae4df07d74..32af6bdc19d7 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -1204,6 +1204,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 a41cdc89dd94..374e1af151ad 100644
--- a/src/compositor/meta-texture-tower.c
+++ b/src/compositor/meta-texture-tower.c
@@ -63,6 +63,7 @@ struct _MetaTextureTower
CoglOffscreen *fbos[MAX_TEXTURE_LEVELS];
Box invalid[MAX_TEXTURE_LEVELS];
CoglPipeline *pipeline_template;
+ CoglSnippet *snippet;
};
/**
@@ -98,6 +99,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_slice_free (MetaTextureTower, tower);
}
@@ -226,6 +228,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. */
@@ -420,6 +444,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 6a39e4184200..e3cfe3608b8f 100644
--- a/src/compositor/meta-texture-tower.h
+++ b/src/compositor/meta-texture-tower.h
@@ -62,6 +62,9 @@ void meta_texture_tower_update_area (MetaTextureTower *tower,
int height);
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower);
+void meta_texture_tower_set_snippet (MetaTextureTower *tower,
+ CoglSnippet *snippet);
+
G_END_DECLS
#endif /* __META_TEXTURE_TOWER_H__ */
--
2.34.1
From 4827e201b341ac4dd0b4ca697df46946b19ae14c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 21 Feb 2022 18:12:25 +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 | 135 +++++++++++++++++++++------
1 file changed, 104 insertions(+), 31 deletions(-)
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 32af6bdc19d7..705d27d5b842 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -96,8 +96,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;
@@ -281,8 +285,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
@@ -385,9 +393,6 @@ get_base_pipeline (MetaShapedTexture *stex,
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
}
- if (stex->snippet)
- cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
-
stex->base_pipeline = pipeline;
return stex->base_pipeline;
@@ -395,50 +400,118 @@ 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;
+
+ if (stex->masked_tower_pipeline)
+ return stex->masked_tower_pipeline;
- return 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;
- CoglColor color;
+ if (stex->texture == tex)
+ {
+ CoglPipeline *pipeline;
+ CoglColor color;
- 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_color_init_from_4ub (&color, 255, 255, 255, 255);
- cogl_pipeline_set_blend (pipeline,
- "RGBA = ADD (SRC_COLOR, 0)",
- NULL);
- cogl_pipeline_set_color (pipeline, &color);
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
+ cogl_pipeline_set_blend (pipeline,
+ "RGBA = ADD (SRC_COLOR, 0)",
+ NULL);
+ cogl_pipeline_set_color (pipeline, &color);
+ 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;
+ CoglColor color;
- return pipeline;
+ if (stex->unblended_tower_pipeline)
+ return stex->unblended_tower_pipeline;
+
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
+ cogl_pipeline_set_blend (pipeline,
+ "RGBA = ADD (SRC_COLOR, 0)",
+ NULL);
+ cogl_pipeline_set_color (pipeline, &color);
+
+ stex->unblended_tower_pipeline = pipeline;
+ return pipeline;
+ }
}
static void
@@ -714,7 +787,7 @@ do_paint (MetaShapedTexture *stex,
if (!cairo_region_is_empty (region))
{
- 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);
@@ -750,11 +823,11 @@ do_paint (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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index 2bf7f5e..1221c7b 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -341,25 +341,30 @@ maybe_disable_screen_cast_dma_bufs (MetaBackendNative *native)
MetaGpuKms *primary_gpu;
const char *driver_name;
int i;
- static const char *disable_dma_buf_drivers[] = {
- "qxl",
+ static const char *enable_dma_buf_drivers[] = {
+ "i915",
};
+ MetaScreenCast *screen_cast = meta_backend_get_screen_cast (backend);
+ gboolean enable_dma_buf = FALSE;
primary_gpu = meta_renderer_native_get_primary_gpu (renderer_native);
driver_name = meta_gpu_kms_get_driver_name (primary_gpu);
- for (i = 0; i < G_N_ELEMENTS (disable_dma_buf_drivers); i++)
+ for (i = 0; i < G_N_ELEMENTS (enable_dma_buf_drivers); i++)
{
- if (g_strcmp0 (driver_name, disable_dma_buf_drivers[i]) == 0)
+ if (g_strcmp0 (driver_name, enable_dma_buf_drivers[i]) == 0)
{
- MetaScreenCast *screen_cast = meta_backend_get_screen_cast (backend);
+ enable_dma_buf = TRUE;
+ break;
+ }
+ }
- g_message ("The '%s' driver doesn't support DMA buffer screen sharing, disabling.",
- driver_name);
+ if (!enable_dma_buf)
+ {
+ g_message ("Not enabling DMA buffer screen sharing for driver '%s'.",
+ driver_name);
- meta_screen_cast_disable_dma_bufs (screen_cast);
- return;
- }
+ meta_screen_cast_disable_dma_bufs (screen_cast);
}
}
#endif /* HAVE_REMOTE_DESKTOP */

View File

@ -0,0 +1,68 @@
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
index f39d348..c1abc9b 100644
--- a/src/backends/meta-screen-cast-stream-src.c
+++ b/src/backends/meta-screen-cast-stream-src.c
@@ -684,11 +684,18 @@ on_stream_param_changed (void *data,
MetaScreenCastStreamSrc *src = data;
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
+ MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
+ MetaScreenCastSession *session = meta_screen_cast_stream_get_session (stream);
+ MetaScreenCast *screen_cast =
+ meta_screen_cast_session_get_screen_cast (session);
+
uint8_t params_buffer[1024];
int32_t width, height, stride, size;
struct spa_pod_builder pod_builder;
const struct spa_pod *params[3];
const int bpp = 4;
+ int buffer_types;
+ CoglDmaBufHandle *dmabuf_handle;
if (!format || id != SPA_PARAM_Format)
return;
@@ -705,6 +712,16 @@ on_stream_param_changed (void *data,
pod_builder = SPA_POD_BUILDER_INIT (params_buffer, sizeof (params_buffer));
+ buffer_types = 1 << SPA_DATA_MemFd;
+ dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast,
+ priv->stream_width,
+ priv->stream_height);
+ if (dmabuf_handle)
+ {
+ buffer_types |= 1 << SPA_DATA_DmaBuf;
+ cogl_dma_buf_handle_free(dmabuf_handle);
+ }
+
params[0] = spa_pod_builder_add_object (
&pod_builder,
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
@@ -712,7 +729,8 @@ on_stream_param_changed (void *data,
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int (1),
SPA_PARAM_BUFFERS_size, SPA_POD_Int (size),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int (stride),
- SPA_PARAM_BUFFERS_align, SPA_POD_Int (16));
+ SPA_PARAM_BUFFERS_align, SPA_POD_Int (16),
+ SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int (buffer_types));
params[1] = spa_pod_builder_add_object (
&pod_builder,
@@ -751,9 +769,16 @@ on_stream_add_buffer (void *data,
spa_data[0].mapoffset = 0;
spa_data[0].maxsize = stride * priv->video_format.size.height;
- dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast,
+ if (spa_data[0].type & (1 << SPA_DATA_DmaBuf))
+ {
+ dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast,
priv->stream_width,
priv->stream_height);
+ }
+ else
+ {
+ dmabuf_handle = NULL;
+ }
if (dmabuf_handle)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,479 @@
From 8e756d48ed31bcacf12b99cbd82fb2052503f51e Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 18 Jun 2019 16:12:46 +0200
Subject: [PATCH 1/4] xwayland: Generate a Xauth file and pass this to Xwayland
when starting it
Before this commit, sudo x11-app, e.g. sudo gvim /etc/some-file, fails
when running a Wayland session. Where as doing this under a "GNOME on Xorg"
session works fine. For a user switching from the Xorg session to the
Wayland session, this is regression, which we want to avoid.
This commit fixes this by creating and passing an xauth file to Xwayland when
mutter starts it. Just like gdm or startx pass a xauth file to Xorg when they
start Xorg.
Fixes #643
https://gitlab.gnome.org/GNOME/mutter/issues/643
---
meson.build | 1 +
src/meson.build | 1 +
src/wayland/meta-wayland-private.h | 1 +
src/wayland/meta-wayland.c | 11 +++-
src/wayland/meta-xwayland.c | 81 ++++++++++++++++++++++++++++++
5 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 8ef592bc58..2a404857ce 100644
--- a/meson.build
+++ b/meson.build
@@ -117,6 +117,7 @@ xrandr_dep = dependency('xrandr', version: xrandr_req)
xcb_randr_dep = dependency('xcb-randr')
xcb_res_dep = dependency('xcb-res')
xinerama_dep = dependency('xinerama')
+xau_dep = dependency('xau')
ice_dep = dependency('ice')
atk_dep = dependency('atk', version: atk_req)
libcanberra_dep = dependency('libcanberra', version: libcanberra_req)
diff --git a/src/meson.build b/src/meson.build
index 7cced8f534..91fe74b99a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -101,6 +101,7 @@ if have_x11
x11_xcb_dep,
xcb_randr_dep,
xcb_res_dep,
+ xau_dep,
]
if have_sm
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index 07a71f82b1..5bcb0ea4f9 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -51,6 +51,7 @@ typedef struct
struct wl_client *client;
struct wl_resource *xserver_resource;
char *display_name;
+ char *auth_file;
GCancellable *xserver_died_cancellable;
GSubprocess *proc;
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index a593f0a7b7..129da8e20d 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -362,6 +362,12 @@ meta_wayland_override_display_name (const char *display_name)
_display_name_override = g_strdup (display_name);
}
+static const char *
+meta_wayland_get_xwayland_auth_file (MetaWaylandCompositor *compositor)
+{
+ return compositor->xwayland_manager.auth_file;
+}
+
void
meta_wayland_init (void)
{
@@ -439,7 +445,10 @@ meta_wayland_init (void)
}
if (meta_should_autostart_x11_display ())
- set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
+ {
+ set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
+ set_gnome_env ("XAUTHORITY", meta_wayland_get_xwayland_auth_file (compositor));
+ }
set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
}
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index f3df9766ee..c883eb3d6f 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -32,6 +32,9 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
+#include <sys/random.h>
+#include <unistd.h>
+#include <X11/Xauth.h>
#include "compositor/meta-surface-actor-wayland.h"
#include "meta/main.h"
@@ -525,6 +528,75 @@ choose_xdisplay (MetaXWaylandManager *manager)
return TRUE;
}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FILE, fclose)
+
+static gboolean
+prepare_auth_file (MetaXWaylandManager *manager)
+{
+ Xauth auth_entry = { 0 };
+ g_autoptr (FILE) fp = NULL;
+ char hostname[HOST_NAME_MAX + 1];
+ char auth_data[16];
+ int fd;
+
+ manager->auth_file = g_build_filename (g_get_user_runtime_dir (),
+ ".mutter-Xwaylandauth.XXXXXX",
+ NULL);
+
+ if (gethostname (hostname, HOST_NAME_MAX) < 0)
+ g_strlcpy (hostname, "localhost", HOST_NAME_MAX);
+
+ if (getrandom (auth_data, sizeof (auth_data), 0) != sizeof (auth_data))
+ {
+ g_warning ("Failed to get random data: %s", g_strerror (errno));
+ return FALSE;
+ }
+
+ auth_entry.family = FamilyLocal;
+ auth_entry.address = hostname;
+ auth_entry.address_length = strlen (auth_entry.address);
+ auth_entry.name = (char *) "MIT-MAGIC-COOKIE-1";
+ auth_entry.name_length = strlen (auth_entry.name);
+ auth_entry.data = auth_data;
+ auth_entry.data_length = sizeof (auth_data);
+
+ fd = g_mkstemp (manager->auth_file);
+ if (fd < 0)
+ {
+ g_warning ("Failed to open Xauthority file: %s", g_strerror (errno));
+ return FALSE;
+ }
+
+ fp = fdopen (fd, "w+");
+ if (!fp)
+ {
+ g_warning ("Failed to open Xauthority stream: %s", g_strerror (errno));
+ close (fd);
+ return FALSE;
+ }
+
+ if (!XauWriteAuth (fp, &auth_entry))
+ {
+ g_warning ("Error writing to Xauthority file: %s", g_strerror (errno));
+ return FALSE;
+ }
+
+ auth_entry.family = FamilyWild;
+ if (!XauWriteAuth (fp, &auth_entry))
+ {
+ g_warning ("Error writing to Xauthority file: %s", g_strerror (errno));
+ return FALSE;
+ }
+
+ if (fflush (fp) == EOF)
+ {
+ g_warning ("Error writing to Xauthority file: %s", g_strerror (errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
xserver_finished_init (MetaXWaylandManager *manager)
{
@@ -566,6 +638,9 @@ meta_xwayland_start (MetaXWaylandManager *manager,
if (!choose_xdisplay (manager))
goto out;
+ if (!prepare_auth_file (manager))
+ goto out;
+
/* We want xwayland to be a wayland client so we make a socketpair to setup a
* wayland protocol connection. */
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, xwayland_client_fd) < 0)
@@ -610,6 +685,7 @@ meta_xwayland_start (MetaXWaylandManager *manager,
"-terminate",
"-accessx",
"-core",
+ "-auth", manager->auth_file,
"-listen", "4",
"-listen", "5",
"-displayfd", "6",
@@ -678,6 +754,11 @@ meta_xwayland_stop (MetaXWaylandManager *manager)
unlink (path);
g_clear_pointer (&manager->display_name, g_free);
+ if (manager->auth_file)
+ {
+ unlink (manager->auth_file);
+ g_clear_pointer (&manager->auth_file, g_free);
+ }
if (manager->lock_file)
{
unlink (manager->lock_file);
--
2.31.1
From fdf6969cf89dc9127fc9f4d03d9408e54ccd1b40 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 19 Aug 2019 15:36:32 +0200
Subject: [PATCH 2/4] xwayland: pass the X11 display
Pass the X11 display to `meta_xwayland_complete_init()` so that it can
be used without poking into GDK.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
---
src/wayland/meta-xwayland-private.h | 3 ++-
src/wayland/meta-xwayland.c | 3 ++-
src/x11/meta-x11-display.c | 5 ++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
index 38874eda3f..abcb09e49b 100644
--- a/src/wayland/meta-xwayland-private.h
+++ b/src/wayland/meta-xwayland-private.h
@@ -29,7 +29,8 @@ meta_xwayland_start (MetaXWaylandManager *manager,
struct wl_display *display);
void
-meta_xwayland_complete_init (MetaDisplay *display);
+meta_xwayland_complete_init (MetaDisplay *display,
+ Display *xdisplay);
void
meta_xwayland_stop (MetaXWaylandManager *manager);
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index c883eb3d6f..350626dfdb 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -727,7 +727,8 @@ on_x11_display_closing (MetaDisplay *display)
/* To be called right after connecting */
void
-meta_xwayland_complete_init (MetaDisplay *display)
+meta_xwayland_complete_init (MetaDisplay *display,
+ Display *xdisplay)
{
/* We install an X IO error handler in addition to the child watch,
because after Xlib connects our child watch may not be called soon
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 065ffcdda5..d40dcfa3f8 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -1066,14 +1066,13 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
g_assert (prepared_gdk_display);
gdk_display = g_steal_pointer (&prepared_gdk_display);
+ xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display);
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
- meta_xwayland_complete_init (display);
+ meta_xwayland_complete_init (display, xdisplay);
#endif
- xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display);
-
if (meta_is_syncing ())
XSynchronize (xdisplay, True);
--
2.31.1
From 25a0945aa69c479d6356a970b39e6ae42e43c877 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 19 Aug 2019 15:48:17 +0200
Subject: [PATCH 3/4] xwayland: Use given X11 display for DnD setup
Use the provided X11 display instead of poking into GDK to get the X11
display.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
---
src/wayland/meta-xwayland-private.h | 4 ++--
src/wayland/meta-xwayland-selection.c | 18 +++++++++---------
src/wayland/meta-xwayland.c | 7 +++++--
3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
index abcb09e49b..f562d7c96d 100644
--- a/src/wayland/meta-xwayland-private.h
+++ b/src/wayland/meta-xwayland-private.h
@@ -36,8 +36,8 @@ void
meta_xwayland_stop (MetaXWaylandManager *manager);
/* wl_data_device/X11 selection interoperation */
-void meta_xwayland_init_selection (void);
-void meta_xwayland_shutdown_selection (void);
+void meta_xwayland_init_selection (Display *xdisplay);
+void meta_xwayland_shutdown_selection (Display *xdisplay);
gboolean meta_xwayland_selection_handle_event (XEvent *xevent);
const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void);
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index 808f913339..122bb76e1c 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -353,9 +353,9 @@ xdnd_send_status (MetaXWaylandSelection *selection_data,
}
static void
-meta_xwayland_init_dnd (MetaXWaylandManager *manager)
+meta_xwayland_init_dnd (MetaXWaylandManager *manager,
+ Display *xdisplay)
{
- Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
MetaDndBridge *dnd = &manager->selection_data->dnd;
XSetWindowAttributes attributes;
guint32 i, version = XDND_VERSION;
@@ -382,12 +382,12 @@ meta_xwayland_init_dnd (MetaXWaylandManager *manager)
}
static void
-meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager)
+meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
+ Display *xdisplay)
{
MetaDndBridge *dnd = &manager->selection_data->dnd;
- XDestroyWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
- dnd->dnd_window);
+ XDestroyWindow (xdisplay, dnd->dnd_window);
dnd->dnd_window = None;
}
@@ -1755,7 +1755,7 @@ shutdown_selection_bridge (MetaSelectionBridge *selection)
}
void
-meta_xwayland_init_selection (void)
+meta_xwayland_init_selection (Display *xdisplay)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager;
@@ -1764,7 +1764,7 @@ meta_xwayland_init_selection (void)
manager->selection_data = g_slice_new0 (MetaXWaylandSelection);
- meta_xwayland_init_dnd (manager);
+ meta_xwayland_init_dnd (manager, xdisplay);
init_selection_bridge (&manager->selection_data->clipboard,
gdk_x11_get_xatom_by_name ("CLIPBOARD"),
&compositor->seat->data_device.selection_ownership_signal);
@@ -1777,7 +1777,7 @@ meta_xwayland_init_selection (void)
}
void
-meta_xwayland_shutdown_selection (void)
+meta_xwayland_shutdown_selection (Display *xdisplay)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager;
@@ -1787,7 +1787,7 @@ meta_xwayland_shutdown_selection (void)
g_clear_object (&selection->clipboard.source);
- meta_xwayland_shutdown_dnd (manager);
+ meta_xwayland_shutdown_dnd (manager, xdisplay);
shutdown_selection_bridge (&selection->clipboard);
shutdown_selection_bridge (&selection->primary);
shutdown_selection_bridge (&selection->dnd.selection);
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 350626dfdb..3236711482 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -38,6 +38,7 @@
#include "compositor/meta-surface-actor-wayland.h"
#include "meta/main.h"
+#include "meta/meta-x11-display.h"
#include "wayland/meta-wayland-actor-surface.h"
enum
@@ -722,7 +723,9 @@ out:
static void
on_x11_display_closing (MetaDisplay *display)
{
- meta_xwayland_shutdown_selection ();
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
+
+ meta_xwayland_shutdown_selection (xdisplay);
}
/* To be called right after connecting */
@@ -739,7 +742,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
g_signal_connect (display, "x11-display-closing",
G_CALLBACK (on_x11_display_closing), NULL);
- meta_xwayland_init_selection ();
+ meta_xwayland_init_selection (xdisplay);
}
void
--
2.31.1
From a398699a53b9cc6efda4aa8abe0e3176bab80e92 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 19 Aug 2019 15:50:54 +0200
Subject: [PATCH 4/4] xwayland: Add local user to xhost
With the addition of xauth support (commit a8984a81c), Xwayland would
rely only on the provided cookies for authentication.
As a result, running an Xclient from another VT (hence without the
XAUTHORITY environment variable set) would result in an access denied.
The same on X11 is granted because the local user is automatically
granted access to Xserver by the startup scripts.
Add the local user to xhost at startup on Xwayland so that the user can
still run a client by setting the DISPLAY as long as it's the same user
on the same host.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
---
src/wayland/meta-xwayland.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 3236711482..275aeb78cb 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -598,6 +598,23 @@ prepare_auth_file (MetaXWaylandManager *manager)
return TRUE;
}
+static void
+add_local_user_to_xhost (Display *xdisplay)
+{
+ XHostAddress host_entry;
+ XServerInterpretedAddress siaddr;
+
+ siaddr.type = (char *) "localuser";
+ siaddr.typelength = strlen (siaddr.type);
+ siaddr.value = (char *) g_get_user_name();
+ siaddr.valuelength = strlen (siaddr.value);
+
+ host_entry.family = FamilyServerInterpreted;
+ host_entry.address = (char *) &siaddr;
+
+ XAddHost (xdisplay, &host_entry);
+}
+
static void
xserver_finished_init (MetaXWaylandManager *manager)
{
@@ -743,6 +760,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
g_signal_connect (display, "x11-display-closing",
G_CALLBACK (on_x11_display_closing), NULL);
meta_xwayland_init_selection (xdisplay);
+ add_local_user_to_xhost (xdisplay);
}
void
--
2.31.1

View File

@ -8,7 +8,7 @@
Name: mutter
Version: 3.32.2
Release: 48%{?dist}
Release: 72%{?dist}
Summary: Window and compositing manager based on Clutter
License: GPLv2+
@ -148,6 +148,8 @@ Patch407: 0004-screen-cast-Disable-DMA-buffer-based-screen-casting-.patch
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1365
Patch408: cursor-move-only-screen-cast-fixes.patch
Patch409: mutter-bump-screencast-api-version.patch
Patch410: mutter-screencast-dmabuf-i915-only.patch
Patch411: mutter-screencast-negotiate-buffer-type.patch
# Only treat WM_PROTOCOLS messages as WM_PROTOCOL messages (#1847203)
Patch500: 0001-stage-x11-Check-that-message-is-WM_PROTOCOLS-before-.patch
@ -159,6 +161,62 @@ Patch501: 0001-window-actor-Don-t-show-actor-until-meta_window_acto.patch
Patch502: 0001-monitor-manager-kms-Trigger-hotplug-processing-on-gp.patch
Patch503: 0002-gpu-kms-Reset-CRTC-mode-and-output-list-if-no-resour.patch
# Add tile based shadow buffer damage tracking (#1670273)
Patch504: shadow-buffer-tile-damage.patch
# Add PING_TIMEOUT_DELAY to mutter MetaPreferences (#1886034)
Patch505: 0001-display-Make-check-alive-timeout-configureable.patch
# Polyinstantiation (#1861769)
Patch506: 0001-xwayland-Don-t-spew-warnings-when-looking-for-X11-di.patch
Patch507: 0002-xwayland-Make-sure-tmp-.X11-unix-exists.patch
# Mitigate nouveau misidentifying connectors (#1786496)
Patch508: 0001-monitor-config-manager-Handle-multiple-builtin-panel.patch
# Don't ever enable double buffered shadowfb and fix software rendering
# detection (#1921151)
Patch509: 0001-clutter-stage-view-Hide-double-buffered-shadowfb-beh.patch
Patch510: 0002-cogl-gpu-info-Fix-software-acceleration-detection.patch
# Backport of geometric picking, improving performance and fixing picking
# 10bpc pixel formats (#1919467)
Patch511: geometric-picking.patch
Patch520: 0001-clutter-Backport-of-touch-mode.patch
# Backport passing -xauth and adding local user to xhost (#1949176)
Patch521: xwayland-xauth-xhost-user.patch
# Backport fixes avoiding frozen partly off-screen clients (#1989035)
Patch522: wayland-frame-callback-rework.patch
# Backport fix avoiding regression due to the above changes (#1999120)
Patch523: 0001-wayland-Move-check-for-present-window-out-of-the-act.patch
Patch524: 0002-wayland-dnd-surface-Propagate-commit-to-parent-class.patch
# Backport monitor configuration policy feature (#2001655)
Patch525: monitor-config-policy.patch
# Backport EGLStream overview fixes (#1977721)
Patch526: eglstream-overview-fixes.patch
# Backport fix for stuck _NET_WM_FRAME_DRAWN handling (#2060305)
Patch527: 0001-compositor-Make-sure-_NET_WM_FRAME_DRAWN-timestamp-h.patch
# Fix race condition causing stuck pointer grabs (#2090168)
Patch528: 0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch
# Downgrade assert to warning (#2089311)
Patch529: 0001-workspace-Downgrade-assert-to-warning-when-adding-wi.patch
# Don't add common modes if panel already has (#2125031)
Patch530: 0001-output-kms-Add-more-heuristics-to-decide-when-to-off.patch
# Queue fail safe page flip callbacks (#2172057)
Patch531: 0001-renderer-native-Queue-fail-safe-callbacks-when-mode-.patch
Patch532: 0001-core-Change-MetaWaylandTextInput-event-forwarding-to.patch
BuildRequires: chrpath
BuildRequires: pango-devel
BuildRequires: startup-notification-devel
@ -300,9 +358,100 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests
%changelog
* Mon Sep 21 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-48
* Mon Oct 02 2023 Jan Grulich <jgrulich@redhat.com> - 3.32.2-72
- Do not use DMA buffers for screencast when the client doesn't support it
- Use DMA buffers only for i195 drivers
Resolves: RHEL-4405
* Thu Aug 17 2023 Carlos Garnacho <cgarnach@redhat.com> - 3.32.2-71
- Fix ordering of keyboard modifiers relative to other keyboard events
Resolves: #2170830
* Thu Apr 06 2023 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-69
- Queue fail safe page flip callbacks
Resolves: #2172057
* Wed Dec 21 2022 Olivier Fourdan <ofourdan@redhat.com> - 3.32.2-68
- Fix downstream synaptics patches breaking xdmcp
Resolves: #2092450
* Thu Oct 20 2022 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-67
- Don't add common modes if panel already has
Resolves: #2125031
* Mon Aug 29 2022 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-66
- Downgrade assert to warning
Resolves: #2089311
* Mon Jun 27 2022 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-65
- Fix race condition causing stuck pointer grabs
Resolves: #2090168
* Fri Mar 18 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-64
- Backport fix for stuck _NET_WM_FRAME_DRAWN handling
Resolves: #2060305
* Thu Feb 24 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-63
- Fix EGLStream overview fixes backport
Related: #1977721
* Mon Feb 21 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-62
- Backport EGLStream overview fixes
Resolves: #1977721
* Fri Feb 04 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-61
- Backport monitor configuration policy feature
Resolves: #2001655
* Mon Aug 30 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-60
- Backport fix avoiding DND regression
Resolves: #2000905
* Fri Aug 06 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-59
- Backport fixes avoiding frozen partly off-screen clients
Resolves: #1989035
* Mon Jul 05 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-58
- Backport xauth and xhost patches
Resolves: #1949176
* Mon Feb 22 2021 Carlos Garnacho <cgarnach@redhat.com> - 3.32.2-57
- Backport touch-mode
Resolves: #1833787
* Tue Feb 09 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-56
- Backport geometric picking patches
Resolves: #1919467
* Tue Feb 09 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-55
- Fix slow nouveau with llvmpipe
Resolves: #1921151
* Tue Jan 12 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-54
- Fix polyinstantiation patch backport
Resolves: #1861769
* Thu Dec 17 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-53
- Fix test case backport
Related: #1786496
* Thu Dec 17 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-52
- Support polyinstantiation
Resolves: #1861769
- Mitigate nouveau misidentifying connectors
Resolves: #1786496
* Mon Dec 07 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-51
- Add PING_TIMEOUT_DELAY to mutter MetaPreferences
Resolves: #1886034
* Thu Nov 26 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-50
- Fix GLX stereo buffer rebase error
Resolves: #1880339
Resolves: #1889528
* Tue Nov 10 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-49
- Add tile based shadow buffer damage tracking
Resolves: #1670273
* Thu Sep 03 2020 Florian Müllner <fmuellner@redhat.com> - 3.32.2-47
- Fix screen sharing on wayland