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).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
Carlos Garnacho 2020-07-16 12:07:20 +02:00
parent 4b7f2905d6
commit 575a4ca281

View File

@ -1901,16 +1901,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)
@ -1927,7 +1929,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