Commit FS#9308: differentiate between TOUCHPAD & TOUCHSCREEN

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18338 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2008-08-23 09:46:38 +00:00
parent 965d2af61f
commit 1392dc2144
81 changed files with 233 additions and 231 deletions

View file

@ -146,8 +146,8 @@ metadata/asap.c
#ifdef HAVE_TAGCACHE
tagcache.c
#endif
#ifdef HAVE_TOUCHPAD
keymaps/keymap-touchpad.c
#ifdef HAVE_TOUCHSCREEN
keymaps/keymap-touchscreen.c
#endif
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
|| (CONFIG_KEYPAD == IRIVER_H300_PAD)

View file

@ -39,7 +39,7 @@ static intptr_t last_data = 0;
static int last_action = ACTION_NONE;
static bool repeated = false;
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
static bool short_press = false;
#endif
@ -145,12 +145,12 @@ static int get_action_worker(int context, int timeout,
return ACTION_NONE; /* "safest" return value */
}
last_context = context;
#ifdef HAVE_TOUCHPAD
if (button & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if (button & BUTTON_TOUCHSCREEN)
{
repeated = false;
short_press = false;
if (last_button & BUTTON_TOUCHPAD)
if (last_button & BUTTON_TOUCHSCREEN)
{
if ((button & BUTTON_REL) &&
((last_button & BUTTON_REPEAT)==0))
@ -161,7 +161,7 @@ static int get_action_worker(int context, int timeout,
repeated = true;
}
last_button = button;
return ACTION_TOUCHPAD;
return ACTION_TOUCHSCREEN;
}
#endif
#ifndef HAS_BUTTON_HOLD
@ -282,18 +282,18 @@ int get_action_statuscode(int *button)
return ret;
}
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
/* return BUTTON_NONE on error
* BUTTON_REPEAT if repeated press
* BUTTON_REPEAT|BUTTON_REL if release after repeated press
* BUTTON_REL if its a short press = release after press
* BUTTON_TOUCHPAD if press
* BUTTON_TOUCHSCREEN if press
*/
int action_get_touchpad_press(short *x, short *y)
int action_get_touchscreen_press(short *x, short *y)
{
static int last_data = 0;
int data;
if ((last_button & BUTTON_TOUCHPAD) == 0)
if ((last_button & BUTTON_TOUCHSCREEN) == 0)
return BUTTON_NONE;
data = button_get_data();
if (last_button & BUTTON_REL)
@ -314,6 +314,6 @@ int action_get_touchpad_press(short *x, short *y)
/* This is to return a BUTTON_REL after a BUTTON_REPEAT. */
if (last_button & BUTTON_REL)
return BUTTON_REPEAT|BUTTON_REL;
return BUTTON_TOUCHPAD;
return BUTTON_TOUCHSCREEN;
}
#endif

View file

@ -82,8 +82,8 @@ enum {
ACTION_NONE = BUTTON_NONE,
ACTION_UNKNOWN,
ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
ACTION_TOUCHPAD,
ACTION_TOUCHPAD_MODE, /* toggle the touchpad mode */
ACTION_TOUCHSCREEN,
ACTION_TOUCHSCREEN_MODE, /* toggle the touchscreen mode */
/* standard actions, use these first */
ACTION_STD_PREV,
@ -265,13 +265,13 @@ int get_action_statuscode(int *button);
BUTTON_NONE or flagged with SYS_EVENT */
intptr_t get_action_data(void);
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
/* return BUTTON_NONE on error
BUTTON_REPEAT if repeated press
BUTTON_REL if its a short press
BUTTON_TOUCHPAD otherwise
BUTTON_TOUCHSCREEN otherwise
*/
int action_get_touchpad_press(short *x, short *y);
int action_get_touchscreen_press(short *x, short *y);
#endif
#endif /* __ACTION_H__ */

View file

@ -285,17 +285,17 @@ void list_draw(struct screen *display, struct viewport *parent,
}
#if defined(HAVE_TOUCHPAD)
#if defined(HAVE_TOUCHSCREEN)
/* This needs to be fixed if we ever get more than 1 touchscreen on a target.
* This also assumes the whole screen is used, which is a bad assumption but
* fine until customizable lists comes in...
*/
static bool scrolling=false;
unsigned gui_synclist_do_touchpad(struct gui_synclist * gui_list, struct viewport *parent)
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct viewport *parent)
{
short x, y;
unsigned button = action_get_touchpad_press(&x, &y);
unsigned button = action_get_touchscreen_press(&x, &y);
int line;
struct screen *display = &screens[SCREEN_MAIN];
if (button == BUTTON_NONE)

View file

@ -330,13 +330,13 @@ static void draw_screen(struct screen *display, char *title,
set_drawinfo(display, DRMODE_SOLID, text_color, background_color);
}
#ifdef HAVE_TOUCHPAD
static int touchpad_slider(struct rgb_pick *rgb, int *selected_slider)
#ifdef HAVE_TOUCHSCREEN
static int touchscreen_slider(struct rgb_pick *rgb, int *selected_slider)
{
short x,y;
int text_top,i,x1;
int slider_left, slider_width;
unsigned button = action_get_touchpad_press(&x, &y);
unsigned button = action_get_touchscreen_press(&x, &y);
bool display_three_rows;
int max_label_width;
struct screen *display = &screens[SCREEN_MAIN];
@ -426,9 +426,9 @@ bool set_color(struct screen *display, char *title, unsigned *color,
}
button = get_action(CONTEXT_SETTINGS_COLOURCHOOSER, TIMEOUT_BLOCK);
#ifdef HAVE_TOUCHPAD
if (button == ACTION_TOUCHPAD)
button = touchpad_slider(&rgb, &slider);
#ifdef HAVE_TOUCHSCREEN
if (button == ACTION_TOUCHSCREEN)
button = touchscreen_slider(&rgb, &slider);
#endif
switch (button)

View file

@ -576,9 +576,9 @@ void gui_synclist_speak_item(struct gui_synclist * lists)
}
extern intptr_t get_action_data(void);
#if defined(HAVE_TOUCHPAD)
#if defined(HAVE_TOUCHSCREEN)
/* this needs to be fixed if we ever get more than 1 touchscreen on a target */
unsigned gui_synclist_do_touchpad(struct gui_synclist * gui_list, struct viewport *parent);
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct viewport *parent);
#endif
bool gui_synclist_do_button(struct gui_synclist * lists,
@ -619,9 +619,9 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
}
#endif
#if defined(HAVE_TOUCHPAD)
if (action == ACTION_TOUCHPAD)
action = *actionptr = gui_synclist_do_touchpad(lists, &parent[SCREEN_MAIN]);
#if defined(HAVE_TOUCHSCREEN)
if (action == ACTION_TOUCHSCREEN)
action = *actionptr = gui_synclist_do_touchscreen(lists, &parent[SCREEN_MAIN]);
#endif
switch (wrap)

View file

@ -19,7 +19,7 @@
*
****************************************************************************/
/* Button Code Definitions for touchpad targets */
/* Button Code Definitions for touchscreen targets */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -34,7 +34,7 @@ const struct button_mapping* target_get_context_mapping(int context);
get_context_mapping() at the bottom of the file is called by action.c as usual.
if the context is for the remote control its then passed straight to
target_get_context_mapping().
These tables are only used for the touchpad buttons, so at the end of each
These tables are only used for the touchscreen buttons, so at the end of each
CONTEXT_CUSTOM2 is OR'ed with the context and then sent to target_get_context_mapping()
(NOTE: CONTEXT_CUSTOM2 will be stripped before being sent to make it easier.)
In the target keymap, remember to |CONTEXT_CUSTOM2 in the LAST_ITEM_IN_LIST__NEXTLIST() macro
@ -43,7 +43,7 @@ const struct button_mapping* target_get_context_mapping(int context);
*/
/* touchpad "buttons"
/* touchscreen "buttons"
screen is split into a 3x3 grid for buttons...
BUTTON_TOPLEFT BUTTON_TOPMIDDLE BUTTON_TOPRIGHT
BUTTON_MIDLEFT BUTTON_CENTER BUTTON_MIDRIGHT

View file

@ -131,8 +131,8 @@ static void app_main(void)
screens[i].update();
}
tree_gui_init();
#ifdef HAVE_TOUCHPAD
touchpad_set_mode(TOUCHPAD_BUTTON);
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
#endif
root_menu();
}

View file

@ -237,8 +237,8 @@ static const struct plugin_api rockbox_api = {
#ifdef HAS_BUTTON_HOLD
button_hold,
#endif
#ifdef HAVE_TOUCHPAD
touchpad_set_mode,
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode,
#endif
#ifdef HAVE_BUTTON_LIGHT

View file

@ -345,8 +345,8 @@ struct plugin_api {
#ifdef HAS_BUTTON_HOLD
bool (*button_hold)(void);
#endif
#ifdef HAVE_TOUCHPAD
void (*touchpad_set_mode)(enum touchpad_mode);
#ifdef HAVE_TOUCHSCREEN
void (*touchscreen_set_mode)(enum touchscreen_mode);
#endif
#ifdef HAVE_BUTTON_LIGHT
void (*buttonlight_set_timeout)(int value);

View file

@ -89,7 +89,7 @@ test_fps,apps
test_grey,apps
test_sampr,apps
test_scanrate,apps
test_touchpad,apps
test_touchscreen,apps
test_viewports,apps
text_editor,apps
vbrfix,viewers

View file

@ -154,7 +154,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef BATTERY_ON
#define BATTERY_ON BUTTON_CENTER
#endif

View file

@ -261,7 +261,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef BJACK_START
#define BJACK_START BUTTON_CENTER
#endif
@ -1238,7 +1238,7 @@ static unsigned int blackjack_menu(struct game_context* bj) {
rb->lcd_puts(0, 10, str);
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
rb->lcd_puts(0, 2, "LCD CENTRE to start & to hit");
rb->lcd_puts(0, 3, "LCD BOTTOMLEFT to stay");
rb->lcd_puts(0, 4, "LCD BOTTOMRIGHT to save/resume");

View file

@ -148,7 +148,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef BOUNCE_LEFT
#define BOUNCE_LEFT BUTTON_MIDLEFT
#endif

View file

@ -173,7 +173,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef LEFT
#define LEFT BUTTON_MIDLEFT
#endif
@ -448,7 +448,7 @@ enum menu_items {
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#include "lib/touchscreen.h"
static struct ts_mapping main_menu_items[4] =
@ -1024,8 +1024,8 @@ int game_menu(int when)
rb->lcd_update();
button = rb->button_get(true);
#ifdef HAVE_TOUCHPAD
if(button & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(button & BUTTON_TOUCHSCREEN)
{
unsigned int result = touchscreen_map(&main_menu, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff);
if(result != (unsigned)-1 && button & BUTTON_REL)
@ -1176,8 +1176,8 @@ int help(int when)
#ifdef RC_QUIT
case RC_QUIT:
#endif
#ifdef HAVE_TOUCHPAD
case BUTTON_TOUCHPAD:
#ifdef HAVE_TOUCHSCREEN
case BUTTON_TOUCHSCREEN:
#endif
case QUIT:
switch (game_menu(when)) {
@ -1871,8 +1871,8 @@ int game_loop(void)
button = QUIT;
#endif
#ifdef HAVE_TOUCHPAD
if(button & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(button & BUTTON_TOUCHSCREEN)
{
short touch_x, touch_y;
touch_x = rb->button_get_data() >> 16;
@ -1936,7 +1936,7 @@ int game_loop(void)
pad_pos_x-=8;
}
}
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
}
#endif

View file

@ -265,7 +265,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef CALCULATOR_LEFT
#define CALCULATOR_LEFT BUTTON_MIDLEFT
#endif
@ -1549,8 +1549,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
while (calStatus != cal_exit ) {
btn = rb->button_get_w_tmo(HZ/2);
#ifdef HAVE_TOUCHPAD
if(btn & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(btn & BUTTON_TOUCHSCREEN)
{
struct ts_raster_result res;
if(touchscreen_map_raster(&calc_raster, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, &res) == 1)
@ -1575,7 +1575,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
sciButtonsProcess();
break;
}
btn = BUTTON_TOUCHPAD;
btn = BUTTON_TOUCHSCREEN;
}
}
}

View file

@ -274,7 +274,7 @@
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef CB_LEVEL
#define CB_LEVEL BUTTON_TOPLEFT
#endif

View file

@ -194,7 +194,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef CHC_SETTINGS_OK
#define CHC_SETTINGS_OK BUTTON_CENTER
#endif

View file

@ -1086,7 +1086,7 @@ STATIC void chip8 (void)
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef CHIP8_OFF
#define CHIP8_OFF BUTTON_TOPLEFT
#endif

View file

@ -112,7 +112,7 @@ Still To do:
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef QUIT
#define QUIT BUTTON_TOPLEFT
#endif

View file

@ -250,7 +250,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
// not enough touchfields, so CUBE_QUIT have to be
// mapped to a real button
//ifndef CUBE_QUIT

View file

@ -272,7 +272,7 @@ void I_ShutdownGraphics(void)
#error Keymap not defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef DOOMBUTTON_UP
#define DOOMBUTTON_UP BUTTON_TOPMIDDLE
#endif

View file

@ -77,7 +77,7 @@ static const struct plugin_api* rb;
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef BTN_MENU
#define BTN_MENU (BUTTON_TOPLEFT|BUTTON_REL)
#endif

View file

@ -216,7 +216,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef FLIPIT_LEFT
#define FLIPIT_LEFT BUTTON_MIDLEFT
#endif
@ -675,7 +675,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->lcd_putsxy(2, 48, "[MENU] step by step");
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
rb->lcd_putsxy(2, 8, "[BOTTOMLEFT] to stop");
rb->lcd_putsxy(2, 18, "[CENTRE] toggle");
rb->lcd_putsxy(2, 28, "[TOPRIGHT] shuffle");

View file

@ -124,7 +124,7 @@ PLUGIN_HEADER
#error INVADROX: Unsupported keypad
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef QUIT
#define QUIT BUTTON_TOPLEFT
#endif

View file

@ -157,7 +157,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef JEWELS_UP
#define JEWELS_UP BUTTON_TOPMIDDLE
#endif
@ -1610,7 +1610,7 @@ static int jewels_main(struct game_context* bj) {
#warning: missing help text.
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
rb->lcd_puts(0, 2, "Swap pairs of jewels to");
rb->lcd_puts(0, 3, "form connected segments");
rb->lcd_puts(0, 4, "of three or more of the");

View file

@ -218,7 +218,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef JPEG_UP
#define JPEG_UP BUTTON_TOPMIDDLE
#endif

View file

@ -79,7 +79,7 @@ PLUGIN_HEADER
#endif
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
# ifndef LAMP_LEFT
# define LAMP_LEFT BUTTON_MIDLEFT
# endif

View file

@ -39,7 +39,7 @@ bmp_smooth_scale.c
#endif
pluginlib_actions.c
helper.c
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
touchscreen.c
#endif
md5.c

View file

@ -67,7 +67,7 @@ const struct button_mapping remote_directions[] =
const struct button_mapping generic_directions[] =
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
{ PLA_UP, BUTTON_TOPMIDDLE, BUTTON_NONE},
{ PLA_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
{ PLA_LEFT, BUTTON_MIDLEFT, BUTTON_NONE},
@ -162,7 +162,7 @@ const struct button_mapping generic_directions[] =
const struct button_mapping generic_left_right_fire[] =
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
{ PLA_LEFT, BUTTON_MIDLEFT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE},
@ -266,7 +266,7 @@ const struct button_mapping generic_left_right_fire[] =
/* these were taken from the bubbles plugin, so may need tweaking */
const struct button_mapping generic_actions[] =
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
{PLA_QUIT, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
{PLA_START, BUTTON_CENTER, BUTTON_NONE},
{PLA_MENU, BUTTON_TOPLEFT, BUTTON_NONE},
@ -399,7 +399,7 @@ const struct button_mapping generic_actions[] =
const struct button_mapping generic_increase_decrease[] =
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
{PLA_INC, BUTTON_TOPMIDDLE, BUTTON_NONE},
{PLA_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE},

View file

@ -21,7 +21,7 @@
#include "plugin.h"
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#include "touchscreen.h"
@ -132,4 +132,4 @@ struct ts_raster_button_result touchscreen_raster_map_button(struct ts_raster_bu
return ret;
}
#endif /* HAVE_TOUCHPAD */
#endif /* HAVE_TOUCHSCREEN */

View file

@ -22,7 +22,9 @@
#ifndef _PLUGIN_LIB_TOUCHSCREEN_H_
#define _PLUGIN_LIB_TOUCHSCREEN_H_
#ifdef HAVE_TOUCHPAD
#include "plugin.h"
#ifdef HAVE_TOUCHSCREEN
struct ts_mapping
{
@ -88,5 +90,5 @@ struct ts_raster_button_result
struct ts_raster_button_result touchscreen_raster_map_button(struct ts_raster_button_mapping *map, int x, int y, int button);
#endif /* HAVE_TOUCHPAD */
#endif /* HAVE_TOUCHSCREEN */
#endif /* _PLUGIN_LIB_TOUCHSCREEN_H_ */

View file

@ -160,7 +160,7 @@ const unsigned char rockbox16x7[] = {
#endif
#endif /* CONFIG_REMOTE_KEYPAD */
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef LP_QUIT
#define LP_QUIT BUTTON_TOPLEFT
#endif

View file

@ -227,7 +227,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MANDELBROT_UP
#define MANDELBROT_UP BUTTON_TOPMIDDLE
#endif

View file

@ -103,7 +103,7 @@ extern const fb_data matrix_normal[];
#error Unsupported keypad
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MATRIX_EXIT
#define MATRIX_EXIT BUTTON_TOPLEFT
#endif

View file

@ -154,7 +154,7 @@ PLUGIN_IRAM_DECLARE
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef BTN_QUIT
#define BTN_QUIT BUTTON_TOPLEFT
#endif

View file

@ -192,7 +192,7 @@ enum minesweeper_status {
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MINESWP_QUIT
# define MINESWP_QUIT BUTTON_TOPLEFT
#endif
@ -305,7 +305,7 @@ int stack_pos = 0;
/* a usefull string for snprintf */
char str[30];
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#include "lib/touchscreen.h"
static struct ts_raster mine_raster = { 0, 0, MAX_WIDTH, MAX_HEIGHT, TileSize, TileSize };
@ -485,7 +485,7 @@ void mine_show( void )
button = rb->button_get(true);
while( ( button == BUTTON_NONE )
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
button = BUTTON_NONE;
#endif
}
@ -582,7 +582,7 @@ enum minesweeper_status minesweeper( void )
top = (LCD_HEIGHT-height*TileSize)/2;
left = (LCD_WIDTH-width*TileSize)/2;
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
mine_raster.tl_x = left;
mine_raster.tl_y = top;
mine_raster.width = width*TileSize;
@ -633,21 +633,21 @@ enum minesweeper_status minesweeper( void )
rb->lcd_update();
button = rb->button_get(true);
#ifdef HAVE_TOUCHPAD
if(button & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(button & BUTTON_TOUCHSCREEN)
{
struct ts_raster_result res;
if(touchscreen_map_raster(&mine_raster, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, &res) == 1)
{
button &= ~BUTTON_TOUCHPAD;
lastbutton &= ~BUTTON_TOUCHPAD;
button &= ~BUTTON_TOUCHSCREEN;
lastbutton &= ~BUTTON_TOUCHSCREEN;
if(button & BUTTON_REPEAT && lastbutton != MINESWP_TOGGLE && lastbutton ^ BUTTON_REPEAT)
button = MINESWP_TOGGLE;
else if(button == BUTTON_REL && lastbutton ^ BUTTON_REPEAT)
button = MINESWP_DISCOVER;
else
button |= BUTTON_TOUCHPAD;
button |= BUTTON_TOUCHSCREEN;
x = res.x;
y = res.y;

View file

@ -131,7 +131,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MOSAIQUE_QUIT
#define MOSAIQUE_QUIT BUTTON_TOPLEFT
#endif

View file

@ -2460,7 +2460,7 @@ void get_mp3_filename(const char *wav_name)
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MP3ENC_PREV
#define MP3ENC_PREV BUTTON_MIDLEFT
#endif

View file

@ -128,7 +128,7 @@ struct mpeg_settings settings;
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MPEG_START_TIME_SELECT
#define MPEG_START_TIME_SELECT BUTTON_CENTER
#endif

View file

@ -201,7 +201,7 @@ PLUGIN_IRAM_DECLARE
#elif CONFIG_KEYPAD == MROBE500_PAD
#define MPEG_MENU BUTTON_RC_HEART
#define MPEG_STOP BUTTON_POWER
#define MPEG_PAUSE BUTTON_TOUCHPAD
#define MPEG_PAUSE BUTTON_TOUCHSCREEN
#define MPEG_VOLDOWN BUTTON_RC_VOL_DOWN
#define MPEG_VOLUP BUTTON_RC_VOL_UP
#define MPEG_RW BUTTON_RC_REW
@ -235,7 +235,7 @@ PLUGIN_IRAM_DECLARE
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef MPEG_MENU
#define MPEG_MENU (BUTTON_TOPRIGHT|BUTTON_REL)
#endif

View file

@ -192,7 +192,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef OSCILLOSCOPE_QUIT
#define OSCILLOSCOPE_QUIT BUTTON_TOPLEFT
#endif

View file

@ -153,7 +153,7 @@
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef PACMAN_UP
#define PACMAN_UP BUTTON_MIDRIGHT
#endif

View file

@ -282,7 +282,7 @@ PLUGIN_HEADER
#error Unsupported keymap!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef PEGBOX_QUIT
#define PEGBOX_QUIT BUTTON_TOPLEFT
#endif
@ -370,7 +370,7 @@ PLUGIN_HEADER
#define BOARD_Y 0
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#include "lib/touchscreen.h"
static struct ts_mapping main_menu_items[5] =
@ -385,7 +385,7 @@ static struct ts_mapping main_menu_items[5] =
#elif LCD_WIDTH > 112
0, LCD_HEIGHT - 8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT
#else
#error "Touchpad isn't supported on non-bitmap screens!"
#error "Touchscreen isn't supported on non-bitmap screens!"
#endif
}
@ -640,8 +640,8 @@ static void display_text(char *str, bool waitkey)
key = rb->button_get(true);
switch (key)
{
#ifdef HAVE_TOUCHPAD
case BUTTON_TOUCHPAD:
#ifdef HAVE_TOUCHSCREEN
case BUTTON_TOUCHSCREEN:
#endif
case PEGBOX_QUIT:
case PEGBOX_LEFT:
@ -769,8 +769,8 @@ static void new_piece(struct game_context* pb, unsigned int x_loc,
while (!exit) {
draw_board(pb);
button = rb->button_get(true);
#ifdef HAVE_TOUCHPAD
if(button & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(button & BUTTON_TOUCHSCREEN)
{
pegbox_raster_btn.two_d_from.y = x_loc;
pegbox_raster_btn.two_d_from.x = y_loc;
@ -1107,8 +1107,8 @@ static unsigned int pegbox_menu(struct game_context* pb) {
/* handle menu button presses */
button = rb->button_get(true);
#ifdef HAVE_TOUCHPAD
if(button & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(button & BUTTON_TOUCHSCREEN)
{
unsigned int result = touchscreen_map(&main_menu, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff);
if(result != (unsigned)-1 && button & BUTTON_REL)
@ -1240,8 +1240,8 @@ static int pegbox(struct game_context* pb) {
while (true) {
temp_var = rb->button_get(true);
#ifdef HAVE_TOUCHPAD
if(temp_var & BUTTON_TOUCHPAD)
#ifdef HAVE_TOUCHSCREEN
if(temp_var & BUTTON_TOUCHSCREEN)
{
pegbox_raster_btn.two_d_from.y = pb->player_row;
pegbox_raster_btn.two_d_from.x = pb->player_col;

View file

@ -104,7 +104,7 @@ static int plasma_frequency;
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef PLASMA_QUIT
#define PLASMA_QUIT BUTTON_TOPLEFT
#endif
@ -114,7 +114,7 @@ static int plasma_frequency;
#ifndef PLASMA_DECREASE_FREQUENCY
#define PLASMA_DECREASE_FREQUENCY BUTTON_MIDLEFT
#endif
#endif /* HAVE_TOUCHPAD */
#endif /* HAVE_TOUCHSCREEN */
#ifndef PLASMA_QUIT
#define PLASMA_QUIT BUTTON_OFF
@ -147,11 +147,11 @@ static int plasma_frequency;
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
#define PLASMA_REGEN_COLORS BUTTON_SELECT
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef PLASMA_REGEN_COLORS
#define PLASMA_REGEN_COLORS BUTTON_CENTER
#endif
#endif /* HAVE_TOUCHPAD */
#endif /* HAVE_TOUCHSCREEN */
#endif /* HAVE_LCD_COLOR */
#define WAV_AMP 90

View file

@ -155,7 +155,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef PONG_QUIT
#define PONG_QUIT BUTTON_TOPMIDDLE
#endif
@ -398,7 +398,7 @@ int keys(struct pong *p)
#endif
/* number of ticks this function will loop reading keys */
#ifndef HAVE_TOUCHPAD
#ifndef HAVE_TOUCHSCREEN
int time = 4;
#else
int time = 1;
@ -409,9 +409,9 @@ int keys(struct pong *p)
while(end > *rb->current_tick) {
key = rb->button_get_w_tmo(end - *rb->current_tick);
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
short touch_x, touch_y;
if(key & BUTTON_TOUCHPAD)
if(key & BUTTON_TOUCHSCREEN)
{
touch_x = rb->button_get_data() >> 16;
touch_y = rb->button_get_data() & 0xFFFF;

View file

@ -151,7 +151,7 @@
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef REVERSI_QUIT
#define REVERSI_QUIT BUTTON_TOPLEFT
#endif

View file

@ -221,7 +221,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef ROCKBLOX_OFF
#define ROCKBLOX_OFF BUTTON_TOPLEFT
#endif

View file

@ -86,7 +86,7 @@ static void setoptions (void)
fd = open(optionsave, O_RDONLY);
if(fd < 0) /* no options to read, set defaults */
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
options.LEFT=BUTTON_MIDLEFT;
options.RIGHT=BUTTON_MIDRIGHT;
#else
@ -219,7 +219,7 @@ static void setoptions (void)
#error No Keymap Defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
options.UP=BUTTON_TOPMIDDLE;
options.DOWN=BUTTON_BOTTOMMIDDLE;

View file

@ -126,7 +126,7 @@ PLUGIN_HEADER
#error "Please define keys for this keypad"
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef ROCKPAINT_QUIT
#define ROCKPAINT_QUIT BUTTON_TOPLEFT
#endif

View file

@ -148,7 +148,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef PUZZLE_QUIT
#define PUZZLE_QUIT BUTTON_TOPLEFT
#endif
@ -676,7 +676,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->lcd_putsxy(0, 28, "[MODE] shuffle");
rb->lcd_putsxy(0, 38, "[MENU] change pic");
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
rb->lcd_putsxy(0, 18, PUZZLE_QUIT_TEXT " to stop");
rb->lcd_putsxy(0, 28, PUZZLE_SHUFFLE_TEXT " shuffle");
rb->lcd_putsxy(0, 38, PUZZLE_PICTURE_TEXT " change pic");

View file

@ -149,7 +149,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef SNAKE_QUIT
#define SNAKE_QUIT BUTTON_TOPLEFT
#endif

View file

@ -297,7 +297,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef SNAKE2_LEFT
#define SNAKE2_LEFT BUTTON_MIDLEFT
#endif

View file

@ -280,7 +280,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef SOKOBAN_LEFT
#define SOKOBAN_LEFT BUTTON_MIDLEFT
#endif
@ -1240,7 +1240,7 @@ static int sokoban_menu(void)
rb->lcd_putsxy(3, 56, "[SELECT+UP] Next Level");
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
rb->lcd_putsxy(3, 6, SOKOBAN_MENU_NAME " Menu");
rb->lcd_putsxy(3, 16, SOKOBAN_UNDO_NAME " Undo");
rb->lcd_putsxy(3, 26, SOKOBAN_REDO_NAME " Redo");

View file

@ -307,7 +307,7 @@ static const struct plugin_api* rb;
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
//#ifndef SOL_QUIT
//# define SOL_QUIT BUTTON_TOPLEFT
//endif

View file

@ -209,7 +209,7 @@ static const struct plugin_api* rb; /* global api struct pointer */
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef AST_PAUSE
#define AST_PAUSE BUTTON_CENTER
#endif

View file

@ -237,7 +237,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
//#ifndef STAR_QUIT
//#define STAR_QUIT BUTTON_TOPLEFT
//#define STAR_QUIT_NAME "[TOPLEFT]"
@ -1075,7 +1075,7 @@ static int star_menu(void)
"[PLAY+RIGHT] Reset level\n"
"[PLAY+UP] Next level", true);
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
star_display_text("KEYS\n\n"
STAR_TOGGLE_CONTROL_NAME " Toggle Control\n"
STAR_QUIT_NAME " Exit\n"

View file

@ -92,7 +92,7 @@ static const struct plugin_api* rb; /* global api struct pointer */
#define STARFIELD_QUIT BUTTON_POWER
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef STARFIELD_QUIT
#define STARFIELD_QUIT BUTTON_TOPLEFT
#endif

View file

@ -154,7 +154,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef STOPWATCH_QUIT
#define STOPWATCH_QUIT BUTTON_TOPLEFT
#endif

View file

@ -190,7 +190,7 @@
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef SUDOKU_BUTTON_QUIT
#define SUDOKU_BUTTON_QUIT BUTTON_TOPLEFT
#endif

View file

@ -134,7 +134,7 @@ char buf[255];
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef SUPERDOM_OK
#define SUPERDOM_OK BUTTON_CENTER
#endif

View file

@ -23,11 +23,11 @@
PLUGIN_HEADER
#if (CONFIG_KEYPAD == COWOND2_PAD)
#define TOUCHPAD_QUIT BUTTON_POWER
#define TOUCHPAD_TOGGLE BUTTON_MENU
#define TOUCHSCREEN_QUIT BUTTON_POWER
#define TOUCHSCREEN_TOGGLE BUTTON_MENU
#elif (CONFIG_KEYPAD == MROBE500_PAD)
#define TOUCHPAD_QUIT BUTTON_POWER
#define TOUCHPAD_TOGGLE BUTTON_RC_MODE
#define TOUCHSCREEN_QUIT BUTTON_POWER
#define TOUCHSCREEN_TOGGLE BUTTON_RC_MODE
#endif
static const struct plugin_api* rb;
@ -36,13 +36,13 @@ static const struct plugin_api* rb;
enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button = 0;
enum touchpad_mode mode = TOUCHPAD_BUTTON;
enum touchscreen_mode mode = TOUCHSCREEN_BUTTON;
/* standard stuff */
(void)parameter;
rb = api;
rb->touchpad_set_mode(mode);
rb->touchscreen_set_mode(mode);
/* wait until user closes plugin */
do
@ -99,10 +99,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
x = 2*(LCD_WIDTH/3); y = 2*(LCD_HEIGHT/3);
}
if (button & TOUCHPAD_TOGGLE && (button & BUTTON_REL))
if (button & TOUCHSCREEN_TOGGLE && (button & BUTTON_REL))
{
mode = (mode == TOUCHPAD_POINT) ? TOUCHPAD_BUTTON : TOUCHPAD_POINT;
rb->touchpad_set_mode(mode);
mode = (mode == TOUCHSCREEN_POINT) ? TOUCHSCREEN_BUTTON : TOUCHSCREEN_POINT;
rb->touchscreen_set_mode(mode);
}
if (button & BUTTON_REL) draw_rect = false;
@ -115,7 +115,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->lcd_fillrect(x, y, LCD_WIDTH/3, LCD_HEIGHT/3);
}
if (draw_rect || button & BUTTON_TOUCHPAD)
if (draw_rect || button & BUTTON_TOUCHSCREEN)
{
intptr_t button_data = rb->button_get_data();
x = button_data >> 16;
@ -125,7 +125,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->lcd_fillrect(x-7, y-7, 14, 14);
/* in stylus mode, show REL position in black */
if (mode == TOUCHPAD_POINT && (button & BUTTON_REL))
if (mode == TOUCHSCREEN_POINT && (button & BUTTON_REL))
rb->lcd_set_foreground(LCD_BLACK);
else
rb->lcd_set_foreground(LCD_WHITE);
@ -135,7 +135,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
}
rb->lcd_update();
} while (button != TOUCHPAD_QUIT);
} while (button != TOUCHSCREEN_QUIT);
return PLUGIN_OK;
}

View file

@ -262,7 +262,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef VIEWER_QUIT
#define VIEWER_QUIT BUTTON_TOPLEFT
#endif

View file

@ -213,7 +213,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef VUMETER_QUIT
#define VUMETER_QUIT BUTTON_TOPLEFT
#define LABEL_QUIT "TOPLEFT"

View file

@ -225,7 +225,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef BTN_DIR_UP
#define BTN_DIR_UP BUTTON_TOPMIDDLE
#endif

View file

@ -149,7 +149,7 @@ PLUGIN_HEADER
#error No keymap defined!
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef QUIT
#define QUIT BUTTON_TOPLEFT
#endif

View file

@ -127,7 +127,7 @@
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef ZX_UP
#define ZX_UP BUTTON_TOPMIDDLE
#endif

View file

@ -138,7 +138,7 @@
#endif
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#ifndef KBD_SELECT
#define KBD_SELECT BUTTON_CENTER
#endif

View file

@ -54,13 +54,13 @@ extern int line;
#if 0
struct touch_calibration_point tl, br;
void touchpad_get_one_point(struct touch_calibration_point *p)
void touchscreen_get_one_point(struct touch_calibration_point *p)
{
int data = 0;
int start = current_tick;
while (TIME_AFTER(start+(HZ/3), current_tick))
{
if (button_read_device()&BUTTON_TOUCHPAD)
if (button_read_device()&BUTTON_TOUCHSCREEN)
{
data = button_get_last_touch();
p->val_x = data>>16;
@ -74,7 +74,7 @@ void touchpad_get_one_point(struct touch_calibration_point *p)
#define MARGIN 25
#define LEN 7
void touchpad_calibrate_screen(void)
void touchscreen_calibrate_screen(void)
{
reset_screen();
printf("touch the center of the crosshairs to calibrate");
@ -83,7 +83,7 @@ void touchpad_calibrate_screen(void)
lcd_vline(MARGIN, MARGIN-LEN, MARGIN+LEN);
lcd_update();
tl.px_x = MARGIN; tl.px_y = MARGIN;
touchpad_get_one_point(&tl);
touchscreen_get_one_point(&tl);
reset_screen();
printf("touch the center of the crosshairs to calibrate");
/* get the topright value */
@ -91,7 +91,7 @@ void touchpad_calibrate_screen(void)
lcd_vline(LCD_WIDTH-MARGIN, LCD_HEIGHT-MARGIN-LEN, LCD_HEIGHT-MARGIN+LEN);
lcd_update();
br.px_x = LCD_WIDTH-MARGIN; br.px_y = LCD_HEIGHT-MARGIN;
touchpad_get_one_point(&br);
touchscreen_get_one_point(&br);
reset_screen();
line++;
printf("tl %d %d", tl.val_x, tl.val_y);
@ -108,7 +108,7 @@ void mrdebug(void)
int button=0;
#if 0
use_calibration(false);
touchpad_calibrate_screen();
touchscreen_calibrate_screen();
use_calibration(true);
#endif
@ -148,15 +148,15 @@ void mrdebug(void)
else if (button == BUTTON_RC_HEART)
{
printf("POINT");
touchpad_set_mode(TOUCHPAD_POINT);
touchscreen_set_mode(TOUCHSCREEN_POINT);
}
else if (button == BUTTON_RC_MODE)
{
printf("BUTTON");
touchpad_set_mode(TOUCHPAD_BUTTON);
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
}
#if 1
else if (button&BUTTON_TOUCHPAD)
else if (button&BUTTON_TOUCHSCREEN)
{
if (button&BUTTON_REL)
continue;

View file

@ -517,7 +517,7 @@ static int button_read(void)
/* Filter the button status. It is only accepted if we get the same
status twice in a row. */
#ifndef HAVE_TOUCHPAD
#ifndef HAVE_TOUCHSCREEN
if (btn != last_read)
retval = lastbtn;
else

View file

@ -60,30 +60,30 @@ void wheel_send_events(bool send);
int button_apply_acceleration(const unsigned int data);
#endif
#define BUTTON_NONE 0x00000000
#define BUTTON_NONE 0x00000000
/* Button modifiers */
#define BUTTON_REL 0x02000000
#define BUTTON_REPEAT 0x04000000
#define BUTTON_TOUCHPAD 0x08000000
#define BUTTON_REL 0x02000000
#define BUTTON_REPEAT 0x04000000
#define BUTTON_TOUCHSCREEN 0x08000000
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
#if !defined(BUTTON_TOPLEFT) || !defined(BUTTON_TOPMIDDLE) \
|| !defined(BUTTON_TOPRIGHT) || !defined(BUTTON_MIDLEFT) \
|| !defined(BUTTON_CENTER) || !defined(BUTTON_MIDRIGHT) \
|| !defined(BUTTON_BOTTOMLEFT) || !defined(BUTTON_BOTTOMMIDDLE) \
|| !defined(BUTTON_BOTTOMRIGHT)
#error Touchpad button mode BUTTON_* defines not set up correctly
#error Touchscreen button mode BUTTON_* defines not set up correctly
#endif
enum touchpad_mode {
TOUCHPAD_POINT = 0, /* touchpad returns pixel co-ords */
TOUCHPAD_BUTTON, /* touchpad returns BUTTON_* area codes
actual pixel value will still be accessable
from button_get_data */
enum touchscreen_mode {
TOUCHSCREEN_POINT = 0, /* touchscreen returns pixel co-ords */
TOUCHSCREEN_BUTTON, /* touchscreen returns BUTTON_* area codes
actual pixel value will still be accessable
from button_get_data */
};
/* maybe define the number of buttons in button-target.h ? */
void touchpad_set_mode(enum touchpad_mode mode);
enum touchpad_mode touchpad_get_mode(void);
void touchscreen_set_mode(enum touchscreen_mode mode);
enum touchscreen_mode touchscreen_get_mode(void);
#endif
#endif /* _BUTTON_H_ */

View file

@ -60,7 +60,7 @@
/* define this to indicate your device's keypad */
#define CONFIG_KEYPAD COWOND2_PAD
#define HAVE_TOUCHPAD
#define HAVE_TOUCHSCREEN
#define HAVE_BUTTON_DATA
/* define this if you have a real-time clock */

View file

@ -86,7 +86,7 @@
#define DEFAULT_REMOTE_CONTRAST_SETTING 7
#define CONFIG_KEYPAD MROBE500_PAD
#define HAVE_TOUCHPAD
#define HAVE_TOUCHSCREEN
#define HAVE_BUTTON_DATA
/* Define this if you do software codec */

View file

@ -66,7 +66,7 @@
#define CONFIG_KEYPAD ONDAVX747_PAD
#define HAS_BUTTON_HOLD
#define HAVE_TOUCHPAD
#define HAVE_TOUCHSCREEN
#define HAVE_BUTTON_DATA
/* Define this if you do software codec */

View file

@ -28,24 +28,24 @@
#define TOUCH_MARGIN 8
static enum touchpad_mode current_mode = TOUCHPAD_POINT;
static enum touchscreen_mode current_mode = TOUCHSCREEN_POINT;
static short last_x, last_y;
static bool touch_available = false;
static int touchpad_buttons[3][3] =
static int touchscreen_buttons[3][3] =
{
{BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT},
{BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT},
{BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT},
};
void touchpad_set_mode(enum touchpad_mode mode)
void touchscreen_set_mode(enum touchscreen_mode mode)
{
current_mode = mode;
}
enum touchpad_mode touchpad_get_mode(void)
enum touchscreen_mode touchscreen_get_mode(void)
{
return current_mode;
}
@ -58,7 +58,7 @@ void button_set_touch_available(void)
struct touch_calibration_point {
short px_x; /* known pixel value */
short px_y;
short val_x; /* touchpad value at the known pixel */
short val_x; /* touchscreen value at the known pixel */
short val_y;
};
@ -188,15 +188,15 @@ int button_read_device(int *data)
*data = touch_to_pixels(x, y);
switch (current_mode)
{
case TOUCHPAD_POINT:
btn |= BUTTON_TOUCHPAD;
case TOUCHSCREEN_POINT:
btn |= BUTTON_TOUCHSCREEN;
break;
case TOUCHPAD_BUTTON:
case TOUCHSCREEN_BUTTON:
{
int px_x = (*data&0xffff0000)>>16;
int px_y = (*data&0x0000ffff);
btn |= touchpad_buttons[px_y/(LCD_HEIGHT/3)]
[px_x/(LCD_WIDTH/3)];
btn |= touchscreen_buttons[px_y/(LCD_HEIGHT/3)]
[px_x/(LCD_WIDTH/3)];
break;
}
}
@ -208,7 +208,7 @@ int button_read_device(int *data)
if (!(GPIOA & 0x4))
btn |= BUTTON_POWER;
if(btn & BUTTON_TOUCHPAD && !is_backlight_on(true))
if(btn & BUTTON_TOUCHSCREEN && !is_backlight_on(true))
*data = 0;
return btn;

View file

@ -44,7 +44,7 @@ void button_set_touch_available(void);
#define BUTTON_UP BUTTON_TOPMIDDLE
#define BUTTON_DOWN BUTTON_BOTTOMMIDDLE
/* Touchpad Screen Area Buttons */
/* Touch Screen Area Buttons */
#define BUTTON_TOPLEFT 0x00000010
#define BUTTON_TOPMIDDLE 0x00000020
#define BUTTON_TOPRIGHT 0x00000040

View file

@ -42,18 +42,18 @@
static short last_x, last_y, last_z1, last_z2; /* for the touch screen */
static bool touch_available = false;
static enum touchpad_mode current_mode = TOUCHPAD_POINT;
static int touchpad_buttons[3][3] = {
static enum touchscreen_mode current_mode = TOUCHSCREEN_POINT;
static int touchscreen_buttons[3][3] = {
{BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT},
{BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT},
{BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT},
};
void touchpad_set_mode(enum touchpad_mode mode)
void touchscreen_set_mode(enum touchscreen_mode mode)
{
current_mode = mode;
}
enum touchpad_mode touchpad_get_mode(void)
enum touchscreen_mode touchscreen_get_mode(void)
{
return current_mode;
}
@ -185,13 +185,13 @@ int button_read_device(int *data)
*data = touch_to_pixels(x, y);
switch (current_mode)
{
case TOUCHPAD_POINT:
r_button |= BUTTON_TOUCHPAD;
case TOUCHSCREEN_POINT:
r_button |= BUTTON_TOUCHSCREEN;
break;
case TOUCHPAD_BUTTON:
case TOUCHSCREEN_BUTTON:
{
int px_x = ((*data&0xffff0000)>>16), px_y = ((*data&0x0000ffff));
r_button |= touchpad_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)];
r_button |= touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)];
oldbutton = r_button;
break;
}
@ -233,7 +233,7 @@ int button_read_device(int *data)
return r_button;
}
/* Touchpad data available interupt */
/* Touchscreen data available interupt */
void read_battery_inputs(void);
void GIO14(void)
{

View file

@ -33,7 +33,7 @@ int button_read_device(int *data);
struct touch_calibration_point {
short px_x; /* known pixel value */
short px_y;
short val_x; /* touchpad value at the known pixel */
short val_x; /* touchscreen value at the known pixel */
short val_y;
};
void use_calibration(bool enable);
@ -55,7 +55,7 @@ void use_calibration(bool enable);
#define BUTTON_TOUCH 0x00000200
/* Touchpad Screen Area Buttons */
/* Touch Screen Area Buttons */
#define BUTTON_TOPLEFT 0x00004000
#define BUTTON_TOPMIDDLE 0x00008000
#define BUTTON_TOPRIGHT 0x00010000
@ -67,8 +67,8 @@ void use_calibration(bool enable);
#define BUTTON_BOTTOMRIGHT 0x00400000
/* compatibility hacks
not mapped to the touchpad button areas because
the touchpad is not always in that mode */
not mapped to the touchscreen button areas because
the touchscreen is not always in that mode */
#define BUTTON_LEFT BUTTON_RC_REW
#define BUTTON_RIGHT BUTTON_RC_FF

View file

@ -44,7 +44,7 @@ void button_set_touch_available(void);
#define BUTTON_UP BUTTON_TOPMIDDLE
#define BUTTON_DOWN BUTTON_BOTTOMMIDDLE
/* Touchpad Screen Area Buttons */
/* Touch Screen Area Buttons */
#define BUTTON_TOPLEFT 0x00000010
#define BUTTON_TOPMIDDLE 0x00000020
#define BUTTON_TOPRIGHT 0x00000040

View file

@ -32,16 +32,16 @@
static intptr_t button_data; /* data value from last message dequeued */
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
static int mouse_coords = 0;
static enum touchpad_mode touchpad_mode = TOUCHPAD_POINT;
void touchpad_set_mode(enum touchpad_mode mode)
static enum touchscreen_mode touchscreen_mode = TOUCHSCREEN_POINT;
void touchscreen_set_mode(enum touchscreen_mode mode)
{
touchpad_mode = mode;
touchscreen_mode = mode;
}
enum touchpad_mode touchpad_get_mode(void)
enum touchscreen_mode touchscreen_get_mode(void)
{
return touchpad_mode;
return touchscreen_mode;
}
#endif
/* how long until repeat kicks in */
@ -120,23 +120,23 @@ void button_event(int key, bool pressed)
switch (key)
{
#ifdef HAVE_TOUCHPAD
case BUTTON_TOUCHPAD:
#ifdef HAVE_TOUCHSCREEN
case BUTTON_TOUCHSCREEN:
data = mouse_coords;
switch (touchpad_mode)
switch (touchscreen_mode)
{
case TOUCHPAD_POINT:
new_btn = BUTTON_TOUCHPAD;
case TOUCHSCREEN_POINT:
new_btn = BUTTON_TOUCHSCREEN;
break;
case TOUCHPAD_BUTTON:
case TOUCHSCREEN_BUTTON:
{
static int touchpad_buttons[3][3] = {
static int touchscreen_buttons[3][3] = {
{BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT},
{BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT},
{BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT},
};
int px_x = ((data&0xffff0000)>>16), px_y = ((data&0x0000ffff));
new_btn = touchpad_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)];
new_btn = touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)];
break;
}
}
@ -171,8 +171,8 @@ void button_event(int key, bool pressed)
case SDLK_F4:
if(pressed)
{
touchpad_mode = (touchpad_mode == TOUCHPAD_POINT ? TOUCHPAD_BUTTON : TOUCHPAD_POINT);
printf("Touchpad mode: %s\n", touchpad_mode == TOUCHPAD_POINT ? "TOUCHPAD_POINT" : "TOUCHPAD_BUTTON");
touchscreen_mode = (touchscreen_mode == TOUCHSCREEN_POINT ? TOUCHSCREEN_BUTTON : TOUCHSCREEN_POINT);
printf("Touchscreen mode: %s\n", touchscreen_mode == TOUCHSCREEN_POINT ? "TOUCHSCREEN_POINT" : "TOUCHSCREEN_BUTTON");
}
break;
@ -1105,7 +1105,7 @@ long button_get_w_tmo(int ticks)
intptr_t button_get_data(void)
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
return button_data;
#else
/* Needed by the accelerating wheel driver for Sansa e200 */
@ -1113,7 +1113,7 @@ intptr_t button_get_data(void)
#endif
}
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
extern bool debug_wps;
void mouse_tick_task(void)
{
@ -1134,7 +1134,7 @@ void mouse_tick_task(void)
}
mouse_coords = (x<<16)|y;
button_event(BUTTON_TOUCHPAD, true);
button_event(BUTTON_TOUCHSCREEN, true);
if (debug_wps)
printf("Mouse at: (%d, %d)\n", x, y);
}
@ -1142,7 +1142,7 @@ void mouse_tick_task(void)
#endif
void button_init(void)
{
#ifdef HAVE_TOUCHPAD
#ifdef HAVE_TOUCHSCREEN
tick_add_task(mouse_tick_task);
#endif
}

View file

@ -78,7 +78,7 @@ void gui_message_loop(void)
button_event(event.key.keysym.sym, false);
sim_exit_irq_handler();
break;
#ifndef HAVE_TOUCHPAD
#ifndef HAVE_TOUCHSCREEN
case SDL_MOUSEBUTTONDOWN:
if (debug_wps && event.button.button == 1)
{
@ -88,7 +88,7 @@ void gui_message_loop(void)
#else
case SDL_MOUSEBUTTONUP:
sim_enter_irq_handler();
button_event(BUTTON_TOUCHPAD, false);
button_event(BUTTON_TOUCHSCREEN, false);
sim_exit_irq_handler();
break;
#endif