Commit Graph

279 Commits

Author SHA1 Message Date
Zhiyi Zhang 5cdbcb0f59 uxtheme: Call DefDlgProc() if drawing tab body in a dialog fails.
Some third party themes have tab body part defined but with its ImageSelectType set to IST_NONE.
In this case, DrawThemeBackground() will fail to draw the background.

Fix track bar black background in winecfg when using VLT theme.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +01:00
Zhiyi Zhang bcbe1bcff3 uxtheme: Use StretchBlt() when resizing a source image for tiling.
For example, when a theme part has a source image with 0xff00ff as transparent pixels and the sizing
margin is larger than the destination, the source image is first resized to fit the destination,
during which, StretchBlt() should be used instead of TransparentBlt() because the image should not
be blended with the temporary memory device context.

Fix group box background may be drawn in black.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +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 bb116c4b77 uxtheme: Support more progress bar parts.
These parts are available on Vista+.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:31:21 +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 2f1bbd88ed uxtheme: Do not draw parent background when handling WM_CTLCOLORSTATIC for static controls.
SetBkMode(TRANSPARENT) already indicates that the parent background should remain untouched.
Drawing parent background destroys any previous content that applications drawn and some
applications rely on the content being unchanged.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51914
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-04 10:25:07 +01:00
Zhiyi Zhang c90edc19bb uxtheme: Implement GetThemeTransitionDuration().
Fix Nokia SDK 2.0 for Java installer buttons not changing state after clicking.

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 59007aaeef uxtheme/tests: Add GetThemeTransitionDuration() tests.
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 36ed40e99f light.msstyles: Add TMT_TRANSITIONDURATIONS property.
Set all transition duration to 100ms for different states and 0ms for the same state.

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 2ca5798b2a uxtheme: Support TMT_TRANSITIONDURATIONS property.
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 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 f86f0aec99 uxtheme/tests: Add GetThemeIntList() tests.
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 2cfd5c0850 uxtheme/tests: Add EnableTheming() tests.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 09:39:48 +02:00
Zhiyi Zhang cd99d08a74 uxtheme: Initialize system metrics in 96 DPI.
Similar to 7290db3.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 09:39:40 +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
Alexandre Julliard 088a787a2c makefiles: Make -mno-cygwin the default.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +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
Francois Gouget 568143ff97 uxtheme/tests: Use the OpenThemeDataForDpi() function pointer.
OpenThemeDataForDpi() is not available in Windows 10 1607 and older.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Zhiyi Zhang f8bc5d7627 uxtheme: Get DPI from theme class.
Fix Command Link glyphs not scaled according to DPI because a NULL device context handle was
passed to GetThemePartSize() and GetThemePartSize() was using a device context to get DPI.

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 8aed2ec3b9 uxtheme: Use OpenThemeDataForDpi() to create a theme handle not associated to a window.
If a window is not passed to OpenThemeData(), OpenThemeData() assumes the DPI is 96 according to
tests. And GetThemePartSize() should select theme parts according to the DPI stored in theme
handles rather than using GDI device contexts. Thus, OpenThemeDataForDpi() should be used in place
of OpenThemeData() when DPI is not 96 and theme handles shouldn't be associated with a window.

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 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 069ed533b4 uxtheme/tests: Add GetThemePartSize() tests.
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 2fd0e56a9f uxtheme: Draw scroll bar parent background only when theme parts are transparent.
Fix hangs in Source Insight 4 Options->Window->Styles.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 10:40:19 +02:00
Zhiyi Zhang 96b7a8a317 uxtheme: Use TransparentBlt() for bitmaps with all alpha values being 0xff.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51553
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 10:40:11 +02:00
Zhiyi Zhang ea430bf2b7 uxtheme: Implement DrawThemeIcon().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51589
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 10:40:08 +02:00
Zhiyi Zhang 6db55005c7 uxtheme: Add comctl32 v6 manifest.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 10:39:54 +02:00
Zhiyi Zhang 877d12f879 uxtheme: Support more HiDPI properties.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 12:13:35 +02:00
Zhiyi Zhang 4b2777db4b uxtheme: Support TrueSizeStretchMark property.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 12:13:27 +02:00
Zhiyi Zhang 0d96bf1f38 uxtheme: Support TrueSizeScalingType property.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 12:13:23 +02:00
Zhiyi Zhang 399ebdf893 uxtheme: Remove useless calculation.
rcDst is not used after it is used for getting destination rectangle width and height.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 12:13:18 +02:00
Zhiyi Zhang 6414726f57 uxtheme: Fix a typo in comment.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:40:15 +02:00
Zhiyi Zhang ec82a0ebe6 uxtheme: Fix incorrect part IDs in button class map.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51506
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 19:42:25 +02:00
Zhiyi Zhang 8c38f02d23 uxtheme: Support pressed state for themed scroll bars.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-20 18:50: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 064dad2342 uxtheme/tests: Test that SetWindowTheme() should send WM_THEMECHANGED instead of posting it.
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
Zhiyi Zhang 59f3758ecb uxtheme/tests: Test SetWindowTheme() with a non-existent subclass.
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 c6b100ef98 uxtheme: Remove unused code.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-22 20:20:10 +01:00