kodi
XBMC_events.h
1 /*
2  * Copyright (C) 2005-2023 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "Resolution.h"
12 #include "input/keyboard/XBMC_keyboard.h"
13 
14 /* Event enumerations */
15 typedef enum
16 {
17  XBMC_NOEVENT = 0, /* Unused (do not remove) */
18  XBMC_KEYDOWN, /* Keys pressed */
19  XBMC_KEYUP, /* Keys released */
20  XBMC_KEYCOMPOSING_COMPOSING, /* A composed key (sequence) is under processing */
21  XBMC_KEYCOMPOSING_FINISHED, /* A composed key is finished */
22  XBMC_KEYCOMPOSING_CANCELLED, /* A composed key is cancelled */
23  XBMC_MOUSEMOTION, /* Mouse moved */
24  XBMC_MOUSEBUTTONDOWN, /* Mouse button pressed */
25  XBMC_MOUSEBUTTONUP, /* Mouse button released */
26  XBMC_QUIT, /* User-requested quit */
27  XBMC_VIDEORESIZE, /* User resized video mode */
28  XBMC_SCREENCHANGE, /* Window moved to a different screen */
29  XBMC_VIDEOMOVE, /* User moved the window */
30  XBMC_MODECHANGE, /* Video mode must be changed */
31  XBMC_TOUCH,
32  XBMC_BUTTON, /* Button (remote) pressed */
33  XBMC_SETFOCUS,
34  XBMC_USEREVENT,
35 
36  XBMC_MAXEVENT = 256 /* XBMC_EventType is represented as uchar */
37 } XBMC_EventType;
38 
39 /* Keyboard event structure */
40 typedef struct XBMC_KeyboardEvent {
41  XBMC_keysym keysym;
43 
44 /* Mouse motion event structure */
45 typedef struct XBMC_MouseMotionEvent {
46  uint16_t x, y; /* The X/Y coordinates of the mouse */
48 
49 /* Mouse button event structure */
50 typedef struct XBMC_MouseButtonEvent {
51  unsigned char button; /* The mouse button index */
52  uint16_t x, y; /* The X/Y coordinates of the mouse at press time */
54 
55 /* The "window resized" event
56  When you get this event, you are responsible for setting a new video
57  mode with the new width and height.
58  */
59 typedef struct XBMC_ResizeEvent {
60  int w; /* New width */
61  int h; /* New height */
63 
64 typedef struct XBMC_MoveEvent {
65  int x; /* New x position */
66  int y; /* New y position */
68 
69 typedef struct XBMC_ScreenChangeEvent
70 {
71  unsigned int screenIdx; /* The screen index */
73 
75 {
76  RESOLUTION res;
77 };
78 
79 /* The "quit requested" event */
80 typedef struct XBMC_QuitEvent {
82 
83 /* A user-defined event type */
84 typedef struct XBMC_UserEvent {
85  int code; /* User defined event code */
86  void *data1; /* User defined data pointer */
87  void *data2; /* User defined data pointer */
89 
90 /* Multimedia keys on keyboards / remotes are mapped to APPCOMMAND events */
91 typedef struct XBMC_AppCommandEvent {
92  unsigned int action; /* One of ACTION_... */
94 
95 /* Mouse motion event structure */
96 typedef struct XBMC_TouchEvent {
97  int action; /* action ID */
98  float x, y; /* The X/Y coordinates of the mouse */
99  float x2, y2; /* Additional X/Y coordinates */
100  float x3, y3; /* Additional X/Y coordinates */
101  int pointers; /* number of touch pointers */
103 
104 typedef struct XBMC_SetFocusEvent {
105  int x; /* x position */
106  int y; /* y position */
108 
109 /* Button event structure */
110 typedef struct XBMC_ButtonEvent
111 {
112  uint32_t button;
113  uint32_t holdtime;
115 
116 /* General event structure */
117 typedef struct XBMC_Event {
118  uint8_t type;
119  union
120  {
121  XBMC_KeyboardEvent key;
122  XBMC_MouseMotionEvent motion;
123  XBMC_MouseButtonEvent button;
124  XBMC_ResizeEvent resize;
125  XBMC_MoveEvent move;
127  XBMC_QuitEvent quit;
128  XBMC_UserEvent user;
129  XBMC_AppCommandEvent appcommand;
130  XBMC_TouchEvent touch;
131  XBMC_ButtonEvent keybutton;
132  XBMC_SetFocusEvent focus;
133  XBMC_ScreenChangeEvent screen;
134  };
135 } XBMC_Event;
136 
Definition: XBMC_events.h:104
Definition: XBMC_events.h:84
Definition: XBMC_events.h:45
Definition: XBMC_events.h:91
Definition: XBMC_events.h:59
Definition: XBMC_events.h:40
Definition: XBMC_events.h:110
Definition: XBMC_events.h:80
Definition: XBMC_keyboard.h:39
Definition: XBMC_events.h:96
Definition: XBMC_events.h:64
Definition: inftrees.h:24
Definition: XBMC_events.h:117
Definition: XBMC_events.h:74
Definition: XBMC_events.h:50
Definition: XBMC_events.h:69