[mutter/wip/carlosg/input-thread: 30/87] backends: Move away from clutter_input_device_set_enabled()




commit c2940efe8b6fb19e6ccdf1f37c4c18d2342ffed7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 16 12:07:20 2020 +0200

    backends: Move away from clutter_input_device_set_enabled()
    
    We actually have a set_send_events() vfunc that can enable or disable
    devices at the libinput and X11 input driver level, so use that. A
    positive side effect is that those layers will leave the device at
    a consistent idle state (as opposed to going mute maybe amid user
    input).
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>

 src/backends/meta-input-settings.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 6c0040ec23..846c58a038 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -1906,16 +1906,18 @@ static void
 power_save_mode_changed_cb (MetaMonitorManager *manager,
                             gpointer            user_data)
 {
+  MetaInputSettings *input_settings = user_data;
   MetaInputSettingsPrivate *priv;
   ClutterInputDevice *device;
   MetaLogicalMonitor *logical_monitor;
   MetaMonitor *builtin;
   MetaPowerSave power_save_mode;
+  GDesktopDeviceSendEvents send_events;
   gboolean on;
 
   power_save_mode = meta_monitor_manager_get_power_save_mode (manager);
   on = power_save_mode == META_POWER_SAVE_ON;
-  priv = meta_input_settings_get_instance_private (user_data);
+  priv = meta_input_settings_get_instance_private (input_settings);
 
   builtin = meta_monitor_manager_get_laptop_panel (manager);
   if (!builtin)
@@ -1932,7 +1934,13 @@ power_save_mode_changed_cb (MetaMonitorManager *manager,
   if (!device)
     return;
 
-  clutter_input_device_set_enabled (device, on);
+  send_events = on ?
+    G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED :
+    G_DESKTOP_DEVICE_SEND_EVENTS_DISABLED;
+
+  META_INPUT_SETTINGS_GET_CLASS (input_settings)->set_send_events (input_settings,
+                                                                   device,
+                                                                   send_events);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]