Support switching the keyboard layout with WINE running.
diff --git a/include/ts_xlib.h b/include/ts_xlib.h
index ac414b5..b3fb97c 100644
--- a/include/ts_xlib.h
+++ b/include/ts_xlib.h
@@ -106,6 +106,7 @@
extern int TSXQueryKeymap(Display*, char*);
extern int TSXQueryPointer(Display*, Window, Window*, Window*, int*, int*, int*, int*, unsigned int*);
extern int TSXQueryTree(Display*, Window, Window*, Window*, Window**, unsigned int*);
+extern int TSXRefreshKeyboardMapping(XMappingEvent*);
extern int TSXResetScreenSaver(Display*);
extern int TSXRestackWindows(Display*, Window*, int);
extern int TSXSendEvent(Display*, Window, int, long, XEvent*);
diff --git a/tsx11/X11_calls b/tsx11/X11_calls
index cab20a2..1a7a121 100644
--- a/tsx11/X11_calls
+++ b/tsx11/X11_calls
@@ -111,6 +111,7 @@
XQueryTree
XReconfigureWMWindow
XRectInRegion
+XRefreshKeyboardMapping
XResetScreenSaver
XResourceManagerString
XRestackWindows
diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c
index 6912f05..44e238b 100644
--- a/tsx11/ts_xlib.c
+++ b/tsx11/ts_xlib.c
@@ -1005,6 +1005,17 @@
return r;
}
+int TSXRefreshKeyboardMapping(XMappingEvent* a0)
+{
+ int r;
+ TRACE("Call XRefreshKeyboardMapping\n");
+ EnterCriticalSection( &X11DRV_CritSection );
+ r = XRefreshKeyboardMapping(a0);
+ LeaveCriticalSection( &X11DRV_CritSection );
+ TRACE("Ret XRefreshKeyboardMapping\n");
+ return r;
+}
+
int TSXResetScreenSaver(Display* a0)
{
int r;
diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c
index 1160865..b72a980 100644
--- a/windows/x11drv/event.c
+++ b/windows/x11drv/event.c
@@ -110,6 +110,7 @@
static void EVENT_ClientMessage( HWND hWnd, XClientMessageEvent *event );
static void EVENT_MapNotify( HWND pWnd, XMapEvent *event );
static void EVENT_UnmapNotify( HWND pWnd, XUnmapEvent *event );
+static void EVENT_MappingNotify( XMappingEvent *event );
#ifdef HAVE_LIBXXSHM
static void EVENT_ShmCompletion( XShmCompletionEvent *event );
@@ -323,7 +324,8 @@
}
if ( !hWnd && event->xany.window != X11DRV_GetXRootWindow()
- && event->type != PropertyNotify )
+ && event->type != PropertyNotify
+ && event->type != MappingNotify)
ERR("Got event %s for unknown Window %08lx\n",
event_names[event->type], event->xany.window );
else
@@ -462,6 +464,10 @@
EVENT_UnmapNotify( hWnd, (XUnmapEvent *)event );
break;
+ case MappingNotify:
+ EVENT_MappingNotify( (XMappingEvent *) event );
+ break;
+
default:
WARN("Unprocessed event %s for hwnd %04x\n",
event_names[event->type], hWnd );
@@ -1860,6 +1866,18 @@
WIN_ReleaseWndPtr(pWnd);
}
+/***********************************************************************
+ * EVENT_MappingNotify
+ */
+static void EVENT_MappingNotify( XMappingEvent *event )
+{
+ TSXRefreshKeyboardMapping(event);
+
+ /* reinitialize Wine-X11 driver keyboard table */
+ X11DRV_KEYBOARD_Init();
+}
+
+
/**********************************************************************
* X11DRV_EVENT_SetInputMethod
*/