Fix wxKeyEvent::GetKeyCode() for non-US keyboard layouts

Use the key code corresponding to the key in the US keyboard layout for
the key down/up events even when not actually using US layout, as this
is much more useful than simply returning 0 as was done before.

It also is compatible with the behaviour of the other ports.

Closes #17643.

Closes #23379.

See #23410.
This commit is contained in:
Ivan Sorokin 2023-03-31 02:43:28 +03:00 committed by Vadim Zeitlin
parent 24a96a78d2
commit 2c0f6a2aa0
5 changed files with 247 additions and 6 deletions

96
configure vendored
View file

@ -946,6 +946,8 @@ GSPELL_LIBS
GSPELL_CFLAGS
LIBSECRET_LIBS
LIBSECRET_CFLAGS
XKBCOMMON_LIBS
XKBCOMMON_CFLAGS
LIBICONV
CXXFLAGS_VISIBILITY
CFLAGS_VISIBILITY
@ -1415,6 +1417,8 @@ WAYLAND_EGL_CFLAGS
WAYLAND_EGL_LIBS
MesaGL_CFLAGS
MesaGL_LIBS
XKBCOMMON_CFLAGS
XKBCOMMON_LIBS
LIBSECRET_CFLAGS
LIBSECRET_LIBS
GSPELL_CFLAGS
@ -2446,6 +2450,10 @@ Some influential environment variables:
MesaGL_CFLAGS
C compiler flags for MesaGL, overriding pkg-config
MesaGL_LIBS linker flags for MesaGL, overriding pkg-config
XKBCOMMON_CFLAGS
C compiler flags for XKBCOMMON, overriding pkg-config
XKBCOMMON_LIBS
linker flags for XKBCOMMON, overriding pkg-config
LIBSECRET_CFLAGS
C compiler flags for LIBSECRET, overriding pkg-config
LIBSECRET_LIBS
@ -35834,6 +35842,94 @@ $as_echo "$as_me: WARNING: wxFileSystemWatcher won't be available on this platfo
fi
fi
if test "$wxUSE_GTK" = 1; then
if test "$USE_WIN32" != 1 -a "$USE_DARWIN" != 1; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XKBCOMMON" >&5
$as_echo_n "checking for XKBCOMMON... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$XKBCOMMON_CFLAGS"; then
pkg_cv_XKBCOMMON_CFLAGS="$XKBCOMMON_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xkbcommon\""; } >&5
($PKG_CONFIG --exists --print-errors "xkbcommon") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_XKBCOMMON_CFLAGS=`$PKG_CONFIG --cflags "xkbcommon" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$XKBCOMMON_LIBS"; then
pkg_cv_XKBCOMMON_LIBS="$XKBCOMMON_LIBS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xkbcommon\""; } >&5
($PKG_CONFIG --exists --print-errors "xkbcommon") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_XKBCOMMON_LIBS=`$PKG_CONFIG --libs "xkbcommon" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
XKBCOMMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xkbcommon"`
else
XKBCOMMON_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xkbcommon"`
fi
# Put the nasty error message in config.log where it belongs
echo "$XKBCOMMON_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libxkbcommon not found, key codes in key events may be incorrect" >&5
$as_echo "$as_me: WARNING: libxkbcommon not found, key codes in key events may be incorrect" >&2;}
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libxkbcommon not found, key codes in key events may be incorrect" >&5
$as_echo "$as_me: WARNING: libxkbcommon not found, key codes in key events may be incorrect" >&2;}
else
XKBCOMMON_CFLAGS=$pkg_cv_XKBCOMMON_CFLAGS
XKBCOMMON_LIBS=$pkg_cv_XKBCOMMON_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$XKBCOMMON_CFLAGS $CFLAGS"
CXXFLAGS="$XKBCOMMON_CFLAGS $CXXFLAGS"
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $XKBCOMMON_LIBS"
$as_echo "#define HAVE_XKBCOMMON 1" >>confdefs.h
fi
fi
fi
if test "$wxUSE_SECRETSTORE" = "yes"; then
if test "$wxUSE_MSW" != "1" -a "$wxUSE_OSX_COCOA" != 1; then