The Pedigree Project  0.1
Input.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef _INPUT_H
21 #define _INPUT_H
22 
23 #include "pedigree/native/compiler.h"
24 #include "pedigree/native/types.h"
25 
26 namespace Input
27 {
29 const int Key = 1;
30 const int Mouse = 2;
31 const int Joystick = 4;
32 const int RawKey = 8;
33 const int Unknown = 255;
34 
35 typedef int CallbackType;
36 
41 {
42  CallbackType type;
43 
44  union
45  {
46  struct
47  {
48  uint64_t key;
49  } key;
50  struct
51  {
52  ssize_t relx;
53  ssize_t rely;
54  ssize_t relz;
55 
56  bool buttons[64];
57  } pointy;
58  struct
59  {
62  uint8_t scancode;
63 
65  bool keyUp;
66  } rawkey;
67  } data;
68 };
69 
71 typedef void (*callback_t)(InputNotification &);
72 
75 EXPORTED_PUBLIC void installCallback(CallbackType type, callback_t cb);
76 
78 EXPORTED_PUBLIC void removeCallback(callback_t cb);
79 
81 EXPORTED_PUBLIC void inhibitEvents();
82 
84 EXPORTED_PUBLIC void uninhibitEvents();
85 
89 EXPORTED_PUBLIC void loadKeymapFromFile(const char *path);
90 }; // namespace Input
91 
92 #endif
bool keyUp
Whether this is a keyUp event or not.
Definition: Input.h:65
Definition: Input.h:26