mirror of https://github.com/encounter/SDL.git
Fixed bug 2772 - SDL2 doesn't handle X KeymapNotify events
Jason Wyatt Currently the keymapnotify event handling is commented out as FIXME in SDL_x11events.c (It looks like this may have functioned SDL1.2). Not handling this event means that if a window manager shortcut such as ALT+SPACE is used, SDL will send an ALT key down signal, but not an up signal. Also querying SDL about the key state, it believes the ALT key remains pressed. X passes the events keypress (alt), ?focusout?, ?focusin?, keymapnotify.
This commit is contained in:
parent
a6df21cd00
commit
cb24f4de94
|
@ -40,6 +40,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*#define DEBUG_XEVENTS*/
|
||||||
|
|
||||||
#ifndef _NET_WM_MOVERESIZE_SIZE_TOPLEFT
|
#ifndef _NET_WM_MOVERESIZE_SIZE_TOPLEFT
|
||||||
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
|
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -132,7 +134,6 @@ static Atom X11_PickTargetFromAtoms(Display *disp, Atom a0, Atom a1, Atom a2)
|
||||||
if (a2 != None) atom[count++] = a2;
|
if (a2 != None) atom[count++] = a2;
|
||||||
return X11_PickTarget(disp, atom, count);
|
return X11_PickTarget(disp, atom, count);
|
||||||
}
|
}
|
||||||
/* #define DEBUG_XEVENTS */
|
|
||||||
|
|
||||||
struct KeyRepeatCheckData
|
struct KeyRepeatCheckData
|
||||||
{
|
{
|
||||||
|
@ -361,7 +362,7 @@ X11_GetNumLockModifierMask(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
X11_ReconcileKeyboardState(_THIS, const SDL_WindowData *data)
|
X11_ReconcileKeyboardState(_THIS)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
|
||||||
Display *display = viddata->display;
|
Display *display = viddata->display;
|
||||||
|
@ -413,7 +414,7 @@ X11_DispatchFocusIn(_THIS, SDL_WindowData *data)
|
||||||
printf("window %p: Dispatching FocusIn\n", data);
|
printf("window %p: Dispatching FocusIn\n", data);
|
||||||
#endif
|
#endif
|
||||||
SDL_SetKeyboardFocus(data->window);
|
SDL_SetKeyboardFocus(data->window);
|
||||||
X11_ReconcileKeyboardState(_this, data);
|
X11_ReconcileKeyboardState(_this);
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
#ifdef X_HAVE_UTF8_STRING
|
||||||
if (data->ic) {
|
if (data->ic) {
|
||||||
X11_XSetICFocus(data->ic);
|
X11_XSetICFocus(data->ic);
|
||||||
|
@ -633,6 +634,12 @@ X11_DispatchEvent(_THIS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
/* The window for KeymapNotify events is 0 */
|
||||||
|
if (xevent.type == KeymapNotify) {
|
||||||
|
if (SDL_GetKeyboardFocus() != NULL) {
|
||||||
|
X11_ReconcileKeyboardState(_this);
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,17 +754,6 @@ X11_DispatchEvent(_THIS)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generated upon EnterWindow and FocusIn */
|
|
||||||
case KeymapNotify:{
|
|
||||||
#ifdef DEBUG_XEVENTS
|
|
||||||
printf("window %p: KeymapNotify!\n", data);
|
|
||||||
#endif
|
|
||||||
/* FIXME:
|
|
||||||
X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Has the keyboard layout changed? */
|
/* Has the keyboard layout changed? */
|
||||||
case MappingNotify:{
|
case MappingNotify:{
|
||||||
#ifdef DEBUG_XEVENTS
|
#ifdef DEBUG_XEVENTS
|
||||||
|
|
Loading…
Reference in New Issue