Commit ad5cb830 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Assume that Xkb extension is available.

parent 0410660d
......@@ -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
......
......@@ -1174,13 +1174,6 @@ then
# include <X11/Xutil.h>
#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
......
......@@ -34,9 +34,7 @@
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#ifdef HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
#endif
#include <ctype.h>
#include <stdarg.h>
......@@ -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 <e> */
/* 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<syms; i++) {
keysym = keycode_to_keysym(display, keyc, i);
keysym = XkbKeycodeToKeysym( display, keyc, 0, i );
if ((keysym<0x8000) && (keysym!=' '))
{
#ifdef HAVE_XKB
if (!use_xkb || !XkbTranslateKeySym(display, &keysym, 0, &ckey[i], 1, NULL))
#endif
if (!XkbTranslateKeySym(display, &keysym, 0, &ckey[i], 1, NULL))
{
/* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent
* with appropriate ShiftMask and Mode_switch, use XLookupString
......@@ -1822,7 +1805,7 @@ void X11DRV_InitKeyboard( Display *display )
for (scan = 0x60, keyc = min_keycode; keyc <= max_keycode; keyc++)
if (keyc2vkey[keyc]&&!keyc2scan[keyc]) {
const char *ksname;
keysym = keycode_to_keysym(display, keyc, 0);
keysym = XkbKeycodeToKeysym( display, keyc, 0, 0 );
ksname = XKeysymToString(keysym);
if (!ksname) ksname = "NoSymbol";
......@@ -1949,7 +1932,7 @@ SHORT X11DRV_VkKeyScanEx( WCHAR wChar, HKL hkl )
}
for (index = 0; index < 4; index++) /* find shift state */
if (keycode_to_keysym(display, keycode, index) == keysym) break;
if (XkbKeycodeToKeysym( display, keycode, 0, index ) == keysym) break;
pthread_mutex_unlock( &kbd_mutex );
......@@ -2201,7 +2184,7 @@ INT X11DRV_GetKeyNameText( LONG lParam, LPWSTR lpBuffer, INT nSize )
INT rc;
keyc = (KeyCode) keyi;
keys = keycode_to_keysym(display, keyc, 0);
keys = XkbKeycodeToKeysym( display, keyc, 0, 0 );
name = XKeysymToString(keys);
if (name && (vkey == VK_SHIFT || vkey == VK_CONTROL || vkey == VK_MENU))
......
......@@ -433,7 +433,6 @@ extern Window root_window DECLSPEC_HIDDEN;
extern BOOL clipping_cursor DECLSPEC_HIDDEN;
extern BOOL keyboard_grabbed DECLSPEC_HIDDEN;
extern unsigned int screen_bpp DECLSPEC_HIDDEN;
extern BOOL use_xkb DECLSPEC_HIDDEN;
extern BOOL usexrandr DECLSPEC_HIDDEN;
extern BOOL usexvidmode DECLSPEC_HIDDEN;
extern BOOL ximInComposeMode DECLSPEC_HIDDEN;
......
......@@ -36,9 +36,7 @@
#include <dlfcn.h>
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
#endif
#ifdef HAVE_X11_EXTENSIONS_XRENDER_H
#include <X11/extensions/Xrender.h>
#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 );
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment