-
Notifications
You must be signed in to change notification settings - Fork 56
MTY_Event
App event encapsulating all event types.
First inspect the type
member to determine what kind of event it is, then choose one of the members from the nameless union
.
typedef struct {
MTY_EventType type;
MTY_Window window;
union {
MTY_ControllerEvent controller;
MTY_ScrollEvent scroll;
MTY_ButtonEvent button;
MTY_MotionEvent motion;
MTY_DropEvent drop;
MTY_PenEvent pen;
MTY_KeyEvent key;
MTY_HIDEvent hid;
const char * reopenArg;
const char * webviewText;
uint32_t hotkey;
uint32_t trayID;
char text[8];
bool focus;
};
} MTY_Event;
type
(MTY_EventType
)
The type of event determining which member in the union
is valid.
window
(MTY_Window
)
The window associated with the event.
controller
(MTY_ControllerEvent
)
Valid on MTY_EVENT_CONTROLLER
, MTY_EVENT_CONNECT
, and MTY_EVENT_DISCONNECT
.
scroll
(MTY_ScrollEvent
)
Valid on MTY_EVENT_SCROLL
.
button
(MTY_ButtonEvent
)
Valid on MTY_EVENT_BUTTON
.
motion
(MTY_MotionEvent
)
Valid on MTY_EVENT_MOTION
.
drop
(MTY_DropEvent
)
Valid on MTY_EVENT_DROP
.
pen
(MTY_PenEvent
)
Valid on MTY_EVENT_PEN
.
key
(MTY_KeyEvent
)
Valid on MTY_EVENT_KEY
.
hid
(MTY_HIDEvent
)
Valid on MTY_EVENT_HID
.
reopenArg
(const char *
)
Valid on MTY_EVENT_REOPEN
, the argument supplied.
webviewText
(const char *
)
Valid on MTY_EVENT_WEBVIEW_TEXT
, text sent from the WebView's JavaScript enitronment.
hotkey
(uint32_t
)
Valid on MTY_EVENT_HOTKEY
, the id
set via MTY_AppSetHotkey
.
trayID
(uint32_t
)
Valid on MTY_EVENT_TRAY
, the menu id
set via MTY_AppSetTray
.
text[8]
(char
)
Valid on MTY_EVENT_TEXT
, the UTF-8 text.
focus
(bool
)
Valid on MTY_EVENT_FOCUS
, the focus state.