mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05: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. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
parent
6c265c131f
commit
2e604709df
@ -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,
|
||||
@ -423,10 +423,9 @@ key_event_is_modifier (ClutterEvent *event)
|
||||
static void
|
||||
notify_stickykeys_mask (MetaInputDeviceNative *device)
|
||||
{
|
||||
g_signal_emit_by_name (device->seat_impl->seat,
|
||||
"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
|
||||
@ -499,10 +498,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
|
||||
@ -532,10 +530,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
|
||||
@ -543,10 +540,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
|
||||
|
@ -105,6 +105,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);
|
||||
@ -2709,6 +2718,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);
|
||||
}
|
||||
|
||||
@ -3066,3 +3090,21 @@ meta_seat_impl_new (MetaSeatNative *seat,
|
||||
"seat-id", seat_id,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *impl,
|
||||
MetaKeyboardA11yFlags new_flags,
|
||||
MetaKeyboardA11yFlags what_changed)
|
||||
{
|
||||
g_signal_emit (impl, signals[KBD_A11Y_FLAGS_CHANGED], 0,
|
||||
new_flags, what_changed);
|
||||
}
|
||||
|
||||
void
|
||||
meta_seat_impl_notify_kbd_a11y_mods_state_changed (MetaSeatImpl *impl,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods)
|
||||
{
|
||||
g_signal_emit (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"
|
||||
@ -254,4 +255,11 @@ GSList * meta_seat_impl_get_devices (MetaSeatImpl *seat);
|
||||
|
||||
MetaKeymapNative * meta_seat_impl_get_keymap (MetaSeatImpl *seat);
|
||||
|
||||
void meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *impl,
|
||||
MetaKeyboardA11yFlags new_flags,
|
||||
MetaKeyboardA11yFlags what_changed);
|
||||
void meta_seat_impl_notify_kbd_a11y_mods_state_changed (MetaSeatImpl *impl,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods);
|
||||
|
||||
#endif /* META_SEAT_IMPL_H */
|
||||
|
@ -105,12 +105,39 @@ meta_seat_native_handle_event_post (ClutterSeat *seat,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_kbd_a11y_flags_changed (MetaSeatImpl *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 *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