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,9 +96,7 @@ struct _ClutterBackendClass
gpointer native,
ClutterEvent *event);
void (* bell_notify) (ClutterBackend *backend);
ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
ClutterKeymap * (* get_keymap) (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);
}
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:
* @backend: the #CLutterBackend

View File

@ -73,9 +73,6 @@ const cairo_font_options_t * clutter_backend_get_font_options (Clutter
CLUTTER_EXPORT
CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend);
CLUTTER_EXPORT
void clutter_backend_bell_notify (ClutterBackend *backend);
CLUTTER_EXPORT
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);
}
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);
GList * (* list_devices) (ClutterSeat *seat);
void (* bell_notify) (ClutterSeat *seat);
};
CLUTTER_EXPORT
@ -53,5 +55,7 @@ CLUTTER_EXPORT
ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
CLUTTER_EXPORT
GList * clutter_seat_list_devices (ClutterSeat *seat);
CLUTTER_EXPORT
void clutter_seat_bell_notify (ClutterSeat *seat);
#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);
}
static void
meta_clutter_backend_native_bell_notify (ClutterBackend *backend)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static ClutterDeviceManager *
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->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_keymap = meta_clutter_backend_native_get_keymap;
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
meta_input_device_native_bell_notify (void)
meta_input_device_native_bell_notify (MetaInputDeviceNative *device)
{
ClutterBackend *backend;
backend = clutter_get_default_backend ();
clutter_backend_bell_notify (backend);
clutter_seat_bell_notify (CLUTTER_SEAT (device->seat));
}
static void
@ -277,7 +274,7 @@ trigger_slow_keys (gpointer data)
meta_input_device_native_free_pending_slow_key (slow_keys_event);
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;
}
@ -315,7 +312,7 @@ start_slow_keys (ClutterEvent *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)
meta_input_device_native_bell_notify ();
meta_input_device_native_bell_notify (device);
}
static void
@ -335,7 +332,7 @@ stop_slow_keys (ClutterEvent *event,
meta_input_device_native_free_pending_slow_key (slow_keys_event);
if (device->a11y_flags & CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT)
meta_input_device_native_bell_notify ();
meta_input_device_native_bell_notify (device);
return;
}
@ -389,7 +386,7 @@ static void
notify_bounce_keys_reject (MetaInputDeviceNative *device)
{
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
@ -609,7 +606,7 @@ handle_stickykeys_release (ClutterEvent *event,
if (key_event_is_modifier (event))
{
if (device->a11y_flags & CLUTTER_A11Y_STICKY_KEYS_BEEP)
meta_input_device_native_bell_notify ();
meta_input_device_native_bell_notify (device);
return;
}
@ -628,7 +625,7 @@ trigger_toggle_slowkeys (gpointer data)
device->toggle_slowkeys_timer = 0;
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)
set_slowkeys_off (device);
@ -690,7 +687,7 @@ handle_enablekeys_release (ClutterEvent *event,
device->shift_count = 0;
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)
set_stickykeys_off (device);
@ -1227,7 +1224,7 @@ void
meta_input_device_native_a11y_maybe_notify_toggle_keys (MetaInputDeviceNative *device)
{
if (device->a11y_flags & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED)
meta_input_device_native_bell_notify ();
meta_input_device_native_bell_notify (device);
}
static void

View File

@ -38,6 +38,7 @@
#include "backends/native/meta-input-device-tool-native.h"
#include "backends/native/meta-keymap-native.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
@ -2503,6 +2504,14 @@ meta_seat_native_list_devices (ClutterSeat *seat)
return devices;
}
static void
meta_seat_native_bell_notify (ClutterSeat *seat)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static void
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_keyboard = meta_seat_native_get_keyboard;
seat_class->list_devices = meta_seat_native_list_devices;
seat_class->bell_notify = meta_seat_native_bell_notify;
props[PROP_SEAT_ID] =
g_param_spec_string ("seat-id",

View File

@ -80,14 +80,6 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
return stage;
}
static void
meta_clutter_backend_x11_bell_notify (ClutterBackend *backend)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static ClutterDeviceManager *
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->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_keymap = meta_clutter_backend_x11_get_keymap;
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 "clutter/clutter-mutter.h"
#include "clutter/x11/clutter-x11.h"
#include "core/bell.h"
#include "meta-seat-x11.h"
enum
@ -1418,6 +1419,14 @@ meta_seat_x11_list_devices (ClutterSeat *seat)
return retval;
}
static void
meta_seat_x11_bell_notify (ClutterSeat *seat)
{
MetaDisplay *display = meta_get_display ();
meta_bell_notify (display, NULL);
}
static void
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_keyboard = meta_seat_x11_get_keyboard;
seat_class->list_devices = meta_seat_x11_list_devices;
seat_class->bell_notify = meta_seat_x11_bell_notify;
props[PROP_OPCODE] =
g_param_spec_int ("opcode",