diff --git a/src/gui/Gui-X.cc b/src/gui/Gui-X.cc index 58a0df4..2a7011e 100644 --- a/src/gui/Gui-X.cc +++ b/src/gui/Gui-X.cc @@ -53,7 +53,9 @@ bool Gui_Init() RootWindow(g_display, g_vi->screen), g_vi->visual, AllocNone); g_swa.colormap = colormap; g_swa.border_pixel = 0; - g_swa.event_mask = StructureNotifyMask; + g_swa.event_mask = StructureNotifyMask | + KeyPressMask | KeyReleaseMask | + ButtonPressMask | ButtonReleaseMask; return true; } diff --git a/src/gui/Gui.h b/src/gui/Gui.h index 64835ac..e0cd38f 100644 --- a/src/gui/Gui.h +++ b/src/gui/Gui.h @@ -3,11 +3,32 @@ #include -#define GUI_EVENT_CLOSE_WINDOW 1u +#define GUI_EVENT_CLOSE_WINDOW 1u +#define GUI_EVENT_EXPOSE 2u +#define GUI_EVENT_KEY_PRESS 3u +#define GUI_EVENT_KEY_RELEASE 4u +#define GUI_EVENT_BUTTON_PRESS 5u +#define GUI_EVENT_BUTTON_RELEASE 6u + +typedef struct +{ + uint32_t key; + uint8_t mods; +} Gui_KeyEvent; + +typedef struct +{ + uint8_t button; +} Gui_ButtonEvent; typedef struct { uint8_t type; + union + { + Gui_KeyEvent key; + Gui_ButtonEvent button; + }; } Gui_Event; bool Gui_Init();