summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-01-16 21:41:57 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-01-16 21:41:57 +0000
commitf7237af58d0371314a4b2e71d80f558c46eb03bb (patch)
tree51ce4d38bfe8ab183ed7c0ae802bf61d3e35adb8 /uisimulator
parentea5c6b94d0929dd6fb954a301c951c05344e88e9 (diff)
downloadrockbox-f7237af58d0371314a4b2e71d80f558c46eb03bb.tar.gz
rockbox-f7237af58d0371314a4b2e71d80f558c46eb03bb.tar.bz2
rockbox-f7237af58d0371314a4b2e71d80f558c46eb03bb.zip
Simulator: Make touchscreen targets usable on keyboards w/o numpad (laptops)
Use 7,8,9,u,i,o,j,k,l as equivalent to the numpad keys used to simulate touching in grid mode (3x3 buttons). These are the keys usually used on such keyboards for numpad keys when the Num Lock is enabled. The USB key on these targets is changed to 'c' (connect) to avoid conflict in key mappings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24252 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/sdl/button.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index 2fbc41e373..f9bfac1dee 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -45,6 +45,12 @@ static int mouse_coords = 0;
/* speed repeat finishes at */
#define REPEAT_INTERVAL_FINISH 2
+#ifdef HAVE_TOUCHSCREEN
+#define USB_KEY SDLK_c /* SDLK_u is taken by BUTTON_MIDLEFT */
+#else
+#define USB_KEY SDLK_u
+#endif
+
#if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES)
int _remote_type=REMOTETYPE_H100_LCD;
@@ -76,7 +82,7 @@ void button_event(int key, bool pressed)
{
int new_btn = 0;
static bool usb_connected = false;
- if (usb_connected && key != SDLK_u)
+ if (usb_connected && key != USB_KEY)
return;
switch (key)
{
@@ -103,30 +109,43 @@ void button_event(int key, bool pressed)
}
break;
case SDLK_KP7:
+ case SDLK_7:
new_btn = BUTTON_TOPLEFT;
break;
case SDLK_KP8:
+ case SDLK_8:
+ case SDLK_UP:
new_btn = BUTTON_TOPMIDDLE;
break;
case SDLK_KP9:
+ case SDLK_9:
new_btn = BUTTON_TOPRIGHT;
break;
case SDLK_KP4:
+ case SDLK_u:
+ case SDLK_LEFT:
new_btn = BUTTON_MIDLEFT;
break;
case SDLK_KP5:
+ case SDLK_i:
new_btn = BUTTON_CENTER;
break;
case SDLK_KP6:
+ case SDLK_o:
+ case SDLK_RIGHT:
new_btn = BUTTON_MIDRIGHT;
break;
case SDLK_KP1:
+ case SDLK_j:
new_btn = BUTTON_BOTTOMLEFT;
break;
case SDLK_KP2:
+ case SDLK_k:
+ case SDLK_DOWN:
new_btn = BUTTON_BOTTOMMIDDLE;
break;
case SDLK_KP3:
+ case SDLK_l:
new_btn = BUTTON_BOTTOMRIGHT;
break;
case SDLK_F4:
@@ -138,7 +157,7 @@ void button_event(int key, bool pressed)
break;
#endif
- case SDLK_u:
+ case USB_KEY:
if (!pressed)
{
usb_connected = !usb_connected;