aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-01-23 21:11:51 +0100
committerdec05eba <dec05eba@protonmail.com>2025-01-23 21:11:51 +0100
commitddc745dab8b03e25e77e143aafb8e26a7af299d1 (patch)
tree46ea3eb964289c029df61769327fae7437b70748 /src
parent44320491c65e265b47282ae3053f5a031f5e740d (diff)
Fix MappingNotify never handledHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/mgl.c2
-rw-r--r--src/window/window.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/mgl.c b/src/mgl.c
index 63512ef..3b5adf2 100644
--- a/src/mgl.c
+++ b/src/mgl.c
@@ -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;