clutter: Move bell_notify() from ClutterBackend to ClutterSeat

Bells can be considered to be a per-seat feature, so move it there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
Carlos Garnacho 2019-10-01 17:15:41 +02:00
parent 9aba37f70f
commit 1fc021c3c6
10 changed files with 41 additions and 47 deletions

View File

@ -96,8 +96,6 @@ struct _ClutterBackendClass
gpointer native, gpointer native,
ClutterEvent *event); ClutterEvent *event);
void (* bell_notify) (ClutterBackend *backend);
ClutterKeymap * (* get_keymap) (ClutterBackend *backend); ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
ClutterSeat * (* get_default_seat) (ClutterBackend *backend); ClutterSeat * (* get_default_seat) (ClutterBackend *backend);

View File

@ -1009,16 +1009,6 @@ clutter_set_allowed_drivers (const char *drivers)
allowed_drivers = g_strdup (drivers); allowed_drivers = g_strdup (drivers);
} }
void
clutter_backend_bell_notify (ClutterBackend *backend)
{
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->bell_notify)
klass->bell_notify (backend);
}
/** /**
* clutter_backend_get_input_method: * clutter_backend_get_input_method:
* @backend: the #CLutterBackend * @backend: the #CLutterBackend

View File

@ -73,9 +73,6 @@ const cairo_font_options_t * clutter_backend_get_font_options (Clutter
CLUTTER_EXPORT CLUTTER_EXPORT
CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend); CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend);
CLUTTER_EXPORT
void clutter_backend_bell_notify (ClutterBackend *backend);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend); ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend);

View File

@ -208,3 +208,9 @@ clutter_seat_list_devices (ClutterSeat *seat)
return CLUTTER_SEAT_GET_CLASS (seat)->list_devices (seat); return CLUTTER_SEAT_GET_CLASS (seat)->list_devices (seat);
} }
void
clutter_seat_bell_notify (ClutterSeat *seat)
{
CLUTTER_SEAT_GET_CLASS (seat)->bell_notify (seat);
}

View File

@ -45,6 +45,8 @@ struct _ClutterSeatClass
ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat); ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
GList * (* list_devices) (ClutterSeat *seat); GList * (* list_devices) (ClutterSeat *seat);
void (* bell_notify) (ClutterSeat *seat);
}; };
CLUTTER_EXPORT CLUTTER_EXPORT
@ -53,5 +55,7 @@ CLUTTER_EXPORT
ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat); ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
CLUTTER_EXPORT CLUTTER_EXPORT
GList * clutter_seat_list_devices (ClutterSeat *seat); GList * clutter_seat_list_devices (ClutterSeat *seat);
CLUTTER_EXPORT
void clutter_seat_bell_notify (ClutterSeat *seat);
#endif /* CLUTTER_SEAT_H */ #endif /* CLUTTER_SEAT_H */

View File

