Skip to content
Commits on Source (9)
mutter (3.38.3-3ubuntu2) hirsute; urgency=medium
[ Marco Trevisan (Treviño) ]
* debian/tests: Adapt autopkgtest name and linked library to current soname
* d/p/input-thread: Cherry-pick upstream commit to properly handle key modifiers
(LP: #1917926)
* d/p/input-thread: Cherry-pick more upstream input-related fixes
* d/p/input-thread: Ensure we handle device events in X11 (LP: #1917926)
* d/p/input-thread: Backport various X11 leak fixes
* d/p/input-thread: Avoid notifying property changes multiple times
(LP: #1918033)
* d/patches: Include a missing commit to fix X11 UI stutters
[ Simon McVittie ]
* d/patches: Update to commit 3.38.3-26-g30c542ddc
-- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 10 Mar 2021 04:48:22 +0100
mutter (3.38.3-3ubuntu1) hirsute; urgency=medium
* debian/patches: Backport wayland input thread support (LP: #1690719)
......
From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 4 Mar 2021 19:11:12 +0100
Subject: compositor/x11: Notify the sync ring about frames on updates
The sync ring has an API about "frames", where it is notified about
the end of frames. However, its "insert wait" call is done before
updates, meaning that some "insert waits" will never see the "after
frame" if there was no frame drawn. This will cause mismatching in the
frame counting, causing freezes in the synchronization until something
else triggers an actual frame, effectively "unfreezing" the sync ring.
Fix this by not only notifying the sync ring about frames when there
were actual frames drawn, but also on plain updates which didn't result
in a drawn frame.
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/1516
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1754>
(cherry picked from commit 44a4e616658edb2a21a9612cfd3a41742a1ca427)
---
src/compositor/meta-compositor-x11.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c
index e7da103..339ef03 100644
--- a/src/compositor/meta-compositor-x11.c
+++ b/src/compositor/meta-compositor-x11.c
@@ -40,6 +40,7 @@ struct _MetaCompositorX11
Window output;
gulong before_update_handler_id;
+ gulong after_update_handler_id;
gboolean frame_has_updated_xsurfaces;
gboolean have_x11_sync_object;
@@ -363,35 +364,32 @@ on_before_update (ClutterStage *stage,
}
static void
-meta_compositor_x11_before_paint (MetaCompositor *compositor,
- ClutterStageView *stage_view)
+on_after_update (ClutterStage *stage,
+ ClutterStageView *stage_view,
+ MetaCompositor *compositor)
{
MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor);
- MetaCompositorClass *parent_class;
- maybe_unredirect_top_window (compositor_x11);
+ if (compositor_x11->frame_has_updated_xsurfaces)
+ {
+ if (compositor_x11->have_x11_sync_object)
+ compositor_x11->have_x11_sync_object = meta_sync_ring_after_frame ();
- parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class);
- parent_class->before_paint (compositor, stage_view);
+ compositor_x11->frame_has_updated_xsurfaces = FALSE;
+ }
}
static void
-meta_compositor_x11_after_paint (MetaCompositor *compositor,
- ClutterStageView *stage_view)
+meta_compositor_x11_before_paint (MetaCompositor *compositor,
+ ClutterStageView *stage_view)
{
MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor);
MetaCompositorClass *parent_class;
- if (compositor_x11->frame_has_updated_xsurfaces)
- {
- if (compositor_x11->have_x11_sync_object)
- compositor_x11->have_x11_sync_object = meta_sync_ring_after_frame ();
-
- compositor_x11->frame_has_updated_xsurfaces = FALSE;
- }
+ maybe_unredirect_top_window (compositor_x11);
parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class);
- parent_class->after_paint (compositor, stage_view);
+ parent_class->before_paint (compositor, stage_view);
}
static void
@@ -465,6 +463,9 @@ meta_compositor_x11_constructed (GObject *object)
compositor_x11->before_update_handler_id =
g_signal_connect (stage, "before-update",
G_CALLBACK (on_before_update), compositor);
+ compositor_x11->after_update_handler_id =
+ g_signal_connect (stage, "after-update",
+ G_CALLBACK (on_after_update), compositor);
G_OBJECT_CLASS (meta_compositor_x11_parent_class)->constructed (object);
}
@@ -483,6 +484,7 @@ meta_compositor_x11_dispose (GObject *object)
}
g_clear_signal_handler (&compositor_x11->before_update_handler_id, stage);
+ g_clear_signal_handler (&compositor_x11->after_update_handler_id, stage);
G_OBJECT_CLASS (meta_compositor_x11_parent_class)->dispose (object);
}
@@ -504,7 +506,6 @@ meta_compositor_x11_class_init (MetaCompositorX11Class *klass)
compositor_class->manage = meta_compositor_x11_manage;
compositor_class->unmanage = meta_compositor_x11_unmanage;
compositor_class->before_paint = meta_compositor_x11_before_paint;
- compositor_class->after_paint = meta_compositor_x11_after_paint;
compositor_class->remove_window = meta_compositor_x11_remove_window;
compositor_class->monotonic_to_high_res_xserver_time =
meta_compositor_x11_monotonic_to_high_res_xserver_time;
From: Sebastian Keller <skeller@gnome.org>
Date: Sat, 27 Feb 2021 00:00:25 +0000
Subject: frame: Fix crash when clicking below titlebar with broken gtk themes
When a gtk theme uses larger shadows for the unfocused state than for
the focused one, this can cause a crash in meta_frame_left_click_event.
Since whether to call meta_frame_left_click_event is decided based on
the decoration size before focusing and the control that was clicked on
after focusing, this can result in an event handled in
meta_frame_left_click_event being on the client area.
Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1668
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1748>
(cherry picked from commit c2968c89fef3d67f161cb01481a8a2939c45a425)
(cherry picked from commit 30c542ddc3f73aa625c5f88167da6700c45b9f33)
---
src/ui/frames.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 5cbfb09..5e39616 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -1112,6 +1112,15 @@ meta_frame_left_click_event (MetaUIFrame *frame,
* that cannot be resized (e. g. it is maximized and the theme
* currently used has borders for maximized windows), see #751884 */
return FALSE;
+ case META_FRAME_CONTROL_CLIENT_AREA:
+ /* This can happen with broken gtk themes that have a larger shadow size
+ * in the unfocused state than in the focused one. Then when clicking
+ * below the titlebar area in the unfocused state would still be
+ * considered a click on the titlebar due to it being shifted down because
+ * of the shadow. This then causes the window to be focused before this
+ * function is called, which removes the shadow such that the same
+ * position is now considered to be on the client area */
+ return FALSE;
default:
g_assert_not_reached ();
return FALSE;
From: =?utf-8?q?Jonas_Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Mon, 8 Mar 2021 13:55:01 +0100
Subject: Revert "backends: Use also a native cursor renderer for tablets"
With commit c98575344295b715a0301c7319195b2724dc2bde the support for
multiple hardware cursors broke, but those were never properly supported
anyway as we usually assume there's only one hardware cursor around.
With the introduction of the KMS thread in the future, we'll only have
one KMS cursor that gets updated directly from the input thread. So
apart from the fact that it never really makes sense to have two cursors
visible, in this new model having multiple cursors won't work anyway.
So make the cursor we show for stylii a software cursor again.
Eventually the plan is to make the input device that's driving the KMS
cursor interchangeable, so that we can always use hardware cursors.
This reverts commit 165b7369c88644867a7c0c2791c48826240b63b5.
Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1645
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1758>
---
src/backends/native/meta-seat-native.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index 9b93193..a84f8e4 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -61,7 +61,7 @@ meta_seat_native_handle_event_post (ClutterSeat *seat,
if (event_type == CLUTTER_PROXIMITY_IN)
{
- MetaCursorRendererNative *cursor_renderer_native;
+ MetaCursorRenderer *cursor_renderer;
if (!seat_native->tablet_cursors)
{
@@ -69,10 +69,9 @@ meta_seat_native_handle_event_post (ClutterSeat *seat,
g_object_unref);
}
- cursor_renderer_native =
- meta_cursor_renderer_native_new (meta_get_backend (), device);
+ cursor_renderer = meta_cursor_renderer_new (meta_get_backend (), device);
g_hash_table_insert (seat_native->tablet_cursors,
- device, cursor_renderer_native);
+ device, cursor_renderer);
return TRUE;
}
else if (event_type == CLUTTER_PROXIMITY_OUT)
From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 28 Jan 2021 15:04:11 +0100
Subject: backend: Only create idle monitors for added physical input devices
The rest of the things we do aren't applicable, e.g. mapping tablet
devices/tools to monitors and hiding cursors.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1688>
---
src/backends/meta-backend.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 4edc366..a862918 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -397,13 +397,6 @@ meta_backend_monitor_device (MetaBackend *backend,
create_device_monitor (backend, device);
}
-static inline gboolean
-device_is_physical_touchscreen (ClutterInputDevice *device)
-{
- return (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL &&
- clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE);
-}
-
static inline gboolean
check_has_pointing_device (ClutterSeat *seat)
{
@@ -467,11 +460,15 @@ on_device_added (ClutterSeat *seat,
create_device_monitor (backend, device);
- if (device_is_physical_touchscreen (device))
- meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, FALSE);
+ if (clutter_input_device_get_device_mode (device) ==
+ CLUTTER_INPUT_MODE_LOGICAL)
+ return;
device_type = clutter_input_device_get_device_type (device);
+ if (device_type == CLUTTER_TOUCHSCREEN_DEVICE)
+ meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker, FALSE);
+
if (device_type == CLUTTER_TOUCHSCREEN_DEVICE ||
device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
@@ -491,6 +488,10 @@ on_device_removed (ClutterSeat *seat,
destroy_device_monitor (backend, device);
+ if (clutter_input_device_get_device_mode (device) ==
+ CLUTTER_INPUT_MODE_LOGICAL)
+ return;
+
meta_input_mapper_remove_device (priv->input_mapper, device);
/* If the device the user last interacted goes away, check again pointer
From: =?utf-8?q?Jonas_=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 15 Jan 2021 10:26:01 +0100
Subject: backend/native: Destroy logind helper after seat
Otherwise we don't actually close input devices using it, since that
would happen after meta_launcher_free() was called.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1670>
---
src/backends/native/meta-backend-native.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index c794891..d2af33b 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -101,9 +101,10 @@ meta_backend_native_dispose (GObject *object)
g_clear_object (&native->udev);
g_clear_object (&native->kms);
- g_clear_pointer (&native->launcher, meta_launcher_free);
G_OBJECT_CLASS (meta_backend_native_parent_class)->dispose (object);
+
+ g_clear_pointer (&native->launcher, meta_launcher_free);
}
static ClutterBackend *
From: Pascal Nowack <Pascal.Nowack@gmx.de>
Date: Thu, 11 Feb 2021 12:33:26 +0100
Subject: backends/native: Handle triple resolution mouse wheels better
When a remote desktop user emits a virtual smooth scrolling event, a
smooth scroll event, that is not emulated, is emitted and on occasion
a discrete scroll event, that is emulated, is emitted.
As base for the discrete scrolling event, the smooth scrolling steps
are accumulated.
When the accumulated smooth scrolling steps surpass the
DISCRETE_SCROLL_STEP, the discrete scrolling event is emitted.
Currently, mutter uses for DISCRETE_SCROLL_STEP the value 10, which is
a terrible value to work with, especially for high resolution mouse
wheels.
When a triple resolution mouse wheel is used, each scrolling step will
have the value 3 1/3.
Three of such events won't however surpass the DISCRETE_SCROLL_STEP.
To fix this situation, add DBL_EPSILON to the calculation step, when
checking for the discrete scroll event to ensure that 3 smooth scroll
events, with each having the value 3 1/3, emit a discrete scrolling
event.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1727>
---
src/backends/native/meta-seat-impl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index bc49e87..5b12318 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -820,8 +820,10 @@ check_notify_discrete_scroll (MetaSeatImpl *seat_impl,
{
int i, n_xscrolls, n_yscrolls;
- n_xscrolls = floor (fabs (seat_impl->accum_scroll_dx) / DISCRETE_SCROLL_STEP);
- n_yscrolls = floor (fabs (seat_impl->accum_scroll_dy) / DISCRETE_SCROLL_STEP);
+ n_xscrolls = floor ((fabs (seat_impl->accum_scroll_dx) + DBL_EPSILON) /
+ DISCRETE_SCROLL_STEP);
+ n_yscrolls = floor ((fabs (seat_impl->accum_scroll_dy) + DBL_EPSILON) /
+ DISCRETE_SCROLL_STEP);
for (i = 0; i < n_xscrolls; i++)
{
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 21 Dec 2020 13:25:28 +0100
Subject: backends/native: Protect against NULL pointer constraints
To clear a pointer constraint, the Wayland backend passes a NULL
constraint to the native input backend.
The new async API however tries to reference/un-reference the given
object to use it while running in a separate task, which leads to a
warning from GLib trying to g_object_ref()/g_object_unref() a non
GObject pointer.
To avoid that issue, simply set the data only if the given constraints
pointer is not NULL.
Suggested-by: Carlos Garnacho <carlosg@gnome.org>
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1587
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1652>
---
src/backends/native/meta-seat-impl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index 5b12318..dea26f5 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -3389,7 +3389,8 @@ meta_seat_impl_set_pointer_constraint (MetaSeatImpl *seat,
g_return_if_fail (META_IS_SEAT_IMPL (seat));
task = g_task_new (seat, NULL, NULL, NULL);
- g_task_set_task_data (task, g_object_ref (constraint_impl), g_object_unref);
+ if (constraint_impl)
+ g_task_set_task_data (task, g_object_ref (constraint_impl), g_object_unref);
meta_seat_impl_run_input_task (seat, task,
(GSourceFunc) set_pointer_constraint);
g_object_unref (task);
From: =?utf-8?q?Jonas_Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Mon, 8 Mar 2021 15:09:07 +0100
Subject: backends/native: Translate right coords when creating motion events
With commit 7d7876880998fe7b414bb38f8094af9822020d1b we switched to
storing pointer coordinates in MetaInputDeviceNative instead of
ClutterInputDevice, and while we had set the coordinates of the
ClutterInputDevice in ClutterStage when queueing an event, we now set
the MetaInputDeviceNative coordinates in new_absolute_motion_event().
Here a small mistake snuck in: new_absolute_motion_event() only
translates the coordinates of the event, but we call
meta_input_device_native_set_coords() using the x and y variables
(which remain untranslated), so now the input device coordinates are no
longer translated.
Fix that by translating the coordinates of the x and y variables in case
we're we handling a tablet/stylus event instead of only translating the
event coordinates.
Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1685
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1760>
---
src/backends/native/meta-seat-impl.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index f87178a..09ac4d9 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -503,6 +503,17 @@ new_absolute_motion_event (MetaSeatImpl *seat_impl,
seat_impl->pointer_y,
&x, &y);
}
+ else
+ {
+ /* This may happen early at startup */
+ if (seat_impl->viewports)
+ {
+ meta_input_device_native_translate_coordinates_in_impl (input_device,
+ seat_impl->viewports,
+ &x,
+ &y);
+ }
+ }
event->motion.time_us = time_us;
event->motion.time = us2ms (time_us);
@@ -510,15 +521,6 @@ new_absolute_motion_event (MetaSeatImpl *seat_impl,
event->motion.x = x;
event->motion.y = y;
- /* This may happen early at startup */
- if (seat_impl->viewports)
- {
- meta_input_device_native_translate_coordinates_in_impl (input_device,
- seat_impl->viewports,
- &event->motion.x,
- &event->motion.y);
- }
-
event->motion.axes = axes;
clutter_event_set_device (event, seat_impl->core_pointer);
clutter_event_set_source_device (event, input_device);
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 10 Mar 2021 03:18:13 +0100
Subject: backends/x11: Add dummy input-settings-x11-nested implementation
The nested backend may need to have an input setting implementation,
while we don't want to change the host settings (re-using an X11 input
settings) we can add a dummy implementation, until something more
complex is needed.
---
src/backends/x11/nested/meta-backend-x11-nested.c | 32 ++-
.../x11/nested/meta-input-settings-x11-nested.c | 294 +++++++++++++++++++++
.../x11/nested/meta-input-settings-x11-nested.h | 34 +++
src/meson.build | 2 +
4 files changed, 361 insertions(+), 1 deletion(-)
create mode 100644 src/backends/x11/nested/meta-input-settings-x11-nested.c
create mode 100644 src/backends/x11/nested/meta-input-settings-x11-nested.h
diff --git a/src/backends/x11/nested/meta-backend-x11-nested.c b/src/backends/x11/nested/meta-backend-x11-nested.c
index 425ddcb..97d04b3 100644
--- a/src/backends/x11/nested/meta-backend-x11-nested.c
+++ b/src/backends/x11/nested/meta-backend-x11-nested.c
@@ -25,6 +25,7 @@
#include "backends/x11/nested/meta-backend-x11-nested.h"
#include "backends/x11/nested/meta-cursor-renderer-x11-nested.h"
#include "backends/x11/nested/meta-renderer-x11-nested.h"
+#include "backends/x11/nested/meta-input-settings-x11-nested.h"
#include "wayland/meta-wayland.h"
@@ -32,6 +33,7 @@ typedef struct _MetaBackendX11NestedPrivate
{
MetaGpu *gpu;
MetaCursorRenderer *cursor_renderer;
+ MetaInputSettings *input_settings;
} MetaBackendX11NestedPrivate;
static GInitableIface *initable_parent_iface;
@@ -86,7 +88,22 @@ meta_backend_x11_nested_get_cursor_renderer (MetaBackend *backend,
static MetaInputSettings *
meta_backend_x11_nested_get_input_settings (MetaBackend *backend)
{
- return NULL;
+ MetaBackendX11Nested *backend_x11_nested = META_BACKEND_X11_NESTED (backend);
+ MetaBackendX11NestedPrivate *priv =
+ meta_backend_x11_nested_get_instance_private (backend_x11_nested);
+
+ if (!priv->input_settings)
+ {
+ ClutterSeat *seat;
+
+ seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
+ priv->input_settings =
+ g_object_new (META_TYPE_INPUT_SETTINGS_X11_NESTED,
+ "seat", seat,
+ NULL);
+ }
+
+ return priv->input_settings;
}
static void
@@ -271,6 +288,18 @@ meta_backend_x11_nested_constructed (GObject *object)
backend_x11_nested_class->init_gpus (backend_x11_nested);
}
+static void
+meta_backend_x11_nested_dispose (GObject *object)
+{
+ MetaBackendX11Nested *backend_x11_nested = META_BACKEND_X11_NESTED (object);
+ MetaBackendX11NestedPrivate *priv =
+ meta_backend_x11_nested_get_instance_private (backend_x11_nested);
+
+ g_clear_object (&priv->input_settings);
+
+ G_OBJECT_CLASS (meta_backend_x11_nested_parent_class)->dispose (object);
+}
+
static void
meta_backend_x11_nested_init (MetaBackendX11Nested *backend_x11_nested)
{
@@ -284,6 +313,7 @@ meta_backend_x11_nested_class_init (MetaBackendX11NestedClass *klass)
MetaBackendX11Class *backend_x11_class = META_BACKEND_X11_CLASS (klass);
object_class->constructed = meta_backend_x11_nested_constructed;
+ object_class->dispose = meta_backend_x11_nested_dispose;
backend_class->post_init = meta_backend_x11_nested_post_init;
backend_class->create_renderer = meta_backend_x11_nested_create_renderer;
diff --git a/src/backends/x11/nested/meta-input-settings-x11-nested.c b/src/backends/x11/nested/meta-input-settings-x11-nested.c
new file mode 100644
index 0000000..f3057c3
--- /dev/null
+++ b/src/backends/x11/nested/meta-input-settings-x11-nested.c
@@ -0,0 +1,294 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright 2021 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Marco Trevisan <marco.trevisan@canonical.com>
+ */
+
+#include "backends/x11/nested/meta-input-settings-x11-nested.h"
+
+G_DEFINE_TYPE (MetaInputSettingsX11Nested,
+ meta_input_settings_x11_nested,
+ META_TYPE_INPUT_SETTINGS)
+
+static void
+meta_input_settings_x11_nested_set_send_events (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopDeviceSendEvents mode)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_matrix (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gfloat matrix[6])
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_speed (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gdouble speed)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_left_handed (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_tap_enabled (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_tap_button_map (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopTouchpadTapButtonMap mode)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_tap_and_drag_enabled (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_tap_and_drag_lock_enabled (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_disable_while_typing (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_invert_scroll (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean inverted)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_edge_scroll (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_two_finger_scroll (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_scroll_button (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ guint button)
+{
+}
+
+
+static void
+meta_input_settings_x11_nested_set_click_method (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopTouchpadClickMethod mode)
+{
+}
+
+
+static void
+meta_input_settings_x11_nested_set_keyboard_repeat (MetaInputSettings *settings,
+ gboolean repeat,
+ guint delay,
+ guint interval)
+{
+}
+
+
+static void
+meta_input_settings_x11_nested_set_tablet_mapping (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopTabletMapping mapping)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_tablet_aspect_ratio (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ double ratio)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_tablet_area (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gdouble padding_left,
+ gdouble padding_right,
+ gdouble padding_top,
+ gdouble padding_bottom)
+{
+}
+
+
+static void
+meta_input_settings_x11_nested_set_mouse_accel_profile (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopPointerAccelProfile profile)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_trackball_accel_profile (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopPointerAccelProfile profile)
+{
+}
+
+
+static void
+meta_input_settings_x11_nested_set_stylus_pressure (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ ClutterInputDeviceTool *tool,
+ const gint32 curve[4])
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_stylus_button_map (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ ClutterInputDeviceTool *tool,
+ GDesktopStylusButtonAction primary,
+ GDesktopStylusButtonAction secondary,
+ GDesktopStylusButtonAction tertiary)
+{
+}
+
+
+static void
+meta_input_settings_x11_nested_set_mouse_middle_click_emulation (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_touchpad_middle_click_emulation (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static void
+meta_input_settings_x11_nested_set_trackball_middle_click_emulation (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ gboolean enabled)
+{
+}
+
+static gboolean
+meta_input_settings_x11_nested_has_two_finger_scroll (MetaInputSettings *settings,
+ ClutterInputDevice *device)
+{
+ return FALSE;
+}
+static gboolean
+meta_input_settings_x11_nested_is_trackball_device (MetaInputSettings *settings,
+ ClutterInputDevice *device)
+{
+ return FALSE;
+}
+
+static void
+meta_input_settings_x11_nested_init (MetaInputSettingsX11Nested *input_settings)
+{
+}
+
+static void
+meta_input_settings_x11_nested_class_init (MetaInputSettingsX11NestedClass *klass)
+{
+ MetaInputSettingsClass *settings_class = META_INPUT_SETTINGS_CLASS (klass);
+
+ settings_class->set_send_events =
+ meta_input_settings_x11_nested_set_send_events;
+ settings_class->set_matrix =
+ meta_input_settings_x11_nested_set_matrix;
+ settings_class->set_speed =
+ meta_input_settings_x11_nested_set_speed;
+ settings_class->set_left_handed =
+ meta_input_settings_x11_nested_set_left_handed;
+ settings_class->set_tap_enabled =
+ meta_input_settings_x11_nested_set_tap_enabled;
+ settings_class->set_tap_button_map =
+ meta_input_settings_x11_nested_set_tap_button_map;
+ settings_class->set_tap_and_drag_enabled =
+ meta_input_settings_x11_nested_set_tap_and_drag_enabled;
+ settings_class->set_tap_and_drag_lock_enabled =
+ meta_input_settings_x11_nested_set_tap_and_drag_lock_enabled;
+ settings_class->set_disable_while_typing =
+ meta_input_settings_x11_nested_set_disable_while_typing;
+ settings_class->set_invert_scroll =
+ meta_input_settings_x11_nested_set_invert_scroll;
+ settings_class->set_edge_scroll =
+ meta_input_settings_x11_nested_set_edge_scroll;
+ settings_class->set_two_finger_scroll =
+ meta_input_settings_x11_nested_set_two_finger_scroll;
+ settings_class->set_scroll_button =
+ meta_input_settings_x11_nested_set_scroll_button;
+ settings_class->set_click_method =
+ meta_input_settings_x11_nested_set_click_method;
+ settings_class->set_keyboard_repeat =
+ meta_input_settings_x11_nested_set_keyboard_repeat;
+ settings_class->set_tablet_mapping =
+ meta_input_settings_x11_nested_set_tablet_mapping;
+ settings_class->set_tablet_aspect_ratio =
+ meta_input_settings_x11_nested_set_tablet_aspect_ratio;
+ settings_class->set_tablet_area =
+ meta_input_settings_x11_nested_set_tablet_area;
+ settings_class->set_mouse_accel_profile =
+ meta_input_settings_x11_nested_set_mouse_accel_profile;
+ settings_class->set_trackball_accel_profile =
+ meta_input_settings_x11_nested_set_trackball_accel_profile;
+ settings_class->set_stylus_pressure =
+ meta_input_settings_x11_nested_set_stylus_pressure;
+ settings_class->set_stylus_button_map =
+ meta_input_settings_x11_nested_set_stylus_button_map;
+ settings_class->set_mouse_middle_click_emulation =
+ meta_input_settings_x11_nested_set_mouse_middle_click_emulation;
+ settings_class->set_touchpad_middle_click_emulation =
+ meta_input_settings_x11_nested_set_touchpad_middle_click_emulation;
+ settings_class->set_trackball_middle_click_emulation =
+ meta_input_settings_x11_nested_set_trackball_middle_click_emulation;
+ settings_class->has_two_finger_scroll =
+ meta_input_settings_x11_nested_has_two_finger_scroll;
+ settings_class->is_trackball_device =
+ meta_input_settings_x11_nested_is_trackball_device;
+}
diff --git a/src/backends/x11/nested/meta-input-settings-x11-nested.h b/src/backends/x11/nested/meta-input-settings-x11-nested.h
new file mode 100644
index 0000000..ace4be5
--- /dev/null
+++ b/src/backends/x11/nested/meta-input-settings-x11-nested.h
@@ -0,0 +1,34 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright 2021 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Marco Trevisan <marco.trevisan@canonical.com>
+ */
+
+#pragma once
+
+#include "backends/meta-input-settings-private.h"
+
+#define META_TYPE_INPUT_SETTINGS_X11_NESTED (meta_input_settings_x11_nested_get_type ())
+
+G_DECLARE_DERIVABLE_TYPE (MetaInputSettingsX11Nested, meta_input_settings_x11_nested,
+ META, INPUT_SETTINGS_X11_NESTED, MetaInputSettings);
+
+struct _MetaInputSettingsX11NestedClass
+{
+ MetaInputSettingsClass parent_class;
+};
diff --git a/src/meson.build b/src/meson.build
index b597e29..c1fc800 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -283,6 +283,8 @@ mutter_sources = [
'backends/x11/nested/meta-backend-x11-nested.h',
'backends/x11/nested/meta-cursor-renderer-x11-nested.c',
'backends/x11/nested/meta-cursor-renderer-x11-nested.h',
+ 'backends/x11/nested/meta-input-settings-x11-nested.c',
+ 'backends/x11/nested/meta-input-settings-x11-nested.h',
'backends/x11/nested/meta-stage-x11-nested.c',
'backends/x11/nested/meta-stage-x11-nested.h',
'backends/x11/nested/meta-renderer-x11-nested.c',
From: Sebastian Keller <skeller@gnome.org>
Date: Thu, 11 Feb 2021 15:52:28 +0100
Subject: backends/x11: Don't leak XRRGetPanning result
---
src/backends/x11/meta-crtc-xrandr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/backends/x11/meta-crtc-xrandr.c b/src/backends/x11/meta-crtc-xrandr.c
index 8a6fc12..e17d3ea 100644
--- a/src/backends/x11/meta-crtc-xrandr.c
+++ b/src/backends/x11/meta-crtc-xrandr.c
@@ -355,6 +355,7 @@ meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
.height = xrandr_crtc->height,
};
}
+ XRRFreePanning (panning);
modes = meta_gpu_get_modes (gpu);
for (i = 0; i < (unsigned int) resources->nmode; i++)
From: Sebastian Keller <skeller@gnome.org>
Date: Thu, 11 Feb 2021 15:42:00 +0100
Subject: backends/x11: Don't try to read more button states than there are
This was causing an (inconsequential) invalid read.
---
src/backends/x11/meta-seat-x11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index c419847..e01530b 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -1492,7 +1492,7 @@ translate_state (XIButtonState *button_state,
if (button_state)
{
- for (i = 1; i <= button_state->mask_len * 8; i++)
+ for (i = 1; i < button_state->mask_len * 8; i++)
{
if (!XIMaskIsSet (button_state->mask, i))
continue;
From: Pascal Nowack <Pascal.Nowack@gmx.de>
Date: Thu, 11 Feb 2021 12:12:09 +0100
Subject: backends/x11: Emit discrete scroll events for accumulated smooth
events
MetaVirtualInputDeviceX11 currently doesn't handle smooth scroll events
at all.
So, if a user of the remote desktop API uses smooth scroll events, then
only the wayland backend handles these events.
The user of the remote desktop API however, might not know which
backend is being used and actually the user should not even have to
care about it.
Actual smooth events cannot be emulated in the X11 events.
What can be done however is accumulating smooth events and then when
the accumulated steps surpass the DISCRETE_SCROLL_STEP value, emit a
discrete scroll event.
So, do exactly that, to make smooth scroll events work when the remote
desktop API is used with the x11 backend.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1727>
---
src/backends/x11/meta-virtual-input-device-x11.c | 38 ++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/src/backends/x11/meta-virtual-input-device-x11.c b/src/backends/x11/meta-virtual-input-device-x11.c
index beeae72..9ae6554 100644
--- a/src/backends/x11/meta-virtual-input-device-x11.c
+++ b/src/backends/x11/meta-virtual-input-device-x11.c
@@ -28,9 +28,14 @@
#include "meta-keymap-x11.h"
#include "meta-virtual-input-device-x11.h"
+#define DISCRETE_SCROLL_STEP 10.0
+
struct _MetaVirtualInputDeviceX11
{
ClutterVirtualInputDevice parent;
+
+ double accum_scroll_dx;
+ double accum_scroll_dy;
};
G_DEFINE_TYPE (MetaVirtualInputDeviceX11,
@@ -112,6 +117,39 @@ meta_virtual_input_device_x11_notify_scroll_continuous (ClutterVirtualInputDevic
ClutterScrollSource scroll_source,
ClutterScrollFinishFlags finish_flags)
{
+ MetaVirtualInputDeviceX11 *virtual_device_x11;
+ ClutterScrollDirection direction;
+ int i, n_xscrolls, n_yscrolls;
+
+ virtual_device_x11 = META_VIRTUAL_INPUT_DEVICE_X11 (virtual_device);
+
+ virtual_device_x11->accum_scroll_dx += dx;
+ virtual_device_x11->accum_scroll_dy += dy;
+ n_xscrolls = floor ((fabs (virtual_device_x11->accum_scroll_dx) + DBL_EPSILON) /
+ DISCRETE_SCROLL_STEP);
+ n_yscrolls = floor ((fabs (virtual_device_x11->accum_scroll_dy) + DBL_EPSILON) /
+ DISCRETE_SCROLL_STEP);
+
+ direction = virtual_device_x11->accum_scroll_dx > 0 ? CLUTTER_SCROLL_RIGHT
+ : CLUTTER_SCROLL_LEFT;
+ for (i = 0; i < n_xscrolls; ++i)
+ {
+ meta_virtual_input_device_x11_notify_discrete_scroll (
+ virtual_device, time_us, direction, CLUTTER_SCROLL_SOURCE_WHEEL);
+ }
+
+ direction = virtual_device_x11->accum_scroll_dy > 0 ? CLUTTER_SCROLL_DOWN
+ : CLUTTER_SCROLL_UP;
+ for (i = 0; i < n_yscrolls; ++i)
+ {
+ meta_virtual_input_device_x11_notify_discrete_scroll (
+ virtual_device, time_us, direction, CLUTTER_SCROLL_SOURCE_WHEEL);
+ }
+
+ virtual_device_x11->accum_scroll_dx =
+ fmod (virtual_device_x11->accum_scroll_dx, DISCRETE_SCROLL_STEP);
+ virtual_device_x11->accum_scroll_dy =
+ fmod (virtual_device_x11->accum_scroll_dy, DISCRETE_SCROLL_STEP);
}
static void
From: Sebastian Keller <skeller@gnome.org>
Date: Thu, 11 Feb 2021 15:44:37 +0100
Subject: backends/x11: Free button state mask allocated by XIQueryPointer
XIQueryPointer allocates the button state mask that we were leaking in
some places. We need to manually free this, because there is no XI
function that would do this for us.
---
src/backends/x11/meta-input-device-x11.c | 4 +++-
src/backends/x11/meta-seat-x11.c | 13 ++++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/backends/x11/meta-input-device-x11.c b/src/backends/x11/meta-input-device-x11.c
index 0c4e023..feade0d 100644
--- a/src/backends/x11/meta-input-device-x11.c
+++ b/src/backends/x11/meta-input-device-x11.c
@@ -401,7 +401,7 @@ meta_input_device_x11_query_pointer_location (MetaInputDeviceX11 *device_xi2)
{
Window xroot_window, xchild_window;
double xroot_x, xroot_y, xwin_x, xwin_y;
- XIButtonState button_state;
+ XIButtonState button_state = { 0 };
XIModifierState mod_state;
XIGroupState group_state;
int result;
@@ -419,6 +419,8 @@ meta_input_device_x11_query_pointer_location (MetaInputDeviceX11 *device_xi2)
&group_state);
clutter_x11_untrap_x_errors ();
+ g_free (button_state.mask);
+
if (!result)
return FALSE;
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index e01530b..926b445 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -1537,7 +1537,7 @@ meta_seat_x11_query_state (ClutterSeat *seat,
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
Window root_ret, child_ret;
double root_x, root_y, win_x, win_y;
- XIButtonState button_state;
+ XIButtonState button_state = { 0 };
XIModifierState modifier_state;
XIGroupState group_state;
@@ -1549,7 +1549,10 @@ meta_seat_x11_query_state (ClutterSeat *seat,
&root_x, &root_y, &win_x, &win_y,
&button_state, &modifier_state, &group_state);
if (clutter_x11_untrap_x_errors ())
- return FALSE;
+ {
+ g_free (button_state.mask);
+ return FALSE;
+ }
if (sequence)
{
@@ -1557,7 +1560,10 @@ meta_seat_x11_query_state (ClutterSeat *seat,
touch_info = g_hash_table_lookup (seat_x11->touch_coords, sequence);
if (!touch_info)
- return FALSE;
+ {
+ g_free (button_state.mask);
+ return FALSE;
+ }
if (coords)
{
@@ -1577,6 +1583,7 @@ meta_seat_x11_query_state (ClutterSeat *seat,
if (modifiers)
*modifiers = translate_state (&button_state, &modifier_state, &group_state);
+ g_free (button_state.mask);
return TRUE;
}
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 30 Nov 2020 19:02:28 +0100
Subject: backends/x11: Iterate button modifiers all the way
This is misuse of XIMaskLen (on a mask len! not the right mask!).
Have this iterate all possible values stored in the button state.
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1559
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1617>
---
src/backends/x11/meta-seat-x11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index 4fa8675..fc908ed 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -1492,7 +1492,7 @@ translate_state (XIButtonState *button_state,
if (button_state)
{
- for (i = 1; i < XIMaskLen (button_state->mask_len); i++)
+ for (i = 1; i <= button_state->mask_len * 8; i++)
{
if (!XIMaskIsSet (button_state->mask, i))
continue;
From: Sebastian Keller <skeller@gnome.org>
Date: Thu, 11 Feb 2021 15:46:13 +0100
Subject: backends/x11: Unref keymap on finalize
Despite keymaps being relatively large, this does not really have much
of an impact, because there is only ever one and it's only leaked on
shutdown.
---
src/backends/x11/meta-backend-x11.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index e1a520b..e220971 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -874,6 +874,17 @@ meta_backend_x11_dispose (GObject *object)
G_OBJECT_CLASS (meta_backend_x11_parent_class)->dispose (object);
}
+static void
+meta_backend_x11_finalize (GObject *object)
+{
+ MetaBackendX11 *x11 = META_BACKEND_X11 (object);
+ MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
+
+ g_clear_pointer (&priv->keymap, xkb_keymap_unref);
+
+ G_OBJECT_CLASS (meta_backend_x11_parent_class)->finalize (object);
+}
+
static void
meta_backend_x11_class_init (MetaBackendX11Class *klass)
{
@@ -881,6 +892,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = meta_backend_x11_dispose;
+ object_class->finalize = meta_backend_x11_finalize;
backend_class->create_clutter_backend = meta_backend_x11_create_clutter_backend;
backend_class->post_init = meta_backend_x11_post_init;
backend_class->grab_device = meta_backend_x11_grab_device;
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 30 Nov 2020 19:00:31 +0100
Subject: backends/x11: Use XkbBuildCoreState the right way around
Pass parameters in the correct order, and don't let it clamp button
modifiers away (Since this macro does "state & 0xff").
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1559
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1617>
---
src/backends/x11/meta-seat-x11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index 2381ddf..4fa8675 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -1521,7 +1521,7 @@ translate_state (XIButtonState *button_state,
}
if (group_state)
- state = XkbBuildCoreState (group_state->effective, state);
+ state |= XkbBuildCoreState (0, group_state->effective);
return state;
}
From: =?utf-8?q?Jonas_Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Mon, 1 Mar 2021 15:51:51 +0100
Subject: clutter: Also pick on BUTTON_PRESS events
In an x11 session, we don't receive motion events from X when the
pointer is above a window. Since commit 734a1859 we only do picking on
motion events though, which means when clicking the mouse to focus a
window, we don't repick and might still think the pointer is hovering
above another window or actor, ending up not focussing the window.
Fix this by always repicking on BUTTON_PRESS events. While this is not
necessary in the wayland session, button presses happen rarely compared
to motion events, so it's not a performance regression to do it in
Wayland sessions, too.
Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1660
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1752>
---
clutter/clutter/clutter-main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 48d3974..c4a6e83 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1900,7 +1900,12 @@ _clutter_process_event_details (ClutterActor *stage,
break;
}
- if (event->type == CLUTTER_MOTION)
+ /* We need to repick on both motion and button press events, the
+ * latter is only needed for X11 (there the device actor might be
+ * stale because we don't always receive motion events).
+ */
+ if (event->type == CLUTTER_BUTTON_PRESS ||
+ event->type == CLUTTER_MOTION)
{
event->any.source =
update_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 10 Mar 2021 01:13:34 +0100
Subject: clutter: Ensure we always call handle_event_post for processed
events
Since commit 2ceac4a device-related X11 events aren't processed anymore,
causing the input settings not to handle the devices.
This is due to the fact that we may never call clutter_seat_handle_event_post()
for such events.
While this is always happening for the native backend, it doesn't happen in
X11 because the events are removed from the queue as part of
meta_x11_handle_event(), and thus no event was queued to the stage by the
backend events source.
This also makes sure that the event post handler is called after the
event is actually processed, and not before an event is queued.
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1564
---
clutter/clutter/clutter-main.c | 3 +++
src/backends/meta-backend.c | 5 -----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index c4a6e83..f19e440 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -2093,8 +2093,10 @@ _clutter_process_event (ClutterEvent *event)
{
ClutterMainContext *context;
ClutterActor *stage;
+ ClutterSeat *seat;
context = _clutter_context_get_default ();
+ seat = clutter_backend_get_default_seat (context->backend);
stage = CLUTTER_ACTOR (event->any.stage);
if (stage == NULL)
@@ -2110,6 +2112,7 @@ _clutter_process_event (ClutterEvent *event)
context->current_event = g_slist_prepend (context->current_event, event);
_clutter_process_event_details (stage, context, event);
+ clutter_seat_handle_event_post (seat, event);
context->current_event = g_slist_delete_link (context->current_event, context->current_event);
}
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index aed54d4..a91fc2d 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -1015,17 +1015,12 @@ clutter_source_dispatch (GSource *source,
gpointer user_data)
{
MetaBackendSource *backend_source = (MetaBackendSource *) source;
- MetaBackendPrivate *priv =
- meta_backend_get_instance_private (backend_source->backend);
ClutterEvent *event = clutter_event_get ();
- ClutterSeat *seat;
if (event)
{
event->any.stage =
CLUTTER_STAGE (meta_backend_get_stage (backend_source->backend));
- seat = clutter_backend_get_default_seat (priv->clutter_backend);
- clutter_seat_handle_event_post (seat, event);
clutter_do_event (event);
clutter_event_free (event);
}