A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2008 by Maurus Cuelenaere
11* Copyright (C) 2009 by Karl Kurbjun
12*
13* This program is free software; you can redistribute it and/or
14* modify it under the terms of the GNU General Public License
15* as published by the Free Software Foundation; either version 2
16* of the License, or (at your option) any later version.
17*
18* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19* KIND, either express or implied.
20*
21****************************************************************************/
22
23#ifndef _PLUGIN_LIB_TOUCHSCREEN_H_
24#define _PLUGIN_LIB_TOUCHSCREEN_H_
25
26#include "plugin.h"
27
28#ifdef HAVE_TOUCHSCREEN
29
30/*******************************************************************************
31 * Touchbutton
32 ******************************************************************************/
33struct touchbutton {
34 /* Each button has it's own viewport to define colors, drawstyle, location*/
35 struct viewport vp;
36 bool repeat; /* requires the area be held for the action */
37 int action; /* action this button will return */
38 bool invisible; /* Is this an invisible button? */
39 char *title; /* Specify a title */
40 fb_data *pixmap; /* Currently unused, but will allow for a graphic */
41};
42
43/* Check: tests if the result of button_get() beloned to a touch button */
44int touchbutton_check_button(int button, struct touchbutton *data, int num_buttons);
45/* Wait: Wait for input and return the corresponding action */
46int touchbutton_get(struct touchbutton *data, int num_buttons);
47/* Wait with timeout */
48int touchbutton_get_w_tmo(int timeout, struct touchbutton *data, int num_buttons);
49
50/* Draw: Draws all visible buttons */
51void touchbutton_draw(struct touchbutton *data, int num_buttons);
52
53
54/*******************************************************************************
55 * Touch mapping
56 ******************************************************************************/
57struct ts_mapping
58{
59 int tl_x; /* top left */
60 int tl_y;
61 int width;
62 int height;
63};
64
65struct ts_mappings
66{
67 struct ts_mapping *mappings;
68 int amount;
69};
70
71unsigned int touchscreen_map(struct ts_mappings *map, int x, int y);
72
73struct ts_raster
74{
75 int tl_x; /* top left */
76 int tl_y;
77 int width;
78 int height;
79 int raster_width;
80 int raster_height;
81};
82
83struct ts_raster_result
84{
85 int x;
86 int y;
87};
88
89unsigned int touchscreen_map_raster(struct ts_raster *map, int x, int y, struct ts_raster_result *result);
90
91struct ts_raster_button_mapping
92{
93 struct ts_raster *raster;
94 bool drag_drop_enable; /* ... */
95 bool double_click_enable; /* ... */
96 bool click_enable; /* ... */
97 bool move_progress_enable; /* ... */
98 bool two_d_movement_enable; /* ... */
99 struct ts_raster_result two_d_from; /* ... */
100 int _prev_x; /* Internal: DO NOT MODIFY! */
101 int _prev_y; /* Internal: DO NOT MODIFY! */
102 int _prev_btn_state; /* Internal: DO NOT MODIFY! */
103};
104
105struct ts_raster_button_result
106{
107 enum{
108 TS_ACTION_NONE,
109 TS_ACTION_MOVE,
110 TS_ACTION_CLICK,
111 TS_ACTION_DOUBLE_CLICK,
112 TS_ACTION_DRAG_DROP,
113 TS_ACTION_TWO_D_MOVEMENT
114 } action;
115 struct ts_raster_result from;
116 struct ts_raster_result to;
117};
118
119struct ts_raster_button_result touchscreen_raster_map_button(struct ts_raster_button_mapping *map, int x, int y, int button);
120
121#endif /* HAVE_TOUCHSCREEN */
122#endif /* _PLUGIN_LIB_TOUCHSCREEN_H_ */