wine-staging/patches/winex11-Fixed-scancodes/0001-winecfg-Move-input-config-options-to-a-dedicated-tab.patch

358 lines
13 KiB
Diff
Raw Normal View History

From 311a382432c4dd6a6d2ded5e6c10c6fe83767646 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] 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 9d60385414f..a88bff34a92 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -181,6 +181,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: Rémi Bernon <rbernon@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].pszTemplate = MAKEINTRESOURCEW (IDD_INPUT_CONFIG);
+ psp[pg].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 &GTK3 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.2