wine-staging/patches/winex11-Fixed-scancodes/0006-winecfg-Add-a-keyboard-scancode-detection-toggle-opt.patch

78 lines
3.2 KiB
Diff

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