diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h index 3e9252c7d..e98a2544f 100644 --- a/src/backends/meta-input-settings-private.h +++ b/src/backends/meta-input-settings-private.h @@ -208,4 +208,15 @@ void meta_input_settings_set_device_aspect_ratio (MetaInputSettings *input_sett void meta_input_settings_get_kbd_a11y_settings (MetaInputSettings *input_settings, MetaKbdA11ySettings *a11y_settings); +void meta_input_settings_add_device (MetaInputSettings *input_settings, + ClutterInputDevice *device); +void meta_input_settings_remove_device (MetaInputSettings *input_settings, + ClutterInputDevice *device); +void meta_input_settings_notify_tool_change (MetaInputSettings *input_settings, + ClutterInputDevice *device, + ClutterInputDeviceTool *tool); +void meta_input_settings_notify_kbd_a11y_change (MetaInputSettings *input_settings, + MetaKeyboardA11yFlags new_flags, + MetaKeyboardA11yFlags what_changed); + #endif /* META_INPUT_SETTINGS_PRIVATE_H */ diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index c4ff231a4..69927583a 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -1204,11 +1204,10 @@ load_keyboard_a11y_settings (MetaInputSettings *input_settings) g_signal_emit (input_settings, signals[KBD_A11Y_CHANGED], 0, &priv->kbd_a11y_settings); } -static void -on_keyboard_a11y_settings_changed (ClutterSeat *seat, - MetaKeyboardA11yFlags new_flags, - MetaKeyboardA11yFlags what_changed, - MetaInputSettings *input_settings) +void +meta_input_settings_notify_kbd_a11y_change (MetaInputSettings *input_settings, + MetaKeyboardA11yFlags new_flags, + MetaKeyboardA11yFlags what_changed) { MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings); guint i; @@ -1580,10 +1579,9 @@ evaluate_two_finger_scrolling (MetaInputSettings *input_settings, g_hash_table_add (priv->two_finger_devices, device); } -static void -meta_input_settings_device_added (ClutterSeat *seat, - ClutterInputDevice *device, - MetaInputSettings *input_settings) +void +meta_input_settings_add_device (MetaInputSettings *input_settings, + ClutterInputDevice *device) { if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER) return; @@ -1594,10 +1592,9 @@ meta_input_settings_device_added (ClutterSeat *seat, check_add_mappable_device (input_settings, device); } -static void -meta_input_settings_device_removed (ClutterSeat *seat, - ClutterInputDevice *device, - MetaInputSettings *input_settings) +void +meta_input_settings_remove_device (MetaInputSettings *input_settings, + ClutterInputDevice *device) { MetaInputSettingsPrivate *priv; @@ -1646,11 +1643,10 @@ current_tool_info_free (CurrentToolInfo *info) g_free (info); } -static void -meta_input_settings_tool_changed (ClutterSeat *seat, - ClutterInputDevice *device, - ClutterInputDeviceTool *tool, - MetaInputSettings *input_settings) +void +meta_input_settings_notify_tool_change (MetaInputSettings *input_settings, + ClutterInputDevice *device, + ClutterInputDeviceTool *tool) { MetaInputSettingsPrivate *priv; @@ -1739,12 +1735,6 @@ meta_input_settings_init (MetaInputSettings *settings) priv = meta_input_settings_get_instance_private (settings); priv->seat = clutter_backend_get_default_seat (clutter_get_default_backend ()); - g_signal_connect (priv->seat, "device-added", - G_CALLBACK (meta_input_settings_device_added), settings); - g_signal_connect (priv->seat, "device-removed", - G_CALLBACK (meta_input_settings_device_removed), settings); - g_signal_connect (priv->seat, "tool-changed", - G_CALLBACK (meta_input_settings_tool_changed), settings); priv->mouse_settings = g_settings_new ("org.gnome.desktop.peripherals.mouse"); g_signal_connect (priv->mouse_settings, "changed", @@ -1771,8 +1761,6 @@ meta_input_settings_init (MetaInputSettings *settings) priv->keyboard_a11y_settings = g_settings_new ("org.gnome.desktop.a11y.keyboard"); g_signal_connect (priv->keyboard_a11y_settings, "changed", G_CALLBACK (meta_input_keyboard_a11y_settings_changed), settings); - g_signal_connect (priv->seat, "kbd-a11y-flags-changed", - G_CALLBACK (on_keyboard_a11y_settings_changed), settings); priv->mouse_a11y_settings = g_settings_new ("org.gnome.desktop.a11y.mouse"); g_signal_connect (priv->mouse_a11y_settings, "changed", diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index 9282a071d..ed0db7157 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -1530,6 +1530,9 @@ process_base_event (MetaSeatImpl *seat, ClutterInputDevice *device; ClutterEvent *device_event; struct libinput_device *libinput_device; + MetaInputSettings *input_settings; + + input_settings = meta_backend_get_input_settings (meta_get_backend ()); switch (libinput_event_get_type (event)) { @@ -1539,6 +1542,7 @@ process_base_event (MetaSeatImpl *seat, device = evdev_add_device (seat, libinput_device); device_event = clutter_event_new (CLUTTER_DEVICE_ADDED); clutter_event_set_device (device_event, device); + meta_input_settings_add_device (input_settings, device); break; case LIBINPUT_EVENT_DEVICE_REMOVED: @@ -1549,6 +1553,7 @@ process_base_event (MetaSeatImpl *seat, clutter_event_set_device (device_event, device); evdev_remove_device (seat, META_INPUT_DEVICE_NATIVE (device)); + meta_input_settings_remove_device (input_settings, device); break; default: @@ -1613,9 +1618,9 @@ input_device_update_tool (ClutterInputDevice *input_device, struct libinput_tablet_tool *libinput_tool) { MetaInputDeviceNative *evdev_device = META_INPUT_DEVICE_NATIVE (input_device); - MetaSeatImpl *seat = seat_from_device (input_device); ClutterInputDeviceTool *tool = NULL; ClutterInputDeviceToolType tool_type; + MetaInputSettings *input_settings; uint64_t tool_serial; if (libinput_tool) @@ -1636,7 +1641,8 @@ input_device_update_tool (ClutterInputDevice *input_device, if (evdev_device->last_tool != tool) { evdev_device->last_tool = tool; - g_signal_emit_by_name (seat->seat, "tool-changed", input_device, tool); + input_settings = meta_backend_get_input_settings (meta_get_backend ()); + meta_input_settings_notify_tool_change (input_settings, input_device, tool); } } @@ -3118,6 +3124,11 @@ meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *impl, MetaKeyboardA11yFlags new_flags, MetaKeyboardA11yFlags what_changed) { + MetaInputSettings *input_settings; + + input_settings = meta_backend_get_input_settings (meta_get_backend ()); + meta_input_settings_notify_kbd_a11y_change (input_settings, + new_flags, what_changed); g_signal_emit (impl, signals[KBD_A11Y_FLAGS_CHANGED], 0, new_flags, what_changed); } diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c index 7ede6fb92..98e1e78a5 100644 --- a/src/backends/x11/meta-seat-x11.c +++ b/src/backends/x11/meta-seat-x11.c @@ -20,6 +20,7 @@ #include +#include "backends/meta-input-settings-private.h" #include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-event-x11.h" #include "backends/x11/meta-input-device-tool-x11.h" @@ -724,19 +725,23 @@ meta_seat_x11_handle_event_post (ClutterSeat *seat, { MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat); ClutterInputDevice *device = event->device.device; + MetaInputSettings *input_settings; gboolean is_touch; is_touch = clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE; + input_settings = meta_backend_get_input_settings (meta_get_backend ()); switch (event->type) { case CLUTTER_DEVICE_ADDED: + meta_input_settings_add_device (input_settings, device); seat_x11->has_touchscreens |= is_touch; break; case CLUTTER_DEVICE_REMOVED: if (is_touch) seat_x11->has_touchscreens = has_touchscreens (seat_x11); + meta_input_settings_remove_device (input_settings, device); break; default: break; @@ -933,6 +938,7 @@ translate_property_event (MetaSeatX11 *seat_x11, { ClutterInputDeviceTool *tool = NULL; ClutterInputDeviceToolType type; + MetaInputSettings *input_settings; int serial_id; serial_id = device_get_tool_serial (device); @@ -953,7 +959,8 @@ translate_property_event (MetaSeatX11 *seat_x11, } meta_input_device_x11_update_tool (device, tool); - g_signal_emit_by_name (seat_x11, "tool-changed", device, tool); + input_settings = meta_backend_get_input_settings (meta_get_backend ()); + meta_input_settings_notify_tool_change (input_settings, device, tool); } } diff --git a/src/backends/x11/meta-xkb-a11y-x11.c b/src/backends/x11/meta-xkb-a11y-x11.c index 024618be6..d2e76b3f7 100644 --- a/src/backends/x11/meta-xkb-a11y-x11.c +++ b/src/backends/x11/meta-xkb-a11y-x11.c @@ -118,10 +118,15 @@ check_settings_changed (ClutterSeat *seat) } if (what_changed) - g_signal_emit_by_name (seat, - "kbd-a11y-flags-changed", - kbd_a11y_settings.controls, - what_changed); + { + meta_input_settings_notify_kbd_a11y_change (input_settings, + kbd_a11y_settings.controls, + what_changed); + g_signal_emit_by_name (seat, + "kbd-a11y-flags-changed", + kbd_a11y_settings.controls, + what_changed); + } XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE); }