Commit Graph

82 Commits

Author SHA1 Message Date
Nikolay Sivov 28d572aa14 uxtheme: Fix double free on registry key handle.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52704
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-25 11:31:53 +02:00
Zhiyi Zhang f11129d9c4 uxtheme: Search parts of any state in IsThemePartDefined().
Tests show that IsThemePartDefined() doesn't use state ID to search parts. If a part of any state is
present, the part is considered as defined. For example, disabled state of part EditText of class
Edit is present in theme files but there is no default state for part EditText. So
IsThemePartDefined(theme, EP_EDITTEXT, 0) failed previously and it should succeed.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52581
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 10:36:16 +01:00
Eric Pouech 354be197cd uxtheme: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-21 12:32:07 +01:00
Zhiyi Zhang b02405d799 uxtheme: Hook DefDlgProc() for dialog theming.
Fix controls on OpenMPT's channel setting dialog having incorrect background.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-24 10:18:31 +01:00
Zhiyi Zhang 9c9274990e uxtheme: Do not hook DefDlgProc() for theming.
Currently there is no need to hook DefDlgProc(). Tests show that dialog theming shouldn't be
implemented in DefDlgProc().

Also fix a double free bug because WM_DESTROY in UXTHEME_DefDlgProc() calls CloseThemeData() even
when the theme handle is not opened when handling WM_CREATE in UXTHEME_DefDlgProc(). The bug can
be demonstrated by running comctl32/tests/propsheet.c tests with Light theme.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-07 12:22:49 +01:00
Zhiyi Zhang ea71625cf1 uxtheme: Do not overwrite system metrics when loading the same theme.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51986
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52025
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:31:38 +01:00
Zhiyi Zhang 3762a11c81 uxtheme: Fix loading a different theme when theming is on.
When a theme is already active and a user tries to activate another theme,
the new theme configuration should be written to the registry so that it's
still in effect after a wine reboot.

Fix a regression introduced in d290362.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-04 10:25:16 +01:00
Zhiyi Zhang 18eacc6dc7 uxtheme: Use vssym32.h instead of tmschema.h.
tmschema.h is obsolete and missing some definitions. The deleted global and menu classes are not
used anywhere and not in Windows headers.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-02 17:09:39 +01:00
Zhiyi Zhang d290362c8c uxtheme: Check LoadedBefore registry key before loading theme.
Only save unthemed system metrics to the registry when the LoadedBefore
registry key value is '0'. This avoids saving themed system metrics
when two processes are trying to activate theming at the same time.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:20:31 +02:00
Zhiyi Zhang aefcd057b1 uxtheme: Save temporary system metrics to a struct in memory.
So that temporary system metrics are not saved in the registry. Saving
them to the registry creates a race condition when two processes are
trying to activate theming at the same time, one process might save
themed system metrics instead of unthemed system metrics to the registry.
The race condition will be more apparent when initializing a wine prefix
after theming is turned on by default in wine.inf.

