Module: wine
Branch: oldstable
Commit: b363adda0512e7c9781f6e7be1b83dd870c36f6e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b363adda0512e7c9781f6e7b…
Author: Gerald Pfeifer <gerald(a)pfeifer.com>
Date: Tue Aug 10 22:36:27 2021 +0200
ntdll: Only use sysinfo function when present.
On some systems <sys/sysinfo.h> may be present while the sysinfo
function may not, or at least not as part of standard libraries,
so check whether the function is actually available before using
it.
This fixes builds on FreeBSD with the devel/libsysinfo present.
Signed-off-by: Gerald Pfeifer <gerald(a)pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
(cherry picked from commit 59da79021a6e441e3b21b933c744aba922208ec1)
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
configure | 1 +
configure.ac | 1 +
dlls/ntdll/unix/virtual.c | 3 ++-
include/config.h.in | 3 +++
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 0ac783d7479..780e32d9ca8 100755
--- a/configure
+++ b/configure
@@ -17760,6 +17760,7 @@ for ac_func in \
setprogname \
sigprocmask \
symlink \
+ sysinfo \
tcdrain \
thr_kill2
diff --git a/configure.ac b/configure.ac
index ed5116b17c9..9cf059e1edc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2160,6 +2160,7 @@ AC_CHECK_FUNCS(\
setprogname \
sigprocmask \
symlink \
+ sysinfo \
tcdrain \
thr_kill2
)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index e2956c1ac97..e8ccf54791d 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -2451,7 +2451,8 @@ ULONG_PTR get_system_affinity_mask(void)
*/
void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
{
-#if defined(HAVE_STRUCT_SYSINFO_TOTALRAM) && defined(HAVE_STRUCT_SYSINFO_MEM_UNIT)
+#if defined(HAVE_SYSINFO) \
+ && defined(HAVE_STRUCT_SYSINFO_TOTALRAM) && defined(HAVE_STRUCT_SYSINFO_MEM_UNIT)
struct sysinfo sinfo;
if (!sysinfo(&sinfo))
diff --git a/include/config.h.in b/include/config.h.in
index c131f8f22bc..2dcf318e4ec 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -891,6 +891,9 @@
/* Define to 1 if you have the <syscall.h> header file. */
#undef HAVE_SYSCALL_H
+/* Define to 1 if you have the `sysinfo' function. */
+#undef HAVE_SYSINFO
+
/* Define to 1 if you have the
<SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h> header file. */
#undef HAVE_SYSTEMCONFIGURATION_SCDYNAMICSTORECOPYDHCPINFO_H
Module: wine
Branch: oldstable
Commit: f0143c1bc9b1186324fafa896fe242eab4da727c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f0143c1bc9b1186324fafa89…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com>
Date: Thu Sep 9 14:46:24 2021 +0800
uxtheme: Get and set system metrics in 96 DPI.
Fix a bug that font size may be smaller than normal after toggling theming.
For example, the following steps will change the system metrics to incorrect values.
1. Open winecfg, and set DPI to 192. Do not restart winecfg.
2. Change the theme to Light. UXTHEME_BackupSystemMetrics() backs up system metrics in 96 DPI
because the current DPI is still 96.
3. Restart winecfg and turn off theming. UXTHEME_RestoreSystemMetrics() restores system metrics in
192 DPI because the current DPI is 192. So system metrics will be scaled to 1/2 of the original size.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37592
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
(cherry picked from commit 7290db3e7a9652fcc39717b2fb492071dd52c641)
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/uxtheme/msstyles.c | 4 ++++
dlls/uxtheme/system.c | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c
index 3624bb2d4a6..ded8685a98e 100644
--- a/dlls/uxtheme/msstyles.c
+++ b/dlls/uxtheme/msstyles.c
@@ -830,12 +830,16 @@ static BOOL parse_handle_nonclient_size (struct PARSENONCLIENTSTATE* state,
static void parse_apply_nonclient (struct PARSENONCLIENTSTATE* state)
{
+ DPI_AWARENESS_CONTEXT old_context;
+
if (state->metricsDirty)
{
+ old_context = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, sizeof (state->metrics),
&state->metrics, 0);
SystemParametersInfoW (SPI_SETICONTITLELOGFONT, sizeof (state->iconTitleFont),
&state->iconTitleFont, 0);
+ SetThreadDpiAwarenessContext(old_context);
}
}
diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c
index f8cc876b0c9..8b772a946d3 100644
--- a/dlls/uxtheme/system.c
+++ b/dlls/uxtheme/system.c
@@ -276,9 +276,12 @@ static void save_sys_colors (HKEY baseKey)
* is deactivated */
static void UXTHEME_BackupSystemMetrics(void)
{
+ DPI_AWARENESS_CONTEXT old_context;
HKEY hKey;
const struct BackupSysParam* bsp = backupSysParams;
+ old_context = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
+
if (RegCreateKeyExW( HKEY_CURRENT_USER, szThemeManager,
0, 0, 0, KEY_ALL_ACCESS,
0, &hKey, 0) == ERROR_SUCCESS)
@@ -315,14 +318,19 @@ static void UXTHEME_BackupSystemMetrics(void)
RegCloseKey (hKey);
}
+
+ SetThreadDpiAwarenessContext(old_context);
}
/* Read back old settings after a theme was deactivated */
static void UXTHEME_RestoreSystemMetrics(void)
{
+ DPI_AWARENESS_CONTEXT old_context;
HKEY hKey;
const struct BackupSysParam* bsp = backupSysParams;
+ old_context = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
+
if (RegOpenKeyExW (HKEY_CURRENT_USER, szThemeManager,
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
@@ -402,6 +410,8 @@ static void UXTHEME_RestoreSystemMetrics(void)
RegCloseKey (hKey);
}
+
+ SetThreadDpiAwarenessContext(old_context);
}
/* Make system settings persistent, so they're in effect even w/o uxtheme