Commit Graph

258 Commits

Author SHA1 Message Date
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
Zhiyi Zhang 300ecff145 uxtheme: Support DTT_FONTPROP for DrawThemeTextEx().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-22 20:20:08 +01:00
Zhiyi Zhang a18df3a412 uxtheme: Support more font properties.
Add support for TMT_HEADING1FONT, TMT_HEADING2FONT and TMT_BODYFONT.
TMT_BODYFONT is used by Command Links.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-22 20:20:06 +01:00
Zhiyi Zhang 061ac08d6b uxtheme: Add Command Link part and state definitions.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-22 20:20:04 +01: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
Michael Stefaniuc e947b08149 uxtheme: Use wide-char string literals in struct initialization.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-20 12:42:53 +02:00
Michael Stefaniuc 43572cbd7d uxtheme/tests: 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:42:37 +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
Michael Stefaniuc 507bc401a4 uxtheme/tests: Use the available ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-31 09:24:54 +02:00
Nikolay Sivov 16ab42f94d uxtheme/tests: Remove some trace messages.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-23 11:09:17 +02:00
Nikolay Sivov d4cc71c5db uxtheme: Use global memory allocation helpers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-26 11:25:31 +01:00
Nikolay Sivov ce50a7ff4d uxtheme: Properly initialize text drawing options.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-14 09:05:57 +01: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
Nikolay Sivov 3fd8a8f209 uxtheme: Return NULL file handle on OpenThemeFile() failure.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-13 13:02:46 +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
Andrey Gusev 1a761379f8 uxtheme/tests: Fix a typo in ok() message.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-09 19:14:32 +02:00
Akihiro Sagawa 9abd3b9622 msstyles: Avoid using isspace() for WCHARs.
Found with Coccinelle.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-17 16:11:22 +02:00
Nikolay Sivov 2b8cf54245 uxtheme/tests: Remove some trace messages.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-26 10:59:41 +02:00
Nikolay Sivov 849c4716c1 uxtheme: Fix buffer dc origin and clipping.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-25 08:45:50 +02:00
Nikolay Sivov e015928a85 uxtheme: Fix buffer bitmap leak.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 10:01:57 +02:00