mirror of https://github.com/encounter/SDL.git
Make sure the X event is an Xkb event before checking the Xkb event type
This commit is contained in:
parent
a1c125c1f5
commit
eda4c40732
|
@ -808,7 +808,8 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
|
|||
if (SDL_GetKeyboardFocus() != NULL) {
|
||||
X11_ReconcileKeyboardState(_this);
|
||||
}
|
||||
} else if (xevent->type == MappingNotify || xkbEvent->any.xkb_type == XkbStateNotify) {
|
||||
} else if (xevent->type == MappingNotify ||
|
||||
(xevent->type == videodata->xkb_event && xkbEvent->any.xkb_type == XkbStateNotify)) {
|
||||
/* Has the keyboard layout changed? */
|
||||
const int request = xevent->xmapping.request;
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ X11_InitKeyboard(_THIS)
|
|||
int xkb_major = XkbMajorVersion;
|
||||
int xkb_minor = XkbMinorVersion;
|
||||
|
||||
if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
|
||||
if (X11_XkbQueryExtension(data->display, NULL, &data->xkb_event, NULL, &xkb_major, &xkb_minor)) {
|
||||
data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ typedef struct SDL_VideoData
|
|||
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
|
||||
XkbDescPtr xkb;
|
||||
#endif
|
||||
int xkb_event;
|
||||
|
||||
KeyCode filter_code;
|
||||
Time filter_time;
|
||||
|
|
Loading…
Reference in New Issue