Fix the directory layout and build system.
[gfxprim.git] / include / input / GP_Event.h
blobf2531d6585e0a979d9c130370dba14e137d9fb66
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
20 * <jiri.bluebear.dluhos@gmail.com> *
21 * *
22 * Copyright (C) 2009-2010 Cyril Hrubis <metan@ucw.cz> *
23 * *
24 *****************************************************************************/
28 This interface is modeled after linux input event system.
32 #ifndef GP_EVENT_H
33 #define GP_EVENT_H
35 /* events */
37 typedef enum GP_EventType {
38 GP_EVENT_KEY = 0x01, /* key up/down event */
39 GP_EVENT_REL = 0x02, /* relative XY event */
40 GP_EVENT_ABS = 0x03, /* absolute XY value */
41 } GP_EventType;
43 /* subevents */
45 typedef enum GP_EventKeyType {
46 GP_KEY_UP = 0x00,
47 GP_KEY_DOWN = 0x01,
48 } GP_EventKeyType;
50 typedef enum GP_EventRelType {
51 GP_REL_MOVE = 0x00,
52 GP_REL_BTN_UP = 0x01,
53 GP_REL_BTN_DOWN = 0x02,
54 GP_REL_WHEEL = 0x03,
55 } GP_EventRelType;
57 typedef enum GP_EventAbsType {
58 GP_ABS_MOVE = 0x00,
59 GP_ABS_PEN_UP = 0x01,
60 GP_ABS_PEN_DOWN = 0x02,
61 } GP_EventAbsType;
63 /* data structures */
65 typedef struct GP_EventAbs {
66 /* event type */
67 GP_EventType type;
68 /* device id */
69 int dev_id;
70 /* possition */
71 int x;
72 int y;
73 /* size */
74 int w;
75 int h;
76 } GP_EventAbs;
78 typedef struct GP_EventRel {
79 GP_EventType type;
80 /* device id */
81 int dev_id;
82 /* possition */
83 int x;
84 int y;
85 /* relative movement */
86 int rx;
87 int ry;
88 int rwheel;
89 /* size */
90 int w;
91 int h;
92 } GP_EventRel;
94 typedef struct GP_EventKey {
95 /* event type */
96 GP_EventType type;
97 /* device id */
98 int dev_id;
99 /* key */
100 int key;
101 } GP_EventKey;
103 typedef union GP_EventPtr {
104 GP_EventAbs *abs;
105 GP_EventRel *rel;
106 GP_EventKey *key;
107 } GP_EventPtr;
109 typedef struct GP_Time {
110 long sec;
111 long usec;
112 } GP_Time;
114 typedef struct GP_Event {
115 /* GP_EventType */
116 int type;
117 /* GP_Event???Type */
118 int stype;
119 /* time */
120 GP_Time time;
121 /* event data */
122 GP_EventPtr data;
123 } GP_Event;
125 #endif /* GP_EVENT_H */