mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Replaced winex11-key_translation with winex11-Fixed-scancodes.
This commit is contained in:
parent
7a0d4fb5b3
commit
c1951fe5d2
@ -235,6 +235,7 @@ patch_enable_all ()
|
||||
enable_winepulse_PulseAudio_Support="$1"
|
||||
enable_winepulse_aux_channels="$1"
|
||||
enable_winex11_CandidateWindowPos="$1"
|
||||
enable_winex11_Fixed_scancodes="$1"
|
||||
enable_winex11_MWM_Decorations="$1"
|
||||
enable_winex11_UpdateLayeredWindow="$1"
|
||||
enable_winex11_Vulkan_support="$1"
|
||||
@ -718,6 +719,9 @@ patch_enable ()
|
||||
winex11-CandidateWindowPos)
|
||||
enable_winex11_CandidateWindowPos="$2"
|
||||
;;
|
||||
winex11-Fixed-scancodes)
|
||||
enable_winex11_Fixed_scancodes="$2"
|
||||
;;
|
||||
winex11-MWM_Decorations)
|
||||
enable_winex11_MWM_Decorations="$2"
|
||||
;;
|
||||
@ -1126,6 +1130,13 @@ if test "$enable_winex11_WM_WINDOWPOSCHANGING" -eq 1; then
|
||||
enable_winex11__NET_ACTIVE_WINDOW=1
|
||||
fi
|
||||
|
||||
if test "$enable_winex11_Fixed_scancodes" -eq 1; then
|
||||
if test "$enable_winecfg_Staging" -gt 1; then
|
||||
abort "Patchset winecfg-Staging disabled, but winex11-Fixed-scancodes depends on that."
|
||||
fi
|
||||
enable_winecfg_Staging=1
|
||||
fi
|
||||
|
||||
if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then
|
||||
if test "$enable_wined3d_SWVP_shaders" -gt 1; then
|
||||
abort "Patchset wined3d-SWVP-shaders disabled, but wined3d-Indexed_Vertex_Blending depends on that."
|
||||
@ -3411,6 +3422,32 @@ if test "$enable_winex11_CandidateWindowPos" -eq 1; then
|
||||
patch_apply winex11-CandidateWindowPos/0001-winex11.drv-Update-a-candidate-window-s-position-wit.patch
|
||||
fi
|
||||
|
||||
# Patchset winex11-Fixed-scancodes
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * winecfg-Staging
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#30984] Improve key translation.
|
||||
# | * [#45605] Letter keys doesn't work in DirectX aplications
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * MAINTAINERS, dlls/winex11.drv/keyboard.c, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c,
|
||||
# | programs/winecfg/Makefile.in, programs/winecfg/input.c, programs/winecfg/main.c, programs/winecfg/resource.h,
|
||||
# | programs/winecfg/winecfg.h, programs/winecfg/winecfg.rc, programs/winecfg/x11drvdlg.c
|
||||
# |
|
||||
if test "$enable_winex11_Fixed_scancodes" -eq 1; then
|
||||
patch_apply winex11-Fixed-scancodes/0001-winecfg-Move-input-config-options-to-a-dedicated-tab.patch
|
||||
patch_apply winex11-Fixed-scancodes/0002-winex11-Always-create-the-HKCU-configuration-registr.patch
|
||||
patch_apply winex11-Fixed-scancodes/0003-winex11-Write-supported-keyboard-layout-list-in-regi.patch
|
||||
patch_apply winex11-Fixed-scancodes/0004-winecfg-Add-a-keyboard-layout-selection-config-optio.patch
|
||||
patch_apply winex11-Fixed-scancodes/0005-winex11-Use-the-user-configured-keyboard-layout-if-a.patch
|
||||
patch_apply winex11-Fixed-scancodes/0006-winecfg-Add-a-keyboard-scancode-detection-toggle-opt.patch
|
||||
patch_apply winex11-Fixed-scancodes/0007-winex11-Use-scancode-high-bit-to-set-KEYEVENTF_EXTEN.patch
|
||||
patch_apply winex11-Fixed-scancodes/0008-winex11-Support-fixed-X11-keycode-to-scancode-conver.patch
|
||||
patch_apply winex11-Fixed-scancodes/0009-winex11-Disable-keyboard-scancode-auto-detection-by-.patch
|
||||
fi
|
||||
|
||||
# Patchset winex11-MWM_Decorations
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -0,0 +1,357 @@
|
||||
From acd27b95daa9e118fc2c1b4191fd9a7c828ae017 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 5 Jan 2023 21:16:38 +0100
|
||||
Subject: [PATCH 1/9] winecfg: Move input config options to a dedicated tab.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
programs/winecfg/Makefile.in | 1 +
|
||||
programs/winecfg/input.c | 105 +++++++++++++++++++++++++++++++++++
|
||||
programs/winecfg/main.c | 12 +++-
|
||||
programs/winecfg/resource.h | 6 +-
|
||||
programs/winecfg/winecfg.h | 4 ++
|
||||
programs/winecfg/winecfg.rc | 36 +++++++-----
|
||||
programs/winecfg/x11drvdlg.c | 18 +-----
|
||||
8 files changed, 150 insertions(+), 33 deletions(-)
|
||||
create mode 100644 programs/winecfg/input.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 276471287da..fa155217267 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -179,6 +179,7 @@ F: dlls/user32/input.c
|
||||
F: dlls/win32u/input.c
|
||||
F: dlls/win32u/rawinput.c
|
||||
F: server/queue.c
|
||||
+F: programs/winecfg/input.c
|
||||
|
||||
Input methods
|
||||
M: Aric Stewart <aric@codeweavers.com>
|
||||
diff --git a/programs/winecfg/Makefile.in b/programs/winecfg/Makefile.in
|
||||
index 80d2f1991dc..5c46b935234 100644
|
||||
--- a/programs/winecfg/Makefile.in
|
||||
+++ b/programs/winecfg/Makefile.in
|
||||
@@ -9,6 +9,7 @@ C_SRCS = \
|
||||
audio.c \
|
||||
drive.c \
|
||||
driveui.c \
|
||||
+ input.c \
|
||||
libraries.c \
|
||||
main.c \
|
||||
staging.c \
|
||||
diff --git a/programs/winecfg/input.c b/programs/winecfg/input.c
|
||||
new file mode 100644
|
||||
index 00000000000..115161b9040
|
||||
--- /dev/null
|
||||
+++ b/programs/winecfg/input.c
|
||||
@@ -0,0 +1,105 @@
|
||||
+/*
|
||||
+ * Copyright 2023 Rémi Bernon for CodeWeavers
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+#define COBJMACROS
|
||||
+#include "windef.h"
|
||||
+#include "winbase.h"
|
||||
+
|
||||
+#include "winecfg.h"
|
||||
+#include "resource.h"
|
||||
+
|
||||
+#include "wine/debug.h"
|
||||
+
|
||||
+WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
|
||||
+
|
||||
+static BOOL updating_ui;
|
||||
+
|
||||
+static void init_dialog( HWND dialog )
|
||||
+{
|
||||
+ WCHAR *buffer;
|
||||
+
|
||||
+ convert_x11_desktop_key();
|
||||
+
|
||||
+ updating_ui = TRUE;
|
||||
+
|
||||
+ buffer = get_reg_key( config_key, keypath( L"X11 Driver" ), L"GrabFullscreen", L"N" );
|
||||
+ if (IS_OPTION_TRUE( *buffer )) CheckDlgButton( dialog, IDC_FULLSCREEN_GRAB, BST_CHECKED );
|
||||
+ else CheckDlgButton( dialog, IDC_FULLSCREEN_GRAB, BST_UNCHECKED );
|
||||
+ free( buffer );
|
||||
+
|
||||
+ updating_ui = FALSE;
|
||||
+}
|
||||
+
|
||||
+static void on_fullscreen_grab_clicked( HWND dialog )
|
||||
+{
|
||||
+ BOOL checked = IsDlgButtonChecked( dialog, IDC_FULLSCREEN_GRAB ) == BST_CHECKED;
|
||||
+ if (checked) set_reg_key( config_key, keypath( L"X11 Driver" ), L"GrabFullscreen", L"Y" );
|
||||
+ else set_reg_key( config_key, keypath( L"X11 Driver" ), L"GrabFullscreen", L"N" );
|
||||
+}
|
||||
+
|
||||
+INT_PTR CALLBACK InputDlgProc( HWND dialog, UINT message, WPARAM wparam, LPARAM lparam )
|
||||
+{
|
||||
+ TRACE( "dialog %p, message %#x, wparam %#Ix, lparam %#Ix\n", dialog, message, wparam, lparam );
|
||||
+
|
||||
+ switch (message)
|
||||
+ {
|
||||
+ case WM_SHOWWINDOW:
|
||||
+ set_window_title( dialog );
|
||||
+ break;
|
||||
+
|
||||
+ case WM_COMMAND:
|
||||
+ switch (HIWORD(wparam))
|
||||
+ {
|
||||
+ case BN_CLICKED:
|
||||
+ if (updating_ui) break;
|
||||
+ SendMessageW( GetParent( dialog ), PSM_CHANGED, 0, 0 );
|
||||
+ switch (LOWORD(wparam))
|
||||
+ {
|
||||
+ case IDC_FULLSCREEN_GRAB: on_fullscreen_grab_clicked( dialog ); break;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case WM_NOTIFY:
|
||||
+ switch (((LPNMHDR)lparam)->code)
|
||||
+ {
|
||||
+ case PSN_KILLACTIVE:
|
||||
+ SetWindowLongPtrW( dialog, DWLP_MSGRESULT, FALSE );
|
||||
+ break;
|
||||
+ case PSN_APPLY:
|
||||
+ apply();
|
||||
+ SetWindowLongPtrW( dialog, DWLP_MSGRESULT, PSNRET_NOERROR );
|
||||
+ break;
|
||||
+ case PSN_SETACTIVE:
|
||||
+ init_dialog( dialog );
|
||||
+ break;
|
||||
+ case LVN_ITEMCHANGED:
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case WM_INITDIALOG:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
|
||||
index e2429c0c047..2ce3020db50 100644
|
||||
--- a/programs/winecfg/main.c
|
||||
+++ b/programs/winecfg/main.c
|
||||
@@ -58,7 +58,7 @@ PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#define NUM_PROPERTY_PAGES 8
|
||||
+#define NUM_PROPERTY_PAGES 9
|
||||
|
||||
static INT_PTR
|
||||
doPropertySheet (HINSTANCE hInstance, HWND hOwner)
|
||||
@@ -149,6 +149,16 @@ doPropertySheet (HINSTANCE hInstance, HWND hOwner)
|
||||
psp[pg].lParam = 0;
|
||||
pg++;
|
||||
|
||||
+ psp[pg].dwSize = sizeof (PROPSHEETPAGEW);
|
||||
+ psp[pg].dwFlags = PSP_USETITLE;
|
||||
+ psp[pg].hInstance = hInstance;
|
||||
+ psp[pg].u.pszTemplate = MAKEINTRESOURCEW (IDD_INPUT_CONFIG);
|
||||
+ psp[pg].u2.pszIcon = NULL;
|
||||
+ psp[pg].pfnDlgProc = InputDlgProc;
|
||||
+ psp[pg].pszTitle = load_string (IDS_TAB_INPUT);
|
||||
+ psp[pg].lParam = 0;
|
||||
+ pg++;
|
||||
+
|
||||
/*
|
||||
* Fill out the (General) PROPSHEETPAGE data structure
|
||||
* for the property sheet
|
||||
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
|
||||
index d77f6a23a5a..78deb1a23a2 100644
|
||||
--- a/programs/winecfg/resource.h
|
||||
+++ b/programs/winecfg/resource.h
|
||||
@@ -46,6 +46,7 @@
|
||||
#define IDS_LINKS_TO 17
|
||||
#define IDS_WINECFG_TITLE_APP 18 /* App specific title */
|
||||
#define IDS_TAB_STAGING 19
|
||||
+#define IDS_TAB_INPUT 20
|
||||
#define IDI_WINECFG 100
|
||||
#define IDI_LOGO 102
|
||||
#define IDD_ABOUTCFG 107
|
||||
@@ -56,6 +57,7 @@
|
||||
#define IDD_DRIVECFG 112
|
||||
#define IDD_DESKTOP_INTEGRATION 115
|
||||
#define IDD_STAGING 116
|
||||
+#define IDD_INPUT_CONFIG 117
|
||||
#define IDC_WINVER 1012
|
||||
#define IDC_DESKTOP_WIDTH 1023
|
||||
#define IDC_DESKTOP_HEIGHT 1024
|
||||
@@ -126,7 +128,6 @@
|
||||
/* graphics */
|
||||
#define IDC_ENABLE_MANAGED 1100
|
||||
#define IDC_ENABLE_DECORATED 1101
|
||||
-#define IDC_FULLSCREEN_GRAB 1102
|
||||
|
||||
#define IDC_RES_TRACKBAR 1107
|
||||
#define IDC_RES_DPIEDIT 1108
|
||||
@@ -227,3 +228,6 @@
|
||||
#define IDC_ABT_TITLE_TEXT 8436
|
||||
#define IDC_ABT_WEB_LINK 8437
|
||||
#define IDC_ABT_LICENSE_TEXT 8438
|
||||
+
|
||||
+/* input tab */
|
||||
+#define IDC_FULLSCREEN_GRAB 1501
|
||||
diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
|
||||
index d4fedff5afb..b83234470c1 100644
|
||||
--- a/programs/winecfg/winecfg.h
|
||||
+++ b/programs/winecfg/winecfg.h
|
||||
@@ -74,6 +74,9 @@ WCHAR *keypath(const WCHAR *section);
|
||||
BOOL initialize(HINSTANCE hInstance);
|
||||
extern HKEY config_key;
|
||||
|
||||
+/* winex11 registry */
|
||||
+void convert_x11_desktop_key(void);
|
||||
+
|
||||
/* hack for the property sheet control */
|
||||
void set_window_title(HWND dialog);
|
||||
|
||||
@@ -87,6 +90,7 @@ INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK StagingDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
+INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* Windows version management */
|
||||
BOOL set_winver_from_string(const WCHAR *version);
|
||||
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
|
||||
index 9041a8fa2d1..605ec54632c 100644
|
||||
--- a/programs/winecfg/winecfg.rc
|
||||
+++ b/programs/winecfg/winecfg.rc
|
||||
@@ -40,6 +40,7 @@ BEGIN
|
||||
IDS_TAB_AUDIO "Audio"
|
||||
IDS_TAB_STAGING "Staging"
|
||||
IDS_TAB_ABOUT "About"
|
||||
+ IDS_TAB_INPUT "Input"
|
||||
IDS_WINECFG_TITLE "Wine configuration"
|
||||
IDS_WINECFG_TITLE_APP "Wine configuration for %s"
|
||||
IDS_THEMEFILE "Theme files (*.msstyles; *.theme)"
|
||||
@@ -165,22 +166,21 @@ IDD_GRAPHCFG DIALOG 0, 0, 260, 220
|
||||
STYLE WS_CHILD | WS_DISABLED
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
- GROUPBOX "Window settings",IDC_STATIC,8,4,244,84
|
||||
- CONTROL "Automatically capture the &mouse in full-screen windows",IDC_FULLSCREEN_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,20,230,10
|
||||
- CONTROL "Allow the window manager to &decorate the windows",IDC_ENABLE_DECORATED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,32,230,10
|
||||
- CONTROL "Allow the &window manager to control the windows",IDC_ENABLE_MANAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,44,230,10
|
||||
+ GROUPBOX "Window settings",IDC_STATIC,8,4,244,72
|
||||
+ CONTROL "Allow the window manager to &decorate the windows",IDC_ENABLE_DECORATED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,20,230,10
|
||||
+ CONTROL "Allow the &window manager to control the windows",IDC_ENABLE_MANAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,32,230,10
|
||||
CONTROL "&Emulate a virtual desktop",IDC_ENABLE_DESKTOP,"Button",
|
||||
- BS_AUTOCHECKBOX | WS_TABSTOP,15,56,230,10
|
||||
- LTEXT "Desktop &size:",IDC_DESKTOP_SIZE,15,70,64,16,WS_DISABLED
|
||||
- LTEXT "#msgctxt#do not translate#X",IDC_DESKTOP_BY,129,70,8,8,WS_DISABLED
|
||||
- EDITTEXT IDC_DESKTOP_WIDTH,84,68,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
|
||||
- EDITTEXT IDC_DESKTOP_HEIGHT,137,68,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
|
||||
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,44,230,10
|
||||
+ LTEXT "Desktop &size:",IDC_DESKTOP_SIZE,15,58,64,16,WS_DISABLED
|
||||
+ LTEXT "#msgctxt#do not translate#X",IDC_DESKTOP_BY,129,58,8,8,WS_DISABLED
|
||||
+ EDITTEXT IDC_DESKTOP_WIDTH,84,56,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
|
||||
+ EDITTEXT IDC_DESKTOP_HEIGHT,137,56,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
|
||||
|
||||
- GROUPBOX "Screen resolution",IDC_STATIC,8,95,244,84
|
||||
- CONTROL "", IDC_RES_TRACKBAR, "msctls_trackbar32",WS_TABSTOP,12,105,171,15
|
||||
- EDITTEXT IDC_RES_DPIEDIT,188,105,23,13,ES_NUMBER|WS_TABSTOP
|
||||
- LTEXT "#msgctxt#unit: dots/inch#dpi",IDC_STATIC,215,107,30,8
|
||||
- LTEXT "This is a sample text using 10 point Tahoma",IDC_RES_FONT_PREVIEW,15,124,230,49
|
||||
+ GROUPBOX "Screen resolution",IDC_STATIC,8,83,244,84
|
||||
+ CONTROL "", IDC_RES_TRACKBAR, "msctls_trackbar32",WS_TABSTOP,12,93,171,15
|
||||
+ EDITTEXT IDC_RES_DPIEDIT,188,93,23,13,ES_NUMBER|WS_TABSTOP
|
||||
+ LTEXT "#msgctxt#unit: dots/inch#dpi",IDC_STATIC,215,95,30,8
|
||||
+ LTEXT "This is a sample text using 10 point Tahoma",IDC_RES_FONT_PREVIEW,15,112,230,49
|
||||
END
|
||||
|
||||
IDD_DLLCFG DIALOG 0, 0, 260, 220
|
||||
@@ -324,6 +324,14 @@ BEGIN
|
||||
CONTROL "Enable >K3 Theming",IDC_ENABLE_GTK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,100,230,8
|
||||
END
|
||||
|
||||
+IDD_INPUT_CONFIG DIALOG 0, 0, 260, 220
|
||||
+STYLE WS_CHILD | WS_DISABLED
|
||||
+FONT 8, "MS Shell Dlg"
|
||||
+BEGIN
|
||||
+ GROUPBOX "Mouse settings",IDC_STATIC,8,4,244,64
|
||||
+ CONTROL "Automatically capture the &mouse in full-screen windows",IDC_FULLSCREEN_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,20,230,10
|
||||
+END
|
||||
+
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
||||
/* @makedep: winecfg.ico */
|
||||
diff --git a/programs/winecfg/x11drvdlg.c b/programs/winecfg/x11drvdlg.c
|
||||
index 215cd6534a2..cd7b7552a1e 100644
|
||||
--- a/programs/winecfg/x11drvdlg.c
|
||||
+++ b/programs/winecfg/x11drvdlg.c
|
||||
@@ -47,7 +47,7 @@ static const UINT dpi_values[] = { 96, 120, 144, 168, 192, 216, 240, 288, 336, 3
|
||||
static BOOL updating_ui;
|
||||
|
||||
/* convert the x11 desktop key to the new explorer config */
|
||||
-static void convert_x11_desktop_key(void)
|
||||
+void convert_x11_desktop_key(void)
|
||||
{
|
||||
WCHAR *buf;
|
||||
|
||||
@@ -139,13 +139,6 @@ static void init_dialog(HWND dialog)
|
||||
SendDlgItemMessageW(dialog, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
|
||||
}
|
||||
|
||||
- buf = get_reg_key(config_key, keypath(L"X11 Driver"), L"GrabFullscreen", L"N");
|
||||
- if (IS_OPTION_TRUE(*buf))
|
||||
- CheckDlgButton(dialog, IDC_FULLSCREEN_GRAB, BST_CHECKED);
|
||||
- else
|
||||
- CheckDlgButton(dialog, IDC_FULLSCREEN_GRAB, BST_UNCHECKED);
|
||||
- free(buf);
|
||||
-
|
||||
buf = get_reg_key(config_key, keypath(L"X11 Driver"), L"Managed", L"Y");
|
||||
if (IS_OPTION_TRUE(*buf))
|
||||
CheckDlgButton(dialog, IDC_ENABLE_MANAGED, BST_CHECKED);
|
||||
@@ -220,14 +213,6 @@ static void on_enable_decorated_clicked(HWND dialog) {
|
||||
}
|
||||
}
|
||||
|
||||
-static void on_fullscreen_grab_clicked(HWND dialog)
|
||||
-{
|
||||
- if (IsDlgButtonChecked(dialog, IDC_FULLSCREEN_GRAB) == BST_CHECKED)
|
||||
- set_reg_key(config_key, keypath(L"X11 Driver"), L"GrabFullscreen", L"Y");
|
||||
- else
|
||||
- set_reg_key(config_key, keypath(L"X11 Driver"), L"GrabFullscreen", L"N");
|
||||
-}
|
||||
-
|
||||
static INT read_logpixels_reg(void)
|
||||
{
|
||||
DWORD dwLogPixels;
|
||||
@@ -383,7 +368,6 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
case IDC_ENABLE_DESKTOP: on_enable_desktop_clicked(hDlg); break;
|
||||
case IDC_ENABLE_MANAGED: on_enable_managed_clicked(hDlg); break;
|
||||
case IDC_ENABLE_DECORATED: on_enable_decorated_clicked(hDlg); break;
|
||||
- case IDC_FULLSCREEN_GRAB: on_fullscreen_grab_clicked(hDlg); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,111 @@
|
||||
From 9b1c1240b270142564a8ef9350720c92004efcc3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 6 Jan 2023 11:22:10 +0100
|
||||
Subject: [PATCH 2/9] winex11: Always create the HKCU configuration registry
|
||||
key.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
dlls/winex11.drv/x11drv_main.c | 67 ++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 64 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index 797e4f92d38..e04bdedd43a 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -356,11 +356,61 @@ HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len )
|
||||
return NtOpenKeyEx( &ret, MAXIMUM_ALLOWED, &attr, 0 ) ? 0 : ret;
|
||||
}
|
||||
|
||||
+/* wrapper for NtCreateKey that creates the key recursively if necessary */
|
||||
+static HKEY reg_create_key( HKEY root, const WCHAR *name, ULONG name_len,
|
||||
+ DWORD options, DWORD *disposition )
|
||||
+{
|
||||
+ UNICODE_STRING nameW = { name_len, name_len, (WCHAR *)name };
|
||||
+ OBJECT_ATTRIBUTES attr;
|
||||
+ NTSTATUS status;
|
||||
+ HANDLE ret;
|
||||
|
||||
-HKEY open_hkcu_key( const char *name )
|
||||
+ attr.Length = sizeof(attr);
|
||||
+ attr.RootDirectory = root;
|
||||
+ attr.ObjectName = &nameW;
|
||||
+ attr.Attributes = 0;
|
||||
+ attr.SecurityDescriptor = NULL;
|
||||
+ attr.SecurityQualityOfService = NULL;
|
||||
+
|
||||
+ status = NtCreateKey( &ret, MAXIMUM_ALLOWED, &attr, 0, NULL, options, disposition );
|
||||
+ if (status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||
+ {
|
||||
+ static const WCHAR registry_rootW[] = { '\\','R','e','g','i','s','t','r','y','\\' };
|
||||
+ DWORD pos = 0, i = 0, len = name_len / sizeof(WCHAR);
|
||||
+
|
||||
+ /* don't try to create registry root */
|
||||
+ if (!root && len > ARRAY_SIZE(registry_rootW) &&
|
||||
+ !memcmp( name, registry_rootW, sizeof(registry_rootW) ))
|
||||
+ i += ARRAY_SIZE(registry_rootW);
|
||||
+
|
||||
+ while (i < len && name[i] != '\\') i++;
|
||||
+ if (i == len) return 0;
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ unsigned int subkey_options = options;
|
||||
+ if (i < len) subkey_options &= ~(REG_OPTION_CREATE_LINK | REG_OPTION_OPEN_LINK);
|
||||
+ nameW.Buffer = (WCHAR *)name + pos;
|
||||
+ nameW.Length = (i - pos) * sizeof(WCHAR);
|
||||
+ status = NtCreateKey( &ret, MAXIMUM_ALLOWED, &attr, 0, NULL, subkey_options, disposition );
|
||||
+
|
||||
+ if (attr.RootDirectory != root) NtClose( attr.RootDirectory );
|
||||
+ if (!NT_SUCCESS(status)) return 0;
|
||||
+ if (i == len) break;
|
||||
+ attr.RootDirectory = ret;
|
||||
+ while (i < len && name[i] == '\\') i++;
|
||||
+ pos = i;
|
||||
+ while (i < len && name[i] != '\\') i++;
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static HKEY reg_open_hkcu_key( const char *name, BOOL create )
|
||||
{
|
||||
WCHAR bufferW[256];
|
||||
static HKEY hkcu;
|
||||
+ DWORD disp;
|
||||
+ HKEY key;
|
||||
|
||||
if (!hkcu)
|
||||
{
|
||||
@@ -385,7 +435,18 @@ HKEY open_hkcu_key( const char *name )
|
||||
hkcu = reg_open_key( NULL, bufferW, len * sizeof(WCHAR) );
|
||||
}
|
||||
|
||||
- return reg_open_key( hkcu, bufferW, asciiz_to_unicode( bufferW, name ) - sizeof(WCHAR) );
|
||||
+ if ((key = reg_open_key( hkcu, bufferW, asciiz_to_unicode( bufferW, name ) - sizeof(WCHAR) )) || !create) return key;
|
||||
+ return reg_create_key( hkcu, bufferW, asciiz_to_unicode( bufferW, name ) - sizeof(WCHAR), 0, &disp );
|
||||
+}
|
||||
+
|
||||
+HKEY open_hkcu_key( const char *name )
|
||||
+{
|
||||
+ return reg_open_hkcu_key( name, FALSE );
|
||||
+}
|
||||
+
|
||||
+static HKEY create_hkcu_key( const char *name )
|
||||
+{
|
||||
+ return reg_open_hkcu_key( name, TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -449,7 +510,7 @@ static void setup_options(void)
|
||||
DWORD len;
|
||||
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver */
|
||||
- hkey = open_hkcu_key( "Software\\Wine\\X11 Driver" );
|
||||
+ hkey = create_hkcu_key( "Software\\Wine\\X11 Driver" );
|
||||
|
||||
/* open the app-specific key */
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,99 @@
|
||||
From 2caaacb0bd8f2feeba60d8a45959b83f6106a7a1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 6 Jan 2023 08:09:11 +0100
|
||||
Subject: [PATCH 3/9] winex11: Write supported keyboard layout list in
|
||||
registry.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 21 +++++++++++++++++++++
|
||||
dlls/winex11.drv/x11drv.h | 4 ++++
|
||||
dlls/winex11.drv/x11drv_main.c | 17 +++++++++++++++++
|
||||
3 files changed, 42 insertions(+)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index f1ad4b01669..187979c4494 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -1089,6 +1089,27 @@ static const WORD xfree86_vendor_key_vkey[256] =
|
||||
0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */
|
||||
};
|
||||
|
||||
+WCHAR *x11drv_get_keyboard_layout_list( DWORD *length )
|
||||
+{
|
||||
+ WCHAR *tmp, *layouts = calloc( 1, sizeof(WCHAR) );
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0, *length = 1; main_key_tab[i].comment; i++)
|
||||
+ {
|
||||
+ const char *name = main_key_tab[i].comment;
|
||||
+ int len = strlen( name ) + 1;
|
||||
+
|
||||
+ if (!(tmp = realloc( layouts, (*length + len) * sizeof(WCHAR) ))) return layouts;
|
||||
+ layouts = tmp;
|
||||
+
|
||||
+ asciiz_to_unicode( layouts + *length - 1, name );
|
||||
+ layouts[*length + len - 1] = 0;
|
||||
+ (*length) += len;
|
||||
+ }
|
||||
+
|
||||
+ return layouts;
|
||||
+}
|
||||
+
|
||||
static inline KeySym keycode_to_keysym( Display *display, KeyCode keycode, int index )
|
||||
{
|
||||
#ifdef HAVE_XKB
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index f4f6ba07e07..7d96ec648d1 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -709,6 +709,10 @@ extern BOOL xinerama_get_fullscreen_monitors( const RECT *rect, long *indices )
|
||||
extern void xinerama_init( unsigned int width, unsigned int height ) DECLSPEC_HIDDEN;
|
||||
extern void init_recursive_mutex( pthread_mutex_t *mutex ) DECLSPEC_HIDDEN;
|
||||
|
||||
+/* keyboard.c */
|
||||
+
|
||||
+extern WCHAR *x11drv_get_keyboard_layout_list( DWORD *size ) DECLSPEC_HIDDEN;
|
||||
+
|
||||
#define DEPTH_COUNT 3
|
||||
extern const unsigned int *depths DECLSPEC_HIDDEN;
|
||||
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index e04bdedd43a..66dbc3c8270 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -449,6 +449,19 @@ static HKEY create_hkcu_key( const char *name )
|
||||
return reg_open_hkcu_key( name, TRUE );
|
||||
}
|
||||
|
||||
+static BOOL set_reg_value( HKEY hkey, const WCHAR *name, UINT type, const void *value, DWORD count )
|
||||
+{
|
||||
+ unsigned int name_size = name ? lstrlenW( name ) * sizeof(WCHAR) : 0;
|
||||
+ UNICODE_STRING nameW = { name_size, name_size, (WCHAR *)name };
|
||||
+ return !NtSetValueKey( hkey, &nameW, 0, type, value, count );
|
||||
+}
|
||||
+
|
||||
+static void set_reg_string_value( HKEY hkey, const char *name, const WCHAR *value, DWORD count )
|
||||
+{
|
||||
+ WCHAR nameW[64];
|
||||
+ asciiz_to_unicode( nameW, name );
|
||||
+ set_reg_value( hkey, nameW, REG_MULTI_SZ, value, count );
|
||||
+}
|
||||
|
||||
ULONG query_reg_value( HKEY hkey, const WCHAR *name, KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size )
|
||||
{
|
||||
@@ -567,6 +580,10 @@ static void setup_options(void)
|
||||
if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) ))
|
||||
grab_fullscreen = IS_OPTION_TRUE( buffer[0] );
|
||||
|
||||
+ p = x11drv_get_keyboard_layout_list( &len );
|
||||
+ if (p) set_reg_string_value( hkey, "KeyboardLayoutList", p, len * sizeof(WCHAR) );
|
||||
+ free( p );
|
||||
+
|
||||
if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
|
||||
default_visual.depth = wcstol( buffer, NULL, 0 );
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,134 @@
|
||||
From 3164e0ecc4ecf49045f8442489a4ff5bda6d3d34 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 6 Jan 2023 08:15:41 +0100
|
||||
Subject: [PATCH 4/9] winecfg: Add a keyboard layout selection config option.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
programs/winecfg/input.c | 48 ++++++++++++++++++++++++++++++++++++-
|
||||
programs/winecfg/resource.h | 3 +++
|
||||
programs/winecfg/winecfg.rc | 9 +++++++
|
||||
3 files changed, 59 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/programs/winecfg/input.c b/programs/winecfg/input.c
|
||||
index 115161b9040..f2f035df80f 100644
|
||||
--- a/programs/winecfg/input.c
|
||||
+++ b/programs/winecfg/input.c
|
||||
@@ -35,7 +35,9 @@ static BOOL updating_ui;
|
||||
|
||||
static void init_dialog( HWND dialog )
|
||||
{
|
||||
- WCHAR *buffer;
|
||||
+ WCHAR auto_detect_layout[256];
|
||||
+ WCHAR *buffer, *layout;
|
||||
+ HWND layouts;
|
||||
|
||||
convert_x11_desktop_key();
|
||||
|
||||
@@ -46,6 +48,23 @@ static void init_dialog( HWND dialog )
|
||||
else CheckDlgButton( dialog, IDC_FULLSCREEN_GRAB, BST_UNCHECKED );
|
||||
free( buffer );
|
||||
|
||||
+ layouts = GetDlgItem( dialog, IDC_KEYBOARD_LAYOUT );
|
||||
+ LoadStringW( GetModuleHandleW( NULL ), IDS_INPUT_AUTO_DETECT_LAYOUT, auto_detect_layout,
|
||||
+ ARRAY_SIZE(auto_detect_layout) );
|
||||
+
|
||||
+ SendMessageW( layouts, CB_RESETCONTENT, 0, 0 );
|
||||
+ SendMessageW( layouts, CB_ADDSTRING, 0, (LPARAM)auto_detect_layout );
|
||||
+
|
||||
+ buffer = get_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardLayoutList", L"" );
|
||||
+ for (layout = buffer; *layout; layout += wcslen( layout ) + 1)
|
||||
+ SendMessageW( layouts, CB_ADDSTRING, 0, (LPARAM)layout );
|
||||
+ free( buffer );
|
||||
+
|
||||
+ buffer = get_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardLayout", L"" );
|
||||
+ if (!buffer || !buffer[0]) SendMessageW( layouts, CB_SETCURSEL, 0, 0 );
|
||||
+ else SendMessageW( layouts, CB_SELECTSTRING, -1, (LPARAM)buffer );
|
||||
+ free( buffer );
|
||||
+
|
||||
updating_ui = FALSE;
|
||||
}
|
||||
|
||||
@@ -56,6 +75,24 @@ static void on_fullscreen_grab_clicked( HWND dialog )
|
||||
else set_reg_key( config_key, keypath( L"X11 Driver" ), L"GrabFullscreen", L"N" );
|
||||
}
|
||||
|
||||
+static void on_keyboard_layout_changed( HWND dialog )
|
||||
+{
|
||||
+ int len, index;
|
||||
+ WCHAR *buffer;
|
||||
+
|
||||
+ if (!(index = SendMessageW( GetDlgItem( dialog, IDC_KEYBOARD_LAYOUT ), CB_GETCURSEL, 0, 0 )))
|
||||
+ set_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardLayout", L"" );
|
||||
+ else
|
||||
+ {
|
||||
+ len = SendMessageW( GetDlgItem( dialog, IDC_KEYBOARD_LAYOUT ), CB_GETLBTEXTLEN, index, 0 ) + 1;
|
||||
+ if (!(buffer = malloc( len * sizeof(WCHAR) ))) return;
|
||||
+
|
||||
+ SendMessageW( GetDlgItem( dialog, IDC_KEYBOARD_LAYOUT ), CB_GETLBTEXT, index, (LPARAM)buffer );
|
||||
+ set_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardLayout", buffer );
|
||||
+ free( buffer );
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
INT_PTR CALLBACK InputDlgProc( HWND dialog, UINT message, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
TRACE( "dialog %p, message %#x, wparam %#Ix, lparam %#Ix\n", dialog, message, wparam, lparam );
|
||||
@@ -77,6 +114,15 @@ INT_PTR CALLBACK InputDlgProc( HWND dialog, UINT message, WPARAM wparam, LPARAM
|
||||
case IDC_FULLSCREEN_GRAB: on_fullscreen_grab_clicked( dialog ); break;
|
||||
}
|
||||
break;
|
||||
+
|
||||
+ case CBN_SELCHANGE:
|
||||
+ if (updating_ui) break;
|
||||
+ SendMessageW( GetParent( dialog ), PSM_CHANGED, 0, 0 );
|
||||
+ switch (LOWORD(wparam))
|
||||
+ {
|
||||
+ case IDC_KEYBOARD_LAYOUT: on_keyboard_layout_changed( dialog ); break;
|
||||
+ }
|
||||
+ break;
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
|
||||
index 78deb1a23a2..485bc18a217 100644
|
||||
--- a/programs/winecfg/resource.h
|
||||
+++ b/programs/winecfg/resource.h
|
||||
@@ -231,3 +231,6 @@
|
||||
|
||||
/* input tab */
|
||||
#define IDC_FULLSCREEN_GRAB 1501
|
||||
+#define IDC_KEYBOARD_LAYOUT 1502
|
||||
+
|
||||
+#define IDS_INPUT_AUTO_DETECT_LAYOUT 8501
|
||||
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
|
||||
index 605ec54632c..e0742794357 100644
|
||||
--- a/programs/winecfg/winecfg.rc
|
||||
+++ b/programs/winecfg/winecfg.rc
|
||||
@@ -130,6 +130,11 @@ BEGIN
|
||||
IDC_SYSPARAMS_MENUBAR "Menu Bar"
|
||||
END
|
||||
|
||||
+STRINGTABLE
|
||||
+BEGIN
|
||||
+ IDS_INPUT_AUTO_DETECT_LAYOUT "(Auto detect)"
|
||||
+END
|
||||
+
|
||||
IDD_ABOUTCFG DIALOGEX 0, 0, 260, 220
|
||||
STYLE WS_CHILD
|
||||
FONT 8, "MS Shell Dlg"
|
||||
@@ -330,6 +335,10 @@ FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Mouse settings",IDC_STATIC,8,4,244,64
|
||||
CONTROL "Automatically capture the &mouse in full-screen windows",IDC_FULLSCREEN_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,20,230,10
|
||||
+
|
||||
+ GROUPBOX "Keyboard settings",IDC_STATIC,8,70,244,64
|
||||
+ LTEXT "&Layout:",IDC_STATIC,15,82,230,8
|
||||
+ COMBOBOX IDC_KEYBOARD_LAYOUT,110,80,135,60,CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,140 @@
|
||||
From 95f66fcd054ff2bae4e35e25a632b88a63aa4bb1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 6 Jan 2023 08:09:11 +0100
|
||||
Subject: [PATCH 5/9] winex11: Use the user configured keyboard layout if any.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 33 +++++++++++++++++++++++++++------
|
||||
dlls/winex11.drv/x11drv.h | 2 ++
|
||||
dlls/winex11.drv/x11drv_main.c | 4 ++++
|
||||
3 files changed, 33 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 187979c4494..26548c9256e 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -934,7 +934,6 @@ static const struct {
|
||||
|
||||
{0, NULL, NULL, NULL, NULL} /* sentinel */
|
||||
};
|
||||
-static unsigned kbd_layout=0; /* index into above table of layouts */
|
||||
|
||||
/* maybe more of these scancodes should be extended? */
|
||||
/* extended must be set for ALT_R, CTRL_R,
|
||||
@@ -1089,6 +1088,26 @@ static const WORD xfree86_vendor_key_vkey[256] =
|
||||
0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */
|
||||
};
|
||||
|
||||
+int x11drv_find_keyboard_layout( const WCHAR *layout )
|
||||
+{
|
||||
+ int i, len;
|
||||
+ char *tmp;
|
||||
+
|
||||
+ len = lstrlenW( layout );
|
||||
+ if (!(tmp = malloc( len * 3 + 1 ))) return -1;
|
||||
+ ntdll_wcstoumbs( layout, len + 1, tmp, len * 3 + 1, FALSE );
|
||||
+
|
||||
+ for (i = 0; main_key_tab[i].comment; i++)
|
||||
+ {
|
||||
+ const char *name = main_key_tab[i].comment;
|
||||
+ if (!strcmp( name, tmp )) break;
|
||||
+ }
|
||||
+ free( tmp );
|
||||
+
|
||||
+ if (!main_key_tab[i].comment) return -1;
|
||||
+ return i;
|
||||
+}
|
||||
+
|
||||
WCHAR *x11drv_get_keyboard_layout_list( DWORD *length )
|
||||
{
|
||||
WCHAR *tmp, *layouts = calloc( 1, sizeof(WCHAR) );
|
||||
@@ -1442,11 +1461,11 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
|
||||
* whichever matches most closely.
|
||||
* kbd_section must be held.
|
||||
*/
|
||||
-static void
|
||||
+static int
|
||||
X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
{
|
||||
unsigned current, match, mismatch, seq, i, syms;
|
||||
- int score, keyc, key, pkey, ok;
|
||||
+ int score, keyc, key, pkey, ok, kbd_layout = 0;
|
||||
KeySym keysym = 0;
|
||||
const char (*lkey)[MAIN_LEN][4];
|
||||
unsigned max_seq = 0;
|
||||
@@ -1546,6 +1565,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
main_key_tab[kbd_layout].comment);
|
||||
|
||||
TRACE("detected layout is \"%s\"\n", main_key_tab[kbd_layout].comment);
|
||||
+ return kbd_layout;
|
||||
}
|
||||
|
||||
static HKL get_locale_kbd_layout(void)
|
||||
@@ -1614,7 +1634,7 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
{ 0x41, 0x5a }, /* VK_A - VK_Z */
|
||||
{ 0, 0 }
|
||||
};
|
||||
- int vkey_range;
|
||||
+ int vkey_range, kbd_layout;
|
||||
|
||||
pthread_mutex_lock( &kbd_mutex );
|
||||
XDisplayKeycodes(display, &min_keycode, &max_keycode);
|
||||
@@ -1648,8 +1668,9 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
}
|
||||
XFreeModifiermap(mmp);
|
||||
|
||||
- /* Detect the keyboard layout */
|
||||
- X11DRV_KEYBOARD_DetectLayout( display );
|
||||
+ /* use the configured layout from registry or auto detect it */
|
||||
+ kbd_layout = keyboard_layout;
|
||||
+ if (kbd_layout == -1) kbd_layout = X11DRV_KEYBOARD_DetectLayout( display );
|
||||
lkey = main_key_tab[kbd_layout].key;
|
||||
syms = (keysyms_per_keycode > 4) ? 4 : keysyms_per_keycode;
|
||||
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index 7d96ec648d1..c02a6c67111 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -443,6 +443,7 @@ extern BOOL use_system_cursors DECLSPEC_HIDDEN;
|
||||
extern BOOL show_systray DECLSPEC_HIDDEN;
|
||||
extern BOOL grab_pointer DECLSPEC_HIDDEN;
|
||||
extern BOOL grab_fullscreen DECLSPEC_HIDDEN;
|
||||
+extern int keyboard_layout DECLSPEC_HIDDEN;
|
||||
extern BOOL usexcomposite DECLSPEC_HIDDEN;
|
||||
extern BOOL managed_mode DECLSPEC_HIDDEN;
|
||||
extern BOOL decorated_mode DECLSPEC_HIDDEN;
|
||||
@@ -711,6 +712,7 @@ extern void init_recursive_mutex( pthread_mutex_t *mutex ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* keyboard.c */
|
||||
|
||||
+extern int x11drv_find_keyboard_layout( const WCHAR *layout ) DECLSPEC_HIDDEN;
|
||||
extern WCHAR *x11drv_get_keyboard_layout_list( DWORD *size ) DECLSPEC_HIDDEN;
|
||||
|
||||
#define DEPTH_COUNT 3
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index 66dbc3c8270..dc2eb716d0b 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -79,6 +79,7 @@ BOOL use_system_cursors = TRUE;
|
||||
BOOL show_systray = TRUE;
|
||||
BOOL grab_pointer = TRUE;
|
||||
BOOL grab_fullscreen = FALSE;
|
||||
+int keyboard_layout = -1;
|
||||
BOOL managed_mode = TRUE;
|
||||
BOOL decorated_mode = TRUE;
|
||||
BOOL private_color_map = FALSE;
|
||||
@@ -580,6 +581,9 @@ static void setup_options(void)
|
||||
if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) ))
|
||||
grab_fullscreen = IS_OPTION_TRUE( buffer[0] );
|
||||
|
||||
+ if (!get_config_key( hkey, appkey, "KeyboardLayout", buffer, sizeof(buffer) ))
|
||||
+ keyboard_layout = x11drv_find_keyboard_layout( buffer );
|
||||
+
|
||||
p = x11drv_get_keyboard_layout_list( &len );
|
||||
if (p) set_reg_string_value( hkey, "KeyboardLayoutList", p, len * sizeof(WCHAR) );
|
||||
free( p );
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,77 @@
|
||||
From e3594ff93e42a000fb6b16023a21f2222b61d307 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 6 Jan 2023 09:27:18 +0100
|
||||
Subject: [PATCH 6/9] winecfg: Add a keyboard scancode detection toggle option.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
programs/winecfg/input.c | 13 +++++++++++++
|
||||
programs/winecfg/resource.h | 1 +
|
||||
programs/winecfg/winecfg.rc | 1 +
|
||||
3 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/programs/winecfg/input.c b/programs/winecfg/input.c
|
||||
index f2f035df80f..a9d83b45f00 100644
|
||||
--- a/programs/winecfg/input.c
|
||||
+++ b/programs/winecfg/input.c
|
||||
@@ -65,6 +65,11 @@ static void init_dialog( HWND dialog )
|
||||
else SendMessageW( layouts, CB_SELECTSTRING, -1, (LPARAM)buffer );
|
||||
free( buffer );
|
||||
|
||||
+ buffer = get_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardScancodeDetect", L"Y" );
|
||||
+ if (IS_OPTION_TRUE( *buffer )) CheckDlgButton( dialog, IDC_KEYBOARD_SCANCODE_DETECT, BST_CHECKED );
|
||||
+ else CheckDlgButton( dialog, IDC_KEYBOARD_SCANCODE_DETECT, BST_UNCHECKED );
|
||||
+ free( buffer );
|
||||
+
|
||||
updating_ui = FALSE;
|
||||
}
|
||||
|
||||
@@ -93,6 +98,13 @@ static void on_keyboard_layout_changed( HWND dialog )
|
||||
}
|
||||
}
|
||||
|
||||
+static void on_keyboard_scancode_detect_clicked( HWND dialog )
|
||||
+{
|
||||
+ BOOL checked = IsDlgButtonChecked( dialog, IDC_KEYBOARD_SCANCODE_DETECT ) == BST_CHECKED;
|
||||
+ if (checked) set_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardScancodeDetect", L"Y" );
|
||||
+ else set_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardScancodeDetect", L"N" );
|
||||
+}
|
||||
+
|
||||
INT_PTR CALLBACK InputDlgProc( HWND dialog, UINT message, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
TRACE( "dialog %p, message %#x, wparam %#Ix, lparam %#Ix\n", dialog, message, wparam, lparam );
|
||||
@@ -112,6 +124,7 @@ INT_PTR CALLBACK InputDlgProc( HWND dialog, UINT message, WPARAM wparam, LPARAM
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_FULLSCREEN_GRAB: on_fullscreen_grab_clicked( dialog ); break;
|
||||
+ case IDC_KEYBOARD_SCANCODE_DETECT: on_keyboard_scancode_detect_clicked( dialog ); break;
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
|
||||
index 485bc18a217..e84cd1a2530 100644
|
||||
--- a/programs/winecfg/resource.h
|
||||
+++ b/programs/winecfg/resource.h
|
||||
@@ -232,5 +232,6 @@
|
||||
/* input tab */
|
||||
#define IDC_FULLSCREEN_GRAB 1501
|
||||
#define IDC_KEYBOARD_LAYOUT 1502
|
||||
+#define IDC_KEYBOARD_SCANCODE_DETECT 1503
|
||||
|
||||
#define IDS_INPUT_AUTO_DETECT_LAYOUT 8501
|
||||
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
|
||||
index e0742794357..4d252b43564 100644
|
||||
--- a/programs/winecfg/winecfg.rc
|
||||
+++ b/programs/winecfg/winecfg.rc
|
||||
@@ -339,6 +339,7 @@ BEGIN
|
||||
GROUPBOX "Keyboard settings",IDC_STATIC,8,70,244,64
|
||||
LTEXT "&Layout:",IDC_STATIC,15,82,230,8
|
||||
COMBOBOX IDC_KEYBOARD_LAYOUT,110,80,135,60,CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
+ CONTROL "Enable keyboard scancode auto-detection",IDC_KEYBOARD_SCANCODE_DETECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,96,230,10
|
||||
END
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,56 @@
|
||||
From 495e0f49611f79291bf95f9236030dd331dff67f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 30 Nov 2022 18:46:00 +0100
|
||||
Subject: [PATCH 7/9] winex11: Use scancode high bit to set
|
||||
KEYEVENTF_EXTENDEDKEY flag.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 26548c9256e..5065d8048d1 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -1363,7 +1363,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
|
||||
char buf[24];
|
||||
char *Str = buf;
|
||||
KeySym keysym = 0;
|
||||
- WORD vkey = 0, bScan;
|
||||
+ WORD vkey = 0, scan;
|
||||
DWORD dwFlags;
|
||||
int ascii_chars;
|
||||
XIC xic = X11DRV_get_ic( hwnd );
|
||||
@@ -1434,10 +1434,10 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
|
||||
vkey = EVENT_event_to_vkey(xic,event);
|
||||
/* X returns keycode 0 for composed characters */
|
||||
if (!vkey && ascii_chars) vkey = VK_NONAME;
|
||||
- bScan = keyc2scan[event->keycode] & 0xFF;
|
||||
+ scan = keyc2scan[event->keycode];
|
||||
|
||||
- TRACE_(key)("keycode %u converted to vkey 0x%X scan %02x\n",
|
||||
- event->keycode, vkey, bScan);
|
||||
+ TRACE_(key)("keycode %u converted to vkey 0x%X scan %04x\n",
|
||||
+ event->keycode, vkey, scan);
|
||||
|
||||
pthread_mutex_unlock( &kbd_mutex );
|
||||
|
||||
@@ -1445,11 +1445,11 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
|
||||
|
||||
dwFlags = 0;
|
||||
if ( event->type == KeyRelease ) dwFlags |= KEYEVENTF_KEYUP;
|
||||
- if ( vkey & 0x100 ) dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
+ if ( scan & 0x100 ) dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
|
||||
update_lock_state( hwnd, vkey, event->state, event_time );
|
||||
|
||||
- X11DRV_send_keyboard_input( hwnd, vkey & 0xff, bScan, dwFlags, event_time );
|
||||
+ X11DRV_send_keyboard_input( hwnd, vkey & 0xff, scan & 0xff, dwFlags, event_time );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,125 @@
|
||||
From 1e2f3aced42e5ad050a8bb6f173c3e4dcdae3b9b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 30 Nov 2022 18:46:00 +0100
|
||||
Subject: [PATCH 8/9] winex11: Support fixed X11 keycode to scancode
|
||||
conversion.
|
||||
|
||||
X11 keycodes are just Linux keycodes + 8 nowadays according to evdev or
|
||||
libinput drivers, and we can avoid innacurate reconstruction in the most
|
||||
common case.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 45 +++++++++++++++++++++++++++++++---
|
||||
dlls/winex11.drv/x11drv.h | 1 +
|
||||
dlls/winex11.drv/x11drv_main.c | 4 +++
|
||||
3 files changed, 47 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 5065d8048d1..c79c578af42 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -67,7 +67,46 @@ 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 WORD keyc2vkey[256];
|
||||
+
|
||||
+/* default scancode mapping if keyboard_scancode_detect is FALSE,
|
||||
+ * as most common X11 implementation use hardware scancode + 8.
|
||||
+ */
|
||||
+static WORD keyc2scan[256] =
|
||||
+{
|
||||
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
|
||||
+ 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
|
||||
+ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
|
||||
+ 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
|
||||
+ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
|
||||
+ 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
|
||||
+ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0136, 0x0037,
|
||||
+ 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
|
||||
+ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0145, 0x0046, 0x0047,
|
||||
+ 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
|
||||
+ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
|
||||
+ 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
|
||||
+ 0x011c, 0x011d, 0x0135, 0x0063, 0x0138, 0x0065, 0x0147, 0x0148,
|
||||
+ 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153,
|
||||
+ 0x0070, 0x0000, 0x0000, 0x0000, 0x0074, 0x0075, 0x0076, 0x0045,
|
||||
+ 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x015b, 0x015c, 0x015d,
|
||||
+ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
+ 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
+ 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
+ 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
+ 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x0000, 0x00a5, 0x00a6, 0x00a7,
|
||||
+ 0x00a8, 0x00a9, 0x00aa, 0x0000, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
||||
+ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
||||
+ 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
||||
+ 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
||||
+ 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
+ 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
||||
+ 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
||||
+ 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
||||
+ 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
+ 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
||||
+};
|
||||
|
||||
static int NumLockMask, ScrollLockMask, AltGrMask; /* mask in the XKeyEvent state */
|
||||
|
||||
@@ -1750,7 +1789,7 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
}
|
||||
TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
|
||||
keyc2vkey[e2.keycode] = vkey;
|
||||
- keyc2scan[e2.keycode] = scan;
|
||||
+ if (keyboard_scancode_detect) keyc2scan[e2.keycode] = scan;
|
||||
if ((vkey & 0xff) && vkey_used[(vkey & 0xff)])
|
||||
WARN("vkey %04X is being used by more than one keycode\n", vkey);
|
||||
vkey_used[(vkey & 0xff)] = 1;
|
||||
@@ -1861,7 +1900,7 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
#undef VKEY_IF_NOT_USED
|
||||
|
||||
/* If some keys still lack scancodes, assign some arbitrary ones to them now */
|
||||
- for (scan = 0x60, keyc = min_keycode; keyc <= max_keycode; keyc++)
|
||||
+ for (scan = 0x60, keyc = min_keycode; keyboard_scancode_detect && keyc <= max_keycode; keyc++)
|
||||
if (keyc2vkey[keyc]&&!keyc2scan[keyc]) {
|
||||
const char *ksname;
|
||||
keysym = keycode_to_keysym(display, keyc, 0);
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index c02a6c67111..3cf4c39d1d3 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -444,6 +444,7 @@ extern BOOL show_systray DECLSPEC_HIDDEN;
|
||||
extern BOOL grab_pointer DECLSPEC_HIDDEN;
|
||||
extern BOOL grab_fullscreen DECLSPEC_HIDDEN;
|
||||
extern int keyboard_layout DECLSPEC_HIDDEN;
|
||||
+extern BOOL keyboard_scancode_detect DECLSPEC_HIDDEN;
|
||||
extern BOOL usexcomposite DECLSPEC_HIDDEN;
|
||||
extern BOOL managed_mode DECLSPEC_HIDDEN;
|
||||
extern BOOL decorated_mode DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index dc2eb716d0b..bbdd5ad7010 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -80,6 +80,7 @@ BOOL show_systray = TRUE;
|
||||
BOOL grab_pointer = TRUE;
|
||||
BOOL grab_fullscreen = FALSE;
|
||||
int keyboard_layout = -1;
|
||||
+BOOL keyboard_scancode_detect = TRUE;
|
||||
BOOL managed_mode = TRUE;
|
||||
BOOL decorated_mode = TRUE;
|
||||
BOOL private_color_map = FALSE;
|
||||
@@ -588,6 +589,9 @@ static void setup_options(void)
|
||||
if (p) set_reg_string_value( hkey, "KeyboardLayoutList", p, len * sizeof(WCHAR) );
|
||||
free( p );
|
||||
|
||||
+ if (!get_config_key( hkey, appkey, "KeyboardScancodeDetect", buffer, sizeof(buffer) ))
|
||||
+ keyboard_scancode_detect = IS_OPTION_TRUE( buffer[0] );
|
||||
+
|
||||
if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
|
||||
default_visual.depth = wcstol( buffer, NULL, 0 );
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 84b078263007bcc40fb246a75ce7a1bb3ca62d4a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 6 Jan 2023 11:31:36 +0100
|
||||
Subject: [PATCH 9/9] winex11: Disable keyboard scancode auto-detection by
|
||||
default.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605
|
||||
---
|
||||
dlls/winex11.drv/x11drv_main.c | 2 +-
|
||||
programs/winecfg/input.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index bbdd5ad7010..6568fcc1c41 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -80,7 +80,7 @@ BOOL show_systray = TRUE;
|
||||
BOOL grab_pointer = TRUE;
|
||||
BOOL grab_fullscreen = FALSE;
|
||||
int keyboard_layout = -1;
|
||||
-BOOL keyboard_scancode_detect = TRUE;
|
||||
+BOOL keyboard_scancode_detect = FALSE;
|
||||
BOOL managed_mode = TRUE;
|
||||
BOOL decorated_mode = TRUE;
|
||||
BOOL private_color_map = FALSE;
|
||||
diff --git a/programs/winecfg/input.c b/programs/winecfg/input.c
|
||||
index a9d83b45f00..3ee20d49874 100644
|
||||
--- a/programs/winecfg/input.c
|
||||
+++ b/programs/winecfg/input.c
|
||||
@@ -65,7 +65,7 @@ static void init_dialog( HWND dialog )
|
||||
else SendMessageW( layouts, CB_SELECTSTRING, -1, (LPARAM)buffer );
|
||||
free( buffer );
|
||||
|
||||
- buffer = get_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardScancodeDetect", L"Y" );
|
||||
+ buffer = get_reg_key( config_key, keypath( L"X11 Driver" ), L"KeyboardScancodeDetect", L"N" );
|
||||
if (IS_OPTION_TRUE( *buffer )) CheckDlgButton( dialog, IDC_KEYBOARD_SCANCODE_DETECT, BST_CHECKED );
|
||||
else CheckDlgButton( dialog, IDC_KEYBOARD_SCANCODE_DETECT, BST_UNCHECKED );
|
||||
free( buffer );
|
||||
--
|
||||
2.39.1
|
||||
|
3
patches/winex11-Fixed-scancodes/definition
Normal file
3
patches/winex11-Fixed-scancodes/definition
Normal file
@ -0,0 +1,3 @@
|
||||
Fixes: [30984] Improve key translation.
|
||||
Fixes: [45605] Letter keys doesn't work in DirectX aplications
|
||||
Depends: winecfg-Staging
|
@ -1,337 +0,0 @@
|
||||
From 6ab9c9e56ba70acd86faf8cb2e30021a2f1586b2 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Thomases <ken@codeweavers.com>
|
||||
Date: Tue, 11 Dec 2018 08:30:41 +1100
|
||||
Subject: [PATCH] winex11: Match keyboard in Unicode
|
||||
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 161 ++++++++++++++++++++++--------------
|
||||
1 file changed, 97 insertions(+), 64 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 8b2a89236f8..37992f6e663 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
+#include <limits.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
@@ -69,7 +70,7 @@ static int NumLockMask, ScrollLockMask, AltGrMask; /* mask in the XKeyEvent stat
|
||||
|
||||
static pthread_mutex_t kbd_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
-static char KEYBOARD_MapDeadKeysym(KeySym keysym);
|
||||
+static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym);
|
||||
|
||||
/* Keyboard translation tables */
|
||||
#define MAIN_LEN 49
|
||||
@@ -1410,6 +1411,36 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+static WCHAR translate_keysym( Display *display, KeySym keysym )
|
||||
+{
|
||||
+ WCHAR ret;
|
||||
+
|
||||
+#ifdef HAVE_XKB
|
||||
+ char buf[16];
|
||||
+ int count = 0;
|
||||
+
|
||||
+ if (use_xkb && (count = XkbTranslateKeySym(display, &keysym, 0, buf, sizeof(buf), NULL)))
|
||||
+ count = MultiByteToWideChar(CP_UNIXCP, 0, buf, count, &ret, 1);
|
||||
+
|
||||
+ if (count != 1)
|
||||
+#endif
|
||||
+ {
|
||||
+ TRACE("XKB could not translate keysym %04lx\n", keysym);
|
||||
+ /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent
|
||||
+ * with appropriate ShiftMask and Mode_switch, use XLookupString
|
||||
+ * to get character in the local encoding.
|
||||
+ */
|
||||
+ if (keysym <= 0xFF)
|
||||
+ ret = keysym;
|
||||
+ else if (0x01000000 <= keysym && keysym <= 0x0100FFFF)
|
||||
+ ret = keysym & 0xFFFF;
|
||||
+ else
|
||||
+ ret = KEYBOARD_MapDeadKeysym(keysym);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
* X11DRV_KEYBOARD_DetectLayout
|
||||
*
|
||||
@@ -1427,7 +1458,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
const char (*lkey)[MAIN_LEN][4];
|
||||
unsigned max_seq = 0;
|
||||
int max_score = INT_MIN, ismatch = 0;
|
||||
- char ckey[256][4];
|
||||
+ WCHAR ckey[256][4];
|
||||
|
||||
syms = keysyms_per_keycode;
|
||||
if (syms > 4) {
|
||||
@@ -1440,35 +1471,25 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
/* get data for keycode from X server */
|
||||
for (i = 0; i < syms; i++) {
|
||||
if (!(keysym = keycode_to_keysym (display, keyc, 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
|
||||
- {
|
||||
- TRACE("XKB could not translate keysym %04lx\n", keysym);
|
||||
- /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent
|
||||
- * with appropriate ShiftMask and Mode_switch, use XLookupString
|
||||
- * to get character in the local encoding.
|
||||
- */
|
||||
- ckey[keyc][i] = keysym & 0xFF;
|
||||
- }
|
||||
- }
|
||||
- else {
|
||||
- ckey[keyc][i] = KEYBOARD_MapDeadKeysym(keysym);
|
||||
- }
|
||||
+ ckey[keyc][i] = translate_keysym( display, keysym );
|
||||
}
|
||||
}
|
||||
|
||||
for (current = 0; main_key_tab[current].comment; current++) {
|
||||
+ DWORD codepage;
|
||||
+ WCHAR lkeyW[MAIN_LEN][4];
|
||||
+
|
||||
TRACE("Attempting to match against \"%s\"\n", main_key_tab[current].comment);
|
||||
match = 0;
|
||||
mismatch = 0;
|
||||
score = 0;
|
||||
seq = 0;
|
||||
lkey = main_key_tab[current].key;
|
||||
+ memset(lkeyW, 0, sizeof(lkeyW));
|
||||
pkey = -1;
|
||||
+ if (!GetLocaleInfoW(main_key_tab[current].lcid, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
+ (LPWSTR)&codepage, sizeof(codepage)/sizeof(WCHAR)))
|
||||
+ codepage = CP_ACP;
|
||||
for (keyc = min_keycode; keyc <= max_keycode; keyc++) {
|
||||
if (ckey[keyc][0]) {
|
||||
/* search for a match in layout table */
|
||||
@@ -1477,10 +1498,13 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
/* the table, it's okay that the X server has "3#£", for example) */
|
||||
/* however, the score will be higher for longer matches */
|
||||
for (key = 0; key < MAIN_LEN; key++) {
|
||||
- for (ok = 0, i = 0; (ok >= 0) && (i < syms); i++) {
|
||||
- if ((*lkey)[key][i] && ((*lkey)[key][i] == ckey[keyc][i]))
|
||||
+ if ((*lkey)[key][0] && !lkeyW[key][0])
|
||||
+ MultiByteToWideChar(codepage, 0, (*lkey)[key], -1, lkeyW[key], 4);
|
||||
+
|
||||
+ for (ok = 0, i = 0; (ok >= 0) && (i < syms) && lkeyW[key][i]; i++) {
|
||||
+ if (lkeyW[key][i] == ckey[keyc][i])
|
||||
ok++;
|
||||
- if ((*lkey)[key][i] && ((*lkey)[key][i] != ckey[keyc][i]))
|
||||
+ else
|
||||
ok = -1;
|
||||
}
|
||||
if (ok > 0) {
|
||||
@@ -1495,11 +1519,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
if (key > pkey) seq++;
|
||||
pkey = key;
|
||||
} else {
|
||||
- /* print spaces instead of \0's */
|
||||
- char str[5];
|
||||
- for (i = 0; i < 4; i++) str[i] = ckey[keyc][i] ? ckey[keyc][i] : ' ';
|
||||
- str[4] = 0;
|
||||
- TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, debugstr_a(str));
|
||||
+ TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, debugstr_wn(ckey[keyc], 4));
|
||||
mismatch++;
|
||||
score -= syms;
|
||||
}
|
||||
@@ -1569,9 +1589,11 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
XKeyEvent e2;
|
||||
WORD scan, vkey;
|
||||
int keyc, i, keyn, syms;
|
||||
- char ckey[4]={0,0,0,0};
|
||||
+ WCHAR ckey[4] = { 0 };
|
||||
const char (*lkey)[MAIN_LEN][4];
|
||||
+ WCHAR lkeyW[MAIN_LEN][4];
|
||||
char vkey_used[256] = { 0 };
|
||||
+ DWORD codepage;
|
||||
|
||||
/* Ranges of OEM, function key, and character virtual key codes.
|
||||
* Don't include those handled specially in X11DRV_ToUnicodeEx and
|
||||
@@ -1627,7 +1649,11 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
/* Detect the keyboard layout */
|
||||
X11DRV_KEYBOARD_DetectLayout( display );
|
||||
lkey = main_key_tab[kbd_layout].key;
|
||||
+ memset(lkeyW, 0, sizeof(lkeyW));
|
||||
syms = (keysyms_per_keycode > 4) ? 4 : keysyms_per_keycode;
|
||||
+ if (!GetLocaleInfoW(main_key_tab[kbd_layout].lcid, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
||||
+ (LPWSTR)&codepage, sizeof(codepage)/sizeof(WCHAR)))
|
||||
+ codepage = CP_ACP;
|
||||
|
||||
/* Now build two conversion arrays :
|
||||
* keycode -> vkey + scancode + extended
|
||||
@@ -1668,26 +1694,14 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
int maxlen=0,maxval=-1,ok;
|
||||
for (i=0; i<syms; i++) {
|
||||
keysym = keycode_to_keysym(display, keyc, i);
|
||||
- if ((keysym<0x8000) && (keysym!=' '))
|
||||
- {
|
||||
-#ifdef HAVE_XKB
|
||||
- if (!use_xkb || !XkbTranslateKeySym(display, &keysym, 0, &ckey[i], 1, NULL))
|
||||
-#endif
|
||||
- {
|
||||
- /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent
|
||||
- * with appropriate ShiftMask and Mode_switch, use XLookupString
|
||||
- * to get character in the local encoding.
|
||||
- */
|
||||
- ckey[i] = (keysym <= 0x7F) ? keysym : 0;
|
||||
- }
|
||||
- } else {
|
||||
- ckey[i] = KEYBOARD_MapDeadKeysym(keysym);
|
||||
- }
|
||||
+ ckey[i] = translate_keysym(display, keysym);
|
||||
}
|
||||
/* find key with longest match streak */
|
||||
for (keyn=0; keyn<MAIN_LEN; keyn++) {
|
||||
- for (ok=(*lkey)[keyn][i=0]; ok&&(i<4); i++)
|
||||
- if ((*lkey)[keyn][i] && (*lkey)[keyn][i]!=ckey[i]) ok=0;
|
||||
+ if ((*lkey)[keyn][0] && !lkeyW[keyn][0])
|
||||
+ MultiByteToWideChar(codepage, 0, (*lkey)[keyn], -1, lkeyW[keyn], 4);
|
||||
+ for (ok=lkeyW[keyn][i=0]; ok&&(i<4); i++)
|
||||
+ if (lkeyW[keyn][i] && lkeyW[keyn][i]!=ckey[i]) ok=0;
|
||||
if (!ok) i--; /* we overshot */
|
||||
if (ok||(i>maxlen)) {
|
||||
maxlen=i; maxval=keyn;
|
||||
@@ -2250,7 +2264,7 @@ INT X11DRV_GetKeyNameText( LONG lParam, LPWSTR lpBuffer, INT nSize )
|
||||
/***********************************************************************
|
||||
* X11DRV_KEYBOARD_MapDeadKeysym
|
||||
*/
|
||||
-static char KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
+static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
{
|
||||
switch (keysym)
|
||||
{
|
||||
@@ -2260,65 +2274,84 @@ static char KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
#endif
|
||||
case 0x1000FE7E : /* Xfree's XK_Dtilde */
|
||||
return '~'; /* '? */
|
||||
+
|
||||
#ifdef XK_dead_acute
|
||||
case XK_dead_acute :
|
||||
#endif
|
||||
case 0x1000FE27 : /* Xfree's XK_Dacute_accent */
|
||||
- return 0xb4; /* '' */
|
||||
+ return 0x00b4; /* '' */
|
||||
+
|
||||
#ifdef XK_dead_circumflex
|
||||
case XK_dead_circumflex:
|
||||
#endif
|
||||
case 0x1000FE5E : /* Xfree's XK_Dcircumflex_accent */
|
||||
return '^'; /* '> */
|
||||
+
|
||||
#ifdef XK_dead_grave
|
||||
case XK_dead_grave :
|
||||
#endif
|
||||
case 0x1000FE60 : /* Xfree's XK_Dgrave_accent */
|
||||
return '`'; /* '! */
|
||||
+
|
||||
#ifdef XK_dead_diaeresis
|
||||
case XK_dead_diaeresis :
|
||||
#endif
|
||||
case 0x1000FE22 : /* Xfree's XK_Ddiaeresis */
|
||||
- return 0xa8; /* ': */
|
||||
+ return 0x00a8; /* ': */
|
||||
+
|
||||
#ifdef XK_dead_cedilla
|
||||
case XK_dead_cedilla :
|
||||
- return 0xb8; /* ', */
|
||||
+ return 0x00b8; /* ', */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_macron
|
||||
case XK_dead_macron :
|
||||
- return '-'; /* 'm isn't defined on iso-8859-x */
|
||||
+ return 0x00af; /* 'm */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_breve
|
||||
case XK_dead_breve :
|
||||
- return 0xa2; /* '( */
|
||||
+ return 0x02d8; /* '( */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_abovedot
|
||||
case XK_dead_abovedot :
|
||||
- return 0xff; /* '. */
|
||||
+ return 0x02d9; /* '. */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_abovering
|
||||
case XK_dead_abovering :
|
||||
- return '0'; /* '0 isn't defined on iso-8859-x */
|
||||
+ return 0x02da; /* '0 */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_doubleacute
|
||||
case XK_dead_doubleacute :
|
||||
- return 0xbd; /* '" */
|
||||
+ return 0x02dd; /* '" */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_caron
|
||||
case XK_dead_caron :
|
||||
- return 0xb7; /* '< */
|
||||
+ return 0x02c7; /* '< */
|
||||
#endif
|
||||
+
|
||||
#ifdef XK_dead_ogonek
|
||||
case XK_dead_ogonek :
|
||||
- return 0xb2; /* '; */
|
||||
+ return 0x02db; /* '; */
|
||||
#endif
|
||||
-/* FIXME: I don't know this three.
|
||||
- case XK_dead_iota :
|
||||
- return 'i';
|
||||
+
|
||||
+#ifdef XK_dead_voiced_sound
|
||||
case XK_dead_voiced_sound :
|
||||
- return 'v';
|
||||
+ return 0x309b; /* unknown */
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_semivoiced_sound
|
||||
case XK_dead_semivoiced_sound :
|
||||
- return 's';
|
||||
+ return 0x309c; /* unknown */
|
||||
+#endif
|
||||
+
|
||||
+/* FIXME: I don't know this one.
|
||||
+ case XK_dead_iota :
|
||||
+ return 'i';
|
||||
*/
|
||||
}
|
||||
TRACE("no character for dead keysym 0x%08lx\n",keysym);
|
||||
@@ -2503,7 +2536,7 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
- char dead_char;
|
||||
+ WCHAR dead_char;
|
||||
|
||||
#ifdef XK_EuroSign
|
||||
/* An ugly hack for EuroSign: X can't translate it to a character
|
||||
@@ -2527,7 +2560,7 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
|
||||
dead_char = KEYBOARD_MapDeadKeysym(keysym);
|
||||
if (dead_char)
|
||||
{
|
||||
- ntdll_umbstowcs( &dead_char, 1, bufW, bufW_size );
|
||||
+ bufW[0] = dead_char;
|
||||
ret = -1;
|
||||
goto found;
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
@ -1,351 +0,0 @@
|
||||
From 261a4727d80b3f85d909a2addb54ebb18c863a8e Mon Sep 17 00:00:00 2001
|
||||
From: Philippe Valembois <lephilousophe@users.sourceforge.net>
|
||||
Date: Tue, 11 Dec 2018 08:42:20 +1100
|
||||
Subject: [PATCH 2/2] winex11: Fix more key translation
|
||||
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 250 +++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 219 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 3f13a7331cc..c33b9b8dff6 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -744,11 +744,11 @@ static const char main_key_LA[MAIN_LEN][4] =
|
||||
/*** Lithuanian keyboard layout (setxkbmap lt) */
|
||||
static const char main_key_LT_B[MAIN_LEN][4] =
|
||||
{
|
||||
- "`~","\xe0\xc0","\xe8\xc8","\xe6\xc6","\xeb\xcb","\xe1\xc1","\xf0\xd0","\xf8\xd8","\xfb\xdb","\xa5(","\xb4)","-_","\xfe\xde",
|
||||
+ "`~","\xe0\xc0","\xe8\xc8","\xe6\xc6","\xeb\xcb","\xe1\xc1","\xf0\xd0","\xf8\xd8","\xfb\xdb","\x84(","\x93)","-_","\xfe\xde",
|
||||
"qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","[{","]}",
|
||||
"aA","sS","dD","fF","gG","hH","jJ","kK","lL",";:","'\"","\\|",
|
||||
"zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?",
|
||||
- "\xaa\xac"
|
||||
+ "\x96\x80"
|
||||
};
|
||||
|
||||
/*** Turkish keyboard Layout */
|
||||
@@ -1455,12 +1455,31 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
|
||||
|
||||
static WCHAR translate_keysym( Display *display, KeySym keysym )
|
||||
{
|
||||
- WCHAR ret;
|
||||
-
|
||||
#ifdef HAVE_XKB
|
||||
char buf[16];
|
||||
int count = 0;
|
||||
+#endif
|
||||
+ WCHAR ret;
|
||||
|
||||
+ /* Don't translate some function keysyms */
|
||||
+ /* Those who have 0s at byte 1 and 2, 253 or 255 at byte 3 */
|
||||
+ /* Let pass only dead characters in 254 */
|
||||
+ if ((keysym >> 8) == 0xFD || (keysym >> 8) == 0xFF) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if ((keysym >> 8) == 0xFE && (keysym < 0xFE50 || keysym >= 0xFE90)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* Don't translate vendor keysyms */
|
||||
+ if (keysym & 0x10000000) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // Don't match space bar
|
||||
+ if (keysym == ' ') {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+#ifdef HAVE_XKB
|
||||
if (use_xkb && (count = XkbTranslateKeySym(display, &keysym, 0, buf, sizeof(buf), NULL)))
|
||||
count = MultiByteToWideChar(CP_UNIXCP, 0, buf, count, &ret, 1);
|
||||
|
||||
@@ -1541,7 +1560,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
|
||||
/* however, the score will be higher for longer matches */
|
||||
for (key = 0; key < MAIN_LEN; key++) {
|
||||
if ((*lkey)[key][0] && !lkeyW[key][0])
|
||||
- MultiByteToWideChar(codepage, 0, (*lkey)[key], -1, lkeyW[key], 4);
|
||||
+ MultiByteToWideChar(codepage, 0, (*lkey)[key], 4, lkeyW[key], 4);
|
||||
|
||||
for (ok = 0, i = 0; (ok >= 0) && (i < syms) && lkeyW[key][i]; i++) {
|
||||
if (lkeyW[key][i] == ckey[keyc][i])
|
||||
@@ -1779,7 +1798,7 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
/* find key with longest match streak */
|
||||
for (keyn=0; keyn<MAIN_LEN; keyn++) {
|
||||
if ((*lkey)[keyn][0] && !lkeyW[keyn][0])
|
||||
- MultiByteToWideChar(codepage, 0, (*lkey)[keyn], -1, lkeyW[keyn], 4);
|
||||
+ MultiByteToWideChar(codepage, 0, (*lkey)[keyn], 4, lkeyW[keyn], 4);
|
||||
for (ok=lkeyW[keyn][i=0]; ok&&(i<4); i++)
|
||||
if (lkeyW[keyn][i] && lkeyW[keyn][i]!=ckey[i]) ok=0;
|
||||
if (!ok) i--; /* we overshot */
|
||||
@@ -1800,7 +1819,7 @@ void X11DRV_InitKeyboard( Display *display )
|
||||
TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
|
||||
keyc2vkey[e2.keycode] = vkey;
|
||||
keyc2scan[e2.keycode] = scan;
|
||||
- if ((vkey & 0xff) && vkey_used[(vkey & 0xff)])
|
||||
+ if ((vkey & 0xff) && !(vkey & 0x100) && vkey_used[(vkey & 0xff)])
|
||||
WARN("vkey %04X is being used by more than one keycode\n", vkey);
|
||||
vkey_used[(vkey & 0xff)] = 1;
|
||||
} /* for */
|
||||
@@ -2388,11 +2407,12 @@ static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
switch (keysym)
|
||||
{
|
||||
/* symbolic ASCII is the same as defined in rfc1345 */
|
||||
-#ifdef XK_dead_tilde
|
||||
- case XK_dead_tilde :
|
||||
+ /* cases are sorted by macro values */
|
||||
+#ifdef XK_dead_grave
|
||||
+ case XK_dead_grave :
|
||||
#endif
|
||||
- case 0x1000FE7E : /* Xfree's XK_Dtilde */
|
||||
- return '~'; /* '? */
|
||||
+ case 0x1000FE60 : /* Xfree's XK_Dgrave_accent */
|
||||
+ return 0x0060; /* '! */
|
||||
|
||||
#ifdef XK_dead_acute
|
||||
case XK_dead_acute :
|
||||
@@ -2404,24 +2424,13 @@ static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
case XK_dead_circumflex:
|
||||
#endif
|
||||
case 0x1000FE5E : /* Xfree's XK_Dcircumflex_accent */
|
||||
- return '^'; /* '> */
|
||||
-
|
||||
-#ifdef XK_dead_grave
|
||||
- case XK_dead_grave :
|
||||
-#endif
|
||||
- case 0x1000FE60 : /* Xfree's XK_Dgrave_accent */
|
||||
- return '`'; /* '! */
|
||||
-
|
||||
-#ifdef XK_dead_diaeresis
|
||||
- case XK_dead_diaeresis :
|
||||
-#endif
|
||||
- case 0x1000FE22 : /* Xfree's XK_Ddiaeresis */
|
||||
- return 0x00a8; /* ': */
|
||||
+ return 0x005e; /* '> */
|
||||
|
||||
-#ifdef XK_dead_cedilla
|
||||
- case XK_dead_cedilla :
|
||||
- return 0x00b8; /* ', */
|
||||
+#ifdef XK_dead_tilde
|
||||
+ case XK_dead_tilde :
|
||||
#endif
|
||||
+ case 0x1000FE7E : /* Xfree's XK_Dtilde */
|
||||
+ return 0x007e; /* '? */
|
||||
|
||||
#ifdef XK_dead_macron
|
||||
case XK_dead_macron :
|
||||
@@ -2438,6 +2447,12 @@ static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
return 0x02d9; /* '. */
|
||||
#endif
|
||||
|
||||
+#ifdef XK_dead_diaeresis
|
||||
+ case XK_dead_diaeresis :
|
||||
+#endif
|
||||
+ case 0x1000FE22 : /* Xfree's XK_Ddiaeresis */
|
||||
+ return 0x00a8; /* ': */
|
||||
+
|
||||
#ifdef XK_dead_abovering
|
||||
case XK_dead_abovering :
|
||||
return 0x02da; /* '0 */
|
||||
@@ -2453,11 +2468,21 @@ static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
return 0x02c7; /* '< */
|
||||
#endif
|
||||
|
||||
+#ifdef XK_dead_cedilla
|
||||
+ case XK_dead_cedilla :
|
||||
+ return 0x00b8; /* ', */
|
||||
+#endif
|
||||
+
|
||||
#ifdef XK_dead_ogonek
|
||||
case XK_dead_ogonek :
|
||||
return 0x02db; /* '; */
|
||||
#endif
|
||||
|
||||
+#ifdef XK_dead_iota
|
||||
+ case XK_dead_iota :
|
||||
+ return 0x037a; /* unknown */
|
||||
+#endif
|
||||
+
|
||||
#ifdef XK_dead_voiced_sound
|
||||
case XK_dead_voiced_sound :
|
||||
return 0x309b; /* unknown */
|
||||
@@ -2468,10 +2493,173 @@ static WCHAR KEYBOARD_MapDeadKeysym(KeySym keysym)
|
||||
return 0x309c; /* unknown */
|
||||
#endif
|
||||
|
||||
-/* FIXME: I don't know this one.
|
||||
- case XK_dead_iota :
|
||||
- return 'i';
|
||||
-*/
|
||||
+/* Modifiers below don't have an independent form in X11 compose files.
|
||||
+ * Maybe we should not return them as Windows doesn't seem to have them. */
|
||||
+#ifdef XK_dead_belowdot
|
||||
+ case XK_dead_belowdot :
|
||||
+ return 0x0323;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_hook
|
||||
+ case XK_dead_hook :
|
||||
+ return 0x0309;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_horn
|
||||
+ case XK_dead_horn :
|
||||
+ return 0x031b;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_stroke
|
||||
+ case XK_dead_stroke :
|
||||
+ return '/'; /* From Compose file */
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_abovecomma
|
||||
+ case XK_dead_abovecomma :
|
||||
+ return 0x0313;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_abovereversedcomma
|
||||
+ case XK_dead_abovereversedcomma :
|
||||
+ return 0x0314;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_doublegrave
|
||||
+ case XK_dead_doublegrave :
|
||||
+ return 0x02f5; /* This one is not combined */
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowring
|
||||
+ case XK_dead_belowring :
|
||||
+ return 0x0325;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowmacron
|
||||
+ case XK_dead_belowmacron :
|
||||
+ return 0x0331;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowcircumflex
|
||||
+ case XK_dead_belowcircumflex :
|
||||
+ return 0x032d;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowtilde
|
||||
+ case XK_dead_belowtilde :
|
||||
+ return 0x0330;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowbreve
|
||||
+ case XK_dead_belowbreve :
|
||||
+ return 0x032e;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowdiaeresis
|
||||
+ case XK_dead_belowdiaeresis :
|
||||
+ return 0x0324;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_invertedbreve
|
||||
+ case XK_dead_invertedbreve :
|
||||
+ return 0x0311;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowcomma
|
||||
+ case XK_dead_belowcomma :
|
||||
+ return ','; /* From Compose file */
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_currency
|
||||
+ case XK_dead_currency :
|
||||
+ return 0x00a4; /* From Compose file */
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_a
|
||||
+ case XK_dead_a :
|
||||
+ return 'a';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_A
|
||||
+ case XK_dead_A :
|
||||
+ return 'A';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_e
|
||||
+ case XK_dead_e :
|
||||
+ return 'e';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_E
|
||||
+ case XK_dead_E :
|
||||
+ return 'E';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_i
|
||||
+ case XK_dead_i :
|
||||
+ return 'i';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_I
|
||||
+ case XK_dead_I :
|
||||
+ return 'I';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_o
|
||||
+ case XK_dead_o :
|
||||
+ return 'o';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_O
|
||||
+ case XK_dead_O :
|
||||
+ return 'O';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_u
|
||||
+ case XK_dead_u :
|
||||
+ return 'u';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_U
|
||||
+ case XK_dead_U :
|
||||
+ return 'U';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_small_schwa
|
||||
+ case XK_dead_small_schwa :
|
||||
+ return 0x0259;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_capital_schwa
|
||||
+ case XK_dead_capital_schwa :
|
||||
+ return 0x018f;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_greek
|
||||
+ case XK_dead_greek :
|
||||
+ return 0x00b5;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_lowline
|
||||
+ case XK_dead_lowline :
|
||||
+ return '_';
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_aboveverticalline
|
||||
+ case XK_dead_aboveverticalline :
|
||||
+ return 0x030d;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_belowverticalline
|
||||
+ case XK_dead_belowverticalline :
|
||||
+ return 0x0329;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef XK_dead_longsolidusoverlay
|
||||
+ case XK_dead_longsolidusoverlay :
|
||||
+ return 0x0338;
|
||||
+#endif
|
||||
+
|
||||
}
|
||||
TRACE("no character for dead keysym 0x%08lx\n",keysym);
|
||||
return 0;
|
||||
--
|
||||
2.19.2
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 98aba5f3f2146d09c5beb453d7dfb493970535dc Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Kraus <neverberlerfellerer@gmail.com>
|
||||
Date: Wed, 12 Dec 2018 15:25:30 +0100
|
||||
Subject: [PATCH 2/2] winex11.drv: Fix main Russian keyboard layout
|
||||
|
||||
Now main_key_RU is properly detected for layout known in X as default Russian layout.
|
||||
---
|
||||
dlls/winex11.drv/keyboard.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 7c7dd4335e..cd4ad570c3 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -452,13 +452,13 @@ static const char main_key_BY[MAIN_LEN][4] =
|
||||
};
|
||||
|
||||
|
||||
-/*** Russian keyboard layout (contributed by Pavel Roskin) */
|
||||
+/*** Russian keyboard layout */
|
||||
static const char main_key_RU[MAIN_LEN][4] =
|
||||
{
|
||||
- "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
|
||||
- "qQ\xca\xea","wW\xc3\xe3","eE\xd5\xf5","rR\xcb\xeb","tT\xc5\xe5","yY\xce\xee","uU\xc7\xe7","iI\xdb\xfb","oO\xdd\xfd","pP\xda\xfa","[{\xc8\xe8","]}\xdf\xff",
|
||||
- "aA\xc6\xe6","sS\xd9\xf9","dD\xd7\xf7","fF\xc1\xe1","gG\xd0\xf0","hH\xd2\xf2","jJ\xcf\xef","kK\xcc\xec","lL\xc4\xe4",";:\xd6\xf6","'\"\xdc\xfc","\\|",
|
||||
- "zZ\xd1\xf1","xX\xde\xfe","cC\xd3\xf3","vV\xcd\xed","bB\xc9\xe9","nN\xd4\xf4","mM\xd8\xf8",",<\xc2\xe2",".>\xc0\xe0","/?"
|
||||
+ "\xb8\xa8","1!","2\"","3\xb9","4;","5%","6:","7?","8*","9(","0)","-_","=+",
|
||||
+ "\xe9\xc9","\xf6\xd6","\xf3\xd3","\xea\xca","\xe5\xc5","\xed\xcd","\xe3\xc3","\xf8\xd8","\xf9\xf9","\xe7\xc7","\xf5\xd5","\xfa\xda",
|
||||
+ "\xf4\xd4","\xec\xcc","\xfb\xdb","\xe2\xc2","\xe0\xc0","\xef\xcf","\xee\xce","\xeb\xcb","\xe4\xc4","\xe6\xc6","\xfd\xdd","\\/",
|
||||
+ "\xff\xdf","\xf7\xd7","\xf1\xd1","\xec\xcc","\xe8\xc8","\xf2\xd2","\xfc\xdc","\xe1\xc1","\xfe\xde",".,"
|
||||
};
|
||||
|
||||
/*** Russian keyboard layout (phantom key version) */
|
||||
--
|
||||
2.20.0
|
||||
|
@ -1,7 +0,0 @@
|
||||
Fixes: [30984] Improve key translation.
|
||||
Fixes: [45605] Letter keys doesn't work in DirectX aplications
|
||||
Disabled: True
|
||||
|
||||
# Broken due to winex11 being converted to PE.
|
||||
# MultiByteToWideChar is undefined and may not be the best way handle
|
||||
# this anymore.
|
Loading…
Reference in New Issue
Block a user