summaryrefslogtreecommitdiff
path: root/include/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/memory.h')
-rw-r--r--include/memory.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/include/memory.h b/include/memory.h
new file mode 100644
index 0000000..8ffbdab
--- /dev/null
+++ b/include/memory.h
@@ -0,0 +1,73 @@
1/***************************************************************************
2 *
3 * Multitouch X driver
4 * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 **************************************************************************/
21
22#ifndef MEMORY_H
23#define MEMORY_H
24
25#include "mtstate.h"
26
27/**
28 * struct Memory - parsing state
29 *
30 * @btdata: logical finger state
31 * @same: true if the finger configuration is unchanged
32 * @fingers: bitmask of fingers on the pad
33 * @added: bitmask of new fingers on the pad
34 * @thumb: bitmask of thumbs on the pad
35 * @pointing: bitmask of pointing fingers
36 * @pending: bitmask of tentatively moving fingers
37 * @moving: bitmask of moving fingers
38 * @ybar: vertical position on pad marking the clicking area
39 * @mvhold: movement before this point in time is accumulated
40 * @mvforget: movement before this point in time is discarded
41 * @dx: array of accumulated horiontal movement per finger
42 * @dy: array of accumulated vertical movement per finger
43 *
44 */
45struct Memory {
46 unsigned btdata, same;
47 unsigned fingers, added, thumb;
48 unsigned pointing, pending, moving;
49 int ybar;
50 mstime_t mvhold, mvforget;
51 int dx[DIM_FINGER], dy[DIM_FINGER];
52};
53
54void init_memory(struct Memory *mem);
55void refresh_memory(struct Memory *m,
56 const struct MTState *prev_state,
57 const struct MTState *state,
58 const struct Capabilities *caps);
59void output_memory(const struct Memory *m);
60
61static inline void mem_hold_movement(struct Memory *m, mstime_t t)
62{
63 if (t > m->mvhold)
64 m->mvhold = t;
65}
66
67static inline void mem_forget_movement(struct Memory *m, mstime_t t)
68{
69 if (t > m->mvforget)
70 m->mvforget = t;
71}
72
73#endif