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_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,
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 
67 {
68  RESOLUTION res;
69 };
70 
71 /* The "quit requested" event */
72 typedef struct XBMC_QuitEvent {
74 
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 */
81 
82 /* Multimedia keys on keyboards / remotes are mapped to APPCOMMAND events */
83 typedef struct XBMC_AppCommandEvent {
84  unsigned int action; /* One of ACTION_... */
86 
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 */
95 
96 typedef struct XBMC_SetFocusEvent {
97  int x; /* x position */
98  int y; /* y position */
100 
101 /* Button event structure */
102 typedef struct XBMC_ButtonEvent
103 {
104  uint32_t button;
105  uint32_t holdtime;
107 
108 /* General event structure */
109 typedef struct XBMC_Event {
110  uint8_t type;
111  union
112  {
113  XBMC_KeyboardEvent key;
114  XBMC_MouseMotionEvent motion;
115  XBMC_MouseButtonEvent button;
116  XBMC_ResizeEvent resize;
117  XBMC_MoveEvent move;
119  XBMC_QuitEvent quit;
120  XBMC_UserEvent user;
121  XBMC_AppCommandEvent appcommand;
122  XBMC_TouchEvent touch;
123  XBMC_ButtonEvent keybutton;
124  XBMC_SetFocusEvent focus;
125  };
126 } XBMC_Event;
127 
Definition: XBMC_events.h:96
Definition: XBMC_events.h:76
Definition: XBMC_events.h:42
Definition: XBMC_events.h:83
Definition: XBMC_events.h:56
Definition: XBMC_events.h:37
Definition: XBMC_events.h:102
Definition: XBMC_events.h:72
Definition: XBMC_keyboard.h:36
Definition: XBMC_events.h:88
Definition: XBMC_events.h:61
Definition: inftrees.h:24
Definition: XBMC_events.h:109
Definition: XBMC_events.h:66
Definition: XBMC_events.h:47