@ -103,14 +103,6 @@ meta_clutter_backend_native_create_stage (ClutterBackend *backend,
return CLUTTER_STAGE_WINDOW (clutter_backend_native->stage_native); return CLUTTER_STAGE_WINDOW (clutter_backend_native->stage_native);
} }
static void
meta_clutter_backend_native_bell_notify (ClutterBackend *backend)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static ClutterDeviceManager * static ClutterDeviceManager *
meta_clutter_backend_native_get_device_manager (ClutterBackend *backend) meta_clutter_backend_native_get_device_manager (ClutterBackend *backend)
{ {
@ -162,7 +154,6 @@ meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass)
clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer; clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage; clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage;
clutter_backend_class->bell_notify = meta_clutter_backend_native_bell_notify;
clutter_backend_class->get_device_manager = meta_clutter_backend_native_get_device_manager; clutter_backend_class->get_device_manager = meta_clutter_backend_native_get_device_manager;
clutter_backend_class->get_keymap = meta_clutter_backend_native_get_keymap; clutter_backend_class->get_keymap = meta_clutter_backend_native_get_keymap;
clutter_backend_class->init_events = meta_clutter_backend_native_init_events; clutter_backend_class->init_events = meta_clutter_backend_native_init_events;

View File

@ -223,12 +223,9 @@ meta_input_device_native_is_grouped (ClutterInputDevice *device,
} }
static void static void
meta_input_device_native_bell_notify (void) meta_input_device_native_bell_notify (MetaInputDeviceNative *device)
{ {
ClutterBackend *backend; clutter_seat_bell_notify (CLUTTER_SEAT (device->seat));
backend = clutter_get_default_backend ();
clutter_backend_bell_notify (backend);
} }
static void static void
@ -277,7 +274,7 @@ trigger_slow_keys (gpointer data)
meta_input_device_native_free_pending_slow_key (slow_keys_event); meta_input_device_native_free_pending_slow_key (slow_keys_event);
if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT) if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -315,7 +312,7 @@ start_slow_keys (ClutterEvent *event,
device->slow_keys_list = g_list_append (device->slow_keys_list, slow_keys_event); device->slow_keys_list = g_list_append (device->slow_keys_list, slow_keys_event);
if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS) if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
} }
static void static void
@ -335,7 +332,7 @@ stop_slow_keys (ClutterEvent *event,
meta_input_device_native_free_pending_slow_key (slow_keys_event); meta_input_device_native_free_pending_slow_key (slow_keys_event);
if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT) if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
return; return;
} }
@ -389,7 +386,7 @@ static void
notify_bounce_keys_reject (MetaInputDeviceNative *device) notify_bounce_keys_reject (MetaInputDeviceNative *device)
{ {
if (device->a11y_flags & CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT) if (device->a11y_flags & CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
} }
static gboolean static gboolean
@ -609,7 +606,7 @@ handle_stickykeys_release (ClutterEvent *event,
if (key_event_is_modifier (event)) if (key_event_is_modifier (event))
{ {
if (device->a11y_flags & CLUTTER_A11Y_STICKY_KEYS_BEEP) if (device->a11y_flags & CLUTTER_A11Y_STICKY_KEYS_BEEP)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
return; return;
} }
@ -628,7 +625,7 @@ trigger_toggle_slowkeys (gpointer data)
device->toggle_slowkeys_timer = 0; device->toggle_slowkeys_timer = 0;
if (device->a11y_flags & CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP) if (device->a11y_flags & CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_ENABLED) if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_ENABLED)
set_slowkeys_off (device); set_slowkeys_off (device);
@ -690,7 +687,7 @@ handle_enablekeys_release (ClutterEvent *event,
device->shift_count = 0; device->shift_count = 0;
if (device->a11y_flags & CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP) if (device->a11y_flags & CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
if (device->a11y_flags & CLUTTER_A11Y_STICKY_KEYS_ENABLED) if (device->a11y_flags & CLUTTER_A11Y_STICKY_KEYS_ENABLED)
set_stickykeys_off (device); set_stickykeys_off (device);
@ -1227,7 +1224,7 @@ void
meta_input_device_native_a11y_maybe_notify_toggle_keys (MetaInputDeviceNative *device) meta_input_device_native_a11y_maybe_notify_toggle_keys (MetaInputDeviceNative *device)
{ {
if (device->a11y_flags & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED) if (device->a11y_flags & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED)
meta_input_device_native_bell_notify (); meta_input_device_native_bell_notify (device);
} }
static void static void

View File

@ -38,6 +38,7 @@
#include "backends/native/meta-input-device-tool-native.h" #include "backends/native/meta-input-device-tool-native.h"
#include "backends/native/meta-keymap-native.h" #include "backends/native/meta-keymap-native.h"
#include "clutter/clutter-mutter.h" #include "clutter/clutter-mutter.h"
#include "core/bell.h"
/* /*
* Clutter makes the assumption that two core devices have ID's 2 and 3 (core * Clutter makes the assumption that two core devices have ID's 2 and 3 (core
@ -2503,6 +2504,14 @@ meta_seat_native_list_devices (ClutterSeat *seat)
return devices; return devices;
} }
static void
meta_seat_native_bell_notify (ClutterSeat *seat)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static void static void
meta_seat_native_class_init (MetaSeatNativeClass *klass) meta_seat_native_class_init (MetaSeatNativeClass *klass)
{ {
@ -2518,6 +2527,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
seat_class->get_pointer = meta_seat_native_get_pointer; seat_class->get_pointer = meta_seat_native_get_pointer;
seat_class->get_keyboard = meta_seat_native_get_keyboard; seat_class->get_keyboard = meta_seat_native_get_keyboard;
seat_class->list_devices = meta_seat_native_list_devices; seat_class->list_devices = meta_seat_native_list_devices;
seat_class->bell_notify = meta_seat_native_bell_notify;
props[PROP_SEAT_ID] = props[PROP_SEAT_ID] =
g_param_spec_string ("seat-id", g_param_spec_string ("seat-id",

View File

@ -80,14 +80,6 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
return stage; return stage;
} }
static void
meta_clutter_backend_x11_bell_notify (ClutterBackend *backend)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static ClutterDeviceManager * static ClutterDeviceManager *
meta_clutter_backend_x11_get_device_manager (ClutterBackend *backend) meta_clutter_backend_x11_get_device_manager (ClutterBackend *backend)
{ {
@ -187,7 +179,6 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass)
clutter_backend_class->get_renderer = meta_clutter_backend_x11_get_renderer; clutter_backend_class->get_renderer = meta_clutter_backend_x11_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_x11_create_stage; clutter_backend_class->create_stage = meta_clutter_backend_x11_create_stage;
clutter_backend_class->bell_notify = meta_clutter_backend_x11_bell_notify;
clutter_backend_class->get_device_manager = meta_clutter_backend_x11_get_device_manager; clutter_backend_class->get_device_manager = meta_clutter_backend_x11_get_device_manager;
clutter_backend_class->get_keymap = meta_clutter_backend_x11_get_keymap; clutter_backend_class->get_keymap = meta_clutter_backend_x11_get_keymap;
clutter_backend_class->translate_event = meta_clutter_backend_x11_translate_event; clutter_backend_class->translate_event = meta_clutter_backend_x11_translate_event;

View File

@ -27,6 +27,7 @@
#include "backends/x11/meta-stage-x11.h" #include "backends/x11/meta-stage-x11.h"
#include "clutter/clutter-mutter.h" #include "clutter/clutter-mutter.h"
#include "clutter/x11/clutter-x11.h" #include "clutter/x11/clutter-x11.h"
#include "core/bell.h"
#include "meta-seat-x11.h" #include "meta-seat-x11.h"
enum enum
@ -1418,6 +1419,14 @@ meta_seat_x11_list_devices (ClutterSeat *seat)
return retval; return retval;
} }
static void
meta_seat_x11_bell_notify (ClutterSeat *seat)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static void static void
meta_seat_x11_class_init (MetaSeatX11Class *klass) meta_seat_x11_class_init (MetaSeatX11Class *klass)
{ {
@ -1432,6 +1441,7 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
seat_class->get_pointer = meta_seat_x11_get_pointer; seat_class->get_pointer = meta_seat_x11_get_pointer;
seat_class->get_keyboard = meta_seat_x11_get_keyboard; seat_class->get_keyboard = meta_seat_x11_get_keyboard;
seat_class->list_devices = meta_seat_x11_list_devices; seat_class->list_devices = meta_seat_x11_list_devices;
seat_class->bell_notify = meta_seat_x11_bell_notify;
props[PROP_OPCODE] = props[PROP_OPCODE] =
g_param_spec_int ("opcode", g_param_spec_int ("opcode",