From e14261dbb737e6177be95df6cea787401c1f7ad1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 6 Feb 2008 20:37:41 +0100 Subject: [PATCH] winex11: Use the gdi display when initializing the keyboard to avoid creating a second display connection. --- dlls/winex11.drv/keyboard.c | 10 ++++------ dlls/winex11.drv/x11drv.h | 2 +- dlls/winex11.drv/x11drv_main.c | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 5196d5e88e..b5f72610c2 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1468,9 +1468,8 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) * X11 lock must be held. */ static void -X11DRV_KEYBOARD_DetectLayout (void) +X11DRV_KEYBOARD_DetectLayout( Display *display ) { - Display *display = thread_display(); unsigned current, match, mismatch, seq, i, syms; int score, keyc, key, pkey, ok; KeySym keysym = 0; @@ -1577,9 +1576,8 @@ X11DRV_KEYBOARD_DetectLayout (void) /********************************************************************** * X11DRV_InitKeyboard */ -void X11DRV_InitKeyboard(void) +void X11DRV_InitKeyboard( Display *display ) { - Display *display = thread_display(); KeySym *ksp; XModifierKeymap *mmp; KeySym keysym; @@ -1621,7 +1619,7 @@ void X11DRV_InitKeyboard(void) XFreeModifiermap(mmp); /* Detect the keyboard layout */ - X11DRV_KEYBOARD_DetectLayout(); + X11DRV_KEYBOARD_DetectLayout( display ); lkey = main_key_tab[kbd_layout].key; syms = (keysyms_per_keycode > 4) ? 4 : keysyms_per_keycode; @@ -1969,7 +1967,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event ) wine_tsx11_lock(); XRefreshKeyboardMapping(&event->xmapping); wine_tsx11_unlock(); - X11DRV_InitKeyboard(); + X11DRV_InitKeyboard( thread_display() ); hwnd = GetFocus(); if (!hwnd) hwnd = GetActiveWindow(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 7af082c701..d7fb478d2f 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -712,7 +712,7 @@ extern void X11DRV_ResetSelectionOwner(void); extern void X11DRV_SetFocus( HWND hwnd ); extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr ); extern BOOL X11DRV_ClipCursor( LPCRECT clip ); -extern void X11DRV_InitKeyboard(void); +extern void X11DRV_InitKeyboard( Display *display ); extern void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD dwFlags, DWORD time, DWORD dwExtraInfo, UINT injected_flags ); extern void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 6f682c2a9e..444754b61a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -543,7 +543,7 @@ static BOOL process_attach(void) X11DRV_XComposite_Init(); #endif - X11DRV_InitKeyboard(); + X11DRV_InitKeyboard( gdi_display ); X11DRV_InitClipboard(); return TRUE;