[clutter/multi-backend: 6/22] gdk: Allow disabling event retrieval



commit 20efc678dffe9dad8696ed71cf112f21632b2985
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Sep 29 18:10:48 2011 +0100

    gdk: Allow disabling event retrieval
    
    Just like the other backends can disable the internal event handling,
    and use clutter_<backend>_handle_event() to do the native â Clutter
    event translation.

 clutter/gdk/clutter-backend-gdk.c |   18 +++++++++++++++++-
 clutter/gdk/clutter-gdk.h         |    2 ++
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/clutter/gdk/clutter-backend-gdk.c b/clutter/gdk/clutter-backend-gdk.c
index 39b2124..9e451ef 100644
--- a/clutter/gdk/clutter-backend-gdk.c
+++ b/clutter/gdk/clutter-backend-gdk.c
@@ -61,6 +61,8 @@ G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND_COGL
 /* global for pre init setup calls */
 static GdkDisplay  *_foreign_dpy = NULL;
 
+static gboolean disable_event_retrieval = FALSE;
+
 static void
 clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk)
 {
@@ -182,7 +184,8 @@ clutter_backend_gdk_init_events (ClutterBackend *backend)
 {
   CLUTTER_NOTE (EVENT, "initialising the event loop");
 
-  _clutter_backend_gdk_events_init (backend);
+  if (!disable_event_retrieval)
+    _clutter_backend_gdk_events_init (backend);
 }
 
 static void
@@ -448,3 +451,16 @@ clutter_gdk_set_display (GdkDisplay *display)
 
   _foreign_dpy = g_object_ref (display);
 }
+
+void
+clutter_gdk_disable_event_retrieval (void)
+{
+  if (_clutter_context_is_initialized ())
+    {
+      g_warning ("%s() can only be used before calling clutter_init()",
+                 G_STRFUNC);
+      return;
+    }
+
+  disable_event_retrieval = TRUE;
+}
diff --git a/clutter/gdk/clutter-gdk.h b/clutter/gdk/clutter-gdk.h
index dc95bdb..36724bd 100644
--- a/clutter/gdk/clutter-gdk.h
+++ b/clutter/gdk/clutter-gdk.h
@@ -51,6 +51,8 @@ GdkFilterReturn clutter_gdk_handle_event                (GdkEvent     *event);
 
 ClutterStage *  clutter_gdk_get_stage_from_window       (GdkWindow    *window);
 
+void            clutter_gdk_disable_event_retrieval     (void);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_GDK_H__ */



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