| 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; |
| 42 |
} XBMC_KeyboardEvent; |
| 43 |
|
| 44 |
/* Mouse motion event structure */ |
| 45 |
typedef struct XBMC_MouseMotionEvent { |
| 46 |
uint16_t x, y; /* The X/Y coordinates of the mouse */ |
| 47 |
} XBMC_MouseMotionEvent; |
| 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 */ |
| 53 |
} XBMC_MouseButtonEvent; |
| 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 width; /* New width */ |
| 61 |
int height; /* New height */ |
| 62 |
double scale; /* Scaling factor */ |
| 63 |
} XBMC_ResizeEvent; |
| 64 |
|
| 65 |
typedef struct XBMC_MoveEvent { |
| 66 |
int x; /* New x position */ |
| 67 |
int y; /* New y position */ |
| 68 |
} XBMC_MoveEvent; |
| 69 |
|
| 70 |
typedef struct XBMC_ScreenChangeEvent |
| 71 |
{ |
| 72 |
unsigned int screenIdx; /* The screen index */ |
| 73 |
} XBMC_ScreenChangeEvent; |
| 74 |
|
| 75 |
struct XBMC_ModeChangeEvent |
| 76 |
{ |
| 77 |
RESOLUTION res; |
| 78 |
}; |
| 79 |
|
| 80 |
/* The "quit requested" event */ |
| 81 |
typedef struct XBMC_QuitEvent { |
| 82 |
} XBMC_QuitEvent; |
| 83 |
|
| 84 |
/* A user-defined event type */ |
| 85 |
typedef struct XBMC_UserEvent { |
| 86 |
int code; /* User defined event code */ |
| 87 |
void *data1; /* User defined data pointer */ |
| 88 |
void *data2; /* User defined data pointer */ |
| 89 |
} XBMC_UserEvent; |
| 90 |
|
| 91 |
/* Multimedia keys on keyboards / remotes are mapped to APPCOMMAND events */ |
| 92 |
typedef struct XBMC_AppCommandEvent { |
| 93 |
unsigned int action; /* One of ACTION_... */ |
| 94 |
} XBMC_AppCommandEvent; |
| 95 |
|
| 96 |
/* Mouse motion event structure */ |
| 97 |
typedef struct XBMC_TouchEvent { |
| 98 |
int action; /* action ID */ |
| 99 |
float x, y; /* The X/Y coordinates of the mouse */ |
| 100 |
float x2, y2; /* Additional X/Y coordinates */ |
| 101 |
float x3, y3; /* Additional X/Y coordinates */ |
| 102 |
int pointers; /* number of touch pointers */ |
| 103 |
} XBMC_TouchEvent; |
| 104 |
|
| 105 |
typedef struct XBMC_SetFocusEvent { |
| 106 |
int x; /* x position */ |
| 107 |
int y; /* y position */ |
| 108 |
} XBMC_SetFocusEvent; |
| 109 |
|
| 110 |
/* Button event structure */ |
| 111 |
typedef struct XBMC_ButtonEvent |
| 112 |
{ |
| 113 |
uint32_t button; |
| 114 |
uint32_t holdtime; |
| 115 |
} XBMC_ButtonEvent; |
| 116 |
|
| 117 |
/* General event structure */ |
| 118 |
typedef struct XBMC_Event { |
| 119 |
uint8_t type; |
| 120 |
union |
| 121 |
{ |
| 122 |
XBMC_KeyboardEvent key; |
| 123 |
XBMC_MouseMotionEvent motion; |
| 124 |
XBMC_MouseButtonEvent button; |
| 125 |
XBMC_ResizeEvent resize; |
| 126 |
XBMC_MoveEvent move; |
| 127 |
XBMC_ModeChangeEvent mode; |
| 128 |
XBMC_QuitEvent quit; |
| 129 |
XBMC_UserEvent user; |
| 130 |
XBMC_AppCommandEvent appcommand; |
| 131 |
XBMC_TouchEvent touch; |
| 132 |
XBMC_ButtonEvent keybutton; |
| 133 |
XBMC_SetFocusEvent focus; |
| 134 |
XBMC_ScreenChangeEvent screen; |
| 135 |
}; |
| 136 |
} XBMC_Event; |
| 137 |
|