This patch refactors the system metric helper functions to use an
in-memory struct and is a prerequisite to remove the race condition.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:20:29 +02:00
Zhiyi Zhang 9314b59a7d uxtheme: Pass size in bytes to RegQueryValueExW().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 11:22:14 +02:00
Zhiyi Zhang 27ab5f7bf4 uxtheme: Do not change system metrics in EnableTheming().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 09:40:00 +02:00
Zhiyi Zhang 50005fee22 uxtheme: Disallow EnableTheming() to enable theming.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 09:39:56 +02:00
Zhiyi Zhang af48d90a6f uxtheme: Use wide character string literals.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 09:39:36 +02:00
Zhiyi Zhang 7290db3e7a 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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 10:21:27 +02:00
Zhiyi Zhang 615a90e219 uxtheme: Implement OpenThemeDataForDpi().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-01 17:06:22 +02:00
Zhiyi Zhang 0a83027e20 uxtheme: Support drawing themed standard scroll bars.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39821
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-20 18:50:11 +02:00
Zhiyi Zhang b0e51ead0d uxtheme: Move themed dialog to uxtheme.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51137
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-20 18:49:55 +02:00
Zhiyi Zhang d9063802f2 uxtheme: Move themed scroll bar to uxtheme.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-20 18:49:49 +02:00
Zhiyi Zhang 6f00a2983a uxtheme: Avoid memory leaks.
A THEME_FILE struct and four global ATOMs are leaked when unloading uxtheme.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-05 17:52:47 +02:00
Zhiyi Zhang fe257dde58 uxtheme: Send WM_THEMECHANGED instead of posting it in SetWindowTheme().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51348
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 12:39:12 +02:00
Zhiyi Zhang 3f292a0e65 uxtheme: Check window handle for SetWindowTheme().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:57 +02:00
Zhiyi Zhang 16e2a9aecc uxtheme: Check window handle for GetWindowTheme().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:57 +02:00
Zhiyi Zhang f5e56638a7 uxtheme: Set last error code for OpenThemeDataEx().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:57 +02:00
Zhiyi Zhang 3e9fbda43c uxtheme: Fall back to default class if the specified subclass is not found.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50113
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 23:13:57 +02:00
Michael Stefaniuc 1f040d666b uxtheme: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-20 12:43:01 +02:00
Alexandre Julliard 21a19fb4e3 uxtheme: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-25 08:36:46 +02:00
Alex Henrie 53c8abbf8a uxtheme: Turn a variable and a constant into static constants.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 16:13:10 +01:00
Michael Stefaniuc 93994dfc0b uxtheme: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-18 21:09:28 +02:00
Louis Lenders 28613fcd93 uxtheme: Add stub for SetWindowThemeAttribute.
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-26 14:45:47 +01:00
Sergio Gómez Del Real 731136d8d3 uxtheme: Add a stub for IsCompositionActive().
Signed-off-by: Sergio Gómez Del Real <sdelreal@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-18 20:26:18 +02:00
Sebastian Lackner 461bfc64ba uxtheme: Return E_NOTIMPL in HRESULT stub functions.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-14 11:51:53 +09:00
Louis Lenders 997e2046df uxtheme: Fix CloseThemeData with invalid handle value.
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-15 21:30:05 +09:00
Andrew Talbot 925a4411e8 uxtheme: Remove unused variable. 2012-11-29 00:15:56 +01:00
Alistair Leslie-Hughes 81079ef35b uxtheme: Set last error on NULL pointer. 2011-08-31 19:43:07 +02:00
Marcus Meissner 790c107045 uxtheme: Mark internal symbols with hidden visibility. 2011-05-25 11:52:01 +02:00
André Hentschel 0304a3e998 uxtheme: Add OpenThemeDataEx. 2011-03-30 15:05:04 +02:00
Alexandre Julliard de3e06a745 uxtheme: Fix some pointer cast warnings on 64-bit. 2009-12-09 12:04:08 +01:00
Michael Stefaniuc 7eb3abc1c1 uxtheme: Remove superfluous pointer casts. 2009-01-13 15:25:55 +01:00
Francois Gouget b3bf746ff9 Straighten out some ellipses. 2008-11-26 12:33:34 +01:00
Michael Stefaniuc 373f8ff103 uxtheme: Remove superflous casts. 2008-11-03 13:42:23 +01:00
Reece Dunn d85c3e7c72 uxtheme: Fixed the todo blocks in the IsThemed tests when theming is inactive. 2008-10-27 13:49:01 +01:00
Austin English 6e59cd2c34 Spelling fixes. 2008-04-22 12:20:12 +02:00
Francois Gouget 2993785f3a Assorted non-ANSI function declaration fixes (missing void). 2007-08-30 11:57:18 +02:00
Andrew Talbot 2bb44198b6 uxtheme: Declare some items static. 2007-02-05 12:32:42 +01:00
Francois Gouget 1ccf944900 Assorted spelling fixes. 2006-11-13 13:01:53 +01:00
Francois Gouget 7a2bd72b8a uxtheme: winerror.h must not define the E_PROP_*_UNSUPPORTED macros. 2006-11-08 12:10:47 +01:00
Francois Gouget a7f8195be9 include: The PSDK does not have the A/W variants of MAKEINTATOM() so we should not either. 2006-11-08 12:10:26 +01:00
Michael Stefaniuc dc3706ae50 uxtheme: Win64 printf format warning fixes. 2006-10-09 12:55:53 +02:00
Francois Gouget 82babbee0b Add missing '\n's to Wine traces. 2006-10-05 17:46:48 +02:00