aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthierry E <thierry@substantiel.fr>2017-05-09 10:13:11 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-05-09 10:15:02 -0700
commit07024ab6c84ddadd74a7c5c08a2661af51e38997 (patch)
tree16fd8141af82f2f6498da2f58b0862c0b9d3fb2e
parentecore_x: handle DPMS state for a more accurate idling evaluation. (diff)
downloadefl-07024ab6c84ddadd74a7c5c08a2661af51e38997.tar.gz
ecore_x: add function to show and hide X cursor.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/ecore_x/Ecore_X.h2
-rw-r--r--src/lib/ecore_x/ecore_x_fixes.c29
2 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index c81be31808..8c0c7d3ef1 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -2436,6 +2436,8 @@ EAPI void ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Regio
EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x_origin, int y_origin);
EAPI void ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window win, Ecore_X_Shape_Type type, int x_offset, int y_offset);
EAPI void ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x_origin, int y_origin);
+EAPI void ecore_x_cursor_show(void);
+EAPI void ecore_x_cursor_hide(void);
/**
* xfixes selection notification request.
diff --git a/src/lib/ecore_x/ecore_x_fixes.c b/src/lib/ecore_x/ecore_x_fixes.c
index 30432354d5..f656edec6e 100644
--- a/src/lib/ecore_x/ecore_x_fixes.c
+++ b/src/lib/ecore_x/ecore_x_fixes.c
@@ -10,6 +10,7 @@
static int _fixes_available;
#ifdef ECORE_XFIXES
static int _fixes_major, _fixes_minor;
+static int _cursor_visible = 1;
#endif /* ifdef ECORE_XFIXES */
void
@@ -406,3 +407,31 @@ ecore_x_region_picture_clip_set(Ecore_X_Region region,
if (_ecore_xlib_sync) ecore_x_sync();
#endif /* ifdef ECORE_XFIXES */
}
+
+EAPI void
+ecore_x_cursor_show(void)
+{
+ EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
+#ifdef ECORE_XFIXES
+ if (!_cursor_visible)
+ {
+ XFixesShowCursor(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp));
+ XFlush(_ecore_x_disp);
+ _cursor_visible = 1;
+ }
+#endif /* ifdef ECORE_XFIXES */
+}
+
+EAPI void
+ecore_x_cursor_hide(void)
+{
+ EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
+#ifdef ECORE_XFIXES
+ if (_cursor_visible)
+ {
+ XFixesHideCursor(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp));
+ XFlush(_ecore_x_disp);
+ _cursor_visible = 0;
+ }
+#endif /* ifdef ECORE_XFIXES */
+}