From ad5cb8305f4ebc10992113f8f6a724d5f33a6bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 27 Feb 2023 10:57:58 +0100 Subject: [PATCH] winex11: Assume that Xkb extension is available. --- configure | 46 ---------------------------------- configure.ac | 7 ------ dlls/winex11.drv/keyboard.c | 37 ++++++++------------------- dlls/winex11.drv/x11drv.h | 1 - dlls/winex11.drv/x11drv_main.c | 14 +++-------- include/config.h.in | 3 --- 6 files changed, 13 insertions(+), 95 deletions(-) diff --git a/configure b/configure index 375ed1d6e5f..80f0acd1f78 100755 --- a/configure +++ b/configure @@ -14465,52 +14465,6 @@ then : fi - if test "$ac_cv_header_X11_XKBlib_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XkbQueryExtension in -lX11" >&5 -printf %s "checking for XkbQueryExtension in -lX11... " >&6; } -if test ${ac_cv_lib_X11_XkbQueryExtension+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lX11 $X_LIBS $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XkbQueryExtension (); -int -main (void) -{ -return XkbQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_X11_XkbQueryExtension=yes -else $as_nop - ac_cv_lib_X11_XkbQueryExtension=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XkbQueryExtension" >&5 -printf "%s\n" "$ac_cv_lib_X11_XkbQueryExtension" >&6; } -if test "x$ac_cv_lib_X11_XkbQueryExtension" = xyes -then : - -printf "%s\n" "#define HAVE_XKB 1" >>confdefs.h - -fi - - fi - if test "$ac_cv_header_X11_Xcursor_Xcursor_h" = "yes" then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXcursor" >&5 diff --git a/configure.ac b/configure.ac index 4feaa969e71..140f26aec16 100644 --- a/configure.ac +++ b/configure.ac @@ -1174,13 +1174,6 @@ then # include #endif]) - dnl *** Check for X keyboard extension - if test "$ac_cv_header_X11_XKBlib_h" = "yes" - then - AC_CHECK_LIB(X11, XkbQueryExtension, - AC_DEFINE(HAVE_XKB, 1, [Define if you have the XKB extension]),,[$X_LIBS $X_EXTRA_LIBS]) - fi - dnl *** Check for X cursor if test "$ac_cv_header_X11_Xcursor_Xcursor_h" = "yes" then diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index f1ad4b01669..616728be621 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -34,9 +34,7 @@ #include #include #include -#ifdef HAVE_X11_XKBLIB_H #include -#endif #include #include @@ -66,7 +64,6 @@ WINE_DECLARE_DEBUG_CHANNEL(key); static const unsigned int ControlMask = 1 << 2; static int min_keycode, max_keycode, keysyms_per_keycode; -static KeySym *key_mapping; static WORD keyc2vkey[256], keyc2scan[256]; static int NumLockMask, ScrollLockMask, AltGrMask; /* mask in the XKeyEvent state */ @@ -1089,14 +1086,6 @@ static const WORD xfree86_vendor_key_vkey[256] = 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */ }; -static inline KeySym keycode_to_keysym( Display *display, KeyCode keycode, int index ) -{ -#ifdef HAVE_XKB - if (use_xkb) return XkbKeycodeToKeysym(display, keycode, 0, index); -#endif - return key_mapping[(keycode - min_keycode) * keysyms_per_keycode + index]; -} - /* Returns the Windows virtual key code associated with the X event */ /* kbd_section must be held */ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e) @@ -1442,13 +1431,11 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) for (keyc = min_keycode; keyc <= max_keycode; keyc++) { /* get data for keycode from X server */ for (i = 0; i < syms; i++) { - if (!(keysym = keycode_to_keysym (display, keyc, i))) continue; + if (!(keysym = XkbKeycodeToKeysym( display, keyc, 0, i ))) continue; /* Allow both one-byte and two-byte national keysyms */ if ((keysym < 0x8000) && (keysym != ' ')) { -#ifdef HAVE_XKB - if (!use_xkb || !XkbTranslateKeySym(display, &keysym, 0, &ckey[keyc][i], 1, NULL)) -#endif + if (!XkbTranslateKeySym(display, &keysym, 0, &ckey[keyc][i], 1, NULL)) { TRACE("XKB could not translate keysym %04lx\n", keysym); /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent @@ -1597,9 +1584,7 @@ void X11DRV_InitKeyboard( Display *display ) pthread_mutex_lock( &kbd_mutex ); XDisplayKeycodes(display, &min_keycode, &max_keycode); - if (key_mapping) XFree( key_mapping ); - key_mapping = XGetKeyboardMapping(display, min_keycode, - max_keycode + 1 - min_keycode, &keysyms_per_keycode); + XFree( XGetKeyboardMapping( display, min_keycode, max_keycode + 1 - min_keycode, &keysyms_per_keycode ) ); mmp = XGetModifierMapping(display); kcp = mmp->modifiermap; @@ -1613,12 +1598,12 @@ void X11DRV_InitKeyboard( Display *display ) int k; for (k = 0; k < keysyms_per_keycode; k += 1) - if (keycode_to_keysym(display, *kcp, k) == XK_Num_Lock) + if (XkbKeycodeToKeysym( display, *kcp, 0, k ) == XK_Num_Lock) { NumLockMask = 1 << i; TRACE_(key)("NumLockMask is %x\n", NumLockMask); } - else if (keycode_to_keysym(display, *kcp, k) == XK_Scroll_Lock) + else if (XkbKeycodeToKeysym( display, *kcp, 0, k ) == XK_Scroll_Lock) { ScrollLockMask = 1 << i; TRACE_(key)("ScrollLockMask is %x\n", ScrollLockMask); @@ -1670,12 +1655,10 @@ void X11DRV_InitKeyboard( Display *display ) /* we seem to need to search the layout-dependent scancodes */ int maxlen=0,maxval=-1,ok; for (i=0; i #include #include -#ifdef HAVE_XKB #include -#endif #ifdef HAVE_X11_EXTENSIONS_XRENDER_H #include #endif @@ -72,7 +70,6 @@ Window root_window; BOOL usexvidmode = TRUE; BOOL usexrandr = TRUE; BOOL usexcomposite = TRUE; -BOOL use_xkb = TRUE; BOOL use_take_focus = TRUE; BOOL use_primary_selection = FALSE; BOOL use_system_cursors = TRUE; @@ -708,9 +705,7 @@ static NTSTATUS x11drv_init( void *arg ) #endif X11DRV_XInput2_Init(); -#ifdef HAVE_XKB - if (use_xkb) use_xkb = XkbUseExtension( gdi_display, NULL, NULL ); -#endif + XkbUseExtension( gdi_display, NULL, NULL ); X11DRV_InitKeyboard( gdi_display ); if (use_xim) use_xim = X11DRV_InitXIM( input_style ); @@ -789,11 +784,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) fcntl( ConnectionNumber(data->display), F_SETFD, 1 ); /* set close on exec flag */ -#ifdef HAVE_XKB - if (use_xkb && XkbUseExtension( data->display, NULL, NULL )) - XkbSetDetectableAutoRepeat( data->display, True, NULL ); -#endif - + XkbUseExtension( data->display, NULL, NULL ); + XkbSetDetectableAutoRepeat( data->display, True, NULL ); if (TRACE_ON(synchronous)) XSynchronize( data->display, True ); set_queue_display_fd( data->display ); diff --git a/include/config.h.in b/include/config.h.in index fe2fc36a914..44ea547b7ec 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -696,9 +696,6 @@ /* Define to 1 if `callback' is a member of `XICCallback'. */ #undef HAVE_XICCALLBACK_CALLBACK -/* Define if you have the XKB extension */ -#undef HAVE_XKB - /* Define if Xrender has the XRenderCreateLinearGradient function */ #undef HAVE_XRENDERCREATELINEARGRADIENT