X11: Don't ignore keyboard mapping changes.
authorRyan C. Gordon
Tue, 30 Jun 2015 14:39:39 -0400
changeset 978708b2895a935a
parent 9786 d857f324bede
child 9788 ecda7d71342e
X11: Don't ignore keyboard mapping changes.

MappingNotify events don't have a window associated with them, so SDL was
dropping these before the point where we would have handled them.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Tue Jun 30 13:46:06 2015 -0400
     1.2 +++ b/src/video/x11/SDL_x11events.c	Tue Jun 30 14:39:39 2015 -0400
     1.3 @@ -642,11 +642,17 @@
     1.4          }
     1.5      }
     1.6      if (!data) {
     1.7 -        /* The window for KeymapNotify events is 0 */
     1.8 +        /* The window for KeymapNotify, etc events is 0 */
     1.9          if (xevent.type == KeymapNotify) {
    1.10              if (SDL_GetKeyboardFocus() != NULL) {
    1.11                  X11_ReconcileKeyboardState(_this);
    1.12              }
    1.13 +        } else if (xevent.type == MappingNotify) {
    1.14 +            /* Has the keyboard layout changed? */
    1.15 +#ifdef DEBUG_XEVENTS
    1.16 +            printf("window %p: MappingNotify!\n", data);
    1.17 +#endif
    1.18 +            X11_UpdateKeymap(_this);
    1.19          }
    1.20          return;
    1.21      }
    1.22 @@ -762,15 +768,6 @@
    1.23          }
    1.24          break;
    1.25  
    1.26 -        /* Has the keyboard layout changed? */
    1.27 -    case MappingNotify:{
    1.28 -#ifdef DEBUG_XEVENTS
    1.29 -            printf("window %p: MappingNotify!\n", data);
    1.30 -#endif
    1.31 -            X11_UpdateKeymap(_this);
    1.32 -        }
    1.33 -        break;
    1.34 -
    1.35          /* Key press? */
    1.36      case KeyPress:{
    1.37              KeyCode keycode = xevent.xkey.keycode;