tslib: drop tslib support

This commit is contained in:
Ray Strode 2016-01-28 14:56:34 -05:00 committed by Rui Matos
parent 89daa8d4fa
commit 2cdd4b8250
5 changed files with 2 additions and 355 deletions

View File

@ -491,14 +491,6 @@ compat_libs += \
$(NULL)
endif
egl_tslib_h = tslib/clutter-event-tslib.h
egl_tslib_c = tslib/clutter-event-tslib.c
if USE_TSLIB
backend_source_c_priv += $(egl_tslib_c)
backend_source_h_priv += $(egl_tslib_h)
endif # SUPPORT_TSLIB
evdev_c_priv = \
evdev/clutter-device-manager-evdev.c \
evdev/clutter-input-device-evdev.c \

View File

@ -70,10 +70,6 @@
#ifdef CLUTTER_INPUT_EVDEV
#include "evdev/clutter-device-manager-evdev.h"
#endif
#ifdef CLUTTER_INPUT_TSLIB
/* XXX - should probably warn, here */
#include "tslib/clutter-event-tslib.h"
#endif
#ifdef CLUTTER_WINDOWING_EGL
#include "egl/clutter-backend-eglnative.h"
#endif
@ -608,15 +604,6 @@ clutter_backend_real_init_events (ClutterBackend *backend)
_clutter_events_evdev_init (backend);
}
else
#endif
#ifdef CLUTTER_INPUT_TSLIB
/* Tslib can be used regardless of the windowing system */
if (input_backend != NULL &&
strcmp (input_backend, CLUTTER_INPUT_TSLIB) == 0)
{
_clutter_events_tslib_init (backend);
}
else
#endif
if (input_backend != NULL)
{

View File

@ -1,277 +0,0 @@
/* Clutter.
* An OpenGL based 'interactive canvas' library.
* Authored By Matthew Allum <mallum@openedhand.com>
* Copyright (C) 2006-2007 OpenedHand
*
* 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/>.
*
*
*/
#include "config.h"
#include "clutter-backend-egl.h"
#include "clutter-egl.h"
#include "clutter-backend.h"
#include "clutter-event-private.h"
#include "clutter-private.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include <string.h>
#include <glib.h>
#include <tslib.h>
typedef struct _ClutterEventSource ClutterEventSource;
struct _ClutterEventSource
{
GSource source;
ClutterBackendEGL *backend;
GPollFD event_poll_fd;
struct tsdev *ts_device;
};
static gboolean clutter_event_prepare (GSource *source,
gint *timeout);
static gboolean clutter_event_check (GSource *source);
static gboolean clutter_event_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data);
static GList *event_sources = NULL;
static GSourceFuncs event_funcs = {
clutter_event_prepare,
clutter_event_check,
clutter_event_dispatch,
NULL
};
static GSource *
clutter_event_source_new (ClutterBackendEGL *backend)
{
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
ClutterEventSource *event_source = (ClutterEventSource *) source;
event_source->backend = backend;
return source;
}
static guint32
get_backend_time (void)
{
ClutterBackendEGL *backend_egl;
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
return g_timer_elapsed (backend_egl->event_timer, NULL) * 1000;
}
void
_clutter_events_tslib_init (ClutterBackend *backend)
{
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);
source = backend_egl->event_source = clutter_event_source_new (backend_egl);
event_source = (ClutterEventSource *) source;
device_name = g_getenv ("TSLIB_TSDEVICE");
if (device_name == NULL || device_name[0] == '\0')
{
g_warning ("No device for TSLib has been defined; please set the "
"TSLIB_TSDEVICE environment variable to define a touch "
"screen device to be used with Clutter.");
g_source_unref (source);
return;
}
event_source->ts_device = ts_open (device_name, 0);
if (event_source->ts_device)
{
CLUTTER_NOTE (EVENT, "Opened '%s'", device_name);
if (ts_config (event_source->ts_device))
{
g_warning ("Closing device '%s': ts_config() failed", device_name);
ts_close (event_source->ts_device);
g_source_unref (source);
return;
}
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);
event_source->event_poll_fd.fd = ts_fd (event_source->ts_device);
event_source->event_poll_fd.events = G_IO_IN;
event_sources = g_list_prepend (event_sources, event_source);
g_source_add_poll (source, &event_source->event_poll_fd);
g_source_set_can_recurse (source, TRUE);
g_source_attach (source, NULL);
}
else
{
g_warning ("Unable to open '%s'", device_name);
g_source_unref (source);
}
}
void
_clutter_events_egl_uninit (ClutterBackendEglNative *backend_egl)
{
if (backend_egl->event_timer != NULL)
{
CLUTTER_NOTE (EVENT, "Stopping the timer");
g_timer_stop (backend_egl->event_timer);
}
if (backend_egl->event_source != NULL)
{
CLUTTER_NOTE (EVENT, "Destroying the event source");
ClutterEventSource *event_source =
(ClutterEventSource *) backend_egl->event_source;
ts_close (event_source->ts_device);
event_sources = g_list_remove (event_sources, backend_egl->event_source);
g_source_destroy (backend_egl->event_source);
g_source_unref (backend_egl->event_source);
backend_egl->event_source = NULL;
}
}
static gboolean
clutter_event_prepare (GSource *source,
gint *timeout)
{
gboolean retval;
_clutter_threads_acquire_lock ();
*timeout = -1;
retval = clutter_events_pending ();
_clutter_threads_release_lock ();
return retval;
}
static gboolean
clutter_event_check (GSource *source)
{
ClutterEventSource *event_source = (ClutterEventSource *) source;
gboolean retval;
_clutter_threads_acquire_lock ();
retval = ((event_source->event_poll_fd.revents & G_IO_IN) ||
clutter_events_pending ());
_clutter_threads_release_lock ();
return retval;
}
static gboolean
clutter_event_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
ClutterEventSource *event_source = (ClutterEventSource *) source;
struct ts_sample tsevent;
ClutterEvent *event;
_clutter_threads_acquire_lock ();
/* FIXME while would be better here but need to deal with lockups */
if ((!clutter_events_pending()) &&
(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.
*
* FIXME - We don't current handle pressure in events and thus
* event_button_generate gets confused generating lots of double
* and triple clicks.
*/
if (tsevent.pressure && last_x == tsevent.x && last_y == tsevent.y)
goto out;
event = clutter_event_new (CLUTTER_NOTHING);
event->any.stage = clutter_stage_get_default ();
last_x = event->button.x = tsevent.x;
last_y = event->button.y = tsevent.y;
if (tsevent.pressure && !clicked)
{
event->button.type = event->type = CLUTTER_BUTTON_PRESS;
event->button.time = get_backend_time ();
event->button.modifier_state = 0;
event->button.button = 1;
clicked = TRUE;
}
else if (tsevent.pressure && clicked)
{
event->motion.type = event->type = CLUTTER_MOTION;
event->motion.time = get_backend_time ();
event->motion.modifier_state = 0;
}
else
{
event->button.type = event->type = CLUTTER_BUTTON_RELEASE;
event->button.time = get_backend_time ();
event->button.modifier_state = 0;
event->button.button = 1;
clicked = FALSE;
}
_clutter_event_push (event, FALSE);
}
/* Pop an event off the queue if any */
event = clutter_event_get ();
if (event)
{
/* forward the event into clutter for emission etc. */
_clutter_stage_queue_event (event->any.stage, event, FALSE);
}
out:
_clutter_threads_release_lock ();
return TRUE;
}

