From 49a2e4b0ea0d677aa749c3d478e0966e82e5efa3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 19 Apr 2022 00:36:53 -0400 Subject: [PATCH] x11: Revert "Fix keymap updating for X11 backend" This reverts commit de6d290266d1def0eef9df81bf9be41c12a98c61. This patch had multiple issues, discussed in #5520. --- src/video/x11/SDL_x11events.c | 8 +++++--- src/video/x11/SDL_x11sym.h | 1 - src/video/x11/SDL_x11window.c | 2 -- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index eb46e4abe..62e5667e5 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -733,9 +733,9 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - XkbEvent* xkbEvent = (XkbEvent*) xevent; Display *display; SDL_WindowData *data; + XEvent xevent; int orig_event_type; KeyCode orig_keycode; XClientMessageEvent m; @@ -744,6 +744,9 @@ X11_DispatchEvent(_THIS, XEvent *xevent) SDL_assert(videodata != NULL); display = videodata->display; + SDL_zero(xevent); /* valgrind fix. --ryan. */ + X11_XNextEvent(display, &xevent); + /* Save the original keycode for dead keys, which are filtered out by the XFilterEvent() call below. */ @@ -823,8 +826,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent) if (SDL_GetKeyboardFocus() != NULL) { X11_ReconcileKeyboardState(_this); } - } else if (xevent->type == MappingNotify || - (xevent->type == videodata->xkb_event && xkbEvent->any.xkb_type == XkbStateNotify)) { + } else if (xevent.type == MappingNotify) { /* Has the keyboard layout changed? */ const int request = xevent->xmapping.request; diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index 67b0a793a..762a86596 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -185,7 +185,6 @@ SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return) -SDL_X11_SYM(Bool,XkbSelectEvents,(Display* a, unsigned int b, unsigned int c, unsigned int d),(a,b,c,d),return) #endif #if NeedWidePrototypes diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 24fcbc541..ee09c9741 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -678,8 +678,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* For _ICC_PROFILE. */ X11_XSelectInput(display, RootWindow(display, screen), PropertyChangeMask); - X11_XkbSelectEvents(display, XkbUseCoreKbd, XkbStateNotifyMask, XkbStateNotifyMask); - X11_XFlush(display); return 0;