xbmc
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/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_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_SCREENCHANGE, /* Window moved to a different screen */
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,
32 
33  XBMC_MAXEVENT = 256 /* XBMC_EventType is represented as uchar */
34 } XBMC_EventType;
35 
36 /* Keyboard event structure */
37 typedef struct XBMC_KeyboardEvent {
38  XBMC_keysym keysym;
40 
41 /* Mouse motion event structure */
42 typedef struct XBMC_MouseMotionEvent {
43  uint16_t x, y; /* The X/Y coordinates of the mouse */
45 
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 */
51 
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.
55  */
56 typedef struct XBMC_ResizeEvent {
57  int w; /* New width */
58  int h; /* New height */
60 
61 typedef struct XBMC_MoveEvent {
62  int x; /* New x position */
63  int y; /* New y position */
65 
66 typedef struct XBMC_ScreenChangeEvent
67 {
68  unsigned int screenIdx; /* The screen index */
70 
72 {
73  RESOLUTION res;
74 };
75 
76 /* The "quit requested" event */
77 typedef struct XBMC_QuitEvent {
79 
80 /* A user-defined event type */
81 typedef struct XBMC_UserEvent {
82  int code; /* User defined event code */
83  void *data1; /* User defined data pointer */
84  void *data2; /* User defined data pointer */
86 
87 /* Multimedia keys on keyboards / remotes are mapped to APPCOMMAND events */
88 typedef struct XBMC_AppCommandEvent {
89  unsigned int action; /* One of ACTION_... */
91 
92 /* Mouse motion event structure */
93 typedef struct XBMC_TouchEvent {
94  int action; /* action ID */
95  float x, y; /* The X/Y coordinates of the mouse */
96  float x2, y2; /* Additional X/Y coordinates */
97  float x3, y3; /* Additional X/Y coordinates */
98  int pointers; /* number of touch pointers */
100 
101 typedef struct XBMC_SetFocusEvent {
102  int x; /* x position */
103  int y; /* y position */
105 
106 /* Button event structure */
107 typedef struct XBMC_ButtonEvent
108 {
109  uint32_t button;
110  uint32_t holdtime;
112 
113 /* General event structure */
114 typedef struct XBMC_Event {
115  uint8_t type;
116  union
117  {
118  XBMC_KeyboardEvent key;
119  XBMC_MouseMotionEvent motion;
120  XBMC_MouseButtonEvent button;
121  XBMC_ResizeEvent resize;
122  XBMC_MoveEvent move;
124  XBMC_QuitEvent quit;
125  XBMC_UserEvent user;
126  XBMC_AppCommandEvent appcommand;
127  XBMC_TouchEvent touch;
128  XBMC_ButtonEvent keybutton;
129  XBMC_SetFocusEvent focus;
130  XBMC_ScreenChangeEvent screen;
131  };
132 } XBMC_Event;
133 
Definition: XBMC_events.h:101
Definition: XBMC_events.h:81
Definition: XBMC_events.h:42
Definition: XBMC_events.h:88
Definition: XBMC_events.h:56
Definition: XBMC_events.h:37
Definition: XBMC_events.h:107
Definition: XBMC_events.h:77
Definition: XBMC_keyboard.h:36
Definition: XBMC_events.h:93
Definition: XBMC_events.h:61
Definition: inftrees.h:24
Definition: XBMC_events.h:114
Definition: XBMC_events.h:71
Definition: XBMC_events.h:47
Definition: XBMC_events.h:66