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.
This commit is contained in:
Emmanuele Bassi 2011-09-29 18:10:48 +01:00
parent a73f1e6768
commit f14cbf5bdb
2 changed files with 19 additions and 1 deletions

View File

@ -65,6 +65,8 @@ G_DEFINE_TYPE (ClutterBackendGdk, clutter_backend_gdk, CLUTTER_TYPE_BACKEND_COGL
/* global for pre init setup calls */ /* global for pre init setup calls */
static GdkDisplay *_foreign_dpy = NULL; static GdkDisplay *_foreign_dpy = NULL;
static gboolean disable_event_retrieval = FALSE;
static void static void
clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk) clutter_backend_gdk_init_settings (ClutterBackendGdk *backend_gdk)
{ {
@ -186,7 +188,8 @@ clutter_backend_gdk_init_events (ClutterBackend *backend)
{ {
CLUTTER_NOTE (EVENT, "initialising the event loop"); 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 static void
@ -452,3 +455,16 @@ clutter_gdk_set_display (GdkDisplay *display)
_foreign_dpy = g_object_ref (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;
}

View File

@ -51,6 +51,8 @@ GdkFilterReturn clutter_gdk_handle_event (GdkEvent *event);
ClutterStage * clutter_gdk_get_stage_from_window (GdkWindow *window); ClutterStage * clutter_gdk_get_stage_from_window (GdkWindow *window);
void clutter_gdk_disable_event_retrieval (void);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_GDK_H__ */ #endif /* __CLUTTER_GDK_H__ */