Make sure the X event is an Xkb event before checking the Xkb event type

This commit is contained in:
Sam Lantinga committed 2021-11-10 12:48:09 -08:00
1 parent a1c125c1f5
commit eda4c40732
3 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
}
+1
View File
@@ -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;