2020-05-27 15:46:43 -07:00
|
|
|
From df6fb4c8cee4e6cf8223ca065234749dec3cfbaf Mon Sep 17 00:00:00 2001
|
2015-11-15 06:47:50 -08:00
|
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
|
|
Date: Thu, 5 Nov 2015 14:33:48 +0100
|
2020-05-27 15:46:43 -07:00
|
|
|
Subject: [PATCH] winex11.drv: Allow to select default display frequency in
|
|
|
|
registry key.
|
2015-11-15 06:47:50 -08:00
|
|
|
|
|
|
|
When an application doesn't request a specific display frequency, Wine
|
|
|
|
currently just picks the first one. Most of the time this is fine, but
|
|
|
|
there is no way to switch to a different frequency. This patch adds a
|
|
|
|
registry key (of type STRING) to select the default display frequency:
|
|
|
|
|
|
|
|
HKCU\Software\Wine\X11 Driver\DefaultDisplayFrequency
|
|
|
|
---
|
2020-02-10 15:40:48 -08:00
|
|
|
dlls/winex11.drv/settings.c | 58 ++++++++++++++++++++++------------
|
2015-11-15 06:47:50 -08:00
|
|
|
dlls/winex11.drv/x11drv.h | 1 +
|
2018-08-24 15:37:59 -07:00
|
|
|
dlls/winex11.drv/x11drv_main.c | 4 +++
|
|
|
|
3 files changed, 43 insertions(+), 20 deletions(-)
|
2015-11-15 06:47:50 -08:00
|
|
|
|
|
|
|
diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c
|
2020-05-27 15:46:43 -07:00
|
|
|
index 70ce35361b6..cada9cd5df2 100644
|
2015-11-15 06:47:50 -08:00
|
|
|
--- a/dlls/winex11.drv/settings.c
|
|
|
|
+++ b/dlls/winex11.drv/settings.c
|
2020-05-27 15:46:43 -07:00
|
|
|
@@ -348,7 +348,7 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
|
|
|
|
WCHAR primary_adapter[CCHDEVICENAME];
|
2018-08-24 15:37:59 -07:00
|
|
|
char bpp_buffer[16], freq_buffer[18];
|
2020-05-27 15:46:43 -07:00
|
|
|
DEVMODEW default_mode;
|
2020-02-10 15:40:48 -08:00
|
|
|
- DWORD i;
|
|
|
|
+ DWORD i, mode;
|
2015-11-15 06:47:50 -08:00
|
|
|
|
2020-05-27 15:46:43 -07:00
|
|
|
if (!get_primary_adapter(primary_adapter))
|
|
|
|
return DISP_CHANGE_FAILED;
|
|
|
|
@@ -379,6 +379,7 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
|
|
|
|
return DISP_CHANGE_SUCCESSFUL;
|
|
|
|
}
|
|
|
|
|
2015-11-15 06:47:50 -08:00
|
|
|
+ mode = ENUM_CURRENT_SETTINGS;
|
|
|
|
for (i = 0; i < dd_mode_count; i++)
|
|
|
|
{
|
|
|
|
if (devmode->dmFields & DM_BITSPERPEL)
|
2020-05-27 15:46:43 -07:00
|
|
|
@@ -396,32 +397,49 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
|
2015-11-15 06:47:50 -08:00
|
|
|
if (devmode->dmPelsHeight != dd_modes[i].height)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
- if ((devmode->dmFields & DM_DISPLAYFREQUENCY) && (dd_modes[i].refresh_rate != 0) &&
|
|
|
|
+ if ((devmode->dmFields & DM_DISPLAYFREQUENCY) &&
|
|
|
|
devmode->dmDisplayFrequency != 0)
|
|
|
|
{
|
|
|
|
- if (devmode->dmDisplayFrequency != dd_modes[i].refresh_rate)
|
|
|
|
+ if (dd_modes[i].refresh_rate != 0 &&
|
|
|
|
+ devmode->dmDisplayFrequency != dd_modes[i].refresh_rate)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
- /* we have a valid mode */
|
|
|
|
- TRACE("Requested display settings match mode %d (%s)\n", i, handler_name);
|
|
|
|
-
|
|
|
|
- if (flags & CDS_UPDATEREGISTRY)
|
|
|
|
- write_registry_settings(devmode);
|
|
|
|
+ else if (default_display_frequency != 0)
|
|
|
|
+ {
|
|
|
|
+ if (dd_modes[i].refresh_rate != 0 &&
|
|
|
|
+ default_display_frequency == dd_modes[i].refresh_rate)
|
|
|
|
+ {
|
|
|
|
+ TRACE("Found display mode %d with default frequency (%s)\n", i, handler_name);
|
|
|
|
+ mode = i;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (!(flags & (CDS_TEST | CDS_NORESET)))
|
|
|
|
- return pSetCurrentMode(i);
|
|
|
|
+ if (mode == ENUM_CURRENT_SETTINGS)
|
|
|
|
+ mode = i;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return DISP_CHANGE_SUCCESSFUL;
|
|
|
|
+ if (mode == ENUM_CURRENT_SETTINGS)
|
|
|
|
+ {
|
2018-08-24 15:37:59 -07:00
|
|
|
+ /* no valid modes found, only print the fields we were trying to matching against */
|
|
|
|
+ bpp_buffer[0] = freq_buffer[0] = 0;
|
|
|
|
+ if (devmode->dmFields & DM_BITSPERPEL)
|
|
|
|
+ sprintf(bpp_buffer, "bpp=%u ", devmode->dmBitsPerPel);
|
|
|
|
+ if ((devmode->dmFields & DM_DISPLAYFREQUENCY) && (devmode->dmDisplayFrequency != 0))
|
|
|
|
+ sprintf(freq_buffer, "freq=%u ", devmode->dmDisplayFrequency);
|
|
|
|
+ ERR("No matching mode found: width=%d height=%d %s%s(%s)\n",
|
|
|
|
+ devmode->dmPelsWidth, devmode->dmPelsHeight, bpp_buffer, freq_buffer, handler_name);
|
2015-11-15 06:47:50 -08:00
|
|
|
+ return DISP_CHANGE_BADMODE;
|
|
|
|
}
|
|
|
|
|
2018-08-24 15:37:59 -07:00
|
|
|
- /* no valid modes found, only print the fields we were trying to matching against */
|
|
|
|
- bpp_buffer[0] = freq_buffer[0] = 0;
|
|
|
|
- if (devmode->dmFields & DM_BITSPERPEL)
|
|
|
|
- sprintf(bpp_buffer, "bpp=%u ", devmode->dmBitsPerPel);
|
|
|
|
- if ((devmode->dmFields & DM_DISPLAYFREQUENCY) && (devmode->dmDisplayFrequency != 0))
|
|
|
|
- sprintf(freq_buffer, "freq=%u ", devmode->dmDisplayFrequency);
|
|
|
|
- ERR("No matching mode found: width=%d height=%d %s%s(%s)\n",
|
|
|
|
- devmode->dmPelsWidth, devmode->dmPelsHeight, bpp_buffer, freq_buffer, handler_name);
|
2015-11-15 06:47:50 -08:00
|
|
|
+ /* we have a valid mode */
|
|
|
|
+ TRACE("Requested display settings match mode %d (%s)\n", mode, handler_name);
|
|
|
|
+
|
|
|
|
+ if (flags & CDS_UPDATEREGISTRY)
|
|
|
|
+ write_registry_settings(devmode);
|
|
|
|
+
|
|
|
|
+ if (!(flags & (CDS_TEST | CDS_NORESET)))
|
|
|
|
+ return pSetCurrentMode(mode);
|
2018-08-24 15:37:59 -07:00
|
|
|
|
|
|
|
- return DISP_CHANGE_BADMODE;
|
2015-11-15 06:47:50 -08:00
|
|
|
+ return DISP_CHANGE_SUCCESSFUL;
|
|
|
|
}
|
|
|
|
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
2020-05-27 15:46:43 -07:00
|
|
|
index 803e3e4103e..6dfe4a35f6b 100644
|
2015-11-15 06:47:50 -08:00
|
|
|
--- a/dlls/winex11.drv/x11drv.h
|
|
|
|
+++ b/dlls/winex11.drv/x11drv.h
|
2020-05-27 15:46:43 -07:00
|
|
|
@@ -403,6 +403,7 @@ extern BOOL private_color_map DECLSPEC_HIDDEN;
|
2015-11-15 06:47:50 -08:00
|
|
|
extern int primary_monitor DECLSPEC_HIDDEN;
|
|
|
|
extern int copy_default_colors DECLSPEC_HIDDEN;
|
|
|
|
extern int alloc_system_colors DECLSPEC_HIDDEN;
|
|
|
|
+extern int default_display_frequency DECLSPEC_HIDDEN;
|
|
|
|
extern int xrender_error_base DECLSPEC_HIDDEN;
|
|
|
|
extern HMODULE x11drv_module DECLSPEC_HIDDEN;
|
2017-07-18 02:29:09 -07:00
|
|
|
extern char *process_name DECLSPEC_HIDDEN;
|
2015-11-15 06:47:50 -08:00
|
|
|
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
2020-05-27 15:46:43 -07:00
|
|
|
index 0732aaa1113..ee8de0a3830 100644
|
2015-11-15 06:47:50 -08:00
|
|
|
--- a/dlls/winex11.drv/x11drv_main.c
|
|
|
|
+++ b/dlls/winex11.drv/x11drv_main.c
|
2020-05-27 15:46:43 -07:00
|
|
|
@@ -85,6 +85,7 @@ BOOL client_side_with_render = TRUE;
|
2015-11-15 06:47:50 -08:00
|
|
|
BOOL shape_layered_windows = TRUE;
|
|
|
|
int copy_default_colors = 128;
|
|
|
|
int alloc_system_colors = 256;
|
|
|
|
+int default_display_frequency = 0;
|
|
|
|
DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES;
|
|
|
|
int xrender_error_base = 0;
|
|
|
|
HMODULE x11drv_module = 0;
|
2020-05-27 15:46:43 -07:00
|
|
|
@@ -437,6 +438,9 @@ static void setup_options(void)
|
2015-11-15 06:47:50 -08:00
|
|
|
if (!get_config_key( hkey, appkey, "AllocSystemColors", buffer, sizeof(buffer) ))
|
|
|
|
alloc_system_colors = atoi(buffer);
|
|
|
|
|
|
|
|
+ if (!get_config_key( hkey, appkey, "DefaultDisplayFrequency", buffer, sizeof(buffer) ))
|
|
|
|
+ default_display_frequency = atoi(buffer);
|
|
|
|
+
|
|
|
|
get_config_key( hkey, appkey, "InputStyle", input_style, sizeof(input_style) );
|
|
|
|
|
|
|
|
if (appkey) RegCloseKey( appkey );
|
|
|
|
--
|
2020-05-27 15:46:43 -07:00
|
|
|
2.26.2
|
2015-11-15 06:47:50 -08:00
|
|
|
|