forked from len0rd/rockbox
1) Implement generic touchscreen detection library for the plugins
2) Adapt minesweeper, pegbox & calculator to it 3) Simplify gui/bitmap/list.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17695 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f9bf137b67
commit
e1753de41a
7 changed files with 382 additions and 12 deletions
90
apps/plugins/lib/touchscreen.h
Normal file
90
apps/plugins/lib/touchscreen.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Maurus Cuelenaere
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _PLUGIN_LIB_TOUCHSCREEN_H_
|
||||
#define _PLUGIN_LIB_TOUCHSCREEN_H_
|
||||
|
||||
#ifdef HAVE_TOUCHPAD
|
||||
|
||||
struct ts_mapping
|
||||
{
|
||||
int tl_x; /* top left */
|
||||
int tl_y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct ts_mappings
|
||||
{
|
||||
struct ts_mapping *mappings;
|
||||
int amount;
|
||||
};
|
||||
|
||||
unsigned int touchscreen_map(struct ts_mappings *map, int x, int y);
|
||||
|
||||
struct ts_raster
|
||||
{
|
||||
int tl_x; /* top left */
|
||||
int tl_y;
|
||||
int width;
|
||||
int height;
|
||||
int raster_width;
|
||||
int raster_height;
|
||||
};
|
||||
|
||||
struct ts_raster_result
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
unsigned int touchscreen_map_raster(struct ts_raster *map, int x, int y, struct ts_raster_result *result);
|
||||
|
||||
struct ts_raster_button_mapping
|
||||
{
|
||||
struct ts_raster *raster;
|
||||
bool drag_drop_enable; /* ... */
|
||||
bool double_click_enable; /* ... */
|
||||
bool click_enable; /* ... */
|
||||
bool move_progress_enable; /* ... */
|
||||
bool two_d_movement_enable; /* ... */
|
||||
struct ts_raster_result two_d_from; /* ... */
|
||||
int _prev_x; /* Internal: DO NOT MODIFY! */
|
||||
int _prev_y; /* Internal: DO NOT MODIFY! */
|
||||
int _prev_btn_state; /* Internal: DO NOT MODIFY! */
|
||||
};
|
||||
|
||||
struct ts_raster_button_result
|
||||
{
|
||||
enum{
|
||||
TS_ACTION_NONE,
|
||||
TS_ACTION_MOVE,
|
||||
TS_ACTION_CLICK,
|
||||
TS_ACTION_DOUBLE_CLICK,
|
||||
TS_ACTION_DRAG_DROP,
|
||||
TS_ACTION_TWO_D_MOVEMENT
|
||||
} action;
|
||||
struct ts_raster_result from;
|
||||
struct ts_raster_result to;
|
||||
};
|
||||
|
||||
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 /* _PLUGIN_LIB_TOUCHSCREEN_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue