summaryrefslogtreecommitdiffstats
path: root/uisimulator/x11/button-x11.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-04-27 23:48:49 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-04-27 23:48:49 +0000
commit3caa3c08717ad745b49da01bf70a4c0da195ac14 (patch)
tree486f9d59673e537cd100957c8748b351e0a64ce4 /uisimulator/x11/button-x11.c
parentc1543511b342162b2b537485c6646186037d8845 (diff)
downloadrockbox-3caa3c08717ad745b49da01bf70a4c0da195ac14.tar.gz
rockbox-3caa3c08717ad745b49da01bf70a4c0da195ac14.zip
moved X11-specific files into a separate subdir to keep root clean for
target files git-svn-id: svn://svn.rockbox.org/rockbox/trunk@282 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11/button-x11.c')
-rw-r--r--uisimulator/x11/button-x11.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c
new file mode 100644
index 0000000000..4bc780bed6
--- /dev/null
+++ b/uisimulator/x11/button-x11.c
@@ -0,0 +1,108 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Björn Stenberg
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#define HAVE_RECORDER_KEYPAD
+#include "types.h"
+#include "button.h"
+
+#include "X11/keysym.h"
+
+/*
+ *Initialize buttons
+ */
+void button_init()
+{
+}
+
+/*
+ * Translate X keys to Recorder keys
+ *
+ * We simulate recorder keys on the numeric keypad:
+ *
+ * 4,6,8,2 = Left, Right, Up, Down
+ * 5 = Play/pause
+ * Div,Mul,Sub = The tree menu keys
+ * +,Enter = On, Off
+ *
+ */
+static int get_raw_button (void)
+{
+ int k = screenhack_handle_events();
+ switch(k)
+ {
+ case XK_KP_Left:
+ case XK_Left:
+ case XK_KP_4:
+ return BUTTON_LEFT;
+
+ case XK_KP_Right:
+ case XK_Right:
+ case XK_KP_6:
+ return BUTTON_RIGHT;
+
+ case XK_KP_Up:
+ case XK_Up:
+ case XK_KP_8:
+ return BUTTON_UP;
+
+ case XK_KP_Down:
+ case XK_Down:
+ case XK_KP_2:
+ return BUTTON_DOWN;
+
+ case XK_KP_Space:
+ case XK_KP_5:
+ return BUTTON_PLAY;
+
+ case XK_KP_Enter:
+ return BUTTON_OFF;
+
+ case XK_KP_Add:
+ return BUTTON_ON;
+
+ case XK_KP_Divide:
+ return BUTTON_F1;
+
+ case XK_KP_Multiply:
+ return BUTTON_F2;
+
+ case XK_KP_Subtract:
+ return BUTTON_F3;
+
+ default:
+ return 0;
+ }
+}
+
+/*
+ * Get the currently pressed button.
+ * Returns one of BUTTON_xxx codes, with possibly a modifier bit set.
+ * No modifier bits are set when the button is first pressed.
+ * BUTTON_HELD bit is while the button is being held.
+ * BUTTON_REL bit is set when button has been released.
+ */
+int button_get(void)
+{
+ return get_raw_button();
+}
+
+/* -----------------------------------------------------------------
+ * local variables:
+ * eval: (load-file "rockbox-mode.el")
+ * end:
+ */