mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter: Move keyboard a11y from ClutterDeviceManager to ClutterSeat
A11y in general may be considered a per-seat feature. https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
parent
34ce39f8dc
commit
bc7ba8c875
@ -54,8 +54,6 @@ struct _ClutterDeviceManagerPrivate
|
||||
/* back-pointer to the backend */
|
||||
ClutterBackend *backend;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
/* Pointer a11y */
|
||||
ClutterPointerA11ySettings pointer_a11y_settings;
|
||||
};
|
||||
@ -76,8 +74,6 @@ enum
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED,
|
||||
TOOL_CHANGED,
|
||||
KBD_A11Y_MASK_CHANGED,
|
||||
KBD_A11Y_FLAGS_CHANGED,
|
||||
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
|
||||
PTR_A11Y_TIMEOUT_STARTED,
|
||||
PTR_A11Y_TIMEOUT_STOPPED,
|
||||
@ -197,46 +193,6 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
|
||||
CLUTTER_TYPE_INPUT_DEVICE,
|
||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::kbd-a11y-mods-state-changed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @latched_mask: the latched modifier mask from stickykeys
|
||||
* @locked_mask: the locked modifier mask from stickykeys
|
||||
*
|
||||
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
|
||||
* latched modifiers mask or locked modifiers mask are changed as the
|
||||
* result of keyboard accessibilty's sticky keys operations.
|
||||
*/
|
||||
manager_signals[KBD_A11Y_MASK_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-mods-state-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::kbd-a11y-flags-changed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
|
||||
* @changed_mask: the ClutterKeyboardA11yFlags changed
|
||||
*
|
||||
* The ::kbd-a11y-flags-changed signal is emitted each time the
|
||||
* ClutterKeyboardA11yFlags configuration is changed as the result of
|
||||
* keyboard accessibilty operations.
|
||||
*/
|
||||
manager_signals[KBD_A11Y_FLAGS_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-flags-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::ptr-a11y-dwell-click-type-changed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
@ -621,43 +577,6 @@ clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
||||
ClutterKbdA11ySettings *b)
|
||||
{
|
||||
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
|
||||
return;
|
||||
|
||||
priv->kbd_a11y_settings = *settings;
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
if (manager_class->apply_kbd_a11y_settings)
|
||||
manager_class->apply_kbd_a11y_settings (device_manager, settings);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
*settings = priv->kbd_a11y_settings;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
|
||||
ClutterPointerA11ySettings *b)
|
||||
|
@ -51,24 +51,6 @@ typedef enum _ClutterVirtualDeviceType
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
|
||||
} ClutterVirtualDeviceType;
|
||||
|
||||
/**
|
||||
* ClutterKbdA11ySettings:
|
||||
*
|
||||
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
|
||||
* settings
|
||||
*
|
||||
*/
|
||||
typedef struct _ClutterKbdA11ySettings
|
||||
{
|
||||
ClutterKeyboardA11yFlags controls;
|
||||
gint slowkeys_delay;
|
||||
gint debounce_delay;
|
||||
gint timeout_delay;
|
||||
gint mousekeys_init_delay;
|
||||
gint mousekeys_max_speed;
|
||||
gint mousekeys_accel_time;
|
||||
} ClutterKbdA11ySettings;
|
||||
|
||||
/**
|
||||
* ClutterPointerA11ySettings:
|
||||
*
|
||||
@ -120,9 +102,6 @@ struct _ClutterDeviceManagerClass
|
||||
void (* compress_motion) (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
/* Keyboard accessbility */
|
||||
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
/* padding */
|
||||
gpointer _padding[4];
|
||||
@ -149,14 +128,6 @@ ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (Clutter
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11ySettings *settings);
|
||||
|
@ -34,6 +34,8 @@ enum
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED,
|
||||
TOOL_CHANGED,
|
||||
KBD_A11Y_MASK_CHANGED,
|
||||
KBD_A11Y_FLAGS_CHANGED,
|
||||
N_SIGNALS,
|
||||
};
|
||||
|
||||
@ -53,6 +55,9 @@ typedef struct _ClutterSeatPrivate ClutterSeatPrivate;
|
||||
struct _ClutterSeatPrivate
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
};
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterSeat, clutter_seat, G_TYPE_OBJECT)
|
||||
@ -143,6 +148,52 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__OBJECT_OBJECTv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::kbd-a11y-mods-state-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @latched_mask: the latched modifier mask from stickykeys
|
||||
* @locked_mask: the locked modifier mask from stickykeys
|
||||
*
|
||||
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
|
||||
* latched modifiers mask or locked modifiers mask are changed as the
|
||||
* result of keyboard accessibilty's sticky keys operations.
|
||||
*/
|
||||
signals[KBD_A11Y_MASK_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-mods-state-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
g_signal_set_va_marshaller (signals[KBD_A11Y_MASK_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__UINT_UINTv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::kbd-a11y-flags-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
|
||||
* @changed_mask: the ClutterKeyboardA11yFlags changed
|
||||
*
|
||||
* The ::kbd-a11y-flags-changed signal is emitted each time the
|
||||
* ClutterKeyboardA11yFlags configuration is changed as the result of
|
||||
* keyboard accessibility operations.
|
||||
*/
|
||||
signals[KBD_A11Y_FLAGS_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-flags-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
g_signal_set_va_marshaller (signals[KBD_A11Y_FLAGS_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__UINT_UINTv);
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
P_("Backend"),
|
||||
@ -228,3 +279,40 @@ clutter_seat_get_keymap (ClutterSeat *seat)
|
||||
{
|
||||
return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
||||
ClutterKbdA11ySettings *b)
|
||||
{
|
||||
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
|
||||
return;
|
||||
|
||||
priv->kbd_a11y_settings = *settings;
|
||||
|
||||
seat_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (seat);
|
||||
if (seat_class->apply_kbd_a11y_settings)
|
||||
seat_class->apply_kbd_a11y_settings (seat, settings);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
*settings = priv->kbd_a11y_settings;
|
||||
}
|
||||
|
@ -36,6 +36,24 @@ CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
|
||||
CLUTTER, SEAT, GObject)
|
||||
|
||||
/**
|
||||
* ClutterKbdA11ySettings:
|
||||
*
|
||||
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
|
||||
* settings
|
||||
*
|
||||
*/
|
||||
typedef struct _ClutterKbdA11ySettings
|
||||
{
|
||||
ClutterKeyboardA11yFlags controls;
|
||||
gint slowkeys_delay;
|
||||
gint debounce_delay;
|
||||
gint timeout_delay;
|
||||
gint mousekeys_init_delay;
|
||||
gint mousekeys_max_speed;
|
||||
gint mousekeys_accel_time;
|
||||
} ClutterKbdA11ySettings;
|
||||
|
||||
typedef struct _ClutterSeatClass ClutterSeatClass;
|
||||
|
||||
struct _ClutterSeatClass
|
||||
@ -57,6 +75,10 @@ struct _ClutterSeatClass
|
||||
ClutterEvent *dest);
|
||||
void (* free_event_data) (ClutterSeat *seat,
|
||||
ClutterEvent *event);
|
||||
|
||||
/* Keyboard accessibility */
|
||||
void (* apply_kbd_a11y_settings) (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@ -71,4 +93,11 @@ void clutter_seat_bell_notify (ClutterSeat *seat);
|
||||
CLUTTER_EXPORT
|
||||
ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
#endif /* CLUTTER_SEAT_H */
|
||||
|
@ -68,6 +68,7 @@ struct _DeviceMappingInfo
|
||||
struct _MetaInputSettingsPrivate
|
||||
{
|
||||
ClutterDeviceManager *device_manager;
|
||||
ClutterSeat *seat;
|
||||
MetaMonitorManager *monitor_manager;
|
||||
gulong monitors_changed_id;
|
||||
|
||||
@ -1247,6 +1248,8 @@ load_keyboard_a11y_settings (MetaInputSettings *input_settings,
|
||||
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings);
|
||||
ClutterKbdA11ySettings kbd_a11y_settings = { 0 };
|
||||
ClutterInputDevice *core_keyboard;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
|
||||
guint i;
|
||||
|
||||
core_keyboard = clutter_device_manager_get_core_device (priv->device_manager, CLUTTER_KEYBOARD_DEVICE);
|
||||
@ -1273,14 +1276,14 @@ load_keyboard_a11y_settings (MetaInputSettings *input_settings,
|
||||
kbd_a11y_settings.mousekeys_accel_time = g_settings_get_int (priv->keyboard_a11y_settings,
|
||||
"mousekeys-accel-time");
|
||||
|
||||
clutter_device_manager_set_kbd_a11y_settings (priv->device_manager, &kbd_a11y_settings);
|
||||
clutter_seat_set_kbd_a11y_settings (seat, &kbd_a11y_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
on_keyboard_a11y_settings_changed (ClutterDeviceManager *device_manager,
|
||||
ClutterKeyboardA11yFlags new_flags,
|
||||
ClutterKeyboardA11yFlags what_changed,
|
||||
MetaInputSettings *input_settings)
|
||||
on_keyboard_a11y_settings_changed (ClutterSeat *seat,
|
||||
ClutterKeyboardA11yFlags new_flags,
|
||||
ClutterKeyboardA11yFlags what_changed,
|
||||
MetaInputSettings *input_settings)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings);
|
||||
guint i;
|
||||
@ -1953,6 +1956,7 @@ meta_input_settings_init (MetaInputSettings *settings)
|
||||
MetaInputSettingsPrivate *priv;
|
||||
|
||||
priv = meta_input_settings_get_instance_private (settings);
|
||||
priv->seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
priv->device_manager = clutter_device_manager_get_default ();
|
||||
g_signal_connect (priv->device_manager, "device-added",
|
||||
G_CALLBACK (meta_input_settings_device_added), settings);
|
||||
@ -1986,7 +1990,7 @@ 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->device_manager, "kbd-a11y-flags-changed",
|
||||
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");
|
||||
|
@ -175,18 +175,6 @@ meta_device_manager_native_compress_motion (ClutterDeviceManager *device_manger,
|
||||
dy_unaccel + dst_dy_unaccel);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_device_manager_native_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterInputDevice *device;
|
||||
|
||||
device = meta_device_manager_native_get_core_device (device_manager, CLUTTER_KEYBOARD_DEVICE);
|
||||
if (device)
|
||||
meta_input_device_native_apply_kbd_a11y_settings (META_INPUT_DEVICE_NATIVE (device),
|
||||
settings);
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_added (ClutterSeat *seat,
|
||||
ClutterInputDevice *parent,
|
||||
@ -251,7 +239,6 @@ meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
|
||||
manager_class->create_virtual_device = meta_device_manager_native_create_virtual_device;
|
||||
manager_class->get_supported_virtual_device_types = meta_device_manager_native_get_supported_virtual_device_types;
|
||||
manager_class->compress_motion = meta_device_manager_native_compress_motion;
|
||||
manager_class->apply_kbd_a11y_settings = meta_device_manager_native_apply_kbd_a11y_settings;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -249,10 +249,11 @@ clear_slow_keys (MetaInputDeviceNative *device)
|
||||
static guint
|
||||
get_slow_keys_delay (ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
|
||||
ClutterKbdA11ySettings a11y_settings;
|
||||
|
||||
clutter_device_manager_get_kbd_a11y_settings (device->device_manager,
|
||||
&a11y_settings);
|
||||
clutter_seat_get_kbd_a11y_settings (CLUTTER_SEAT (device_native->seat),
|
||||
&a11y_settings);
|
||||
/* Settings use int, we use uint, make sure we dont go negative */
|
||||
return MAX (0, a11y_settings.slowkeys_delay);
|
||||
}
|
||||
@ -344,10 +345,11 @@ stop_slow_keys (ClutterEvent *event,
|
||||
static guint
|
||||
get_debounce_delay (ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
|
||||
ClutterKbdA11ySettings a11y_settings;
|
||||
|
||||
clutter_device_manager_get_kbd_a11y_settings (device->device_manager,
|
||||
&a11y_settings);
|
||||
clutter_seat_get_kbd_a11y_settings (CLUTTER_SEAT (device_native->seat),
|
||||
&a11y_settings);
|
||||
/* Settings use int, we use uint, make sure we dont go negative */
|
||||
return MAX (0, a11y_settings.debounce_delay);
|
||||
}
|
||||
@ -424,7 +426,7 @@ key_event_is_modifier (ClutterEvent *event)
|
||||
static void
|
||||
notify_stickykeys_mask (MetaInputDeviceNative *device)
|
||||
{
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->device_manager,
|
||||
g_signal_emit_by_name (device->seat,
|
||||
"kbd-a11y-mods-state-changed",
|
||||
device->stickykeys_latched_mask,
|
||||
device->stickykeys_locked_mask);
|
||||
@ -496,7 +498,7 @@ 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)->device_manager,
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
device->a11y_flags,
|
||||
CLUTTER_A11Y_STICKY_KEYS_ENABLED);
|
||||
@ -529,7 +531,7 @@ set_slowkeys_off (MetaInputDeviceNative *device)
|
||||
{
|
||||
device->a11y_flags &= ~CLUTTER_A11Y_SLOW_KEYS_ENABLED;
|
||||
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->device_manager,
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
device->a11y_flags,
|
||||
CLUTTER_A11Y_SLOW_KEYS_ENABLED);
|
||||
@ -540,7 +542,7 @@ set_slowkeys_on (MetaInputDeviceNative *device)
|
||||
{
|
||||
device->a11y_flags |= CLUTTER_A11Y_SLOW_KEYS_ENABLED;
|
||||
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->device_manager,
|
||||
g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
device->a11y_flags,
|
||||
CLUTTER_A11Y_SLOW_KEYS_ENABLED);
|
||||
|
@ -2556,6 +2556,18 @@ meta_seat_native_free_event_data (ClutterSeat *seat,
|
||||
meta_event_native_free (event_evdev);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterInputDevice *device;
|
||||
|
||||
device = clutter_seat_get_keyboard (seat);
|
||||
if (device)
|
||||
meta_input_device_native_apply_kbd_a11y_settings (META_INPUT_DEVICE_NATIVE (device),
|
||||
settings);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
{
|
||||
@ -2575,6 +2587,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
seat_class->get_keymap = meta_seat_native_get_keymap;
|
||||
seat_class->copy_event_data = meta_seat_native_copy_event_data;
|
||||
seat_class->free_event_data = meta_seat_native_free_event_data;
|
||||
seat_class->apply_kbd_a11y_settings = meta_seat_native_apply_kbd_a11y_settings;
|
||||
|
||||
props[PROP_SEAT_ID] =
|
||||
g_param_spec_string ("seat-id",
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "backends/x11/meta-seat-x11.h"
|
||||
#include "backends/x11/meta-stage-x11.h"
|
||||
#include "backends/x11/meta-virtual-input-device-x11.h"
|
||||
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "core/display-private.h"
|
||||
@ -196,7 +195,6 @@ on_tool_changed (ClutterSeat *seat,
|
||||
static void
|
||||
meta_device_manager_x11_constructed (GObject *object)
|
||||
{
|
||||
ClutterDeviceManager *manager = CLUTTER_DEVICE_MANAGER (object);
|
||||
MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (object);
|
||||
|
||||
g_signal_connect (manager_xi2->seat, "device-added",
|
||||
@ -206,8 +204,6 @@ meta_device_manager_x11_constructed (GObject *object)
|
||||
g_signal_connect (manager_xi2->seat, "tool-changed",
|
||||
G_CALLBACK (on_tool_changed), manager_xi2);
|
||||
|
||||
meta_device_manager_x11_a11y_init (manager);
|
||||
|
||||
if (G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed)
|
||||
G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed (object);
|
||||
}
|
||||
@ -277,7 +273,6 @@ meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
|
||||
manager_class->select_stage_events = meta_device_manager_x11_select_stage_events;
|
||||
manager_class->create_virtual_device = meta_device_manager_x11_create_virtual_device;
|
||||
manager_class->get_supported_virtual_device_types = meta_device_manager_x11_get_supported_virtual_device_types;
|
||||
manager_class->apply_kbd_a11y_settings = meta_device_manager_x11_apply_kbd_a11y_settings;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
#include "backends/x11/meta-keymap-x11.h"
|
||||
#include "backends/x11/meta-stage-x11.h"
|
||||
#include "backends/x11/meta-xkb-a11y-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "core/bell.h"
|
||||
@ -1394,6 +1395,8 @@ meta_seat_x11_constructed (GObject *object)
|
||||
G_CALLBACK (on_keymap_state_change),
|
||||
seat_x11);
|
||||
|
||||
meta_seat_x11_a11y_init (CLUTTER_SEAT (seat_x11));
|
||||
|
||||
if (G_OBJECT_CLASS (meta_seat_x11_parent_class)->constructed)
|
||||
G_OBJECT_CLASS (meta_seat_x11_parent_class)->constructed (object);
|
||||
}
|
||||
@ -1497,6 +1500,7 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
|
||||
seat_class->get_keymap = meta_seat_x11_get_keymap;
|
||||
seat_class->copy_event_data = meta_seat_x11_copy_event_data;
|
||||
seat_class->free_event_data = meta_seat_x11_free_event_data;
|
||||
seat_class->apply_kbd_a11y_settings = meta_seat_x11_apply_kbd_a11y_settings;
|
||||
|
||||
props[PROP_OPCODE] =
|
||||
g_param_spec_int ("opcode",
|
||||
|
@ -75,7 +75,7 @@ set_xkb_desc_rec (Display *xdisplay,
|
||||
}
|
||||
|
||||
static void
|
||||
check_settings_changed (ClutterDeviceManager *device_manager)
|
||||
check_settings_changed (ClutterSeat *seat)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
@ -86,7 +86,7 @@ check_settings_changed (ClutterDeviceManager *device_manager)
|
||||
if (!desc)
|
||||
return;
|
||||
|
||||
clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
|
||||
clutter_seat_get_kbd_a11y_settings (seat, &kbd_a11y_settings);
|
||||
|
||||
if (desc->ctrls->enabled_ctrls & XkbSlowKeysMask &&
|
||||
!(kbd_a11y_settings.controls & CLUTTER_A11Y_SLOW_KEYS_ENABLED))
|
||||
@ -115,7 +115,7 @@ check_settings_changed (ClutterDeviceManager *device_manager)
|
||||
}
|
||||
|
||||
if (what_changed)
|
||||
g_signal_emit_by_name (device_manager,
|
||||
g_signal_emit_by_name (seat,
|
||||
"kbd-a11y-flags-changed",
|
||||
kbd_a11y_settings.controls,
|
||||
what_changed);
|
||||
@ -128,7 +128,7 @@ xkb_a11y_event_filter (XEvent *xevent,
|
||||
ClutterEvent *clutter_event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
|
||||
ClutterSeat *seat = CLUTTER_SEAT (data);
|
||||
XkbEvent *xkbev = (XkbEvent *) xevent;
|
||||
|
||||
/* 'event_type' is set to zero on notifying us of updates in
|
||||
@ -141,9 +141,9 @@ xkb_a11y_event_filter (XEvent *xevent,
|
||||
*/
|
||||
if (xevent->xany.type == (_xkb_event_base + XkbEventCode) &&
|
||||
xkbev->any.xkb_type == XkbControlsNotify && xkbev->ctrls.event_type != 0)
|
||||
check_settings_changed (device_manager);
|
||||
check_settings_changed (seat);
|
||||
|
||||
return CLUTTER_X11_FILTER_CONTINUE;
|
||||
return CLUTTER_X11_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -194,11 +194,9 @@ set_xkb_ctrl (XkbDescRec *desc,
|
||||
}
|
||||
|
||||
void
|
||||
meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *kbd_a11y_settings)
|
||||
meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *kbd_a11y_settings)
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
ClutterSeat *seat;
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
XkbDescRec *desc;
|
||||
gboolean enable_accessX;
|
||||
@ -207,9 +205,6 @@ meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_
|
||||
if (!desc)
|
||||
return;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
|
||||
/* general */
|
||||
enable_accessX = kbd_a11y_settings->controls & CLUTTER_A11Y_KEYBOARD_ENABLED;
|
||||
|
||||
@ -318,7 +313,7 @@ meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
|
||||
meta_seat_x11_a11y_init (ClutterSeat *seat)
|
||||
{
|
||||
Display *xdisplay = clutter_x11_get_default_display ();
|
||||
guint event_mask;
|
||||
@ -330,7 +325,7 @@ meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
|
||||
|
||||
XkbSelectEvents (xdisplay, XkbUseCoreKbd, event_mask, event_mask);
|
||||
|
||||
clutter_x11_add_filter (xkb_a11y_event_filter, device_manager);
|
||||
clutter_x11_add_filter (xkb_a11y_event_filter, seat);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -29,10 +29,10 @@
|
||||
#include "clutter/clutter.h"
|
||||
|
||||
void
|
||||
meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *kbd_a11y_settings);
|
||||
meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *kbd_a11y_settings);
|
||||
|
||||
gboolean
|
||||
meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager);
|
||||
meta_seat_x11_a11y_init (ClutterSeat *seat);
|
||||
|
||||
#endif /* META_XKB_A11Y_X11_H */
|
||||
|
@ -436,10 +436,10 @@ meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
|
||||
}
|
||||
|
||||
static void
|
||||
on_kbd_a11y_mask_changed (ClutterDeviceManager *device_manager,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods,
|
||||
MetaWaylandKeyboard *keyboard)
|
||||
on_kbd_a11y_mask_changed (ClutterSeat *seat,
|
||||
xkb_mod_mask_t new_latched_mods,
|
||||
xkb_mod_mask_t new_locked_mods,
|
||||
MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
xkb_mod_mask_t latched, locked, depressed, group;
|
||||
|
||||
@ -567,6 +567,7 @@ void
|
||||
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
|
||||
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
|
||||
g_signal_connect (keyboard->settings, "changed",
|
||||
@ -577,7 +578,8 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
|
||||
g_signal_connect (backend, "keymap-layout-group-changed",
|
||||
G_CALLBACK (on_keymap_layout_group_changed), keyboard);
|
||||
|
||||
g_signal_connect (clutter_device_manager_get_default (), "kbd-a11y-mods-state-changed",
|
||||
g_signal_connect (clutter_backend_get_default_seat (clutter_backend),
|
||||
"kbd-a11y-mods-state-changed",
|
||||
G_CALLBACK (on_kbd_a11y_mask_changed), keyboard);
|
||||
|
||||
meta_wayland_keyboard_take_keymap (keyboard, meta_backend_get_keymap (backend));
|
||||
|
Loading…
Reference in New Issue
Block a user