mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
cursor-tracker: Check if coordinates are NULL
To avoid a SEGV on X11. Passing NULL coordinates is perfectly valid if you are only seeking to get the `mods`. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1484 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1519
This commit is contained in:
parent
232dcad64f
commit
ebe8cd3704
@ -465,18 +465,26 @@ meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
|
||||
}
|
||||
|
||||
static void
|
||||
get_pointer_position_gdk (int *x,
|
||||
int *y,
|
||||
int *mods)
|
||||
get_pointer_position_gdk (graphene_point_t *point,
|
||||
int *mods)
|
||||
{
|
||||
GdkSeat *gseat;
|
||||
GdkDevice *gdevice;
|
||||
GdkScreen *gscreen;
|
||||
int x, y;
|
||||
|
||||
gseat = gdk_display_get_default_seat (gdk_display_get_default ());
|
||||
gdevice = gdk_seat_get_pointer (gseat);
|
||||
|
||||
gdk_device_get_position (gdevice, &gscreen, x, y);
|
||||
/* Even if point is NULL we need this to get gscreen */
|
||||
gdk_device_get_position (gdevice, &gscreen, &x, &y);
|
||||
|
||||
if (point)
|
||||
{
|
||||
point->x = x;
|
||||
point->y = y;
|
||||
}
|
||||
|
||||
if (mods)
|
||||
gdk_device_get_state (gdevice,
|
||||
gdk_screen_get_root_window (gscreen),
|
||||
@ -509,17 +517,9 @@ meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
|
||||
we forward to xwayland.
|
||||
*/
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
get_pointer_position_clutter (coords, (int*)mods);
|
||||
}
|
||||
get_pointer_position_clutter (coords, (int *) mods);
|
||||
else
|
||||
{
|
||||
int x, y;
|
||||
|
||||
get_pointer_position_gdk (&x, &y, (int*)mods);
|
||||
coords->x = x;
|
||||
coords->y = y;
|
||||
}
|
||||
get_pointer_position_gdk (coords, (int *) mods);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user