diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-01-23 21:11:51 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-01-23 21:11:51 +0100 |
commit | ddc745dab8b03e25e77e143aafb8e26a7af299d1 (patch) | |
tree | 46ea3eb964289c029df61769327fae7437b70748 /src | |
parent | 44320491c65e265b47282ae3053f5a031f5e740d (diff) |
Diffstat (limited to 'src')
-rw-r--r-- | src/mgl.c | 2 | ||||
-rw-r--r-- | src/window/window.c | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -67,6 +67,8 @@ int mgl_init(void) { return -1; } connected_to_x_server = true; + /* If we dont call we will never get a MappingNotify until a key has been pressed */ + XKeysymToKeycode(context.connection, XK_F1); prev_xerror = XSetErrorHandler(mgl_x_error_handler); prev_xioerror = XSetIOErrorHandler(mgl_x_io_error_handler); diff --git a/src/window/window.c b/src/window/window.c index 9280e32..2c7077d 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -1512,6 +1512,7 @@ static void mgl_window_on_receive_event(mgl_window *self, XEvent *xev, mgl_event return; } case MappingNotify: { + /* TODO: Only handle this globally once for mgl, not for each window */ XRefreshKeyboardMapping(&xev->xmapping); event->type = MGL_EVENT_MAPPING_CHANGED; event->mapping_changed.type = MappingModifier; @@ -1526,7 +1527,7 @@ static void mgl_window_on_receive_event(mgl_window *self, XEvent *xev, mgl_event event->mapping_changed.type = MGL_MAPPING_CHANGED_POINTER; break; } - break; + return; } default: { event->type = MGL_EVENT_UNKNOWN; @@ -1552,7 +1553,7 @@ bool mgl_window_poll_event(mgl_window *self, mgl_event *event) { if(XPending(display)) { XEvent xev; /* TODO: Move to window struct */ XNextEvent(display, &xev); - if(xev.xany.window == self->window || xev.type == ClientMessage || xev.type - context->randr_event_base >= 0) + if(xev.xany.window == self->window || xev.type == ClientMessage || xev.type == MappingNotify || xev.type - context->randr_event_base >= 0) mgl_window_on_receive_event(self, &xev, event, context, false); else event->type = MGL_EVENT_UNKNOWN; |