Merge pull request #22634 from CastagnaIT/webvtt_overllaped_segment
[xbmc.git] / xbmc / windowing / XBMC_events.h
blob0a3b786b8d977a38d3b3ba7bfbed6db4ba5ab147
1 /*
2 * Copyright (C) 2005-2023 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "Resolution.h"
12 #include "input/XBMC_keyboard.h"
14 /* Event enumerations */
15 typedef enum
17 XBMC_NOEVENT = 0, /* Unused (do not remove) */
18 XBMC_KEYDOWN, /* Keys pressed */
19 XBMC_KEYUP, /* Keys released */
20 XBMC_MOUSEMOTION, /* Mouse moved */
21 XBMC_MOUSEBUTTONDOWN, /* Mouse button pressed */
22 XBMC_MOUSEBUTTONUP, /* Mouse button released */
23 XBMC_QUIT, /* User-requested quit */
24 XBMC_VIDEORESIZE, /* User resized video mode */
25 XBMC_FULLSCREEN_UPDATE, /* Triggered by an OS event when Kodi is running in fullscreen, rescale and repositioning is required */
26 XBMC_VIDEOMOVE, /* User moved the window */
27 XBMC_MODECHANGE, /* Video mode must be changed */
28 XBMC_TOUCH,
29 XBMC_BUTTON, /* Button (remote) pressed */
30 XBMC_SETFOCUS,
31 XBMC_USEREVENT,
33 XBMC_MAXEVENT = 256 /* XBMC_EventType is represented as uchar */
34 } XBMC_EventType;
36 /* Keyboard event structure */
37 typedef struct XBMC_KeyboardEvent {
38 XBMC_keysym keysym;
39 } XBMC_KeyboardEvent;
41 /* Mouse motion event structure */
42 typedef struct XBMC_MouseMotionEvent {
43 uint16_t x, y; /* The X/Y coordinates of the mouse */
44 } XBMC_MouseMotionEvent;
46 /* Mouse button event structure */
47 typedef struct XBMC_MouseButtonEvent {
48 unsigned char button; /* The mouse button index */
49 uint16_t x, y; /* The X/Y coordinates of the mouse at press time */
50 } XBMC_MouseButtonEvent;
52 /* The "window resized" event
53 When you get this event, you are responsible for setting a new video
54 mode with the new width and height.
56 typedef struct XBMC_ResizeEvent {
57 int w; /* New width */
58 int h; /* New height */
59 } XBMC_ResizeEvent;
61 typedef struct XBMC_MoveEvent {
62 int x; /* New x position */
63 int y; /* New y position */
64 } XBMC_MoveEvent;
66 struct XBMC_ModeChangeEvent
68 RESOLUTION res;
71 /* The "quit requested" event */
72 typedef struct XBMC_QuitEvent {
73 } XBMC_QuitEvent;
75 /* A user-defined event type */
76 typedef struct XBMC_UserEvent {
77 int code; /* User defined event code */
78 void *data1; /* User defined data pointer */
79 void *data2; /* User defined data pointer */
80 } XBMC_UserEvent;
82 /* Multimedia keys on keyboards / remotes are mapped to APPCOMMAND events */
83 typedef struct XBMC_AppCommandEvent {
84 unsigned int action; /* One of ACTION_... */
85 } XBMC_AppCommandEvent;
87 /* Mouse motion event structure */
88 typedef struct XBMC_TouchEvent {
89 int action; /* action ID */
90 float x, y; /* The X/Y coordinates of the mouse */
91 float x2, y2; /* Additional X/Y coordinates */
92 float x3, y3; /* Additional X/Y coordinates */
93 int pointers; /* number of touch pointers */
94 } XBMC_TouchEvent;
96 typedef struct XBMC_SetFocusEvent {
97 int x; /* x position */
98 int y; /* y position */
99 } XBMC_SetFocusEvent;
101 /* Button event structure */
102 typedef struct XBMC_ButtonEvent
104 uint32_t button;
105 uint32_t holdtime;
106 } XBMC_ButtonEvent;
108 /* General event structure */
109 typedef struct XBMC_Event {
110 uint8_t type;
111 union
113 XBMC_KeyboardEvent key;
114 XBMC_MouseMotionEvent motion;
115 XBMC_MouseButtonEvent button;
116 XBMC_ResizeEvent resize;
117 XBMC_MoveEvent move;
118 XBMC_ModeChangeEvent mode;
119 XBMC_QuitEvent quit;
120 XBMC_UserEvent user;
121 XBMC_AppCommandEvent appcommand;
122 XBMC_TouchEvent touch;
123 XBMC_ButtonEvent keybutton;
124 XBMC_SetFocusEvent focus;
126 } XBMC_Event;