clutter event egl: fixes lots of compiler warnings

The way the #ifdef HAVE_TSLIB guards were spread around it meant there
were lots of warnings about unused variables when building without
tslib.
This commit is contained in:
Robert Bragg 2010-06-18 00:18:02 +01:00
parent cd82b704e9
commit ad9006e561

View File

@ -55,6 +55,8 @@ struct _ClutterEventSource
#endif #endif
}; };
#ifdef HAVE_TSLIB
static gboolean clutter_event_prepare (GSource *source, static gboolean clutter_event_prepare (GSource *source,
gint *timeout); gint *timeout);
static gboolean clutter_event_check (GSource *source); static gboolean clutter_event_check (GSource *source);
@ -91,10 +93,12 @@ get_backend_time (void)
return g_timer_elapsed (backend_egl->event_timer, NULL) * 1000; return g_timer_elapsed (backend_egl->event_timer, NULL) * 1000;
} }
#endif
void void
_clutter_events_egl_init (ClutterBackendEGL *backend_egl) _clutter_events_egl_init (ClutterBackendEGL *backend_egl)
{ {
#ifdef HAVE_TSLIB
ClutterEventSource *event_source; ClutterEventSource *event_source;
const char *device_name; const char *device_name;
GSource *source; GSource *source;
@ -103,7 +107,6 @@ _clutter_events_egl_init (ClutterBackendEGL *backend_egl)
g_assert (backend_egl->event_timer != NULL); g_assert (backend_egl->event_timer != NULL);
g_timer_start (backend_egl->event_timer); g_timer_start (backend_egl->event_timer);
#ifdef HAVE_TSLIB
source = backend_egl->event_source = clutter_event_source_new (backend_egl); source = backend_egl->event_source = clutter_event_source_new (backend_egl);
event_source = (ClutterEventSource *) source; event_source = (ClutterEventSource *) source;
@ -151,6 +154,7 @@ _clutter_events_egl_init (ClutterBackendEGL *backend_egl)
void void
_clutter_events_egl_uninit (ClutterBackendEGL *backend_egl) _clutter_events_egl_uninit (ClutterBackendEGL *backend_egl)
{ {
#ifdef HAVE_TSLIB
if (backend_egl->event_timer != NULL) if (backend_egl->event_timer != NULL)
{ {
CLUTTER_NOTE (EVENT, "Stopping the timer"); CLUTTER_NOTE (EVENT, "Stopping the timer");
@ -164,17 +168,18 @@ _clutter_events_egl_uninit (ClutterBackendEGL *backend_egl)
ClutterEventSource *event_source = ClutterEventSource *event_source =
(ClutterEventSource *) backend_egl->event_source; (ClutterEventSource *) backend_egl->event_source;
#ifdef HAVE_TSLIB
ts_close (event_source->ts_device); ts_close (event_source->ts_device);
event_sources = g_list_remove (event_sources, backend_egl->event_source); event_sources = g_list_remove (event_sources, backend_egl->event_source);
#endif /* HAVE_TSLIB */
g_source_destroy (backend_egl->event_source); g_source_destroy (backend_egl->event_source);
g_source_unref (backend_egl->event_source); g_source_unref (backend_egl->event_source);
backend_egl->event_source = NULL; backend_egl->event_source = NULL;
} }
#endif /* HAVE_TSLIB */
} }
#ifdef HAVE_TSLIB
static gboolean static gboolean
clutter_event_prepare (GSource *source, clutter_event_prepare (GSource *source,
gint *timeout) gint *timeout)
@ -212,24 +217,22 @@ clutter_event_dispatch (GSource *source,
GSourceFunc callback, GSourceFunc callback,
gpointer user_data) gpointer user_data)
{ {
ClutterEventSource *event_source = (ClutterEventSource *) source;
ClutterEvent *event; ClutterEvent *event;
#ifdef HAVE_TSLIB ClutterEventSource *event_source = (ClutterEventSource *) source;
struct ts_sample tsevent; struct ts_sample tsevent;
#endif
ClutterMainContext *clutter_context; ClutterMainContext *clutter_context;
static gint last_x = 0, last_y = 0;
static gboolean clicked = FALSE;
clutter_threads_enter (); clutter_threads_enter ();
clutter_context = _clutter_context_get_default (); clutter_context = _clutter_context_get_default ();
#ifdef HAVE_TSLIB
/* FIXME while would be better here but need to deal with lockups */ /* FIXME while would be better here but need to deal with lockups */
if ((!clutter_events_pending()) && if ((!clutter_events_pending()) &&
(ts_read(event_source->ts_device, &tsevent, 1) == 1)) (ts_read(event_source->ts_device, &tsevent, 1) == 1))
{ {
static gint last_x = 0, last_y = 0;
static gboolean clicked = FALSE;
/* Avoid sending too many events which are just pressure changes. /* Avoid sending too many events which are just pressure changes.
* *
* FIXME - We don't current handle pressure in events and thus * FIXME - We don't current handle pressure in events and thus
@ -273,7 +276,6 @@ clutter_event_dispatch (GSource *source,
g_queue_push_head (clutter_context->events_queue, event); g_queue_push_head (clutter_context->events_queue, event);
} }
#endif /* HAVE_TSLIB */
/* Pop an event off the queue if any */ /* Pop an event off the queue if any */
event = clutter_event_get (); event = clutter_event_get ();
@ -286,7 +288,10 @@ clutter_event_dispatch (GSource *source,
} }
out: out:
clutter_threads_leave (); clutter_threads_leave ();
return TRUE; return TRUE;
} }
#endif