mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
backends/native: Forward keyboard a11y changes via the MetaSeatImpl
These changes will happen in the input event management code, so let them be emitted via the MetaSeatImpl, as that's what we'll have neat access to. The ClutterSeat signals are now emitted from there. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
parent
39f4acac3d
commit
31439d7841
@ -27,7 +27,7 @@
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/native/meta-input-device-tool-native.h"
|
||||
#include "backends/native/meta-input-device-native.h"
|
||||
#include "backends/native/meta-seat-native.h"
|
||||
#include "backends/native/meta-seat-impl.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
|
||||
G_DEFINE_TYPE (MetaInputDeviceNative,
|
||||
@ -416,10 +416,9 @@ key_event_is_modifier (ClutterEvent *event)
|
||||
static void
|
||||
notify_stickykeys_mask (MetaInputDeviceNative *device)
|
||||
{
|
||||
g_signal_emit_by_name (device->seat_impl->seat_native,
|
||||
"kbd-a11y-mods-state-changed",
|
||||
device->stickykeys_latched_mask,
|
||||
device->stickykeys_locked_mask);
|
||||
meta_seat_impl_notify_kbd_a11y_mods_state_changed (device->seat_impl,
|
||||
device->stickykeys_latched_mask,
|
||||
device->stickykeys_locked_mask);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -492,10 +491,9 @@ notify_stickykeys_change (MetaInputDeviceNative *device)
|
||||
device->stickykeys_depressed_mask = 0;
|
||||
update_internal_xkb_state (device, 0, 0);
|
||||
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
device->a11y_flags,
|
||||
META_A11Y_STICKY_KEYS_ENABLED);
|
||||
meta_seat_impl_notify_kbd_a11y_flags_changed (device->seat_impl,
|
||||
device->a11y_flags,
|
||||
META_A11Y_STICKY_KEYS_ENABLED);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -525,10 +523,9 @@ set_slowkeys_off (MetaInputDeviceNative *device)
|
||||
{
|
||||
device->a11y_flags &= ~META_A11Y_SLOW_KEYS_ENABLED;
|
||||
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
device->a11y_flags,
|
||||
META_A11Y_SLOW_KEYS_ENABLED);
|
||||
meta_seat_impl_notify_kbd_a11y_flags_changed (device->seat_impl,
|
||||
device->a11y_flags,
|
||||
META_A11Y_SLOW_KEYS_ENABLED);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -536,10 +533,9 @@ set_slowkeys_on (MetaInputDeviceNative *device)
|
||||
{
|
||||
device->a11y_flags |= META_A11Y_SLOW_KEYS_ENABLED;
|
||||
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
device->a11y_flags,
|
||||
META_A11Y_SLOW_KEYS_ENABLED);
|
||||
meta_seat_impl_notify_kbd_a11y_flags_changed (device->seat_impl,
|
||||
device->a11y_flags,
|
||||
META_A11Y_SLOW_KEYS_ENABLED);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -106,6 +106,15 @@ enum
|
||||
|
||||
static GParamSpec *props[N_PROPS] = { NULL };
|
||||
|
||||
enum
|
||||
{
|
||||
KBD_A11Y_FLAGS_CHANGED,
|
||||
KBD_A11Y_MODS_STATE_CHANGED,
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (MetaSeatImpl, meta_seat_impl, G_TYPE_OBJECT)
|
||||
|
||||
static void process_events (MetaSeatImpl *seat_impl);
|
||||
@ -2700,6 +2709,21 @@ meta_seat_impl_class_init (MetaSeatImplClass *klass)
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
signals[KBD_A11Y_FLAGS_CHANGED] =
|
||||
g_signal_new ("kbd-a11y-flags-changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT, G_TYPE_UINT);
|
||||
signals[KBD_A11Y_MODS_STATE_CHANGED] =
|
||||
g_signal_new ("kbd-a11y-mods-state-changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
}
|
||||
|
||||
@ -3020,3 +3044,21 @@ meta_seat_impl_new (MetaSeatNative *seat_native,
|
||||
"seat-id", seat_id,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
|
||||
MetaKeyboardA11yFlags new_flags,
|
||||
MetaKeyboardA11yFlags what_changed)
|
||||
{
|
||||
g_signal_emit (seat_impl, signals[KBD_A11Y_FLAGS_CHANGED], 0,
|
||||
new_flags, what_changed);
|
||||
}
|
||||
|
||||
void
|
||||
meta_seat_impl_notify_kbd_a11y_mods_state_changed (MetaSeatImpl *seat_impl,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods)
|
||||
{
|
||||
g_signal_emit (seat_impl, signals[KBD_A11Y_MODS_STATE_CHANGED], 0,
|
||||
new_latched_mods, new_locked_mods);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
|
||||
#include "backends/meta-input-settings-private.h"
|
||||
#include "backends/meta-viewport-info.h"
|
||||
#include "backends/native/meta-backend-native-types.h"
|
||||
#include "backends/native/meta-barrier-native.h"
|
||||
@ -239,4 +240,11 @@ GSList * meta_seat_impl_get_devices (MetaSeatImpl *seat_impl);
|
||||
|
||||
MetaKeymapNative * meta_seat_impl_get_keymap (MetaSeatImpl *seat_impl);
|
||||
|
||||
void meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
|
||||
MetaKeyboardA11yFlags new_flags,
|
||||
MetaKeyboardA11yFlags what_changed);
|
||||
void meta_seat_impl_notify_kbd_a11y_mods_state_changed (MetaSeatImpl *seat_impl,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods);
|
||||
|
||||
#endif /* META_SEAT_IMPL_H */
|
||||
|
@ -101,12 +101,39 @@ meta_seat_native_handle_event_post (ClutterSeat *seat,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
|
||||
MetaKeyboardA11yFlags new_flags,
|
||||
MetaKeyboardA11yFlags what_changed,
|
||||
MetaSeatNative *seat_native)
|
||||
{
|
||||
g_signal_emit_by_name (seat_native,
|
||||
"kbd-a11y-flags-changed",
|
||||
new_flags, what_changed);
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_kbd_a11y_mods_state_changed (MetaSeatImpl *seat_impl,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods,
|
||||
MetaSeatNative *seat_native)
|
||||
{
|
||||
g_signal_emit_by_name (seat_native,
|
||||
"kbd-a11y-mods-state-changed",
|
||||
new_latched_mods,
|
||||
new_locked_mods);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_constructed (GObject *object)
|
||||
{
|
||||
MetaSeatNative *seat = META_SEAT_NATIVE (object);
|
||||
|
||||
seat->impl = meta_seat_impl_new (seat, seat->seat_id);
|
||||
g_signal_connect (seat->impl, "kbd-a11y-flags-changed",
|
||||
G_CALLBACK (proxy_kbd_a11y_flags_changed), seat);
|
||||
g_signal_connect (seat->impl, "kbd-a11y-mods-state-changed",
|
||||
G_CALLBACK (proxy_kbd_a11y_mods_state_changed), seat);
|
||||
|
||||
seat->core_pointer = meta_seat_impl_get_pointer (seat->impl);
|
||||
seat->core_keyboard = meta_seat_impl_get_keyboard (seat->impl);
|
||||
|
Loading…
Reference in New Issue
Block a user