mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
MetaCursorTracker: add methods for setting the cursor visibility
clutter_stage_show_cursor()/hide_cursor() only works in the X11 backend (where someone else is in charge of showing the cursor), and even then, it has confusing effects when running nested wayland, so an abstraction layer is needed. https://bugzilla.gnome.org/show_bug.cgi?id=707474
This commit is contained in:
parent
6f4f611ba8
commit
5b3340e585
@ -426,7 +426,7 @@ meta_cursor_tracker_paint (MetaCursorTracker *tracker)
|
||||
{
|
||||
g_assert (meta_is_wayland_compositor ());
|
||||
|
||||
if (tracker->sprite == NULL)
|
||||
if (tracker->sprite == NULL || tracker->is_showing == FALSE)
|
||||
return;
|
||||
|
||||
/* FIXME: try to use a DRM cursor when possible */
|
||||
@ -513,3 +513,29 @@ meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
|
||||
else
|
||||
get_pointer_position_gdk (x, y, (int*)mods);
|
||||
}
|
||||
|
||||
void
|
||||
meta_cursor_tracker_set_pointer_visible (MetaCursorTracker *tracker,
|
||||
gboolean visible)
|
||||
{
|
||||
if (visible == tracker->is_showing)
|
||||
return;
|
||||
tracker->is_showing = visible;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
meta_cursor_tracker_queue_redraw (tracker, compositor->stage);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (visible)
|
||||
XFixesShowCursor (tracker->screen->display->xdisplay,
|
||||
tracker->screen->xroot);
|
||||
else
|
||||
XFixesHideCursor (tracker->screen->display->xdisplay,
|
||||
tracker->screen->xroot);
|
||||
}
|
||||
}
|
||||
|
@ -52,5 +52,7 @@ void meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
|
||||
int *x,
|
||||
int *y,
|
||||
ClutterModifierType *mods);
|
||||
void meta_cursor_tracker_set_pointer_visible (MetaCursorTracker *tracker,
|
||||
gboolean visible);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user