From 405e72f2e4ce94e3fad5c668cf0e7622fdc3af35 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 3 Oct 2011 12:25:53 +0100 Subject: [PATCH] egl: First attempt at cleaning up the EGL native backend At least, let's make it compile when built along with the other backends. In reality, it still needs to be verified as working. --- clutter/Makefile.am | 16 +- clutter/clutter-main.c | 4 +- clutter/cogl/clutter-backend-cogl.c | 40 +---- clutter/cogl/clutter-stage-cogl.h | 4 - clutter/egl/clutter-backend-eglnative.c | 159 +++++++++++++++---- clutter/egl/clutter-backend-eglnative.h | 5 - clutter/egl/clutter-egl.h | 3 + clutter/evdev/clutter-device-manager-evdev.c | 11 +- clutter/tslib/clutter-event-tslib.c | 26 +-- clutter/tslib/clutter-event-tslib.h | 35 ++++ configure.ac | 48 +++--- 11 files changed, 220 insertions(+), 131 deletions(-) create mode 100644 clutter/tslib/clutter-event-tslib.h diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 195cec5fd..6ee76e78a 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -528,6 +528,11 @@ egl_source_h = \ $(srcdir)/egl/clutter-egl.h \ $(NULL) +egl_source_h_priv = $(srcdir)/egl/clutter-backend-eglnative.h +egl_source_c = $(srcdir)/egl/clutter-backend-eglnative.c +egl_source_c_priv = + +egl_tslib_h = $(srcdir)/tslib/clutter-event-tslib.h egl_tslib_c = $(srcdir)/tslib/clutter-event-tslib.c evdev_c_priv = \ @@ -546,16 +551,17 @@ BUILT_SOURCES += $(cex_h) EXTRA_DIST += $(srcdir)/$(cex_h).in if USE_TSLIB -backend_source_c_priv += $(egl_tslib_c) +egl_source_c_priv += $(egl_tslib_c) +egl_source_h_priv += $(egl_tslib_h) endif # SUPPORT_TSLIB if USE_EVDEV -backend_source_c_priv += $(evdev_c_priv) -backend_source_h_priv += $(evdev_h_priv) +egl_source_c_priv += $(evdev_c_priv) +egl_source_h_priv += $(evdev_h_priv) endif # SUPPORT_EVDEV if SUPPORT_CEX100 -backend_source_h += $(cex_h) +egl_source_h += $(cex_h) clutter-cex100-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc $(QUIET_GEN)cp -f $< $(@F) @@ -567,6 +573,8 @@ endif # SUPPORT_CEX100 if SUPPORT_EGL backend_source_h += $(egl_source_h) +backend_source_c += $(egl_source_c) +backend_source_h_priv += $(egl_source_h_priv) clutteregl_includedir = $(clutter_includedir)/egl clutteregl_include_HEADERS = $(egl_source_h) diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 888d215c3..29eda9e7d 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -1342,7 +1342,7 @@ clutter_context_get_default_unlocked (void) #endif #ifdef CLUTTER_WINDOWING_EGL if (backend == NULL || strcmp (backend, CLUTTER_EGL_NATIVE_BACKEND) == 0) - ctx->backend = g_object_new (CLUTTER_TYPE_BACKEND_EGLNATIVE, NULL); + ctx->backend = g_object_new (CLUTTER_TYPE_BACKEND_EGL_NATIVE, NULL); else #endif #ifdef CLUTTER_WINDOWING_X11 @@ -3649,7 +3649,7 @@ clutter_check_backend (const char *backend_type) else #endif #ifdef CLUTTER_WINDOWING_EGL - if (strcmp (backend_type, CLUTTER_EGL_BACKEND) == 0 && + if (strcmp (backend_type, CLUTTER_EGL_NATIVE_BACKEND) == 0 && CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend)) return TRUE; else diff --git a/clutter/cogl/clutter-backend-cogl.c b/clutter/cogl/clutter-backend-cogl.c index 588c4f9b3..af0ad1400 100644 --- a/clutter/cogl/clutter-backend-cogl.c +++ b/clutter/cogl/clutter-backend-cogl.c @@ -192,44 +192,16 @@ _clutter_backend_cogl_class_init (ClutterBackendCoglClass *klass) ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass); gobject_class->constructor = clutter_backend_cogl_constructor; - gobject_class->dispose = clutter_backend_cogl_dispose; - gobject_class->finalize = clutter_backend_cogl_finalize; + gobject_class->dispose = clutter_backend_cogl_dispose; + gobject_class->finalize = clutter_backend_cogl_finalize; - backend_class->pre_parse = clutter_backend_cogl_pre_parse; - backend_class->post_parse = clutter_backend_cogl_post_parse; - backend_class->get_features = clutter_backend_cogl_get_features; - backend_class->ensure_context = clutter_backend_cogl_ensure_context; + backend_class->pre_parse = clutter_backend_cogl_pre_parse; + backend_class->post_parse = clutter_backend_cogl_post_parse; + backend_class->get_features = clutter_backend_cogl_get_features; + backend_class->ensure_context = clutter_backend_cogl_ensure_context; } static void _clutter_backend_cogl_init (ClutterBackendCogl *backend_cogl) { - } - -#ifdef COGL_HAS_EGL_SUPPORT -EGLDisplay -clutter_eglx_display (void) -{ - return clutter_egl_get_egl_display (); -} - -EGLDisplay -clutter_egl_display (void) -{ - return clutter_egl_get_egl_display (); -} - -EGLDisplay -clutter_egl_get_egl_display (void) -{ - if (backend_singleton == NULL) - { - g_critical ("%s has been called before clutter_init()", G_STRFUNC); - return 0; - } - - return cogl_egl_context_get_egl_display (backend_singleton->cogl_context); -} -#endif - diff --git a/clutter/cogl/clutter-stage-cogl.h b/clutter/cogl/clutter-stage-cogl.h index b514c9b90..d3a9b9806 100644 --- a/clutter/cogl/clutter-stage-cogl.h +++ b/clutter/cogl/clutter-stage-cogl.h @@ -1,10 +1,6 @@ #ifndef __CLUTTER_STAGE_COGL_H__ #define __CLUTTER_STAGE_COGL_H__ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/clutter/egl/clutter-backend-eglnative.c b/clutter/egl/clutter-backend-eglnative.c index 8568490c2..573582022 100644 --- a/clutter/egl/clutter-backend-eglnative.c +++ b/clutter/egl/clutter-backend-eglnative.c @@ -26,9 +26,7 @@ * Neil Roberts */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include #include @@ -46,6 +44,10 @@ #include "clutter-device-manager-evdev.h" #endif +#ifdef HAVE_TSLIB +#include "clutter-event-tslib.h" +#endif + #include "clutter-debug.h" #include "clutter-private.h" #include "clutter-main.h" @@ -54,6 +56,7 @@ #ifdef COGL_HAS_EGL_SUPPORT #include "clutter-egl.h" #endif + #ifdef CLUTTER_EGL_BACKEND_CEX100 #include "clutter-cex100.h" #endif @@ -63,10 +66,9 @@ static gdl_plane_id_t gdl_plane = GDL_PLANE_ID_UPP_C; static guint gdl_n_buffers = CLUTTER_CEX100_TRIPLE_BUFFERING; #endif -static gboolean gdl_plane_set = FALSE; -static gboolean gdl_n_buffers_set = FALSE; +#define clutter_backend_egl_native_get_type _clutter_backend_egl_native_get_type -G_DEFINE_TYPE (ClutterBackendEglNative, _clutter_backend_egl_native, CLUTTER_TYPE_BACKEND_COGL); +G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND_COGL); static ClutterDeviceManager * clutter_backend_egl_native_get_device_manager (ClutterBackend *backend) @@ -89,31 +91,54 @@ clutter_backend_egl_native_get_device_manager (ClutterBackend *backend) static void clutter_backend_egl_native_init_events (ClutterBackend *backend) { -#ifdef HAVE_TSLIB - _clutter_events_tslib_init (CLUTTER_BACKEND_EGL (backend)); -#endif + const char *input_backend = NULL; + + input_backend = g_getenv ("CLUTTER_INPUT_BACKEND"); #ifdef HAVE_EVDEV - _clutter_events_evdev_init (CLUTTER_BACKEND (backend)); + if (input_backend != NULL && + strcmp (input_backend, CLUTTER_EVDEV_INPUT_BACKEND) == 0) + _clutter_events_evdev_init (CLUTTER_BACKEND (backend)); + else #endif +#ifdef HAVE_TSLIB + if (input_backend != NULL && + strcmp (input_backend, CLUTTER_TSLIB_INPUT_BACKEND) == 0) + _clutter_events_tslib_init (CLUTTER_BACKEND (backend)); + else +#endif + if (input_backend != NULL) + g_error ("Unrecognized input backend '%s'", input_backend); + else + g_error ("Unknown input backend"); } static void -clutter_backend_cogl_dispose (GObject *gobject) +clutter_backend_egl_native_dispose (GObject *gobject) { -#ifdef HAVE_TSLIB ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (gobject); - _clutter_events_tslib_uninit (backend_egl_native); - if (backend_egl_native->event_timer != NULL) { g_timer_destroy (backend_egl_native->event_timer); backend_egl_native->event_timer = NULL; } + +#ifdef HAVE_TSLIB + _clutter_events_tslib_uninit (CLUTTER_BACKEND (gobject)); #endif - G_OBJECT_CLASS (_clutter_backend_cogl_parent_class)->dispose (gobject); +#ifdef HAVE_EVDEV + _clutter_events_evdev_uninit (CLUTTER_BACKEND (gobject)); + + if (backend_egl_native->device_manager != NULL) + { + g_object_unref (backend_egl_native->device_manager); + backend_egl_native->device_manager = NULL; + } +#endif + + G_OBJECT_CLASS (clutter_backend_egl_native_parent_class)->dispose (gobject); } static ClutterStageWindow * @@ -123,7 +148,6 @@ clutter_backend_egl_native_create_stage (ClutterBackend *backend, { ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (backend); ClutterStageWindow *stage; - ClutterStageCogl *stage_cogl; if (G_UNLIKELY (backend_egl_native->stage != NULL)) { @@ -159,8 +183,9 @@ clutter_backend_egl_native_create_context (ClutterBackend *backend, swap_chain = cogl_swap_chain_new (); - if (gdl_n_buffers_set) - cogl_swap_chain_set_length (swap_chain, gdl_n_buffers); +#if defined(CLUTTER_EGL_BACKEND_CEX100) && defined(COGL_HAS_GDL_SUPPORT) + cogl_swap_chain_set_length (swap_chain, gdl_n_buffers); +#endif onscreen_template = cogl_onscreen_template_new (swap_chain); cogl_object_unref (swap_chain); @@ -177,9 +202,8 @@ clutter_backend_egl_native_create_context (ClutterBackend *backend, backend->cogl_display = cogl_display_new (backend->cogl_renderer, onscreen_template); -#ifdef CLUTTER_EGL_BACKEND_CEX100 - if (gdl_plane_set) - cogl_gdl_display_set_plane (backend->cogl_display, gdl_plane); +#if defined(CLUTTER_EGL_BACKEND_CEX100) && defined(COGL_HAS_GDL_SUPPORT) + cogl_gdl_display_set_plane (backend->cogl_display, gdl_plane); #endif /* CLUTTER_EGL_BACKEND_CEX100 */ cogl_object_unref (backend->cogl_renderer); @@ -203,6 +227,7 @@ error: if (onscreen_template != NULL) cogl_object_unref (onscreen_template); + if (swap_chain != NULL) cogl_object_unref (swap_chain); @@ -211,32 +236,31 @@ error: cogl_object_unref (backend->cogl_renderer); backend->cogl_renderer = NULL; } + return FALSE; } static void -_clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass) +clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass); - gobject_class->dispose = clutter_backend_egl_native_dispose; - gobject_class->finalize = clutter_backend_egl_native_finalize; + gobject_class->dispose = clutter_backend_egl_native_dispose; backend_class->get_device_manager = clutter_backend_egl_native_get_device_manager; - backend_class->init_events = clutter_backend_egl_native_init_events; - backend_class->create_stage = clutter_backend_egl_native_create_stage; - backend_class->create_context = clutter_backend_egl_native_create_context; + backend_class->init_events = clutter_backend_egl_native_init_events; + backend_class->create_stage = clutter_backend_egl_native_create_stage; + backend_class->create_context = clutter_backend_egl_native_create_context; } static void -_clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native) +clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native) { -#ifdef HAVE_TSLIB backend_egl_native->event_timer = g_timer_new (); -#endif } +#ifdef CLUTTER_EGL_BACKEND_CEX100 /** * clutter_cex100_set_plane: * @plane: FIXME @@ -248,14 +272,13 @@ _clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native) void clutter_cex100_set_plane (gdl_plane_id_t plane) { -#ifdef CLUTTER_EGL_BACKEND_CEX100 g_return_if_fail (plane >= GDL_PLANE_ID_UPP_A && plane <= GDL_PLANE_ID_UPP_E); gdl_plane = plane; - gdl_plane_set = TRUE; -#endif } +#endif +#ifdef CLUTTER_EGL_BACKEND_CEX100 /** * clutter_cex100_set_plane: * @mode: FIXME @@ -267,11 +290,79 @@ clutter_cex100_set_plane (gdl_plane_id_t plane) void clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode) { -#ifdef CLUTTER_EGL_BACKEND_CEX100 g_return_if_fail (mode == CLUTTER_CEX100_DOUBLE_BUFFERING || mode == CLUTTER_CEX100_TRIPLE_BUFFERING); gdl_n_buffers = mode; - gdl_n_buffers_set = TRUE; +} +#endif + +/** + * clutter_eglx_display: + * + * Retrieves the EGL display used by Clutter. + * + * Return value: the EGL display, or 0 + * + * Since: 0.6 + * + * Deprecated: 1.6: Use clutter_egl_get_egl_display() instead. + */ +EGLDisplay +clutter_eglx_display (void) +{ + return clutter_egl_get_egl_display (); +} + +/** + * clutter_egl_display: + * + * Retrieves the EGL display used by Clutter. + * + * Return value: the EGL display used by Clutter, or 0 + * + * Since: 0.6 + * + * Deprecated: 1.6: Use clutter_egl_get_egl_display() instead. + */ +EGLDisplay +clutter_egl_display (void) +{ + return clutter_egl_get_egl_display (); +} + +/** + * clutter_egl_get_egl_display: + * + * Retrieves the EGL display used by Clutter, if it supports the + * EGL windowing system and if it is running using an EGL backend. + * + * Return value: the EGL display used by Clutter, or 0 + * + * Since: 1.6 + */ +EGLDisplay +clutter_egl_get_egl_display (void) +{ + ClutterBackend *backend; + + if (!_clutter_context_is_initialized ()) + { + g_critical ("The Clutter backend has not been initialized yet"); + return 0; + } + + backend = clutter_get_default_backend (); + + if (!CLUTTER_IS_BACKEND_EGL_NATIVE (backend)) + { + g_critical ("The Clutter backend is not an EGL backend"); + return 0; + } + +#if COGL_HAS_EGL_SUPPORT + return cogl_egl_context_get_egl_display (backend->cogl_context); +#else + return 0; #endif } diff --git a/clutter/egl/clutter-backend-eglnative.h b/clutter/egl/clutter-backend-eglnative.h index 959e61c5c..5156339e9 100644 --- a/clutter/egl/clutter-backend-eglnative.h +++ b/clutter/egl/clutter-backend-eglnative.h @@ -70,11 +70,6 @@ struct _ClutterBackendEglNativeClass GType _clutter_backend_egl_native_get_type (void) G_GNUC_CONST; -#ifdef HAVE_TSLIB -void _clutter_events_tslib_init (ClutterBackendEglNative *backend); -void _clutter_events_tslib_uninit (ClutterBackendEglNative *backend); -#endif - G_END_DECLS #endif /* __CLUTTER_BACKEND_EGL_NATIVE_H__ */ diff --git a/clutter/egl/clutter-egl.h b/clutter/egl/clutter-egl.h index 93710392e..193290a54 100644 --- a/clutter/egl/clutter-egl.h +++ b/clutter/egl/clutter-egl.h @@ -49,6 +49,9 @@ G_BEGIN_DECLS +#define CLUTTER_TSLIB_INPUT_BACKEND "tslib" +#define CLUTTER_EVDEV_INPUT_BACKEND "evdev" + #ifndef CLUTTER_DISABLE_DEPRECATED /** * clutter_eglx_display: diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 03d08be06..edc01bf58 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -855,17 +855,16 @@ clutter_device_manager_evdev_init (ClutterDeviceManagerEvdev *self) void _clutter_events_evdev_init (ClutterBackend *backend) { + ClutterDeviceManager *dummy G_GNUC_UNUSED; + CLUTTER_NOTE (EVENT, "Initializing evdev backend"); - /* We just have to create the singleon here */ - clutter_device_manager_get_default (); + /* we need to create the device manager here */ + dummy = clutter_device_manager_get_default (); } void _clutter_events_evdev_uninit (ClutterBackend *backend) { - ClutterDeviceManager *manager; - - manager = clutter_device_manager_get_default (); - g_object_unref (manager); + CLUTTER_NOTE (EVENT, "Uninitializing evdev backend"); } diff --git a/clutter/tslib/clutter-event-tslib.c b/clutter/tslib/clutter-event-tslib.c index c02cb0c11..045412fe9 100644 --- a/clutter/tslib/clutter-event-tslib.c +++ b/clutter/tslib/clutter-event-tslib.c @@ -19,9 +19,7 @@ * */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "clutter-backend-egl.h" #include "clutter-egl.h" @@ -36,9 +34,7 @@ #include -#ifdef HAVE_TSLIB #include -#endif typedef struct _ClutterEventSource ClutterEventSource; @@ -49,13 +45,9 @@ struct _ClutterEventSource ClutterBackendEGL *backend; GPollFD event_poll_fd; -#ifdef HAVE_TSLIB - struct tsdev *ts_device; -#endif + struct tsdev *ts_device; }; -#ifdef HAVE_TSLIB - static gboolean clutter_event_prepare (GSource *source, gint *timeout); static gboolean clutter_event_check (GSource *source); @@ -92,16 +84,17 @@ get_backend_time (void) return g_timer_elapsed (backend_egl->event_timer, NULL) * 1000; } -#endif void -_clutter_events_tslib_init (ClutterBackendEglNative *backend_egl) +_clutter_events_tslib_init (ClutterBackend *backend) { -#ifdef HAVE_TSLIB + ClutterBackendEglNative *backend_egl; ClutterEventSource *event_source; const char *device_name; GSource *source; + backend_egl = CLUTTER_BACKEND_EGL (backend); + CLUTTER_NOTE (EVENT, "Starting timer"); g_assert (backend_egl->event_timer != NULL); g_timer_start (backend_egl->event_timer); @@ -147,13 +140,11 @@ _clutter_events_tslib_init (ClutterBackendEglNative *backend_egl) g_warning ("Unable to open '%s'", device_name); g_source_unref (source); } -#endif /* HAVE_TSLIB */ } void _clutter_events_egl_uninit (ClutterBackendEglNative *backend_egl) { -#ifdef HAVE_TSLIB if (backend_egl->event_timer != NULL) { CLUTTER_NOTE (EVENT, "Stopping the timer"); @@ -174,11 +165,8 @@ _clutter_events_egl_uninit (ClutterBackendEglNative *backend_egl) g_source_unref (backend_egl->event_source); backend_egl->event_source = NULL; } -#endif /* HAVE_TSLIB */ } -#ifdef HAVE_TSLIB - static gboolean clutter_event_prepare (GSource *source, gint *timeout) @@ -226,7 +214,7 @@ clutter_event_dispatch (GSource *source, if ((!clutter_events_pending()) && (ts_read(event_source->ts_device, &tsevent, 1) == 1)) { - static gint last_x = 0, last_y = 0; + static gint last_x = 0, last_y = 0; static gboolean clicked = FALSE; /* Avoid sending too many events which are just pressure changes. @@ -289,5 +277,3 @@ out: return TRUE; } - -#endif diff --git a/clutter/tslib/clutter-event-tslib.h b/clutter/tslib/clutter-event-tslib.h new file mode 100644 index 000000000..423633a27 --- /dev/null +++ b/clutter/tslib/clutter-event-tslib.h @@ -0,0 +1,35 @@ +/* Clutter. + * An OpenGL based 'interactive canvas' library. + * + * Copyright (C) 2006, 2007 OpenedHand + * Copyright (C) 2008, 2009, 2010, 2011 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +#ifndef __CLUTTER_EVENT_TSLIB_H__ +#define __CLUTTER_EVENT_TSLIB_H__ + +#include + +G_BEGIN_DECLS + +void _clutter_events_tslib_init (ClutterBackend *backend); +void _clutter_events_tslib_uninit (ClutterBackend *backend); + +G_END_DECLS + +#endif /* __CLUTTER_EVENT_TSLIB_H__ */ diff --git a/configure.ac b/configure.ac index b709ed21d..56d434977 100644 --- a/configure.ac +++ b/configure.ac @@ -215,15 +215,15 @@ AC_ARG_ENABLE([osx], AC_ARG_ENABLE([gdk], [AS_HELP_STRING([--enable-gdk=@<:@yes/no@:>@], [Enable the GDK backend (default=no)])], [], - [enable_gdk=no]) + [enable_gdk=maybe]) AC_ARG_ENABLE([wayland], [AS_HELP_STRING([--enable-wayland=@<:@yes/no@:>@], [Enable the Wayland client backend (default=no)])], [], - [enable_wayland=no]) + [enable_wayland=maybe]) AC_ARG_ENABLE([egl], - [AS_HELP_STRING([--enable-egl=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])] + [AS_HELP_STRING([--enable-egl=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])], [], - [enable_egl=no]) + [enable_egl=maybe]) dnl Define default values AS_IF([test "x$platform_glx" = "xyes"], [enable_x11=yes]) @@ -245,14 +245,6 @@ AS_IF([test "x$enable_x11" = "xyes"], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"]) - # if Mesa has support for egl, we can use it as well - PKG_CHECK_EXISTS([egl], - [ - BACKEND_PC_FILES="$BACKEND_PC_FILES egl" - SUPPORT_EGL=1 - ], - []) - # We might fall back to DRM for sync-to-vblank on GLX PKG_CHECK_EXISTS([libdrm], [ @@ -291,6 +283,7 @@ AS_IF([test "x$enable_wayland" = "xyes"], experimental_backend="yes" SUPPORT_WAYLAND=1 + SUPPORT_EVDEV=1 PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], []) PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], []) @@ -308,6 +301,13 @@ AS_IF([test "x$enable_egl" = "xyes"], SUPPORT_EGL=1 SUPPORT_COGL=1 + # if Mesa has support for egl, we can use it as well + PKG_CHECK_EXISTS([egl], + [ + BACKEND_PC_FILES="$BACKEND_PC_FILES egl" + ], + []) + AC_ARG_WITH([tslib], [AS_HELP_STRING([--with-tslib=@<:@yes/no@:>@], [Use TSLib for events])], [], @@ -329,8 +329,10 @@ AS_IF([test "x$enable_egl" = "xyes"], AS_IF([test "x$have_tslib" = "xyes"], [ AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling]) + SUPPORT_TSLIB=1 ]) - ]) + ], + [have_tslib=no]) AS_IF([test "x$with_evdev" = "xyes"], [ @@ -338,8 +340,10 @@ AS_IF([test "x$enable_egl" = "xyes"], AS_IF([test "x$have_evdev" = "xyes"], [ AC_DEFINE([HAVE_EVDEV], [1], [Have evdev support for input handling]) + SUPPORT_EVDEV=1 ]) - ]) + ], + [have_evdev=no]) AS_IF([test "x$with_gdl" = "xyes"], [ @@ -366,14 +370,8 @@ AS_IF([test "x$enable_egl" = "xyes"], SUPPORT_EGL_PLATFORM_GDL=1 AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend]) - ]) - - # Make sure we don't enable tslib and evdev at the same time, we - # don't support multiple event backends yet. - AS_IF([test "x$have_tslib" = "xyes" -a "x$have_evdev" = "xyes"], - [ - AC_MSG_ERROR([Cannot enable both tslib and evdev events]) - ]) + ], + [have_gdl=no]) FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS" FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS" @@ -471,6 +469,12 @@ AS_IF([test "x$SUPPORT_WIN32" = "x1"], AS_IF([test "x$SUPPORT_EGL_PLATFORM_GDL" = "x1"], [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES #define CLUTTER_WINDOWING_CEX100 1"]) +AS_IF([test "x$SUPPORT_EVDEV" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_EVDEV 1"]) +AS_IF([test "x$SUPPORT_TSLIB" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_TSLIB 1"]) AC_SUBST([CLUTTER_CONFIG_DEFINES])