From fa8b7281cd3c071013805c913a86fc8660dc8ca7 Mon Sep 17 00:00:00 2001 From: Stephane Lussier Date: Sun, 16 Apr 2000 17:07:27 +0000 Subject: [PATCH] Support switching the keyboard layout with WINE running. --- include/ts_xlib.h | 1 + tsx11/X11_calls | 1 + tsx11/ts_xlib.c | 11 +++++++++++ windows/x11drv/event.c | 20 +++++++++++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/include/ts_xlib.h b/include/ts_xlib.h index ac414b5ac3e..b3fb97cd78b 100644 --- a/include/ts_xlib.h +++ b/include/ts_xlib.h @@ -106,6 +106,7 @@ extern int TSXQueryColor(Display*, Colormap, XColor*); 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 cab20a2179e..1a7a121d1ff 100644 --- a/tsx11/X11_calls +++ b/tsx11/X11_calls @@ -111,6 +111,7 @@ XQueryPointer XQueryTree XReconfigureWMWindow XRectInRegion +XRefreshKeyboardMapping XResetScreenSaver XResourceManagerString XRestackWindows diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c index 6912f058736..44e238bc631 100644 --- a/tsx11/ts_xlib.c +++ b/tsx11/ts_xlib.c @@ -1005,6 +1005,17 @@ int TSXQueryTree(Display* a0, Window a1, Window* a2, Window* a3, Window** a4, 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 11608659c45..b72a980adc4 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -110,6 +110,7 @@ static void EVENT_PropertyNotify( XPropertyEvent *event ); 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 @@ static void EVENT_ProcessEvent( XEvent *event ) } 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 @@ static void EVENT_ProcessEvent( XEvent *event ) 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 @@ void EVENT_UnmapNotify( HWND hWnd, XUnmapEvent *event ) 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 */