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.
This commit is contained in:
Emmanuele Bassi
2011-10-03 12:25:53 +01:00
parent 19508132df
commit 405e72f2e4
11 changed files with 220 additions and 131 deletions

View File

@ -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 <glib.h>
#ifdef HAVE_TSLIB
#include <tslib.h>
#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