summaryrefslogtreecommitdiff
path: root/clutter-gtk/gtk-clutter-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'clutter-gtk/gtk-clutter-util.c')
-rw-r--r--clutter-gtk/gtk-clutter-util.c103
1 files changed, 66 insertions, 37 deletions
diff --git a/clutter-gtk/gtk-clutter-util.c b/clutter-gtk/gtk-clutter-util.c
index be9f4ee..61c1d7a 100644
--- a/clutter-gtk/gtk-clutter-util.c
+++ b/clutter-gtk/gtk-clutter-util.c
@@ -11,17 +11,25 @@
#include <gtk/gtk.h>
#include <clutter/clutter.h>
-#if defined(HAVE_CLUTTER_GTK_X11)
+#if defined(CLUTTER_WINDOWING_GDK)
+#include <clutter/gdk/clutter-gdk.h>
+#endif
+#if defined(CLUTTER_WINDOWING_X11)
#include <clutter/x11/clutter-x11.h>
-#include <gdk/gdkx.h>
-
-#elif defined(HAVE_CLUTTER_GTK_WIN32)
+#endif
+#if defined(CLUTTER_WINDOWING_WIN32)
#include <clutter/win32/clutter-win32.h>
-#include <gdk/gdkwin32.h>
+#endif
-#endif /* HAVE_CLUTTER_GTK_{X11,WIN32} */
+#if defined(GDK_WINDOWING_X11)
+#include <gdk/gdkx.h>
+#endif
+
+#if defined(GDK_WINDOWING_WIN32)
+#include <gdk/gdkwin32.h>
+#endif
/**
* SECTION:gtk-clutter-util
@@ -48,27 +56,50 @@ post_parse_hook (GOptionContext *context,
gpointer data,
GError **error)
{
+ GdkDisplay *display;
+
gtk_clutter_is_initialized = TRUE;
- gdk_disable_multidevice ();
+ display = gdk_display_get_default ();
-#if defined(HAVE_CLUTTER_GTK_X11)
-# if CLUTTER_CHECK_VERSION (1, 1, 5)
- /* enable ARGB visuals by default for Clutter */
- clutter_x11_set_use_argb_visual (TRUE);
-# endif
-#endif
+#if defined(CLUTTER_WINDOWING_GDK)
+ if (clutter_check_windowing_backend (CLUTTER_WINDOWING_GDK))
+ {
+ clutter_gdk_set_display (gdk_display_get_default ());
-#if defined(GDK_WINDOWING_X11)
- /* share the X11 Display with GTK+ */
- clutter_x11_set_display (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
-
- /* let GTK+ in charge of the event handling */
- clutter_x11_disable_event_retrieval ();
-#elif defined(GDK_WINDOWING_WIN32)
- /* let GTK+ in charge of the event handling */
- clutter_win32_disable_event_retrieval ();
-#endif /* GDK_WINDOWING_{X11,WIN32} */
+ /* let GDK be in charge of the event handling */
+ clutter_gdk_disable_event_retrieval ();
+ }
+ else
+#endif
+#if defined(GDK_WINDOWING_X11) && defined(CLUTTER_WINDOWING_X11)
+ if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
+ GDK_IS_X11_DISPLAY (display))
+ {
+ /* we need XI enabled because GTK will enable it by default as well */
+ clutter_x11_enable_xinput ();
+
+ /* enable ARGB visuals by default for Clutter */
+ clutter_x11_set_use_argb_visual (TRUE);
+
+ /* share the X11 Display with GTK+ */
+ clutter_x11_set_display (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+
+ /* let GTK+ be in charge of the event handling */
+ clutter_x11_disable_event_retrieval ();
+ }
+ else
+#endif
+#if defined(GDK_WINDOWING_WIN32) && defined(CLUTTER_WINDOWING_WIN32)
+ if (clutter_check_windowing_backend (CLUTTER_WINDOWING_WIN32) &&
+ GDK_IS_WIN32_DISPLAY (display))
+ {
+ /* let GTK+ be in charge of the event handling */
+ clutter_win32_disable_event_retrieval ();
+ }
+ else
+#endif
+ g_error ("*** Unsupported backend.");
/* this is required since parsing clutter's option group did not
* complete the initialization process
@@ -150,26 +181,26 @@ gtk_clutter_init (int *argc,
gtk_clutter_is_initialized = TRUE;
- gdk_disable_multidevice ();
-
if (!gtk_init_check (argc, argv))
return CLUTTER_INIT_ERROR_UNKNOWN;
-#if defined(HAVE_CLUTTER_GTK_X11)
-# if CLUTTER_CHECK_VERSION (1, 1, 5)
- /* enable ARGB visuals by default for Clutter */
+#if defined(CLUTTER_WINDOWING_GDK)
+ clutter_gdk_disable_event_retrieval ();
+#endif
+
+#if defined(GDK_WINDOWING_X11) && defined(CLUTTER_WINDOWING_X11)
+ clutter_x11_enable_xinput ();
+
clutter_x11_set_use_argb_visual (TRUE);
-# endif
- /* share the X11 Display with GTK+ */
clutter_x11_set_display (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
- /* let GTK+ in charge of the event handling */
clutter_x11_disable_event_retrieval ();
-#elif defined(HAVE_CLUTTER_GTK_WIN32)
- /* let GTK+ in charge of the event handling */
+#endif
+
+#if defined(CLUTTER_WINDOWING_WIN32)
clutter_win32_disable_event_retrieval ();
-#endif /* HAVE_CLUTTER_GTK_{X11,WIN32} */
+#endif
return clutter_init (argc, argv);
}
@@ -211,9 +242,7 @@ gtk_clutter_init_with_args (int *argc,
if (gtk_clutter_is_initialized)
return CLUTTER_INIT_SUCCESS;
- gdk_disable_multidevice ();
-
-#if defined(GDK_WINDOWING_X11) && CLUTTER_CHECK_VERSION (1, 1, 5)
+#if defined(CLUTTER_WINDOWING_X11)
/* enable ARGB visuals by default for Clutter */
clutter_x11_set_use_argb_visual (TRUE);
#endif