summaryrefslogtreecommitdiff
path: root/uisimulator/button-x11.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/button-x11.c')
-rw-r--r--uisimulator/button-x11.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/uisimulator/button-x11.c b/uisimulator/button-x11.c
new file mode 100644
index 0000000000..92b054f265
--- /dev/null
+++ b/uisimulator/button-x11.c
@@ -0,0 +1,77 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#define HAVE_RECORDER_KEYPAD
20#include "types.h"
21#include "button.h"
22
23#include "X11/keysym.h"
24
25/*
26 *Initialize buttons
27 */
28void button_init()
29{
30}
31
32/*
33 * Get button pressed from hardware
34 */
35static int get_raw_button (void)
36{
37 int k = screenhack_handle_events();
38 switch(k)
39 {
40 case XK_KP_Left:
41 case XK_Left:
42 case XK_KP_4:
43 return BUTTON_LEFT;
44 case XK_KP_Right:
45 case XK_Right:
46 case XK_KP_6:
47 return BUTTON_RIGHT;
48 case XK_KP_Up:
49 case XK_Up:
50 case XK_KP_8:
51 return BUTTON_UP;
52 case XK_KP_Down:
53 case XK_Down:
54 case XK_KP_2:
55 return BUTTON_DOWN;
56 default:
57 return 0;
58 }
59}
60
61/*
62 * Get the currently pressed button.
63 * Returns one of BUTTON_xxx codes, with possibly a modifier bit set.
64 * No modifier bits are set when the button is first pressed.
65 * BUTTON_HELD bit is while the button is being held.
66 * BUTTON_REL bit is set when button has been released.
67 */
68int button_get(void)
69{
70 return get_raw_button();
71}
72
73/* -----------------------------------------------------------------
74 * local variables:
75 * eval: (load-file "rockbox-mode.el")
76 * end:
77 */