begin defining GUI events

This commit is contained in:
Josh Holtrop 2017-09-28 20:19:04 -04:00
parent ff89fc7ca7
commit 8154aa84cc
2 changed files with 25 additions and 2 deletions

View File

@ -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;
}

View File

@ -4,10 +4,31 @@
#include <stdint.h>
#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();