mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
core: Manage MetaPadActionMapper devices through events
Use the CLUTTER_DEVICE_ADDED/REMOVED set of events instead of the ClutterSeat signals to track device availability. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3370>
This commit is contained in:
parent
b611569b26
commit
2dec4dd088
@ -340,6 +340,8 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
if (event_type != CLUTTER_DEVICE_ADDED &&
|
||||
event_type != CLUTTER_DEVICE_REMOVED)
|
||||
handle_idletime_for_event (display, event);
|
||||
else
|
||||
meta_pad_action_mapper_handle_event (display->pad_action_mapper, event);
|
||||
|
||||
if (event_type == CLUTTER_MOTION)
|
||||
{
|
||||
|
@ -134,9 +134,8 @@ pad_mapping_info_free (PadMappingInfo *info)
|
||||
}
|
||||
|
||||
static void
|
||||
device_added (ClutterSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
MetaPadActionMapper *mapper)
|
||||
device_added (MetaPadActionMapper *mapper,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
PadMappingInfo *info;
|
||||
|
||||
@ -149,9 +148,8 @@ device_added (ClutterSeat *seat,
|
||||
}
|
||||
|
||||
static void
|
||||
device_removed (ClutterSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
MetaPadActionMapper *mapper)
|
||||
device_removed (MetaPadActionMapper *mapper,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
g_hash_table_remove (mapper->pads, device);
|
||||
}
|
||||
@ -163,10 +161,6 @@ meta_pad_action_mapper_init (MetaPadActionMapper *mapper)
|
||||
(GDestroyNotify) pad_mapping_info_free);
|
||||
|
||||
mapper->seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
g_signal_connect (mapper->seat, "device-added",
|
||||
G_CALLBACK (device_added), mapper);
|
||||
g_signal_connect (mapper->seat, "device-removed",
|
||||
G_CALLBACK (device_removed), mapper);
|
||||
}
|
||||
|
||||
MetaPadActionMapper *
|
||||
@ -727,9 +721,17 @@ meta_pad_action_mapper_handle_event (MetaPadActionMapper *mapper,
|
||||
return meta_pad_action_mapper_handle_action (mapper, pad, event,
|
||||
META_PAD_FEATURE_STRIP,
|
||||
number, mode);
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
device_added (mapper, clutter_event_get_source_device (event));
|
||||
break;
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
device_removed (mapper, clutter_event_get_source_device (event));
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static char *
|
||||
|
Loading…
Reference in New Issue
Block a user