screenshot: Use MetaCursorTracker to fetch the cursor position

ClutterInputDevice will use the last place it knows the cursor to be,
which isn't always up to date when running under X11.
This commit is contained in:
Jasper St. Pierre 2015-02-11 00:58:42 -08:00
parent 397460d64c
commit d54b87c455

View File

@ -249,22 +249,6 @@ do_grab_screenshot (ShellScreenshot *screenshot,
cogl_object_unref (bitmap);
}
static void
get_pointer_coords (int *x,
int *y)
{
ClutterDeviceManager *manager;
ClutterInputDevice *device;
ClutterPoint point;
manager = clutter_device_manager_get_default ();
device = clutter_device_manager_get_device (manager, META_VIRTUAL_CORE_POINTER_ID);
clutter_input_device_get_coords (device, NULL, &point);
*x = point.x;
*y = point.y;
}
static void
_draw_cursor_image (MetaCursorTracker *tracker,
cairo_surface_t *surface,
@ -281,7 +265,7 @@ _draw_cursor_image (MetaCursorTracker *tracker,
int xhot, yhot;
screenshot_region = cairo_region_create_rectangle (&area);
get_pointer_coords (&x, &y);
meta_cursor_tracker_get_pointer (tracker, &x, &y, NULL);
if (!cairo_region_contains_point (screenshot_region, x, y))
{