import mutter-40.4-3.el9_b

This commit is contained in:
CentOS Sources 2021-11-02 11:52:32 -04:00 committed by Stepan Oksanichenko
commit 3ba3624cec
15 changed files with 5358 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/mutter-40.4.tar.xz

1
.mutter.metadata Normal file
View File

@ -0,0 +1 @@
e97fff99b075736fc6f0d5bd5713d89983fe99e1 SOURCES/mutter-40.4.tar.xz

View File

@ -0,0 +1,26 @@
From 3899a01cd6cb00ca686946d3065d58f59f5c2099 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 17 Nov 2020 14:00:02 +0100
Subject: [PATCH] Revert "build: Do not provide built sources as libmutter_dep
sources"
This reverts commit 4e9a2e479969973bf3063c740ceff149036b3af4.
---
src/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/meson.build b/src/meson.build
index e7c99caee..8fe484ec2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -955,6 +955,7 @@ libmutter = shared_library(libmutter_name,
libmutter_dep = declare_dependency(
link_with: libmutter,
include_directories: mutter_includes,
+ sources: mutter_built_sources,
dependencies: [
libmutter_cogl_dep,
libmutter_clutter_dep,
--
2.28.0

View File

@ -0,0 +1,35 @@
From a8746403352be96bae7dfd73ac31fe0253f884b8 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 9 Mar 2021 17:21:59 -0800
Subject: [PATCH] Test: deny atomic KMS for "tegra" (RHBZ #1936991)
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
data/61-mutter.rules | 1 +
src/backends/native/meta-kms-device.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/data/61-mutter.rules b/data/61-mutter.rules
index edc03e6c1..d8e3c5f00 100644
--- a/data/61-mutter.rules
+++ b/data/61-mutter.rules
@@ -3,3 +3,4 @@ DRIVERS=="nouveau", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="amdgpu", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="radeon", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
ENV{ID_PATH}=="platform-vkms", TAG+="mutter-device-ignore"
+DRIVER=="tegra", SUBSYSTEM=="platform", TAG+="mutter-device-disable-atomic-kms"
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
index c388096d5..ef65cf82b 100644
--- a/src/backends/native/meta-kms-device.c
+++ b/src/backends/native/meta-kms-device.c
@@ -252,6 +252,7 @@ is_atomic_allowed (const char *driver_name)
"vmwgfx",
"vboxvideo",
"nvidia-drm",
+ "tegra",
NULL,
};
--
2.28.0

View File

@ -0,0 +1,92 @@
From ff4dc8cc8274dc5f6ed11515e05a341e4e2cec28 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 12 Aug 2021 14:13:23 -0400
Subject: [PATCH] backend: Clean up renderer after clutter backendm
commit c4a73e795020722eda3e2bec0c16d96f9f37333b added
code to cleanup the renderer when the meta backend is
disposed. Unfortunately, this introduced a crash when
the window manager is replaced.
This is because cleaning up the renderer involves talking
to the X server over a display connection that's closed
two lines higher as part of the clutter_backend_destroy
call.
This commit fixes the crash by swapping their order.
---
src/backends/meta-backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index ff84bfe6a..7e8b4ee95 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -216,63 +216,63 @@ meta_backend_dispose (GObject *object)
if (priv->sleep_signal_id)
{
g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id);
priv->sleep_signal_id = 0;
}
if (priv->upower_watch_id)
{
g_bus_unwatch_name (priv->upower_watch_id);
priv->upower_watch_id = 0;
}
g_cancellable_cancel (priv->cancellable);
g_clear_object (&priv->cancellable);
g_clear_object (&priv->system_bus);
g_clear_object (&priv->upower_proxy);
g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
g_clear_pointer (&priv->device_monitors, g_hash_table_destroy);
g_clear_object (&priv->settings);
#ifdef HAVE_PROFILER
g_clear_object (&priv->profiler);
#endif
g_clear_pointer (&priv->default_seat, clutter_seat_destroy);
g_clear_pointer (&priv->stage, clutter_actor_destroy);
- g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy);
g_clear_object (&priv->renderer);
g_clear_list (&priv->gpus, g_object_unref);
+ g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy);
G_OBJECT_CLASS (meta_backend_parent_class)->dispose (object);
}
static void
meta_backend_destroy (MetaBackend *backend)
{
g_object_run_dispose (G_OBJECT (backend));
g_object_unref (backend);
}
static void
meta_backend_sync_screen_size (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
int width, height;
meta_monitor_manager_get_screen_size (priv->monitor_manager, &width, &height);
META_BACKEND_GET_CLASS (backend)->update_screen_size (backend, width, height);
}
static void
reset_pointer_position (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaMonitorManager *monitor_manager = priv->monitor_manager;
ClutterSeat *seat = clutter_backend_get_default_seat (priv->clutter_backend);
MetaLogicalMonitor *primary;
--
2.31.1

View File

@ -0,0 +1,85 @@
From 1ab51efc968d7d3c6244d9b7efcdf4bae4fc0a9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 12 Mar 2014 02:04:13 +0100
Subject: [PATCH] constraints: Enforce X11 size limits
X11 limits windows to a maximum of 32767x32767, enforce that restriction
to keep insanely huge windows from crashing the WM.
---
src/core/constraints.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 4b1d95338a..eee16dc48f 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -109,6 +109,7 @@ typedef enum
PRIORITY_TITLEBAR_VISIBLE = 4,
PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA = 4,
PRIORITY_CUSTOM_RULE = 4,
+ PRIORITY_XLIMITS = 4,
PRIORITY_MAXIMUM = 4 /* Dummy value used for loop end = max(all priorities) */
} ConstraintPriority;
@@ -204,6 +205,10 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only);
+static gboolean constrain_xlimits (MetaWindow *window,
+ ConstraintInfo *info,
+ ConstraintPriority priority,
+ gboolean check_only);
static void setup_constraint_info (ConstraintInfo *info,
MetaWindow *window,
@@ -239,6 +244,7 @@ static const Constraint all_constraints[] = {
{constrain_fully_onscreen, "constrain_fully_onscreen"},
{constrain_titlebar_visible, "constrain_titlebar_visible"},
{constrain_partially_onscreen, "constrain_partially_onscreen"},
+ {constrain_xlimits, "constrain_xlimits"},
{NULL, NULL}
};
@@ -1876,3 +1882,39 @@ constrain_partially_onscreen (MetaWindow *window,
return retval;
}
+
+
+#define MAX_WINDOW_SIZE 32767
+
+static gboolean
+constrain_xlimits (MetaWindow *window,
+ ConstraintInfo *info,
+ ConstraintPriority priority,
+ gboolean check_only)
+{
+ int max_w, max_h;
+ gboolean constraint_already_satisfied;
+
+ if (priority > PRIORITY_XLIMITS)
+ return TRUE;
+
+ max_w = max_h = MAX_WINDOW_SIZE;
+
+ if (window->frame)
+ {
+ MetaFrameBorders borders;
+ meta_frame_calc_borders (window->frame, &borders);
+
+ max_w -= (borders.total.left + borders.total.right);
+ max_h -= (borders.total.top + borders.total.bottom);
+ }
+
+ constraint_already_satisfied = info->current.width < max_w && info->current.height < max_h;
+ if (check_only || constraint_already_satisfied)
+ return constraint_already_satisfied;
+
+ info->current.width = MIN (info->current.width, max_w);
+ info->current.height = MIN (info->current.height, max_h);
+
+ return TRUE;
+}
--
2.31.1

View File

@ -0,0 +1,42 @@
From 7ac5b7bad8f2d0e61700610f68282f6687cc9d2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 21 Jul 2016 15:43:12 +0200
Subject: [PATCH] events: Don't move (sloppy) focus while buttons are pressed
(https://bugzilla.redhat.com/show_bug.cgi?id=1358535)
---
src/x11/events.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/x11/events.c b/src/x11/events.c
index efa8f9856b..388eff0ac7 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -839,6 +839,16 @@ crossing_serial_is_ignored (MetaX11Display *x11_display,
return FALSE;
}
+static gboolean
+event_has_button_mask (XIEnterEvent *enter_event)
+{
+ int i;
+ for (i = 0; i < enter_event->buttons.mask_len; i++)
+ if (enter_event->buttons.mask[i] != '\0')
+ return TRUE;
+ return FALSE;
+}
+
static gboolean
handle_input_xevent (MetaX11Display *x11_display,
XIEvent *input_event,
@@ -883,6 +893,7 @@ handle_input_xevent (MetaX11Display *x11_display,
* avoid races.
*/
if (window && !crossing_serial_is_ignored (x11_display, serial) &&
+ !event_has_button_mask (enter_event) &&
enter_event->mode != XINotifyGrab &&
enter_event->mode != XINotifyUngrab &&
enter_event->detail != XINotifyInferior &&
--
2.31.1

View File

@ -0,0 +1,49 @@
From 99c74360451a85fca9dacad531ed22adbc1b0805 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 13 Feb 2018 09:44:50 -0500
Subject: [PATCH] main: be more aggressive in assuming X11 backend
If the session is started by vncserver right now, the
XDG_SESSION_TYPE won't be X11. Ideally that would be
fixed, but for backward compatibility we should default
to X11 if the session type isn't set to wayland explicitly.
---
src/core/main.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index a07dda9ecc..0d241f952b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -407,7 +407,6 @@ find_session_type (void)
char *session_id;
char *session_type;
const char *session_type_env;
- gboolean is_tty = FALSE;
int ret, i;
ret = sd_pid_get_session (0, &session_id);
@@ -420,8 +419,7 @@ find_session_type (void)
{
if (session_type_is_supported (session_type))
goto out;
- else
- is_tty = g_strcmp0 (session_type, "tty") == 0;
+
free (session_type);
}
}
@@ -453,8 +451,8 @@ find_session_type (void)
goto out;
}
- /* Legacy support for starting through xinit */
- if (is_tty && (g_getenv ("MUTTER_DISPLAY") || g_getenv ("DISPLAY")))
+ /* Legacy support for starting through xinit or vncserver */
+ if (g_getenv ("MUTTER_DISPLAY") || g_getenv ("DISPLAY"))
{
session_type = strdup ("x11");
goto out;
--
2.31.1

View File

@ -0,0 +1,35 @@
From 6e2ef652cd58136aa668d0c1bd843fe83f11a0ab Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 26 Oct 2018 08:49:39 +0200
Subject: [PATCH] wayland: Allow Xwayland grabs on selected apps
Allow Xwayland grabs on a selected set of X11 applications.
---
data/org.gnome.mutter.wayland.gschema.xml.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/data/org.gnome.mutter.wayland.gschema.xml.in b/data/org.gnome.mutter.wayland.gschema.xml.in
index 8a1878e105..5527a46bc6 100644
--- a/data/org.gnome.mutter.wayland.gschema.xml.in
+++ b/data/org.gnome.mutter.wayland.gschema.xml.in
@@ -66,7 +66,7 @@
gettext-domain="@GETTEXT_DOMAIN@">
<key name="xwayland-allow-grabs" type="b">
- <default>false</default>
+ <default>true</default>
<summary>Allow X11 grabs to lock keyboard focus with Xwayland</summary>
<description>
Allow all keyboard events to be routed to X11 “override redirect”
@@ -86,7 +86,7 @@
</key>
<key name="xwayland-grab-access-rules" type="as">
- <default>[]</default>
+ <default>['@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@']</default>
<summary>Xwayland applications allowed to issue keyboard grabs</summary>
<description>
List the resource names or resource class of X11 windows either
--
2.31.1

View File

@ -0,0 +1,192 @@
From 5e4a1290ce75ed94e3f0f457d35a225f2ef3878c Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 28 Nov 2017 10:54:08 +0100
Subject: [PATCH] wayland: Avoid a race in wl_seat capabilities
The way wl_seat capabilities work, by notifying clients of capabilities
changes, and clients consequently requesting the relevant interface
objects (pointer, keyboard, touch) is inherently racy.
On quick VT changes for example, capabilities on the seat will be added
and removed, and by the time the client receives the capability change
notification and requests the relevant keyboard, pointer or touch,
another VT switch might have occurred and the wl_pointer, wl_keyboard or
wl_touch already destroyed, leading to a protocol error which kills the
client.
To avoid this, create the objects when requested regardless of the
capabilities.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1797
Related: https://bugzilla.gnome.org/show_bug.cgi?id=790932
---
src/wayland/meta-wayland-pointer.c | 45 ++++++++++++++++++++++++------
src/wayland/meta-wayland-seat.c | 9 ++----
src/wayland/meta-wayland-touch.c | 8 ------
3 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 3132abfd2..abd779ad7 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -109,7 +109,7 @@ meta_wayland_pointer_client_new (void)
}
static void
-meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
+meta_wayland_pointer_make_resources_inert (MetaWaylandPointerClient *pointer_client)
{
struct wl_resource *resource, *next;
@@ -141,10 +141,25 @@ meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
wl_list_init (wl_resource_get_link (resource));
wl_resource_set_user_data (resource, NULL);
}
+}
+static void
+meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
+{
+ meta_wayland_pointer_make_resources_inert (pointer_client);
g_free (pointer_client);
}
+static void
+make_resources_inert_foreach (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ MetaWaylandPointerClient *pointer_client = value;
+
+ meta_wayland_pointer_make_resources_inert (pointer_client);
+}
+
static gboolean
meta_wayland_pointer_client_is_empty (MetaWaylandPointerClient *pointer_client)
{
@@ -158,8 +173,6 @@ MetaWaylandPointerClient *
meta_wayland_pointer_get_pointer_client (MetaWaylandPointer *pointer,
struct wl_client *client)
{
- if (!pointer->pointer_clients)
- return NULL;
return g_hash_table_lookup (pointer->pointer_clients, client);
}
@@ -475,10 +488,6 @@ meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
ClutterSeat *clutter_seat;
- pointer->pointer_clients =
- g_hash_table_new_full (NULL, NULL, NULL,
- (GDestroyNotify) meta_wayland_pointer_client_free);
-
pointer->cursor_surface = NULL;
clutter_seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
@@ -508,6 +517,10 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
ClutterBackend *clutter_backend = clutter_get_default_backend ();
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
+ g_hash_table_foreach (pointer->pointer_clients,
+ make_resources_inert_foreach,
+ NULL);
+
g_signal_handlers_disconnect_by_func (cursor_tracker,
(gpointer) meta_wayland_pointer_on_cursor_changed,
pointer);
@@ -531,7 +544,6 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
meta_wayland_pointer_set_focus (pointer, NULL);
meta_wayland_pointer_set_current (pointer, NULL);
- g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
pointer->cursor_surface = NULL;
}
@@ -1356,11 +1368,28 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer)
pointer->default_grab.interface = &default_pointer_grab_interface;
pointer->default_grab.pointer = pointer;
pointer->grab = &pointer->default_grab;
+ pointer->pointer_clients =
+ g_hash_table_new_full (NULL, NULL, NULL,
+ (GDestroyNotify) meta_wayland_pointer_client_free);
+}
+
+static void
+meta_wayland_pointer_finalize (GObject *object)
+{
+ MetaWaylandPointer *pointer = META_WAYLAND_POINTER (object);
+
+ g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
+
+ G_OBJECT_CLASS (meta_wayland_pointer_parent_class)->finalize (object);
}
static void
meta_wayland_pointer_class_init (MetaWaylandPointerClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = meta_wayland_pointer_finalize;
+
signals[FOCUS_SURFACE_CHANGED] = g_signal_new ("focus-surface-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index c6390dde7..efce6d6d6 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -46,8 +46,7 @@ seat_get_pointer (struct wl_client *client,
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandPointer *pointer = seat->pointer;
- if (meta_wayland_seat_has_pointer (seat))
- meta_wayland_pointer_create_new_resource (pointer, client, resource, id);
+ meta_wayland_pointer_create_new_resource (pointer, client, resource, id);
}
static void
@@ -58,8 +57,7 @@ seat_get_keyboard (struct wl_client *client,
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandKeyboard *keyboard = seat->keyboard;
- if (meta_wayland_seat_has_keyboard (seat))
- meta_wayland_keyboard_create_new_resource (keyboard, client, resource, id);
+ meta_wayland_keyboard_create_new_resource (keyboard, client, resource, id);
}
static void
@@ -70,8 +68,7 @@ seat_get_touch (struct wl_client *client,
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandTouch *touch = seat->touch;
- if (meta_wayland_seat_has_touch (seat))
- meta_wayland_touch_create_new_resource (touch, client, resource, id);
+ meta_wayland_touch_create_new_resource (touch, client, resource, id);
}
static void
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 002ff16f7..15f0312eb 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -521,16 +521,8 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
struct wl_resource *seat_resource,
uint32_t id)
{
- MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
struct wl_resource *cr;
- if (!meta_wayland_seat_has_touch (seat))
- {
- wl_resource_post_error (seat_resource, WL_DISPLAY_ERROR_INVALID_METHOD,
- "Cannot retrieve touch interface without touch capability");
- return;
- }
-
cr = wl_resource_create (client, &wl_touch_interface, wl_resource_get_version (seat_resource), id);
wl_resource_set_implementation (cr, &touch_interface, touch, unbind_resource);
wl_list_insert (&touch->resource_list, wl_resource_get_link (cr));
--
2.31.1

View File

@ -0,0 +1,35 @@
From 9efcc35102b4c41265e93461b35a1193b3d5822d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 12 May 2017 13:40:31 +0200
Subject: [PATCH] window-actor: Special-case shaped Java windows
OpenJDK wrongly assumes that shaping a window implies no shadows.
They got lucky until commit b975676c changed the fallback case,
but now their compliance tests are broken. Make them happy again
by special-casing shaped Java windows.
---
src/compositor/meta-window-actor-x11.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index b7032e0ba..b05d5e158 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -528,6 +528,14 @@ has_shadow (MetaWindowActorX11 *actor_x11)
*/
if (window->has_custom_frame_extents)
return FALSE;
+
+ /*
+ * OpenJDK wrongly assumes that shaping a window implies no compositor
+ * shadows; make its compliance tests happy to give it what it wants ...
+ */
+ if (g_strcmp0 (window->res_name, "sun-awt-X11-XWindowPeer") == 0 &&
+ window->shape_region != NULL)
+ return FALSE;
/*
* Generate shadows for all other windows.
--
2.23.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,819 @@
From 705818340dec181335b48ab73d6411e639daaeae Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 1 Jun 2021 11:44:20 +0200
Subject: [PATCH 1/6] backends/x11: Support synaptics configuration
The code is taken mostly as-is from g-s-d, so we can drag the
dead horse a bit longer.
---
src/backends/x11/meta-input-settings-x11.c | 275 +++++++++++++++++++++
1 file changed, 275 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 96390285a6..0631fd2fee 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -26,6 +26,7 @@
#include "backends/x11/meta-input-settings-x11.h"
#include <gdk/gdkx.h>
+#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput2.h>
@@ -165,6 +166,184 @@ change_property (ClutterInputDevice *device,
meta_XFree (data_ret);
}
+static gboolean
+is_device_synaptics (ClutterInputDevice *device)
+{
+ guchar *has_setting;
+
+ /* We just need looking for a synaptics-specific property */
+ has_setting = get_property (device, "Synaptics Off", XA_INTEGER, 8, 1);
+ if (!has_setting)
+ return FALSE;
+
+ meta_XFree (has_setting);
+ return TRUE;
+}
+
+static void
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
+ gboolean tap_enabled,
+ gboolean left_handed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaX11Display *x11_display = display ? display->x11_display : NULL;
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ int device_id;
+ XDevice *xdevice;
+ guchar *tap_action, *buttons;
+ guint buttons_capacity = 16, n_buttons;
+
+ device_id = meta_input_device_x11_get_device_id (device);
+ xdevice = XOpenDevice (xdisplay, device_id);
+ if (!xdevice)
+ return;
+
+ tap_action = get_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, 7);
+ if (!tap_action)
+ goto out;
+
+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
+ tap_action[6] = tap_enabled ? 2 : 0;
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+ buttons = g_new (guchar, buttons_capacity);
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
+
+ while (n_buttons > buttons_capacity)
+ {
+ buttons_capacity = n_buttons;
+ buttons = (guchar *) g_realloc (buttons,
+ buttons_capacity * sizeof (guchar));
+
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
+ }
+
+ buttons[0] = left_handed ? 3 : 1;
+ buttons[2] = left_handed ? 1 : 3;
+ XSetDeviceButtonMapping (xdisplay, xdevice, buttons, n_buttons);
+ g_free (buttons);
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ {
+ g_warning ("Could not set synaptics touchpad left-handed for %s",
+ clutter_input_device_get_device_name (device));
+ }
+
+ out:
+ XCloseDevice (xdisplay, xdevice);
+}
+
+static void
+change_synaptics_speed (ClutterInputDevice *device,
+ gdouble speed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaX11Display *x11_display = display ? display->x11_display : NULL;
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ int device_id;
+ XDevice *xdevice;
+ XPtrFeedbackControl feedback;
+ XFeedbackState *states, *state;
+ int i, num_feedbacks, motion_threshold, numerator, denominator;
+ gfloat motion_acceleration;
+
+ device_id = meta_input_device_x11_get_device_id (device);
+ xdevice = XOpenDevice (xdisplay, device_id);
+ if (!xdevice)
+ return;
+ /* Get the list of feedbacks for the device */
+ states = XGetFeedbackControl (xdisplay, xdevice, &num_feedbacks);
+ if (!states)
+ return;
+
+ /* Calculate acceleration and threshold */
+ motion_acceleration = (speed + 1) * 5; /* speed is [-1..1], map to [0..10] */
+ motion_threshold = CLAMP (10 - floor (motion_acceleration), 1, 10);
+
+ if (motion_acceleration >= 1.0)
+ {
+ /* we want to get the acceleration, with a resolution of 0.5
+ */
+ if ((motion_acceleration - floor (motion_acceleration)) < 0.25)
+ {
+ numerator = floor (motion_acceleration);
+ denominator = 1;
+ }
+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.5)
+ {
+ numerator = ceil (2.0 * motion_acceleration);
+ denominator = 2;
+ }
+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.75)
+ {
+ numerator = floor (2.0 *motion_acceleration);
+ denominator = 2;
+ }
+ else
+ {
+ numerator = ceil (motion_acceleration);
+ denominator = 1;
+ }
+ }
+ else if (motion_acceleration < 1.0 && motion_acceleration > 0)
+ {
+ /* This we do to 1/10ths */
+ numerator = floor (motion_acceleration * 10) + 1;
+ denominator= 10;
+ }
+ else
+ {
+ numerator = -1;
+ denominator = -1;
+ }
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+
+ state = (XFeedbackState *) states;
+
+ for (i = 0; i < num_feedbacks; i++)
+ {
+ if (state->class == PtrFeedbackClass)
+ {
+ /* And tell the device */
+ feedback.class = PtrFeedbackClass;
+ feedback.length = sizeof (XPtrFeedbackControl);
+ feedback.id = state->id;
+ feedback.threshold = motion_threshold;
+ feedback.accelNum = numerator;
+ feedback.accelDenom = denominator;
+
+ XChangeFeedbackControl (xdisplay, xdevice,
+ DvAccelNum | DvAccelDenom | DvThreshold,
+ (XFeedbackControl *) &feedback);
+ break;
+ }
+
+ state = (XFeedbackState *) ((char *) state + state->length);
+ }
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ {
+ g_warning ("Could not set synaptics touchpad acceleration for %s",
+ clutter_input_device_get_device_name (device));
+ }
+
+ XFreeFeedbackList (states);
+ XCloseDevice (xdisplay, xdevice);
+}
+
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -173,6 +352,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */
guchar *available;
+ if (is_device_synaptics (device))
+ {
+ values[0] = mode != G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED;
+ change_property (device, "Synaptics Off", XA_INTEGER, 8, &values, 1);
+ return;
+ }
+
available = get_property (device, "libinput Send Events Modes Available",
XA_INTEGER, 8, 2);
if (!available)
@@ -225,6 +411,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
+ if (is_device_synaptics (device))
+ {
+ change_synaptics_speed (device, speed);
+ return;
+ }
+
change_property (device, "libinput Accel Speed",
XInternAtom (xdisplay, "FLOAT", False),
32, &value, 1);
@@ -251,6 +443,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
else
{
value = enabled ? 1 : 0;
+
+ if (is_device_synaptics (device))
+ {
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+ change_synaptics_tap_left_handed (device,
+ g_settings_get_boolean (settings, "tap-to-click"),
+ enabled);
+ g_object_unref (settings);
+ return;
+ }
+
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -274,6 +479,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ GDesktopTouchpadHandedness handedness;
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+ handedness = g_settings_get_enum (settings, "left-handed");
+ g_object_unref (settings);
+
+ change_synaptics_tap_left_handed (device, enabled,
+ handedness == G_DESKTOP_TOUCHPAD_HANDEDNESS_LEFT);
+ return;
+ }
+
change_property (device, "libinput Tapping Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -307,6 +526,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
{
guchar value = (inverted) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ gint32 *scrolling_distance;
+
+ scrolling_distance = get_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, 2);
+ if (scrolling_distance)
+ {
+ scrolling_distance[0] = inverted ?
+ -abs (scrolling_distance[0]) : abs (scrolling_distance[0]);
+ scrolling_distance[1] = inverted ?
+ -abs (scrolling_distance[1]) : abs (scrolling_distance[1]);
+
+ change_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, scrolling_distance, 2);
+ meta_XFree (scrolling_distance);
+ }
+
+ return;
+ }
+
change_property (device, "libinput Natural Scrolling Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -320,6 +560,41 @@ change_scroll_method (ClutterInputDevice *device,
guchar *current = NULL;
guchar *available = NULL;
+ if (is_device_synaptics (device))
+ {
+ switch (method)
+ {
+ case SCROLL_METHOD_FIELD_EDGE:
+ current = get_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, 3);
+ if (current)
+ {
+ current[0] = enabled;
+ current[1] = enabled;
+ change_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, current, 3);
+ meta_XFree (current);
+ }
+ break;
+ case SCROLL_METHOD_FIELD_2FG:
+ current = get_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, 2);
+ if (current)
+ {
+ current[0] = enabled;
+ current[1] = enabled;
+ change_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, current, 2);
+ meta_XFree (current);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[method])
--
2.31.1
From 50c4733acf56b3b67a2706d32f5c455cb51f9458 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 13 Feb 2018 11:44:40 +0100
Subject: [PATCH 2/6] clutter: Extend touchpad device property check for
Synaptics
So we reliably get CLUTTER_TOUCHPAD_DEVICE for those. The other heuristics
to get the device type may fall short.
---
src/backends/x11/meta-seat-x11.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index d43834bd7b..73938e22e0 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -246,7 +246,8 @@ is_touch_device (XIAnyClassInfo **classes,
}
static gboolean
-is_touchpad_device (XIDeviceInfo *info)
+query_exists_device_property (XIDeviceInfo *info,
+ const char *property)
{
gulong nitems, bytes_after;
uint32_t *data = NULL;
@@ -254,7 +255,7 @@ is_touchpad_device (XIDeviceInfo *info)
Atom type;
Atom prop;
- prop = XInternAtom (clutter_x11_get_default_display (), "libinput Tapping Enabled", True);
+ prop = XInternAtom (clutter_x11_get_default_display (), property, True);
if (prop == None)
return FALSE;
@@ -275,6 +276,18 @@ is_touchpad_device (XIDeviceInfo *info)
return TRUE;
}
+static gboolean
+is_touchpad_device (XIDeviceInfo *info)
+{
+ if (query_exists_device_property (info, "libinput Tapping Enabled"))
+ return TRUE;
+
+ if (query_exists_device_property (info, "Synaptics Off"))
+ return TRUE;
+
+ return FALSE;
+}
+
static gboolean
get_device_ids (XIDeviceInfo *info,
char **vendor_id,
--
2.31.1
From 307970305d11cdca1b97c53c85bda8b809ff4f0f Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:39:52 +0200
Subject: [PATCH 3/6] backends/x11: Add a synaptics check for two finger scroll
availability
Commit "backends/x11: Support synaptics configuration" added support
for synaptics two finger scrolling but didn't add the code to check
that it is available resulting in the upper layer always assuming it
isn't.
---
src/backends/x11/meta-input-settings-x11.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 0631fd2fee..2ac080127c 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -638,6 +638,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
guchar *available = NULL;
gboolean has_two_finger = TRUE;
+ if (is_device_synaptics (device))
+ {
+ available = get_property (device, "Synaptics Capabilities",
+ XA_INTEGER, 8, 4);
+ if (!available || !available[3])
+ has_two_finger = FALSE;
+
+ meta_XFree (available);
+ return has_two_finger;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.31.1
From cba31f88ddbfb7355de1daa34397aba8e8607765 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:55:56 +0200
Subject: [PATCH 4/6] backends/x11: Add disable while typing support for
synaptics
This is basically a copy of the old g-s-d mouse plugin code to manage
syndaemon when the synaptics driver is being used.
---
src/backends/x11/meta-input-settings-x11.c | 112 +++++++++++++++++++++
1 file changed, 112 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 2ac080127c..2658b82172 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -35,6 +35,9 @@
#ifdef HAVE_LIBGUDEV
#include <gudev/gudev.h>
#endif
+#ifdef __linux
+#include <sys/prctl.h>
+#endif
#include "backends/x11/meta-backend-x11.h"
#include "backends/x11/meta-input-device-x11.h"
@@ -46,6 +49,8 @@ typedef struct _MetaInputSettingsX11Private
#ifdef HAVE_LIBGUDEV
GUdevClient *udev_client;
#endif
+ gboolean syndaemon_spawned;
+ GPid syndaemon_pid;
} MetaInputSettingsX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
@@ -344,6 +349,107 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
+/* Ensure that syndaemon dies together with us, to avoid running several of
+ * them */
+static void
+setup_syndaemon (gpointer user_data)
+{
+#ifdef __linux
+ prctl (PR_SET_PDEATHSIG, SIGHUP);
+#endif
+}
+
+static gboolean
+have_program_in_path (const char *name)
+{
+ gchar *path;
+ gboolean result;
+
+ path = g_find_program_in_path (name);
+ result = (path != NULL);
+ g_free (path);
+ return result;
+}
+
+static void
+syndaemon_died (GPid pid,
+ gint status,
+ gpointer user_data)
+{
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (user_data);
+ MetaInputSettingsX11Private *priv =
+ meta_input_settings_x11_get_instance_private (settings_x11);
+ GError *error = NULL;
+
+ if (!g_spawn_check_exit_status (status, &error))
+ {
+ if ((WIFSIGNALED (status) && WTERMSIG (status) != SIGHUP) ||
+ error->domain == G_SPAWN_EXIT_ERROR)
+ g_warning ("Syndaemon exited unexpectedly: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_spawn_close_pid (pid);
+ priv->syndaemon_spawned = FALSE;
+}
+
+static void
+set_synaptics_disable_w_typing (MetaInputSettings *settings,
+ gboolean state)
+{
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (settings);
+ MetaInputSettingsX11Private *priv =
+ meta_input_settings_x11_get_instance_private (settings_x11);
+
+ if (state)
+ {
+ GError *error = NULL;
+ GPtrArray *args;
+
+ if (priv->syndaemon_spawned)
+ return;
+
+ if (!have_program_in_path ("syndaemon"))
+ return;
+
+ args = g_ptr_array_new ();
+
+ g_ptr_array_add (args, (gpointer)"syndaemon");
+ g_ptr_array_add (args, (gpointer)"-i");
+ g_ptr_array_add (args, (gpointer)"1.0");
+ g_ptr_array_add (args, (gpointer)"-t");
+ g_ptr_array_add (args, (gpointer)"-K");
+ g_ptr_array_add (args, (gpointer)"-R");
+ g_ptr_array_add (args, NULL);
+
+ /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid
+ * double-forking, otherwise syndaemon will immediately get
+ * killed again through (PR_SET_PDEATHSIG when the intermediate
+ * process dies */
+ g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL,
+ G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL,
+ &priv->syndaemon_pid, &error);
+
+ priv->syndaemon_spawned = (error == NULL);
+ g_ptr_array_free (args, TRUE);
+
+ if (error)
+ {
+ g_warning ("Failed to launch syndaemon: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ g_child_watch_add (priv->syndaemon_pid, syndaemon_died, settings);
+ }
+ }
+ else if (priv->syndaemon_spawned)
+ {
+ kill (priv->syndaemon_pid, SIGHUP);
+ priv->syndaemon_spawned = FALSE;
+ }
+}
+
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -468,6 +574,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ set_synaptics_disable_w_typing (settings, enabled);
+ return;
+ }
+
change_property (device, "libinput Disable While Typing Enabled",
XA_INTEGER, 8, &value, 1);
}
--
2.31.1
From 354d34263534d0c7a5c7f7169d8b4a3dba79491c Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 13 Jun 2018 13:48:24 +0200
Subject: [PATCH 5/6] clutter: Only reset scroll axes on slave devices
As a plus, unknown source device IDs will just warn instead of crash.
---
src/backends/x11/meta-seat-x11.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index 73938e22e0..6d2c7d3740 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -2362,7 +2362,9 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
seat->has_pointer_focus = FALSE;
}
- meta_input_device_x11_reset_scroll_info (source_device);
+ if (clutter_input_device_get_device_mode (source_device) ==
+ CLUTTER_INPUT_MODE_PHYSICAL)
+ meta_input_device_x11_reset_scroll_info (source_device);
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
--
2.31.1
From b7f94b5dd09953d5a4c8aee1b79491d71f8c1e0e Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Tue, 10 Oct 2017 19:07:27 +0200
Subject: [PATCH 6/6] backends/x11: Support plain old X device configuration
We re-use part of the code added to support synaptics and add a few
bits specific for xorg-x11-drv-evdev devices.
---
src/backends/x11/meta-input-settings-x11.c | 98 +++++++++++++++++-----
1 file changed, 75 insertions(+), 23 deletions(-)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 2658b82172..80bc33c6b5 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -185,10 +185,23 @@ is_device_synaptics (ClutterInputDevice *device)
return TRUE;
}
+static gboolean
+is_device_libinput (ClutterInputDevice *device)
+{
+ guchar *has_setting;
+
+ /* We just need looking for a synaptics-specific property */
+ has_setting = get_property (device, "libinput Send Events Modes Available", XA_INTEGER, 8, 2);
+ if (!has_setting)
+ return FALSE;
+
+ meta_XFree (has_setting);
+ return TRUE;
+}
+
static void
-change_synaptics_tap_left_handed (ClutterInputDevice *device,
- gboolean tap_enabled,
- gboolean left_handed)
+change_x_device_left_handed (ClutterInputDevice *device,
+ gboolean left_handed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
@@ -196,7 +209,7 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
int device_id;
XDevice *xdevice;
- guchar *tap_action, *buttons;
+ guchar *buttons;
guint buttons_capacity = 16, n_buttons;
device_id = meta_input_device_x11_get_device_id (device);
@@ -204,19 +217,6 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
if (!xdevice)
return;
- tap_action = get_property (device, "Synaptics Tap Action",
- XA_INTEGER, 8, 7);
- if (!tap_action)
- goto out;
-
- tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
- tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
- tap_action[6] = tap_enabled ? 2 : 0;
-
- change_property (device, "Synaptics Tap Action",
- XA_INTEGER, 8, tap_action, 7);
- meta_XFree (tap_action);
-
if (x11_display)
meta_x11_error_trap_push (x11_display);
buttons = g_new (guchar, buttons_capacity);
@@ -240,17 +240,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
{
- g_warning ("Could not set synaptics touchpad left-handed for %s",
+ g_warning ("Could not set left-handed for %s",
clutter_input_device_get_device_name (device));
}
- out:
XCloseDevice (xdisplay, xdevice);
}
static void
-change_synaptics_speed (ClutterInputDevice *device,
- gdouble speed)
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
+ gboolean tap_enabled,
+ gboolean left_handed)
+{
+ guchar *tap_action;
+
+ tap_action = get_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, 7);
+ if (!tap_action)
+ return;
+
+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
+ tap_action[6] = tap_enabled ? 2 : 0;
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ change_x_device_left_handed (device, left_handed);
+}
+
+static void
+change_x_device_speed (ClutterInputDevice *device,
+ gdouble speed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
@@ -349,6 +371,23 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
+static void
+change_x_device_scroll_button (ClutterInputDevice *device,
+ guint button)
+{
+ guchar value;
+
+ value = button > 0 ? 1 : 0;
+ change_property (device, "Evdev Wheel Emulation",
+ XA_INTEGER, 8, &value, 1);
+ if (button > 0)
+ {
+ value = button;
+ change_property (device, "Evdev Wheel Emulation Button",
+ XA_INTEGER, 8, &value, 1);
+ }
+}
+
/* Ensure that syndaemon dies together with us, to avoid running several of
* them */
static void
@@ -517,9 +556,10 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
- if (is_device_synaptics (device))
+ if (is_device_synaptics (device) ||
+ !is_device_libinput (device))
{
- change_synaptics_speed (device, speed);
+ change_x_device_speed (device, speed);
return;
}
@@ -561,6 +601,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
g_object_unref (settings);
return;
}
+ else if (!is_device_libinput (device) && device_type != CLUTTER_PAD_DEVICE)
+ {
+ change_x_device_left_handed (device, enabled);
+ return;
+ }
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
@@ -778,7 +823,14 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
{
gchar lock = button_lock;
+ if (!is_device_libinput (device))
+ {
+ change_x_device_scroll_button (device, button);
+ return;
+ }
+
change_scroll_method (device, SCROLL_METHOD_FIELD_BUTTON, button != 0);
+
change_property (device, "libinput Button Scrolling Button",
XA_CARDINAL, 32, &button, 1);
change_property (device, "libinput Button Scrolling Button Lock Enabled",
--
2.31.1

File diff suppressed because it is too large Load Diff

1329
SPECS/mutter.spec Normal file

File diff suppressed because it is too large Load Diff