Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 337 lines (246 sloc) 6.094 kb
72983d7 @andoma Major rewrite of the widget system.
andoma authored
1 /*
2 * Input handling
2c12d8d @wader Convert showtime source to UTF-8, skip dvdnav etc
wader authored
3 * Copyright (C) 2007 Andreas Öman
72983d7 @andoma Major rewrite of the widget system.
andoma authored
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
6e1f252 @andoma Avoid collision with EVENT_H in IOKit.framework/Headers/hidsystem/IOL…
andoma authored
19 #ifndef EVENT_H__
20 #define EVENT_H__
72983d7 @andoma Major rewrite of the widget system.
andoma authored
21
7caa866 @andoma Implement seeking in video player.
andoma authored
22 #include <inttypes.h>
b1b9546 @andoma Need stddef.h here
andoma authored
23 #include <stddef.h>
67d2e72 @andoma Move various stuff into misc/
andoma authored
24 #include "misc/queue.h"
25 #include "arch/threads.h"
26 #include "arch/atomic.h"
72983d7 @andoma Major rewrite of the widget system.
andoma authored
27
60edf05 @andoma Pass parent directory prop structure to playqueue instead of just an URL
andoma authored
28 struct prop;
72983d7 @andoma Major rewrite of the widget system.
andoma authored
29
30 typedef enum {
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
31
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
32 ACTION_NONE = 0,
c0347e1 @andoma Add a keyboard mapper
andoma authored
33
34 ACTION_mappable_begin,
35
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
36 ACTION_UP,
37 ACTION_DOWN,
38 ACTION_LEFT,
39 ACTION_RIGHT,
0c87976 @andoma Add trivial search bar.
andoma authored
40 ACTION_ACTIVATE,
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
41 ACTION_ENTER,
54025b7 @andoma ps3: Fix semantics of enter button with OSK
andoma authored
42 ACTION_SUBMIT,
8df840c @andoma Use real events to handle ok/cancel in auth popup
andoma authored
43 ACTION_OK,
e1609f6 @andoma Add cancel event and map it to Esc key
andoma authored
44 ACTION_CANCEL,
46ea234 @andoma Rewrite eventhandling
andoma authored
45 ACTION_BS,
7037ef7 @andoma event: Add handler for Delete-key
andoma authored
46 ACTION_DELETE,
46ea234 @andoma Rewrite eventhandling
andoma authored
47
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
48 ACTION_FOCUS_NEXT, /* TAB */
49 ACTION_FOCUS_PREV, /* Shift + TAB */
50
8fd15a7 @andoma Add move actions (only works on OSX so far)
andoma authored
51 ACTION_MOVE_UP, // Move item
52 ACTION_MOVE_DOWN,
53 ACTION_MOVE_LEFT,
54 ACTION_MOVE_RIGHT,
c0347e1 @andoma Add a keyboard mapper
andoma authored
55
56 ACTION_NAV_FWD,
57 ACTION_NAV_BACK,
58
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
59 ACTION_PAGE_UP,
60 ACTION_PAGE_DOWN,
61
93fccdf @andoma Add ACTION_TOP and ACTION_BOTTOM and use it for list navigation.
andoma authored
62 ACTION_TOP,
63 ACTION_BOTTOM,
64
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
65 ACTION_INCR,
66 ACTION_DECR,
67
68 ACTION_STOP,
69 ACTION_PLAYPAUSE,
70 ACTION_PLAY,
71 ACTION_PAUSE,
72 ACTION_EJECT,
c0347e1 @andoma Add a keyboard mapper
andoma authored
73 ACTION_RECORD,
74
0df78e9 @andoma Rework event handling a bit so Function key mapping is done in non-ar…
andoma authored
75 ACTION_SKIP_FORWARD,
76 ACTION_SKIP_BACKWARD,
77
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
78 ACTION_SEEK_FORWARD,
79 ACTION_SEEK_BACKWARD,
0df78e9 @andoma Rework event handling a bit so Function key mapping is done in non-ar…
andoma authored
80
c0347e1 @andoma Add a keyboard mapper
andoma authored
81 ACTION_VOLUME_UP,
82 ACTION_VOLUME_DOWN,
83 ACTION_VOLUME_MUTE_TOGGLE,
84
85 ACTION_MENU,
aca9044 @andoma Add new action: ItemMenu
andoma authored
86 ACTION_ITEMMENU,
35fb628 @andoma Add logwindow event (these should be dynamic!!)
andoma authored
87 ACTION_LOGWINDOW,
c0347e1 @andoma Add a keyboard mapper
andoma authored
88 ACTION_SELECT,
89 ACTION_SHOW_MEDIA_STATS,
4b76d03 @andoma Rename "mainmenu" to "home"
andoma authored
90 ACTION_HOME,
c0347e1 @andoma Add a keyboard mapper
andoma authored
91
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
92 ACTION_SWITCH_VIEW,
c0347e1 @andoma Add a keyboard mapper
andoma authored
93 ACTION_FULLSCREEN_TOGGLE,
94
d6c437b @andoma Rename ACTION_CHANNEL_PREV,NEXT into ACTION_PREV,NEXT_CHANNEL
andoma authored
95 ACTION_NEXT_CHANNEL,
96 ACTION_PREV_CHANNEL,
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
97
7a14e60 @andoma Make Ctrl+ and Ctrl- zoom the UI (much like a regular browser)
andoma authored
98 ACTION_ZOOM_UI_INCR,
99 ACTION_ZOOM_UI_DECR,
a8fd5bd @andoma Reload the entire GLW user interface when user press F5. Makes develo…
andoma authored
100 ACTION_RELOAD_UI,
101
a80ae12 @andoma Rename som stuff and make alt+F4 exit the show
andoma authored
102 ACTION_QUIT,
103 ACTION_STANDBY,
104 ACTION_POWER_OFF,
105
c0347e1 @andoma Add a keyboard mapper
andoma authored
106
107 ACTION_SHUFFLE,
108 ACTION_REPEAT,
109
b2b4ddf @andoma Implement a screensaver and change idle.page to be that instead
andoma authored
110 ACTION_ENABLE_SCREENSAVER,
111
1526dff @andoma Add support for cycling between audio and subtitle tracks using a sin…
andoma authored
112 ACTION_CYCLE_AUDIO,
113 ACTION_CYCLE_SUBTITLE,
114
0d3e069 @andoma Change RELOAD_DEV_PLUGIN into RELOAD_DATA
andoma authored
115 ACTION_RELOAD_DATA,
a3d03df @andoma Make it possible to reload plugin under development
andoma authored
116
e45d51d @andoma ps3: Make it possible to stop playback of audio and open playqueue fr…
andoma authored
117 ACTION_PLAYQUEUE,
118
c24a24b @andoma Add sysinfo popup
andoma authored
119 ACTION_SYSINFO,
120
c0347e1 @andoma Add a keyboard mapper
andoma authored
121 ACTION_mappable_end,
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
122 } action_type_t;
72983d7 @andoma Major rewrite of the widget system.
andoma authored
123
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
124
125
126 typedef enum {
127 EVENT_OFFSET = 5000,
128 EVENT_ACTION_VECTOR,
207ef1b @andoma Rearrange EVENT enum so we keep all mappable events in consecutive
andoma authored
129 EVENT_UNICODE,
72983d7 @andoma Major rewrite of the widget system.
andoma authored
130 EVENT_KEYDESC,
131 EVENT_AUDIO_CLOCK,
132 EVENT_VIDEO_CLOCK,
9ef4b31 @andoma Showtime source code restructuring, step #2
andoma authored
133 EVENT_PLAYQUEUE_JUMP,
c15d42a @andoma Make it possible to start playback in paused mode
andoma authored
134 EVENT_PLAYQUEUE_JUMP_AND_PAUSE,
e03deb8 @andoma Initial stab on a HTSP client.
andoma authored
135 EVENT_TV, /* TV specific events, see tv.h */
7caa866 @andoma Implement seeking in video player.
andoma authored
136 EVENT_SEEK,
5c5ddf8 @andoma ps3: When seeking using L2/R2, rescale seek delta based on duration o…
andoma authored
137 EVENT_DELTA_SEEK_REL,
9ef4b31 @andoma Showtime source code restructuring, step #2
andoma authored
138 EVENT_EOF, /* End of file */
2315b6c @andoma Split video decoder from video display.
andoma authored
139 EVENT_PLAY_URL,
5e525c0 @andoma SPU support for DVDs
andoma authored
140 EVENT_EXIT,
141 EVENT_DVD_PCI,
142 EVENT_DVD_SELECT_BUTTON,
143 EVENT_DVD_ACTIVATE_BUTTON, /* "Press" button */
75a4f7b @andoma Rename openurl2 -> openurl
andoma authored
144 EVENT_OPENURL,
0298d9e @andoma Use $global.playqueue.eventsink to enqueue tracks to playqueue instea…
andoma authored
145 EVENT_PLAYTRACK, /* For playqueue */
2315b6c @andoma Split video decoder from video display.
andoma authored
146
f3ebbba @andoma Set a reason in media property tree when paused
andoma authored
147 EVENT_INTERNAL_PAUSE, // Carries a string as a reason
7b5d81b @andoma Make a correct internal pause when the spotify play token is lost.
andoma authored
148
37feb9b @andoma Improve responsiveness of seeking
andoma authored
149 EVENT_CURRENT_TIME,
719c0f4 @andoma More intelligent PTS/DTS calculations during video playback.
andoma authored
150
d5ddc98 @andoma Revamp the handling of audio and subtitle tracks for media
andoma authored
151 EVENT_SELECT_AUDIO_TRACK,
152 EVENT_SELECT_SUBTITLE_TRACK,
520c786 @andoma Add select_track event
andoma authored
153
49c57cf @andoma Make it possible to assign a priority to video playback
andoma authored
154 EVENT_PLAYBACK_PRIORITY, // 0 = best, higher value == less important
155
9b8de6c @andoma Drop the ability to run multiple UIs simultaniously and simplify thin…
andoma authored
156 EVENT_STOP_UI,
157
868a11d @andoma Improve Showtime's response to play/pause events
andoma authored
158 EVENT_HOLD,
159
744da80 @andoma More work on user configurable fonts
andoma authored
160 EVENT_REPAINT_UI,
161
18f9c8f @andoma New event type: DYNAMIC_ACTION
andoma authored
162 EVENT_DYNAMIC_ACTION,
163
72983d7 @andoma Major rewrite of the widget system.
andoma authored
164 } event_type_t;
165
32ba4a8 @andoma Rework event handling framework.
andoma authored
166
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
167
168 TAILQ_HEAD(event_q, event);
169
170 /**
171 *
172 */
173 typedef struct event_queue {
174 struct event_q eq_q;
175 hts_cond_t eq_cond;
176 hts_mutex_t eq_mutex;
177 } event_queue_t;
178
179
180 /**
181 *
182 */
183 typedef struct event {
184 int e_refcount;
185 int e_mapped;
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
186 event_type_t e_type_x;
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
187 void (*e_dtor)(struct event *e);
188 TAILQ_ENTRY(event) e_link;
5e525c0 @andoma SPU support for DVDs
andoma authored
189 char e_payload[0];
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
190 } event_t;
191
192
193 /**
194 *
195 */
127ee7b @andoma Rework event_create_unicode() into a more generic event constructor f…
andoma authored
196 typedef struct event_int {
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
197 event_t h;
127ee7b @andoma Rework event_create_unicode() into a more generic event constructor f…
andoma authored
198 int val;
199 } event_int_t;
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
200
201
5c5ddf8 @andoma ps3: When seeking using L2/R2, rescale seek delta based on duration o…
andoma authored
202 /**
203 *
204 */
205 typedef struct event_int3 {
206 event_t h;
207 int val1;
208 int val2;
209 int val3;
210 } event_int3_t;
211
58ded0e @andoma Make the event interceptor / mapper in GLW more flexible
andoma authored
212
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
213 /**
214 *
215 */
75a4f7b @andoma Rename openurl2 -> openurl
andoma authored
216 typedef struct event_openurl {
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
217 event_t h;
37244e4 @andoma Rename genericEvent -> navOpen (It's only used for that purpose)
andoma authored
218 char *url;
21692e4 @andoma Allow navigator pages to be opened with a hardcoded view parameter
andoma authored
219 char *view;
ee4449b @andoma glw: Allow navOpen() event to pass a referenced property to the navig…
andoma authored
220 struct prop *origin;
1f7c531 @andoma Add support for continuous playback of all video items in a directory
andoma authored
221 struct prop *model;
d95f79c @andoma Add support for an extra 'how' parameter in navOpen()
andoma authored
222 char *how;
75a4f7b @andoma Rename openurl2 -> openurl
andoma authored
223 } event_openurl_t;
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
224
7caa866 @andoma Implement seeking in video player.
andoma authored
225
ba15271 @andoma Add a 'primary' bool to video displaying widgets. When in non-primary…
andoma authored
226
227 /**
228 *
229 */
230 typedef struct event_playurl {
231 event_t h;
232 char *url;
233 int primary;
49c57cf @andoma Make it possible to assign a priority to video playback
andoma authored
234 int priority;
dfd5e82 @andoma Add support for setting noAudio attribute on video widgets
andoma authored
235 int no_audio;
1f7c531 @andoma Add support for continuous playback of all video items in a directory
andoma authored
236 struct prop *model;
d95f79c @andoma Add support for an extra 'how' parameter in navOpen()
andoma authored
237 char *how;
ba15271 @andoma Add a 'primary' bool to video displaying widgets. When in non-primary…
andoma authored
238 } event_playurl_t;
239
240
7caa866 @andoma Implement seeking in video player.
andoma authored
241 /**
242 *
243 */
520c786 @andoma Add select_track event
andoma authored
244 typedef struct event_select_track {
245 event_t h;
d5ddc98 @andoma Revamp the handling of audio and subtitle tracks for media
andoma authored
246 int manual; /* Set iff it was initiated by user,
247 otherwise it was suggested by showtime itself */
520c786 @andoma Add select_track event
andoma authored
248 char *id;
249 } event_select_track_t;
250
251
252 /**
253 *
254 */
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
255 typedef struct event_action_vector {
256 event_t h;
257 int num;
258 action_type_t actions[0];
259 } event_action_vector_t;
260
261
0298d9e @andoma Use $global.playqueue.eventsink to enqueue tracks to playqueue instea…
andoma authored
262 /**
263 *
264 */
265 typedef struct event_playtrack {
266 event_t h;
267 struct prop *track;
268 struct prop *source;
269 int mode;
270 } event_playtrack_t;
271
272
f29c817 @andoma Add prop event class
andoma authored
273 /**
274 *
275 */
276 typedef struct event_prop {
277 event_t h;
278 struct prop *p;
279 } event_prop_t;
280
2315b6c @andoma Split video decoder from video display.
andoma authored
281 void event_generic_dtor(event_t *e);
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
282
283 void *event_create(event_type_t type, size_t size);
284
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
285 event_t *event_create_action(action_type_t action);
286
46ea234 @andoma Rewrite eventhandling
andoma authored
287 event_t *event_create_action_multi(const action_type_t *actions, size_t numactions);
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
288
6471e6a @andoma Add event_create_action_str() helper and use it in glw_event.c
andoma authored
289 event_t *event_create_action_str(const char *str);
290
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
291 #define event_create_type(type) event_create(type, sizeof(event_t))
c527287 @andoma Correctly pass events only to local UI
andoma authored
292
127ee7b @andoma Rework event_create_unicode() into a more generic event constructor f…
andoma authored
293 void *event_create_int(event_type_t type, int val);
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
294
5c5ddf8 @andoma ps3: When seeking using L2/R2, rescale seek delta based on duration o…
andoma authored
295 void *event_create_int3(event_type_t type, int val1, int val2, int val3);
296
3c6d1b9 @andoma Fix event released memory leaks.
andoma authored
297 void event_release(event_t *e);
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
298
3c6d1b9 @andoma Fix event released memory leaks.
andoma authored
299 void event_addref(event_t *e);
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
300
c0347e1 @andoma Add a keyboard mapper
andoma authored
301 event_t *event_create_str(event_type_t et, const char *url);
ccbb3b9 @andoma Move much of the event handling from the glw-specific code into
andoma authored
302
1f7c531 @andoma Add support for continuous playback of all video items in a directory
andoma authored
303 event_t *event_create_playurl(const char *url, int primary, int priority,
d95f79c @andoma Add support for an extra 'how' parameter in navOpen()
andoma authored
304 int no_audio, struct prop *model,
305 const char *how);
ba15271 @andoma Add a 'primary' bool to video displaying widgets. When in non-primary…
andoma authored
306
ee4449b @andoma glw: Allow navOpen() event to pass a referenced property to the navig…
andoma authored
307 event_t *event_create_openurl(const char *url, const char *view,
d95f79c @andoma Add support for an extra 'how' parameter in navOpen()
andoma authored
308 struct prop *origin, struct prop *model,
309 const char *how);
0298d9e @andoma Use $global.playqueue.eventsink to enqueue tracks to playqueue instea…
andoma authored
310
311 event_t *event_create_playtrack(struct prop *track,
312 struct prop *psource,
313 int mode);
314
d5ddc98 @andoma Revamp the handling of audio and subtitle tracks for media
andoma authored
315 event_t *event_create_select_track(const char *id, event_type_t type,
316 int manual);
520c786 @andoma Add select_track event
andoma authored
317
f29c817 @andoma Add prop event class
andoma authored
318 event_t *event_create_prop(event_type_t type, struct prop *p);
319
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
320 const char *action_code2str(action_type_t code);
321
322 action_type_t action_str2code(const char *str);
323
324 int action_update_hold_by_event(int hold, event_t *e);
116ad03 @andoma Initial work on a new keymapper
andoma authored
325
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
326 #define event_is_type(e, et) ((e)->e_type_x == (et))
32ba4a8 @andoma Rework event handling framework.
andoma authored
327
d1351ad @andoma Rework event handling so we can support multiple target actions per e…
andoma authored
328 int event_is_action(event_t *e, action_type_t at);
d79bec2 @andoma Rename mp_update_hold_by_event() to event_update_hold_by_type() and m…
andoma authored
329
46ea234 @andoma Rewrite eventhandling
andoma authored
330 void event_dispatch(event_t *e);
331
0df78e9 @andoma Rework event handling a bit so Function key mapping is done in non-ar…
andoma authored
332 event_t *event_from_Fkey(unsigned int keynum, unsigned int mod);
333
9b8de6c @andoma Drop the ability to run multiple UIs simultaniously and simplify thin…
andoma authored
334 void event_to_ui(event_t *e);
335
72983d7 @andoma Major rewrite of the widget system.
andoma authored
336 #endif /* EVENT_H */
Something went wrong with that request. Please try again.