View File

@ -1,35 +0,0 @@
/* 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__ */

View File

@ -218,12 +218,6 @@ AC_ARG_ENABLE([egl-backend],
[AS_HELP_STRING([--enable-egl-backend=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])],
[enable_egl=$enableval],
[enable_egl=check])
dnl Additional input backends
AC_ARG_ENABLE([tslib-input],
[AS_HELP_STRING([--enable-tslib-input=@<:@yes/no@:>@], [Enable TSLib for input events (default=no)])],
[enable_tslib=$enableval],
[enable_tslib=no])
AC_ARG_ENABLE([evdev-input],
[AS_HELP_STRING([--enable-evdev-input=@<:@yes/no@:>@], [Enable evdev for input events (default=check)])],
[enable_evdev=$enableval],
@ -293,8 +287,8 @@ AS_IF([test "x$enable_egl" = "xyes"],
SUPPORT_EGL=1
SUPPORT_COGL=1
FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
FLAVOUR_LIBS="$FLAVOUR_LIBS $EVDEV_LIBS"
FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $EVDEV_CFLAGS"
AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])
])
@ -304,16 +298,6 @@ AS_IF([test "x$CLUTTER_BACKENDS" = "x"],
AC_MSG_ERROR([No backend enabled. You need to enable at least one backend.])
])
AS_IF([test "x$enable_tslib" = xyes], [
PKG_CHECK_EXISTS([tslib-1.0], [have_tslib=yes], [have_tslib=no])
AS_IF([test "x$have_tslib" = xyes], [
CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS tslib"
experimental_input_backend="yes"
AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])
SUPPORT_TSLIB=1
])
])
AS_IF([test "x$enable_evdev" = xyes], [
PKG_CHECK_EXISTS([libinput gudev-1.0 xkbcommon], [have_evdev=yes], [have_evdev=no])
AS_IF([test "x$have_evdev" = "xyes"], [
@ -331,7 +315,6 @@ AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "x1"])
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$SUPPORT_WAYLAND" = "x1"])
AM_CONDITIONAL(USE_COGL, [test "x$SUPPORT_COGL" = "x1"])
AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
AM_CONDITIONAL(USE_EVDEV, [test "x$have_evdev" = "xyes"])
AM_CONDITIONAL(NEED_XKB_UTILS, [test "x$have_evdev" = "xyes" -o "x$SUPPORT_WAYLAND" = "x1"])
@ -375,9 +358,6 @@ AS_IF([test "x$SUPPORT_EGL" = "x1"],
AS_IF([test "x$SUPPORT_EVDEV" = "x1"],
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_INPUT_EVDEV \"evdev\""])
AS_IF([test "x$SUPPORT_TSLIB" = "x1"],
[CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_INPUT_TSLIB \"tslib\""])
# the 'null' input backend is special
CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES