mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
clutter: Move platform event data management to ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
parent
9be4f98c73
commit
34ce39f8dc
@ -770,24 +770,24 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
ClutterDeviceManagerClass *device_manager_class;
|
||||
ClutterDeviceManager *device_manager;
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeat *seat;
|
||||
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
device_manager_class->copy_event_data (device_manager, src, dest);
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
seat_class->copy_event_data (seat, src, dest);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_free_event_data (ClutterBackend *backend,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterDeviceManagerClass *device_manager_class;
|
||||
ClutterDeviceManager *device_manager;
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeat *seat;
|
||||
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
device_manager_class->free_event_data (device_manager, event);
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
seat_class->free_event_data (seat, event);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,13 +124,6 @@ struct _ClutterDeviceManagerClass
|
||||
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
/* Event platform data */
|
||||
void (* copy_event_data) (ClutterDeviceManager *device_manager,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest);
|
||||
void (* free_event_data) (ClutterDeviceManager *device_manager,
|
||||
ClutterEvent *event);
|
||||
|
||||
/* padding */
|
||||
gpointer _padding[4];
|
||||
};
|
||||
|
@ -50,6 +50,13 @@ struct _ClutterSeatClass
|
||||
void (* bell_notify) (ClutterSeat *seat);
|
||||
|
||||
ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
|
||||
|
||||
/* Event platform data */
|
||||
void (* copy_event_data) (ClutterSeat *seat,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest);
|
||||
void (* free_event_data) (ClutterSeat *seat,
|
||||
ClutterEvent *event);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
@ -53,29 +53,6 @@ G_DEFINE_TYPE_WITH_CODE (MetaDeviceManagerNative,
|
||||
CLUTTER_TYPE_DEVICE_MANAGER,
|
||||
G_ADD_PRIVATE (MetaDeviceManagerNative))
|
||||
|
||||
static void
|
||||
meta_device_manager_native_copy_event_data (ClutterDeviceManager *device_manager,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
MetaEventNative *event_evdev;
|
||||
|
||||
event_evdev = _clutter_event_get_platform_data (src);
|
||||
if (event_evdev != NULL)
|
||||
_clutter_event_set_platform_data (dest, meta_event_native_copy (event_evdev));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_device_manager_native_free_event_data (ClutterDeviceManager *device_manager,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
MetaEventNative *event_evdev;
|
||||
|
||||
event_evdev = _clutter_event_get_platform_data (event);
|
||||
if (event_evdev != NULL)
|
||||
meta_event_native_free (event_evdev);
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterDeviceManager implementation
|
||||
*/
|
||||
@ -275,8 +252,6 @@ meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
|
||||
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;
|
||||
manager_class->copy_event_data = meta_device_manager_native_copy_event_data;
|
||||
manager_class->free_event_data = meta_device_manager_native_free_event_data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2533,6 +2533,29 @@ meta_seat_native_get_keymap (ClutterSeat *seat)
|
||||
return CLUTTER_KEYMAP (seat_native->keymap);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_copy_event_data (ClutterSeat *seat,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
MetaEventNative *event_evdev;
|
||||
|
||||
event_evdev = _clutter_event_get_platform_data (src);
|
||||
if (event_evdev != NULL)
|
||||
_clutter_event_set_platform_data (dest, meta_event_native_copy (event_evdev));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_free_event_data (ClutterSeat *seat,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
MetaEventNative *event_evdev;
|
||||
|
||||
event_evdev = _clutter_event_get_platform_data (event);
|
||||
if (event_evdev != NULL)
|
||||
meta_event_native_free (event_evdev);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
{
|
||||
@ -2550,6 +2573,8 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
seat_class->list_devices = meta_seat_native_list_devices;
|
||||
seat_class->bell_notify = meta_seat_native_bell_notify;
|
||||
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;
|
||||
|
||||
props[PROP_SEAT_ID] =
|
||||
g_param_spec_string ("seat-id",
|
||||
|
@ -52,29 +52,6 @@ G_DEFINE_TYPE (MetaDeviceManagerX11,
|
||||
meta_device_manager_x11,
|
||||
CLUTTER_TYPE_DEVICE_MANAGER)
|
||||
|
||||
static void
|
||||
meta_device_manager_x11_copy_event_data (ClutterDeviceManager *device_manager,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
gpointer event_x11;
|
||||
|
||||
event_x11 = _clutter_event_get_platform_data (src);
|
||||
if (event_x11 != NULL)
|
||||
_clutter_event_set_platform_data (dest, meta_event_x11_copy (event_x11));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_device_manager_x11_free_event_data (ClutterDeviceManager *device_manager,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
gpointer event_x11;
|
||||
|
||||
event_x11 = _clutter_event_get_platform_data (event);
|
||||
if (event_x11 != NULL)
|
||||
meta_event_x11_free (event_x11);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_device_manager_x11_select_stage_events (ClutterDeviceManager *manager,
|
||||
ClutterStage *stage)
|
||||
@ -301,8 +278,6 @@ meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
|
||||
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;
|
||||
manager_class->copy_event_data = meta_device_manager_x11_copy_event_data;
|
||||
manager_class->free_event_data = meta_device_manager_x11_free_event_data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1456,6 +1456,29 @@ meta_seat_x11_get_keymap (ClutterSeat *seat)
|
||||
return CLUTTER_KEYMAP (META_SEAT_X11 (seat)->keymap);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_x11_copy_event_data (ClutterSeat *seat,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
gpointer event_x11;
|
||||
|
||||
event_x11 = _clutter_event_get_platform_data (src);
|
||||
if (event_x11 != NULL)
|
||||
_clutter_event_set_platform_data (dest, meta_event_x11_copy (event_x11));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_x11_free_event_data (ClutterSeat *seat,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
gpointer event_x11;
|
||||
|
||||
event_x11 = _clutter_event_get_platform_data (event);
|
||||
if (event_x11 != NULL)
|
||||
meta_event_x11_free (event_x11);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_x11_class_init (MetaSeatX11Class *klass)
|
||||
{
|
||||
@ -1472,6 +1495,8 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
|
||||
seat_class->list_devices = meta_seat_x11_list_devices;
|
||||
seat_class->bell_notify = meta_seat_x11_bell_notify;
|
||||
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;
|
||||
|
||||
props[PROP_OPCODE] =
|
||||
g_param_spec_int ("opcode",
|
||||
|
Loading…
Reference in New Issue
Block a user