[clutter-gst] examples: video-player: deal with enter/leave events to show/hide cursor



commit bbe7e01f09003093c8b04248a8b2597e43d36214
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Wed Jan 30 15:08:31 2013 +0000

    examples: video-player: deal with enter/leave events to show/hide cursor

 examples/video-player.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/examples/video-player.c b/examples/video-player.c
index 2686483..3295e6e 100644
--- a/examples/video-player.c
+++ b/examples/video-player.c
@@ -48,7 +48,7 @@ typedef struct _VideoApp
 
   ClutterActor *control_seek1, *control_seek2, *control_seekbar;
 
-  gboolean      controls_showing, paused;
+  gboolean      controls_showing, paused, mouse_in_window;
 
   guint         controls_timeout;
 } VideoApp;
@@ -144,7 +144,8 @@ show_controls (VideoApp *app, gboolean vis)
     {
       app->controls_showing = FALSE;
 
-      clutter_stage_hide_cursor (CLUTTER_STAGE (app->stage));
+      if (app->mouse_in_window)
+        clutter_stage_hide_cursor (CLUTTER_STAGE (app->stage));
       _actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 250,
                       "opacity", 0,
                       NULL);
@@ -280,6 +281,17 @@ input_cb (ClutterStage *stage,
             break;
           }
       }
+
+    case CLUTTER_ENTER:
+      app->mouse_in_window = TRUE;
+      g_object_set (app->stage, "cursor-visible", app->controls_showing, NULL);
+      break;
+
+    case CLUTTER_LEAVE:
+      app->mouse_in_window = FALSE;
+      clutter_stage_show_cursor (CLUTTER_STAGE (app->stage));
+      break;
+
     default:
       break;
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]