From: Rémi Bernon rbernon@codeweavers.com
--- 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 84be34eab10..0deab41954c 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 \ theme.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 67df9146f3d..7ab5a71186a 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 7 +#define NUM_PROPERTY_PAGES 8
static INT_PTR doPropertySheet (HINSTANCE hInstance, HWND hOwner) @@ -139,6 +139,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 dd46bc71b40..716f87e0d6f 100644 --- a/programs/winecfg/resource.h +++ b/programs/winecfg/resource.h @@ -45,6 +45,7 @@ #define IDS_SHELL_FOLDER 16 #define IDS_LINKS_TO 17 #define IDS_WINECFG_TITLE_APP 18 /* App specific title */ +#define IDS_TAB_INPUT 19 #define IDI_WINECFG 100 #define IDI_LOGO 102 #define IDD_ABOUTCFG 107 @@ -54,6 +55,7 @@ #define IDD_DLLCFG 111 #define IDD_DRIVECFG 112 #define IDD_DESKTOP_INTEGRATION 115 +#define IDD_INPUT_CONFIG 116 #define IDC_WINVER 1012 #define IDC_DESKTOP_WIDTH 1023 #define IDC_DESKTOP_HEIGHT 1024 @@ -124,7 +126,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 @@ -218,3 +219,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 f3f3ad2addf..0c7ed407803 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);
@@ -86,6 +89,7 @@ INT_PTR CALLBACK LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ThemeDlgProc (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 8775b3b691b..19332ea0e64 100644 --- a/programs/winecfg/winecfg.rc +++ b/programs/winecfg/winecfg.rc @@ -39,6 +39,7 @@ BEGIN IDS_TAB_DESKTOP_INTEGRATION "Desktop Integration" IDS_TAB_AUDIO "Audio" 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)" @@ -164,22 +165,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 @@ -310,6 +310,14 @@ BEGIN PUSHBUTTON "B&rowse...",IDC_BROWSE_SFPATH,195,195,50,13,WS_DISABLED 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; }