From 3b9c20f869a2f55bd9953665c9e7fd713db4ff43 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 20 Jul 2010 12:01:32 +0200 Subject: Merge in fix of dev package. This patch moves header files around, and does not contain any logic changes. Signed-off-by: Henrik Rydberg --- src/Makefile.am | 4 +++- src/gebuf.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/gesture-client.c | 4 ++-- src/gesture-dev.c | 3 +-- src/touch-dev.c | 2 +- src/touch-engine.c | 2 +- 6 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 src/gebuf.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 0ecc531..7ccacae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,4 +15,6 @@ AM_CFLAGS = $(CWARNFLAGS) -std=c99 INCLUDES = -I$(top_srcdir)/include/ libgrailincludedir = $(includedir) -libgrailinclude_HEADERS = $(top_srcdir)/include/grail.h +libgrailinclude_HEADERS = \ + $(top_srcdir)/include/grail-touch.h \ + $(top_srcdir)/include/grail.h diff --git a/src/gebuf.h b/src/gebuf.h new file mode 100644 index 0000000..e92431a --- /dev/null +++ b/src/gebuf.h @@ -0,0 +1,62 @@ +/***************************************************************************** + * + * grail - Gesture Recognition And Instantiation Library + * + * Copyright (C) 2010 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + * Authors: + * Henrik Rydberg + * + ****************************************************************************/ + +#ifndef _GRAIL_GESTURE_BUFFER_H +#define _GRAIL_GESTURE_BUFFER_H + +#include + +#define DIM_GESTURE_EVENTS 512 + +struct gebuf { + int head; + int tail; + struct gesture_event buffer[DIM_GESTURE_EVENTS]; +}; + +static inline void gebuf_clear(struct gebuf *gebuf) +{ + gebuf->head = gebuf->tail = 0; +} + +static inline int gebuf_empty(const struct gebuf *gebuf) +{ + return gebuf->head == gebuf->tail; +} + +static inline void gebuf_put(struct gebuf *gebuf, + const struct gesture_event *ev) +{ + gebuf->buffer[gebuf->head++] = *ev; + gebuf->head &= DIM_GESTURE_EVENTS - 1; +} + +static inline void gebuf_get(struct gebuf *gebuf, + struct gesture_event *ev) +{ + *ev = gebuf->buffer[gebuf->tail++]; + gebuf->tail &= DIM_GESTURE_EVENTS - 1; +} + +#endif diff --git a/src/gesture-client.c b/src/gesture-client.c index 3b8eb5d..78328b7 100644 --- a/src/gesture-client.c +++ b/src/gesture-client.c @@ -22,11 +22,11 @@ * ****************************************************************************/ -#include -#include +#include #include #include #include +#include "gebuf.h" #define GESTURE_GAP (1000 * 60 * 60) diff --git a/src/gesture-dev.c b/src/gesture-dev.c index b49b8ea..8dd11a9 100644 --- a/src/gesture-dev.c +++ b/src/gesture-dev.c @@ -22,8 +22,7 @@ * ****************************************************************************/ -#include -#include +#include #include #include #include diff --git a/src/touch-dev.c b/src/touch-dev.c index 9e140ca..80cc82f 100644 --- a/src/touch-dev.c +++ b/src/touch-dev.c @@ -22,7 +22,7 @@ * ****************************************************************************/ -#include +#include #include #include #include diff --git a/src/touch-engine.c b/src/touch-engine.c index b6774f3..a3830a9 100644 --- a/src/touch-engine.c +++ b/src/touch-engine.c @@ -22,7 +22,7 @@ * ****************************************************************************/ -#include +#include #include static void tp_event(struct touch_dev *dev, const struct input_event *ev) -- cgit v1.2.3