mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
clutter: Move check for device type into remove_device_for_event()
We'll call this function from a few more places for the CLUTTER_DEVICE_REMOVED case, so move the check for which devices are valid into the function itself to avoid having to check everywhere. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2696>
This commit is contained in:
parent
425e80adc2
commit
2d85e84136
@ -709,7 +709,7 @@ update_device_for_event (ClutterStage *stage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
remove_device_for_event (ClutterStage *stage,
|
maybe_remove_device_for_event (ClutterStage *stage,
|
||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gboolean emit_crossing)
|
gboolean emit_crossing)
|
||||||
{
|
{
|
||||||
@ -718,6 +718,19 @@ remove_device_for_event (ClutterStage *stage,
|
|||||||
graphene_point_t point;
|
graphene_point_t point;
|
||||||
uint32_t time;
|
uint32_t time;
|
||||||
|
|
||||||
|
if (event->type == CLUTTER_DEVICE_REMOVED)
|
||||||
|
{
|
||||||
|
ClutterInputDeviceType device_type =
|
||||||
|
clutter_input_device_get_device_type (device);
|
||||||
|
|
||||||
|
if (device_type != CLUTTER_POINTER_DEVICE &&
|
||||||
|
device_type != CLUTTER_TABLET_DEVICE &&
|
||||||
|
device_type != CLUTTER_PEN_DEVICE &&
|
||||||
|
device_type != CLUTTER_ERASER_DEVICE &&
|
||||||
|
device_type != CLUTTER_CURSOR_DEVICE)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
clutter_event_get_coords (event, &point.x, &point.y);
|
clutter_event_get_coords (event, &point.x, &point.y);
|
||||||
time = clutter_event_get_time (event);
|
time = clutter_event_get_time (event);
|
||||||
|
|
||||||
@ -793,7 +806,7 @@ clutter_do_event (ClutterEvent *event)
|
|||||||
event->type == CLUTTER_TOUCH_CANCEL)
|
event->type == CLUTTER_TOUCH_CANCEL)
|
||||||
{
|
{
|
||||||
_clutter_stage_process_queued_events (event->any.stage);
|
_clutter_stage_process_queued_events (event->any.stage);
|
||||||
remove_device_for_event (event->any.stage, event, TRUE);
|
maybe_remove_device_for_event (event->any.stage, event, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -901,7 +914,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
|
|
||||||
if (event->type == CLUTTER_TOUCH_END ||
|
if (event->type == CLUTTER_TOUCH_END ||
|
||||||
event->type == CLUTTER_TOUCH_CANCEL)
|
event->type == CLUTTER_TOUCH_CANCEL)
|
||||||
remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
|
maybe_remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -917,19 +930,8 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_DEVICE_REMOVED:
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
{
|
maybe_remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
|
||||||
ClutterInputDeviceType device_type;
|
|
||||||
|
|
||||||
device_type = clutter_input_device_get_device_type (device);
|
|
||||||
if (device_type == CLUTTER_POINTER_DEVICE ||
|
|
||||||
device_type == CLUTTER_TABLET_DEVICE ||
|
|
||||||
device_type == CLUTTER_PEN_DEVICE ||
|
|
||||||
device_type == CLUTTER_ERASER_DEVICE ||
|
|
||||||
device_type == CLUTTER_CURSOR_DEVICE)
|
|
||||||
remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case CLUTTER_DEVICE_ADDED:
|
case CLUTTER_DEVICE_ADDED:
|
||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
|
Loading…
Reference in New Issue
Block a user