Browse Source

x11: Revert "Fix keymap updating for X11 backend"

This reverts commit de6d290266d1def0eef9df81bf9be41c12a98c61.

This patch had multiple issues, discussed in #5520.
Ryan C. Gordon 3 years ago
parent
commit
49a2e4b0ea
3 changed files with 5 additions and 6 deletions
  1. 5 3
      src/video/x11/SDL_x11events.c
  2. 0 1
      src/video/x11/SDL_x11sym.h
  3. 0 2
      src/video/x11/SDL_x11window.c

+ 5 - 3
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;
 

+ 0 - 1
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

+ 0 - 2
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;