$(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 = \
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)
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)
#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
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
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
-
#ifndef __CLUTTER_STAGE_COGL_H__
#define __CLUTTER_STAGE_COGL_H__
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <glib-object.h>
#include <cairo.h>
#include <clutter/clutter-stage.h>
* Neil Roberts
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#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"
#ifdef COGL_HAS_EGL_SUPPORT
#include "clutter-egl.h"
#endif
+
#ifdef CLUTTER_EGL_BACKEND_CEX100
#include "clutter-cex100.h"
#endif
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)
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
+
+#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_cogl_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (clutter_backend_egl_native_parent_class)->dispose (gobject);
}
static ClutterStageWindow *
{
ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (backend);
ClutterStageWindow *stage;
- ClutterStageCogl *stage_cogl;
if (G_UNLIKELY (backend_egl_native->stage != NULL))
{
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);
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);
if (onscreen_template != NULL)
cogl_object_unref (onscreen_template);
+
if (swap_chain != NULL)
cogl_object_unref (swap_chain);
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
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
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
}
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__ */
G_BEGIN_DECLS
+#define CLUTTER_TSLIB_INPUT_BACKEND "tslib"
+#define CLUTTER_EVDEV_INPUT_BACKEND "evdev"
+
#ifndef CLUTTER_DISABLE_DEPRECATED
/**
* clutter_eglx_display:
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");
}
*
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include "clutter-backend-egl.h"
#include "clutter-egl.h"
#include <glib.h>
-#ifdef HAVE_TSLIB
#include <tslib.h>
-#endif
typedef struct _ClutterEventSource 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);
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);
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");
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)
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.
return TRUE;
}
-
-#endif
--- /dev/null
+/* 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 <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __CLUTTER_EVENT_TSLIB_H__
+#define __CLUTTER_EVENT_TSLIB_H__
+
+#include <clutter/clutter-backend.h>
+
+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__ */
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])
[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],
[
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"], [])
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])],
[],
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"],
[
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"],
[
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"
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])