[mutter/wip/wayland-work: 18/22] MetaCursorTracker: add methods for setting the cursor visibility
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-work: 18/22] MetaCursorTracker: add methods for setting the cursor visibility
- Date: Mon, 9 Sep 2013 13:42:07 +0000 (UTC)
commit 797ecab3aced8e8adf4a05446365941330618001
Author: Giovanni Campagna <gcampagn redhat com>
Date: Wed Sep 4 16:56:00 2013 +0200
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
src/core/meta-cursor-tracker.c | 28 +++++++++++++++++++++++++++-
src/meta/meta-cursor-tracker.h | 2 ++
2 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c
index 0ae1786..8c3815e 100644
--- a/src/core/meta-cursor-tracker.c
+++ b/src/core/meta-cursor-tracker.c
@@ -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);
+ }
+}
diff --git a/src/meta/meta-cursor-tracker.h b/src/meta/meta-cursor-tracker.h
index 8862e43..3920295 100644
--- a/src/meta/meta-cursor-tracker.h
+++ b/src/meta/meta-cursor-tracker.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]