clutter: Add boolean return value to clutter_stage_get_device_coords()

The device/sequence may not currently have a set of coordinates to return.
We correctly leave the out values uninitialized, but don't tell the upper
layers in any way.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3183>
This commit is contained in:
Carlos Garnacho 2023-08-15 17:13:32 +02:00 committed by Marge Bot
parent 1da1b00de4
commit 88af55b857
2 changed files with 13 additions and 8 deletions

View File

@ -118,7 +118,7 @@ void clutter_stage_update_device (ClutterStage *stage,
gboolean emit_crossing);
CLUTTER_EXPORT
void clutter_stage_get_device_coords (ClutterStage *stage,
gboolean clutter_stage_get_device_coords (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *coords);

View File

@ -3134,7 +3134,7 @@ clutter_stage_get_device_actor (ClutterStage *stage,
/**
* clutter_stage_get_device_coords: (skip):
*/
void
gboolean
clutter_stage_get_device_coords (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
@ -3143,16 +3143,21 @@ clutter_stage_get_device_coords (ClutterStage *stage,
ClutterStagePrivate *priv = stage->priv;
PointerDeviceEntry *entry = NULL;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (device != NULL);
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
g_return_val_if_fail (device != NULL, FALSE);
if (sequence != NULL)
entry = g_hash_table_lookup (priv->touch_sequences, sequence);
else
entry = g_hash_table_lookup (priv->pointer_devices, device);
if (entry && coords)
if (!entry)
return FALSE;
if (coords)
*coords = entry->coords;
return TRUE;
}
static void