mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
cursor-tracker: Use a separate cursor for xfixes cursor tracking
This commit is contained in:
parent
33cb7f4a2c
commit
da175bca52
@ -62,6 +62,9 @@ struct _MetaCursorTracker {
|
|||||||
MetaCursorReference *window_cursor;
|
MetaCursorReference *window_cursor;
|
||||||
|
|
||||||
MetaCursorReference *root_cursor;
|
MetaCursorReference *root_cursor;
|
||||||
|
|
||||||
|
/* The cursor from the X11 server. */
|
||||||
|
MetaCursorReference *xfixes_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaCursorTrackerClass {
|
struct _MetaCursorTrackerClass {
|
||||||
|
@ -224,7 +224,7 @@ meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
|||||||
if (notify_event->subtype != XFixesDisplayCursorNotify)
|
if (notify_event->subtype != XFixesDisplayCursorNotify)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
set_window_cursor (tracker, FALSE, NULL);
|
g_clear_pointer (&tracker->xfixes_cursor, meta_cursor_reference_unref);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
|
|||||||
gboolean free_cursor_data;
|
gboolean free_cursor_data;
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
|
|
||||||
if (tracker->has_window_cursor)
|
if (tracker->xfixes_cursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cursor_image = XFixesGetCursorImage (tracker->screen->display->xdisplay);
|
cursor_image = XFixesGetCursorImage (tracker->screen->display->xdisplay);
|
||||||
@ -304,7 +304,7 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
|
|||||||
MetaCursorReference *cursor = meta_cursor_reference_take_texture (sprite,
|
MetaCursorReference *cursor = meta_cursor_reference_take_texture (sprite,
|
||||||
cursor_image->xhot,
|
cursor_image->xhot,
|
||||||
cursor_image->yhot);
|
cursor_image->yhot);
|
||||||
set_window_cursor (tracker, TRUE, cursor);
|
tracker->xfixes_cursor = cursor;
|
||||||
}
|
}
|
||||||
XFree (cursor_image);
|
XFree (cursor_image);
|
||||||
}
|
}
|
||||||
@ -317,13 +317,22 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
|
|||||||
CoglTexture *
|
CoglTexture *
|
||||||
meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
|
meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
|
||||||
{
|
{
|
||||||
|
MetaCursorReference *cursor;
|
||||||
|
|
||||||
g_return_val_if_fail (META_IS_CURSOR_TRACKER (tracker), NULL);
|
g_return_val_if_fail (META_IS_CURSOR_TRACKER (tracker), NULL);
|
||||||
|
|
||||||
if (!meta_is_wayland_compositor ())
|
if (meta_is_wayland_compositor ())
|
||||||
ensure_xfixes_cursor (tracker);
|
{
|
||||||
|
cursor = tracker->displayed_cursor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ensure_xfixes_cursor (tracker);
|
||||||
|
cursor = tracker->xfixes_cursor;
|
||||||
|
}
|
||||||
|
|
||||||
if (tracker->displayed_cursor)
|
if (cursor)
|
||||||
return meta_cursor_reference_get_cogl_texture (tracker->displayed_cursor, NULL, NULL);
|
return meta_cursor_reference_get_cogl_texture (cursor, NULL, NULL);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -340,13 +349,22 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
|
|||||||
int *x,
|
int *x,
|
||||||
int *y)
|
int *y)
|
||||||
{
|
{
|
||||||
|
MetaCursorReference *cursor;
|
||||||
|
|
||||||
g_return_if_fail (META_IS_CURSOR_TRACKER (tracker));
|
g_return_if_fail (META_IS_CURSOR_TRACKER (tracker));
|
||||||
|
|
||||||
if (!meta_is_wayland_compositor ())
|
if (meta_is_wayland_compositor ())
|
||||||
ensure_xfixes_cursor (tracker);
|
{
|
||||||
|
cursor = tracker->displayed_cursor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ensure_xfixes_cursor (tracker);
|
||||||
|
cursor = tracker->xfixes_cursor;
|
||||||
|
}
|
||||||
|
|
||||||
if (tracker->displayed_cursor)
|
if (cursor)
|
||||||
meta_cursor_reference_get_cogl_texture (tracker->displayed_cursor, x, y);
|
meta_cursor_reference_get_cogl_texture (cursor, x, y);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x)
|
if (x)
|
||||||
|
Loading…
Reference in New Issue
Block a user