~oif-packaging/grail/precise

« back to all changes in this revision

Viewing changes to src/v2/evbuf.h

  • Committer: Francis Ginther
  • Date: 2012-08-09 19:14:46 UTC
  • Revision ID: francis.ginther@canonical.com-20120809191446-1yvzd7ug6s7kqmlx
* Update debian/watch file for project rename
* New upstream microrelease, bug fixes only
  - Fix documentation of UGSubscriptionPropertyTapThreshold
  - Merge removal of grail v2
  - Properly process gestures that end before composition time (LP: #1020315)
  - Don't expand gestures that have physically ended already (LP: #1023397)
  - Correct behaviour when a touch ends before ownership is gained
    for it (LP: #1026962)
  - Fix include path for correct compilation of some tests
  - Rename project to "Grail"
  - Remove ChangeLog

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 *
3
 
 * grail - Gesture Recognition And Instantiation Library
4
 
 *
5
 
 * Copyright (C) 2010-2012 Canonical Ltd.
6
 
 *
7
 
 * This library is free software: you can redistribute it and/or modify it 
8
 
 * under the terms of the GNU Lesser General Public License version 3
9
 
 * as published by the Free Software Foundation.
10
 
 *
11
 
 * This library is distributed in the hope that it will be useful, but 
12
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of 
13
 
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
14
 
 * PURPOSE.  See the GNU Lesser General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Lesser General Public License
17
 
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
18
 
 *
19
 
 ****************************************************************************/
20
 
 
21
 
#ifndef GRAIL_EVBUF_H
22
 
#define GRAIL_EVBUF_H
23
 
 
24
 
#define DIM_EVENTS 4096
25
 
 
26
 
struct evbuf {
27
 
        int head;
28
 
        int tail;
29
 
        struct input_event buffer[DIM_EVENTS];
30
 
};
31
 
 
32
 
static inline void evbuf_clear(struct evbuf *evbuf)
33
 
{
34
 
        evbuf->head = evbuf->tail = 0;
35
 
}
36
 
 
37
 
static inline int evbuf_empty(const struct evbuf *evbuf)
38
 
{
39
 
        return evbuf->head == evbuf->tail;
40
 
}
41
 
 
42
 
static inline void evbuf_put(struct evbuf *evbuf,
43
 
                             const struct input_event *ev)
44
 
{
45
 
        evbuf->buffer[evbuf->head++] = *ev;
46
 
        evbuf->head &= DIM_EVENTS - 1;
47
 
}
48
 
 
49
 
static inline void evbuf_get(struct evbuf *evbuf,
50
 
                             struct input_event *ev)
51
 
{
52
 
        *ev = evbuf->buffer[evbuf->tail++];
53
 
        evbuf->tail &= DIM_EVENTS - 1;
54
 
}
55
 
 
56
 
#endif