[COMCTL32] Install comctl32 v6 and its manifest in first stage
[reactos.git] / dll / win32 / comctl32 / comctl32_ros.diff
1 diff -pudN e:\wine\dlls\comctl32/comctl32.h e:\reactos\dll\win32\comctl32/comctl32.h
2 --- e:\wine\dlls\comctl32/comctl32.h 2017-09-07 12:58:14 +0100
3 +++ e:\reactos\dll\win32\comctl32/comctl32.h 2017-06-15 11:36:56 +0100
4 @@ -45,83 +45,15 @@
5 #include <uxtheme.h>
6 #include <vssym32.h>
7
8 -#include <wine/unicode.h>
9 #include <wine/debug.h>
10 +#include <wine/list.h>
11 +#include <wine/unicode.h>
12
13 #include "resource.h"
14
15 extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN;
16 extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN;
17
18 -/* Property sheet / Wizard */
19 -#define IDD_PROPSHEET 1006
20 -#define IDD_WIZARD 1020
21 -
22 -#define IDC_TABCONTROL 12320
23 -#define IDC_APPLY_BUTTON 12321
24 -#define IDC_BACK_BUTTON 12323
25 -#define IDC_NEXT_BUTTON 12324
26 -#define IDC_FINISH_BUTTON 12325
27 -#define IDC_SUNKEN_LINE 12326
28 -#define IDC_SUNKEN_LINEHEADER 12327
29 -
30 -#define IDS_CLOSE 4160
31 -
32 -/* Toolbar customization dialog */
33 -#define IDD_TBCUSTOMIZE 200
34 -
35 -#define IDC_AVAILBTN_LBOX 201
36 -#define IDC_RESET_BTN 202
37 -#define IDC_TOOLBARBTN_LBOX 203
38 -#define IDC_REMOVE_BTN 204
39 -#define IDC_HELP_BTN 205
40 -#define IDC_MOVEUP_BTN 206
41 -#define IDC_MOVEDN_BTN 207
42 -
43 -#define IDS_SEPARATOR 1024
44 -
45 -/* Toolbar imagelist bitmaps */
46 -#define IDB_STD_SMALL 120
47 -#define IDB_STD_LARGE 121
48 -#define IDB_VIEW_SMALL 124
49 -#define IDB_VIEW_LARGE 125
50 -#define IDB_HIST_SMALL 130
51 -#define IDB_HIST_LARGE 131
52 -
53 -#define IDM_TODAY 4163
54 -#define IDM_GOTODAY 4164
55 -
56 -/* Treeview Checkboxes */
57 -
58 -#define IDT_CHECK 401
59 -
60 -
61 -/* Cursors */
62 -#define IDC_MOVEBUTTON 102
63 -#define IDC_COPY 104
64 -#define IDC_DIVIDER 106
65 -#define IDC_DIVIDEROPEN 107
66 -
67 -
68 -/* DragList resources */
69 -#define IDI_DRAGARROW 501
70 -
71 -/* HOTKEY internal strings */
72 -#define HKY_NONE 2048
73 -
74 -/* Tooltip icons */
75 -#define IDI_TT_INFO_SM 22
76 -#define IDI_TT_WARN_SM 25
77 -#define IDI_TT_ERROR_SM 28
78 -
79 -/* Taskdialog strings */
80 -#define IDS_BUTTON_YES 3000
81 -#define IDS_BUTTON_NO 3001
82 -#define IDS_BUTTON_RETRY 3002
83 -#define IDS_BUTTON_OK 3003
84 -#define IDS_BUTTON_CANCEL 3004
85 -#define IDS_BUTTON_CLOSE 3005
86 -
87 typedef struct
88 {
89 COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */
90 @@ -145,6 +77,21 @@ typedef struct
91
92 extern COMCTL32_SysColor comctl32_color DECLSPEC_HIDDEN;
93
94 +typedef struct _BUTTON_DATA {
95 + LONG state;
96 + HFONT font;
97 + LONG_PTR image;
98 + DWORD ui_state;
99 +
100 + RECT rcTextMargin;
101 + BUTTON_IMAGELIST imlData;
102 +} BUTTON_DATA, *PBUTTON_DATA;
103 +
104 +static inline PBUTTON_DATA _GetButtonData(HWND hwnd)
105 +{
106 + return (PBUTTON_DATA)GetWindowLongPtrW( hwnd, 0 );
107 +}
108 +
109 /* Internal function */
110 HWND COMCTL32_CreateToolTip (HWND) DECLSPEC_HIDDEN;
111 VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN;
112 @@ -157,8 +104,6 @@ INT Str_GetPtrAtoW (LPCSTR lpSrc, LPWST
113 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN;
114 BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN;
115
116 -#define COMCTL32_VERSION_MINOR 81
117 -
118 /* Our internal stack structure of the window procedures to subclass */
119 typedef struct _SUBCLASSPROCS {
120 SUBCLASSPROC subproc;
121 @@ -230,13 +175,18 @@ extern void TREEVIEW_Register(void) DECL
122 extern void TREEVIEW_Unregister(void) DECLSPEC_HIDDEN;
123 extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
124 extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
125 -
126 +extern void BUTTON_Register();
127 +extern void BUTTON_Unregister();
128 +#ifdef __REACTOS__
129 +extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
130 +extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;
131 +#endif
132
133 int MONTHCAL_MonthLength(int month, int year) DECLSPEC_HIDDEN;
134 int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) DECLSPEC_HIDDEN;
135 LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN;
136
137 -extern void THEMING_Initialize(void) DECLSPEC_HIDDEN;
138 +extern void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6) DECLSPEC_HIDDEN;
139 extern void THEMING_Uninitialize(void) DECLSPEC_HIDDEN;
140 extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
141 extern void THEMING_SetSubclassData(HWND, ULONG_PTR) DECLSPEC_HIDDEN;
142 diff -pudN e:\wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commctrl.c
143 --- e:\wine\dlls\comctl32/commctrl.c 2017-09-07 12:58:14 +0100
144 +++ e:\reactos\dll\win32\comctl32/commctrl.c 2017-08-17 11:24:56 +0100
145 @@ -3,7 +3,7 @@
146 *
147 * Copyright 1997 Dimitrie O. Paun
148 * Copyright 1998,2000 Eric Kohl
149 - * Copyright 2014-2015 Michael Müller
150 + * Copyright 2014-2015 Michael Müller
151 *
152 * This library is free software; you can redistribute it and/or
153 * modify it under the terms of the GNU Lesser General Public
154 @@ -81,6 +81,259 @@ static const WCHAR strCC32SubclassInfo[]
155 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0
156 };
157
158 +#ifdef __REACTOS__
159 +
160 +#include <strsafe.h>
161 +
162 +#define NAME L"microsoft.windows.common-controls"
163 +#define VERSION_V5 L"5.82.2600.2982"
164 +#define VERSION L"6.0.2600.2982"
165 +#define PUBLIC_KEY L"6595b64144ccf1df"
166 +
167 +#ifdef __i386__
168 +#define ARCH L"x86"
169 +#elif defined __x86_64__
170 +#define ARCH L"amd64"
171 +#else
172 +#define ARCH L"none"
173 +#endif
174 +
175 +static const WCHAR manifest_filename[] = ARCH L"_" NAME L"_" PUBLIC_KEY L"_" VERSION L"_none_deadbeef.manifest";
176 +static const WCHAR manifest_filename_v5[] = ARCH L"_" NAME L"_" PUBLIC_KEY L"_" VERSION_V5 L"_none_deadbeef.manifest";
177 +
178 +static WCHAR* GetManifestPath(BOOL create, BOOL bV6)
179 +{
180 + WCHAR *pwszBuf;
181 + HRESULT hres;
182 +
183 + pwszBuf = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
184 + if (!pwszBuf)
185 + return NULL;
186 +
187 + GetWindowsDirectoryW(pwszBuf, MAX_PATH);
188 + hres = StringCchCatW(pwszBuf, MAX_PATH, L"\\winsxs");
189 + if (FAILED(hres))
190 + return NULL;
191 + if (create)
192 + CreateDirectoryW(pwszBuf, NULL);
193 + hres = StringCchCatW(pwszBuf, MAX_PATH, L"\\manifests\\");
194 + if (FAILED(hres))
195 + return NULL;
196 + if (create)
197 + CreateDirectoryW(pwszBuf, NULL);
198 +
199 + hres = StringCchCatW(pwszBuf, MAX_PATH, bV6 ? manifest_filename : manifest_filename_v5);
200 + if (FAILED(hres))
201 + return NULL;
202 +
203 + return pwszBuf;
204 +}
205 +
206 +static BOOL create_manifest(BOOL install, BOOL bV6)
207 +{
208 + WCHAR *pwszBuf;
209 + HRSRC hResInfo;
210 + HGLOBAL hResData;
211 + PVOID pManifest;
212 + DWORD cbManifest, cbWritten;
213 + HANDLE hFile;
214 + BOOL bRet = FALSE;
215 +
216 + if (bV6)
217 + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", (LPWSTR)RT_MANIFEST);
218 + else
219 + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFESTV5", (LPWSTR)RT_MANIFEST);
220 +
221 + if (!hResInfo)
222 + return FALSE;
223 +
224 + cbManifest = SizeofResource(COMCTL32_hModule, hResInfo);
225 + if (!cbManifest)
226 + return FALSE;
227 +
228 + hResData = LoadResource(COMCTL32_hModule, hResInfo);
229 + if (!hResData)
230 + return FALSE;
231 +
232 + pManifest = LockResource(hResData);
233 + if (!pManifest)
234 + return FALSE;
235 +
236 + pwszBuf = GetManifestPath(TRUE, bV6);
237 + if (!pwszBuf)
238 + return FALSE;
239 +
240 + if (install)
241 + {
242 + hFile = CreateFileW(pwszBuf, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
243 + if (hFile != INVALID_HANDLE_VALUE)
244 + {
245 + if (WriteFile(hFile, pManifest, cbManifest, &cbWritten, NULL) && cbWritten == cbManifest)
246 + bRet = TRUE;
247 +
248 + CloseHandle(hFile);
249 +
250 + if (!bRet)
251 + DeleteFileW(pwszBuf);
252 + else
253 + TRACE("created %s\n", debugstr_w(pwszBuf));
254 + }
255 + }
256 + else
257 + bRet = DeleteFileW(pwszBuf);
258 +
259 + HeapFree(GetProcessHeap(), 0, pwszBuf);
260 +
261 + return bRet;
262 +}
263 +
264 +static HANDLE CreateComctl32ActCtx(BOOL bV6)
265 +{
266 + HANDLE ret;
267 + WCHAR* pwstrSource;
268 + ACTCTXW ActCtx = {sizeof(ACTCTX)};
269 +
270 + pwstrSource = GetManifestPath(FALSE, bV6);
271 + if (!pwstrSource)
272 + {
273 + ERR("GetManifestPath failed! bV6=%d\n", bV6);
274 + return INVALID_HANDLE_VALUE;
275 + }
276 + ActCtx.lpSource = pwstrSource;
277 + ret = CreateActCtxW(&ActCtx);
278 + HeapFree(GetProcessHeap(), 0, pwstrSource);
279 + if (ret == INVALID_HANDLE_VALUE)
280 + ERR("CreateActCtxW failed! bV6=%d\n", bV6);
281 + return ret;
282 +}
283 +
284 +static void RegisterControls(BOOL bV6)
285 +{
286 + ANIMATE_Register ();
287 + COMBOEX_Register ();
288 + DATETIME_Register ();
289 + FLATSB_Register ();
290 + HEADER_Register ();
291 + HOTKEY_Register ();
292 + IPADDRESS_Register ();
293 + LISTVIEW_Register ();
294 + MONTHCAL_Register ();
295 + NATIVEFONT_Register ();
296 + PAGER_Register ();
297 + PROGRESS_Register ();
298 + REBAR_Register ();
299 + STATUS_Register ();
300 + SYSLINK_Register ();
301 + TAB_Register ();
302 + TOOLTIPS_Register ();
303 + TRACKBAR_Register ();
304 + TREEVIEW_Register ();
305 + UPDOWN_Register ();
306 +
307 + if (!bV6)
308 + {
309 + TOOLBAR_Register ();
310 + }
311 + else
312 + {
313 + BUTTON_Register();
314 + TOOLBARv6_Register();
315 + }
316 +}
317 +
318 +static void UnregisterControls(BOOL bV6)
319 +{
320 + ANIMATE_Unregister ();
321 + COMBOEX_Unregister ();
322 + DATETIME_Unregister ();
323 + FLATSB_Unregister ();
324 + HEADER_Unregister ();
325 + HOTKEY_Unregister ();
326 + IPADDRESS_Unregister ();
327 + LISTVIEW_Unregister ();
328 + MONTHCAL_Unregister ();
329 + NATIVEFONT_Unregister ();
330 + PAGER_Unregister ();
331 + PROGRESS_Unregister ();
332 + REBAR_Unregister ();
333 + STATUS_Unregister ();
334 + SYSLINK_Unregister ();
335 + TAB_Unregister ();
336 + TOOLTIPS_Unregister ();
337 + TRACKBAR_Unregister ();
338 + TREEVIEW_Unregister ();
339 + UPDOWN_Unregister ();
340 +
341 + if (!bV6)
342 + {
343 + TOOLBAR_Unregister ();
344 + }
345 + else
346 + {
347 + BUTTON_Unregister();
348 + TOOLBARv6_Unregister ();
349 + }
350 +
351 +}
352 +
353 +static void InitializeClasses()
354 +{
355 + HANDLE hActCtx5, hActCtx6;
356 + BOOL activated;
357 + ULONG_PTR ulCookie;
358 +
359 + /* like comctl32 5.82+ register all the common control classes */
360 + /* Register the classes once no matter what */
361 + hActCtx5 = CreateComctl32ActCtx(FALSE);
362 + activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5, &ulCookie) : FALSE);
363 + RegisterControls(FALSE); /* Register the classes pretending to be v5 */
364 + if (activated) DeactivateActCtx(0, ulCookie);
365 +
366 + hActCtx6 = CreateComctl32ActCtx(TRUE);
367 + if (hActCtx6 != INVALID_HANDLE_VALUE)
368 + {
369 + activated = ActivateActCtx(hActCtx6, &ulCookie);
370 + RegisterControls(TRUE); /* Register the classes pretending to be v6 */
371 + if (activated) DeactivateActCtx(0, ulCookie);
372 +
373 + /* Initialize the themed controls only when the v6 manifest is present */
374 + THEMING_Initialize (hActCtx5, hActCtx6);
375 + }
376 +}
377 +
378 +static void UninitializeClasses()
379 +{
380 + HANDLE hActCtx5, hActCtx6;
381 + BOOL activated;
382 + ULONG_PTR ulCookie;
383 +
384 + hActCtx5 = CreateComctl32ActCtx(FALSE);
385 + activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5, &ulCookie) : FALSE);
386 + UnregisterControls(FALSE);
387 + if (activated) DeactivateActCtx(0, ulCookie);
388 +
389 + hActCtx6 = CreateComctl32ActCtx(TRUE);
390 + if (hActCtx6 != INVALID_HANDLE_VALUE)
391 + {
392 + activated = ActivateActCtx(hActCtx6, &ulCookie);
393 + THEMING_Uninitialize();
394 + UnregisterControls(TRUE);
395 + if (activated) DeactivateActCtx(0, ulCookie);
396 + }
397 +}
398 +
399 +/***********************************************************************
400 + * RegisterClassNameW [COMCTL32.@]
401 + *
402 + * Register window class again while using as SxS module.
403 + */
404 +BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className)
405 +{
406 + InitializeClasses();
407 + return TRUE;
408 +}
409 +
410 +#endif
411
412 /***********************************************************************
413 * DllMain [Internal]
414 @@ -118,6 +371,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
415 /* Get all the colors at DLL load */
416 COMCTL32_RefreshSysColors();
417
418 +#ifndef __REACTOS__
419 /* like comctl32 5.82+ register all the common control classes */
420 ANIMATE_Register ();
421 COMBOEX_Register ();
422 @@ -143,10 +397,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
423
424 /* subclass user32 controls */
425 THEMING_Initialize ();
426 +#else
427 + InitializeClasses();
428 +#endif
429 +
430 break;
431
432 case DLL_PROCESS_DETACH:
433 if (lpvReserved) break;
434 +#ifndef __REACTOS__
435 /* clean up subclassing */
436 THEMING_Uninitialize();
437
438 @@ -172,7 +431,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
439 TRACKBAR_Unregister ();
440 TREEVIEW_Unregister ();
441 UPDOWN_Unregister ();
442 -
443 +#else
444 + UninitializeClasses();
445 +#endif
446 /* delete local pattern brush */
447 DeleteObject (COMCTL32_hPattern55AABrush);
448 DeleteObject (COMCTL32_hPattern55AABitmap);
449 @@ -917,6 +1178,22 @@ HRESULT WINAPI DllGetVersion (DLLVERSION
450 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
451 {
452 TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
453 +
454 +#ifdef __REACTOS__
455 +
456 + if (!create_manifest(bInstall, TRUE))
457 + {
458 + ERR("Failed to install comctl32 v6 manifest!\n");
459 + return HRESULT_FROM_WIN32(GetLastError());
460 + }
461 +
462 + if (!create_manifest(bInstall, FALSE))
463 + {
464 + ERR("Failed to install comctl32 v5 manifest!\n");
465 + return HRESULT_FROM_WIN32(GetLastError());
466 + }
467 +#endif
468 +
469 return S_OK;
470 }
471
472 @@ -1580,33 +1857,113 @@ LRESULT WINAPI SetPathWordBreakProc(HWND
473 *
474 * Draw text with shadow.
475 */
476 -int WINAPI DrawShadowText(HDC hdc, LPCWSTR text, UINT length, RECT *rect, DWORD flags,
477 - COLORREF crText, COLORREF crShadow, int offset_x, int offset_y)
478 +int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags,
479 + COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
480 {
481 - int bkmode, ret;
482 - COLORREF clr;
483 - RECT r;
484 + COLORREF crOldText;
485 + RECT rcText;
486 + INT iRet, x, y, x2, y2;
487 + BYTE *pBits;
488 + HBITMAP hbm, hbmOld;
489 + BITMAPINFO bi;
490 + HDC hdcMem;
491 + HFONT hOldFont;
492 + BLENDFUNCTION bf;
493
494 - FIXME("(%p, %s, %d, %p, 0x%08x, 0x%08x, 0x%08x, %d, %d): semi-stub\n", hdc, debugstr_w(text),
495 - length, rect, flags, crText, crShadow, offset_x, offset_y);
496 + /* Create 32 bit DIB section for the shadow */
497 + ZeroMemory(&bi, sizeof(bi));
498 + bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
499 + bi.bmiHeader.biWidth = prc->right - prc->left + 4;
500 + bi.bmiHeader.biHeight = prc->bottom - prc->top + 5; // bottom-up DIB
501 + bi.bmiHeader.biPlanes = 1;
502 + bi.bmiHeader.biBitCount = 32;
503 + bi.bmiHeader.biCompression = BI_RGB;
504 + hbm = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, (PVOID*)&pBits, NULL, 0);
505 + if(!hbm)
506 + {
507 + ERR("CreateDIBSection failed\n");
508 + return 0;
509 + }
510
511 - bkmode = SetBkMode(hdc, TRANSPARENT);
512 - clr = SetTextColor(hdc, crShadow);
513 + /* Create memory device context for new DIB section and select it */
514 + hdcMem = CreateCompatibleDC(hdc);
515 + if(!hdcMem)
516 + {
517 + ERR("CreateCompatibleDC failed\n");
518 + DeleteObject(hbm);
519
520 + return 0;
521 + }
522
523 - /* FIXME: for shadow we need to render normally, blur it, and blend with current background. */
524 - r = *rect;
525 - OffsetRect(&r, 1, 1);
526 - DrawTextW(hdc, text, length, &r, flags);
527 + hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
528
529 - SetTextColor(hdc, crText);
530 + /* Draw text on our helper bitmap */
531 + hOldFont = (HFONT)SelectObject(hdcMem, GetCurrentObject(hdc, OBJ_FONT));
532 + SetTextColor(hdcMem, RGB(16, 16, 16));
533 + SetBkColor(hdcMem, RGB(0, 0, 0));
534 + SetBkMode(hdcMem, TRANSPARENT);
535 + SetRect(&rcText, 0, 0, prc->right - prc->left, prc->bottom - prc->top);
536 + DrawTextW(hdcMem, pszText, cch, &rcText, dwFlags);
537 + SelectObject(hdcMem, hOldFont);
538
539 - /* with text color on top of a shadow */
540 - ret = DrawTextW(hdc, text, length, rect, flags);
541 + /* Flush GDI so data pointed by pBits is valid */
542 + GdiFlush();
543
544 - SetTextColor(hdc, clr);
545 - SetBkMode(hdc, bkmode);
546 + /* Set alpha of pixels (forget about colors for now. They will be changed in next loop).
547 + We copy text image 4*5 times and each time alpha is added */
548 + for (x = 0; x < bi.bmiHeader.biWidth; ++x)
549 + for (y = 0; y < bi.bmiHeader.biHeight; ++y)
550 + {
551 + BYTE *pDest = &pBits[(y * bi.bmiHeader.biWidth + x) * 4];
552 + UINT Alpha = 0;
553
554 - return ret;
555 + for (x2 = x - 4 + 1; x2 <= x; ++x2)
556 + for (y2 = y; y2 < y + 5; ++y2)
557 + {
558 + if (x2 >= 0 && x2 < bi.bmiHeader.biWidth && y2 >= 0 && y2 < bi.bmiHeader.biHeight)
559 + {
560 + BYTE *pSrc = &pBits[(y2 * bi.bmiHeader.biWidth + x2) * 4];
561 + Alpha += pSrc[0];
562 + }
563 + }
564 +
565 + if (Alpha > 255)
566 + Alpha = 255;
567 + pDest[3] = Alpha;
568 + }
569 +
570 + /* Now set the color of each pixel to shadow color * alpha (see GdiAlphaBlend) */
571 + for (x = 0; x < bi.bmiHeader.biWidth; ++x)
572 + for (y = 0; y < bi.bmiHeader.biHeight; ++y)
573 + {
574 + BYTE *pDest = &pBits[(y * bi.bmiHeader.biWidth + x) * 4];
575 + pDest[0] = GetBValue(crShadow) * pDest[3] / 255;
576 + pDest[1] = GetGValue(crShadow) * pDest[3] / 255;
577 + pDest[2] = GetRValue(crShadow) * pDest[3] / 255;
578 + }
579 +
580 + /* Fix ixOffset of the shadow (tested on Win) */
581 + ixOffset -= 3;
582 + iyOffset -= 3;
583 +
584 + /* Alpha blend helper image to destination DC */
585 + bf.BlendOp = AC_SRC_OVER;
586 + bf.BlendFlags = 0;
587 + bf.SourceConstantAlpha = 255;
588 + bf.AlphaFormat = AC_SRC_ALPHA;
589 + GdiAlphaBlend(hdc, prc->left + ixOffset, prc->top + iyOffset, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight, hdcMem, 0, 0, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight, bf);
590 +
591 + /* Delete the helper bitmap */
592 + SelectObject(hdcMem, hbmOld);
593 + DeleteObject(hbm);
594 + DeleteDC(hdcMem);
595 +
596 + /* Finally draw the text over shadow */
597 + crOldText = SetTextColor(hdc, crText);
598 + SetBkMode(hdc, TRANSPARENT);
599 + iRet = DrawTextW(hdc, pszText, cch, prc, dwFlags);
600 + SetTextColor(hdc, crOldText);
601 +
602 + return iRet;
603 }
604
605 /***********************************************************************
606 diff -pudN e:\wine\dlls\comctl32/imagelist.c e:\reactos\dll\win32\comctl32/imagelist.c
607 --- e:\wine\dlls\comctl32/imagelist.c 2017-09-07 12:58:14 +0100
608 +++ e:\reactos\dll\win32\comctl32/imagelist.c 2017-05-07 14:47:57 +0100
609 @@ -33,7 +33,7 @@
610 *
611 * TODO:
612 * - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE
613 - * - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE
614 + * - Add support for ILS_GLOW, ILS_SHADOW
615 * - Thread-safe locking
616 */
617
618 @@ -1243,8 +1243,11 @@ ImageList_DrawEx (HIMAGELIST himl, INT i
619 return ImageList_DrawIndirect (&imldp);
620 }
621
622 -
623 +#ifdef __REACTOS__
624 +static BOOL alpha_blend_image( HIMAGELIST himl, HDC srce_dc, HDC dest_dc, int dest_x, int dest_y,
625 +#else
626 static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
627 +#endif
628 int src_x, int src_y, int cx, int cy, BLENDFUNCTION func,
629 UINT style, COLORREF blend_col )
630 {
631 @@ -1269,9 +1272,17 @@ static BOOL alpha_blend_image( HIMAGELIS
632 info->bmiHeader.biYPelsPerMeter = 0;
633 info->bmiHeader.biClrUsed = 0;
634 info->bmiHeader.biClrImportant = 0;
635 +#ifdef __REACTOS__
636 + if (!(bmp = CreateDIBSection( srce_dc, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
637 +#else
638 if (!(bmp = CreateDIBSection( himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
639 +#endif
640 SelectObject( hdc, bmp );
641 +#ifdef __REACTOS__
642 + BitBlt( hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY );
643 +#else
644 BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
645 +#endif
646
647 if (blend_col != CLR_NONE)
648 {
649 @@ -1344,6 +1355,68 @@ done:
650 return ret;
651 }
652
653 +#ifdef __REACTOS__
654 +HDC saturate_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
655 + int src_x, int src_y, int cx, int cy, COLORREF rgbFg)
656 +{
657 + HDC hdc = NULL;
658 + HBITMAP bmp = 0;
659 + BITMAPINFO *info;
660 +
661 + unsigned int *ptr;
662 + void *bits;
663 + int i;
664 +
665 + /* create a dc and its device independent bitmap for doing the work,
666 + shamelessly copied from the alpha-blending function above */
667 + if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE;
668 + if (!(info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
669 + info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
670 + info->bmiHeader.biWidth = cx;
671 + info->bmiHeader.biHeight = cy;
672 + info->bmiHeader.biPlanes = 1;
673 + info->bmiHeader.biBitCount = 32;
674 + info->bmiHeader.biCompression = BI_RGB;
675 + info->bmiHeader.biSizeImage = cx * cy * 4;
676 + info->bmiHeader.biXPelsPerMeter = 0;
677 + info->bmiHeader.biYPelsPerMeter = 0;
678 + info->bmiHeader.biClrUsed = 0;
679 + info->bmiHeader.biClrImportant = 0;
680 + if (!(bmp = CreateDIBSection(himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
681 +
682 + /* bind both surfaces */
683 + SelectObject(hdc, bmp);
684 +
685 + /* copy into our dc the section that covers just the icon we we're asked for */
686 + BitBlt(hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY);
687 +
688 + /* loop every pixel of the bitmap */
689 + for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
690 + {
691 + COLORREF orig_color = *ptr;
692 +
693 + /* calculate the effective luminance using the constants from here, adapted to the human eye:
694 + <http://bobpowell.net/grayscale.aspx> */
695 + float mixed_color = (GetRValue(orig_color) * .30 +
696 + GetGValue(orig_color) * .59 +
697 + GetBValue(orig_color) * .11);
698 +
699 + *ptr = RGBA(mixed_color, mixed_color, mixed_color, GetAValue(orig_color));
700 + }
701 +
702 +done:
703 +
704 + if (bmp)
705 + DeleteObject(bmp);
706 +
707 + if (info)
708 + HeapFree(GetProcessHeap(), 0, info);
709 +
710 + /* return the handle to our desaturated dc, that will substitute its original counterpart in the next calls */
711 + return hdc;
712 +}
713 +#endif /* __REACTOS__ */
714 +
715 /*************************************************************************
716 * ImageList_DrawIndirect [COMCTL32.@]
717 *
718 @@ -1371,6 +1444,9 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
719 HBRUSH hOldBrush;
720 POINT pt;
721 BOOL has_alpha;
722 +#ifdef __REACTOS__
723 + HDC hdcSaturated = NULL;
724 +#endif
725
726 if (!pimldp || !(himl = pimldp->himl)) return FALSE;
727 if (!is_valid(himl)) return FALSE;
728 @@ -1420,6 +1496,24 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
729 oldImageFg = SetTextColor( hImageDC, RGB( 0, 0, 0 ) );
730 oldImageBk = SetBkColor( hImageDC, RGB( 0xff, 0xff, 0xff ) );
731
732 +#ifdef __REACTOS__
733 + /*
734 + * If the ILS_SATURATE bit is enabled we should multiply the
735 + * RGB colors of the original image by the contents of rgbFg.
736 + */
737 + if (fState & ILS_SATURATE)
738 + {
739 + hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
740 + pt.x, pt.y, cx, cy, pimldp->rgbFg);
741 +
742 + hImageListDC = hdcSaturated;
743 + /* shitty way of getting subroutines to blit at the right place (top left corner),
744 + as our modified imagelist only contains a single image for performance reasons */
745 + pt.x = 0;
746 + pt.y = 0;
747 + }
748 +#endif
749 +
750 has_alpha = (himl->has_alpha && himl->has_alpha[pimldp->i]);
751 if (!bMask && (has_alpha || (fState & ILS_ALPHA)))
752 {
753 @@ -1440,7 +1534,11 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
754
755 if (bIsTransparent)
756 {
757 +#ifdef __REACTOS__
758 + bResult = alpha_blend_image( himl, hImageListDC, pimldp->hdcDst, pimldp->x, pimldp->y,
759 +#else
760 bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y,
761 +#endif
762 pt.x, pt.y, cx, cy, func, fStyle, blend_col );
763 goto end;
764 }
765 @@ -1450,7 +1548,11 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
766
767 hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
768 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
769 +#ifdef __REACTOS__
770 + alpha_blend_image( himl, hImageListDC, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
771 +#else
772 alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
773 +#endif
774 DeleteObject (SelectObject (hImageDC, hOldBrush));
775 bResult = BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCCOPY );
776 goto end;
777 @@ -1544,7 +1646,9 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
778 }
779 }
780
781 +#ifndef __REACTOS__
782 if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n");
783 +#endif
784 if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n");
785 if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n");
786
787 @@ -1572,6 +1676,10 @@ end:
788 SetTextColor(hImageDC, oldImageFg);
789 SelectObject(hImageDC, hOldImageBmp);
790 cleanup:
791 +#ifdef __REACTOS__
792 + if (hdcSaturated)
793 + DeleteDC(hdcSaturated);
794 +#endif
795 DeleteObject(hBlendMaskBmp);
796 DeleteObject(hImageBmp);
797 DeleteDC(hImageDC);
798 Common subdirectories: e:\wine\dlls\comctl32/lang and e:\reactos\dll\win32\comctl32/lang
799 diff -pudN e:\wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listview.c
800 --- e:\wine\dlls\comctl32/listview.c 2017-09-07 12:58:14 +0100
801 +++ e:\reactos\dll\win32\comctl32/listview.c 2017-08-04 10:38:09 +0100
802 @@ -286,6 +286,9 @@ typedef struct tagLISTVIEW_INFO
803 COLORREF clrBk;
804 COLORREF clrText;
805 COLORREF clrTextBk;
806 +#ifdef __REACTOS__
807 + BOOL bDefaultBkColor;
808 +#endif
809
810 /* font */
811 HFONT hDefaultFont;
812 @@ -1695,8 +1698,24 @@ static inline BOOL LISTVIEW_GetItemW(con
813 /* used to handle collapse main item column case */
814 static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc)
815 {
816 +#ifdef __REACTOS__
817 + BOOL Ret = FALSE;
818 +
819 + if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
820 + {
821 + DWORD dwOldBkColor, dwOldTextColor;
822 +
823 + dwOldBkColor = SetBkColor(hdc, RGB(255, 255, 255));
824 + dwOldTextColor = SetBkColor(hdc, RGB(0, 0, 0));
825 + Ret = DrawFocusRect(hdc, &infoPtr->rcFocus);
826 + SetBkColor(hdc, dwOldBkColor);
827 + SetBkColor(hdc, dwOldTextColor);
828 + }
829 + return Ret;
830 +#else
831 return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
832 DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
833 +#endif
834 }
835
836 /* Listview invalidation functions: use _only_ these functions to invalidate */
837 @@ -2202,8 +2221,9 @@ static void LISTVIEW_ShowFocusRect(const
838 SelectObject(hdc, hOldFont);
839 }
840 else
841 - LISTVIEW_InvalidateItem(infoPtr, infoPtr->nFocusedItem);
842 -
843 + {
844 + LISTVIEW_DrawFocusRect(infoPtr, hdc);
845 + }
846 done:
847 ReleaseDC(infoPtr->hwndSelf, hdc);
848 }
849 @@ -4707,7 +4727,12 @@ static void LISTVIEW_DrawItemPart(LISTVI
850 if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
851 rcLabel.bottom--;
852
853 - DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
854 +#ifdef __REACTOS__
855 + if ((!(item->state & LVIS_SELECTED) || !infoPtr->bFocus) && (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTSHADOWTEXT))
856 + DrawShadowText(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format, RGB(255, 255, 255), RGB(0, 0, 0), 2, 2);
857 + else
858 +#endif
859 + DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
860 }
861
862 /***
863 @@ -5251,7 +5276,11 @@ enddraw:
864
865 /* Draw marquee rectangle if appropriate */
866 if (infoPtr->bMarqueeSelect)
867 + {
868 + SetBkColor(hdc, RGB(255, 255, 255));
869 + SetTextColor(hdc, RGB(0, 0, 0));
870 DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
871 + }
872
873 if (cdmode & CDRF_NOTIFYPOSTPAINT)
874 notify_postpaint(infoPtr, &nmlvcd);
875 @@ -8056,6 +8085,9 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW
876 {
877 TRACE("(color=%x)\n", color);
878
879 +#ifdef __REACTOS__
880 + infoPtr->bDefaultBkColor = FALSE;
881 +#endif
882 if(infoPtr->clrBk != color) {
883 if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
884 infoPtr->clrBk = color;
885 @@ -8731,7 +8763,7 @@ static DWORD LISTVIEW_SetIconSpacing(LIS
886 return oldspacing;
887 }
888
889 -static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL small)
890 +static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL is_small)
891 {
892 INT cx, cy;
893
894 @@ -8742,8 +8774,8 @@ static inline void set_icon_size(SIZE *s
895 }
896 else
897 {
898 - size->cx = GetSystemMetrics(small ? SM_CXSMICON : SM_CXICON);
899 - size->cy = GetSystemMetrics(small ? SM_CYSMICON : SM_CYICON);
900 + size->cx = GetSystemMetrics(is_small ? SM_CXSMICON : SM_CXICON);
901 + size->cy = GetSystemMetrics(is_small ? SM_CYSMICON : SM_CYICON);
902 }
903 }
904
905 @@ -9477,6 +9509,9 @@ static LRESULT LISTVIEW_NCCreate(HWND hw
906 infoPtr->clrText = CLR_DEFAULT;
907 infoPtr->clrTextBk = CLR_DEFAULT;
908 LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow);
909 +#ifdef __REACTOS__
910 + infoPtr->bDefaultBkColor = TRUE;
911 +#endif
912
913 /* set default values */
914 infoPtr->nFocusedItem = -1;
915 @@ -10622,8 +10657,15 @@ static BOOL LISTVIEW_NCPaint(const LISTV
916 CombineRgn (cliprgn, cliprgn, region, RGN_AND);
917 OffsetRect(&r, -r.left, -r.top);
918
919 +#ifdef __REACTOS__ /* r73789 */
920 + dc = GetWindowDC(infoPtr->hwndSelf);
921 + /* Exclude client part */
922 + ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge,
923 + r.right - cxEdge, r.bottom -cyEdge);
924 +#else
925 dc = GetDCEx(infoPtr->hwndSelf, region, DCX_WINDOW|DCX_INTERSECTRGN);
926 OffsetRect(&r, -r.left, -r.top);
927 +#endif
928
929 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
930 DrawThemeParentBackground(infoPtr->hwndSelf, dc, &r);
931 @@ -11761,6 +11803,14 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg
932
933 case WM_SYSCOLORCHANGE:
934 COMCTL32_RefreshSysColors();
935 +#ifdef __REACTOS__
936 + if (infoPtr->bDefaultBkColor)
937 + {
938 + LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow);
939 + infoPtr->bDefaultBkColor = TRUE;
940 + LISTVIEW_InvalidateList(infoPtr);
941 + }
942 +#endif
943 return 0;
944
945 /* case WM_TIMER: */
946 diff -pudN e:\wine\dlls\comctl32/monthcal.c e:\reactos\dll\win32\comctl32/monthcal.c
947 --- e:\wine\dlls\comctl32/monthcal.c 2017-09-07 12:58:14 +0100
948 +++ e:\reactos\dll\win32\comctl32/monthcal.c 2017-09-07 13:07:02 +0100
949 @@ -43,6 +43,9 @@
950
951 WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
952
953 +/* FIXME: Inspect */
954 +#define MCS_NOSELCHANGEONNAV 0x0100
955 +
956 #define MC_SEL_LBUTUP 1 /* Left button released */
957 #define MC_SEL_LBUTDOWN 2 /* Left button pressed in calendar */
958 #define MC_PREVPRESSED 4 /* Prev month button pressed */
959 diff -pudN e:\wine\dlls\comctl32/propsheet.c e:\reactos\dll\win32\comctl32/propsheet.c
960 --- e:\wine\dlls\comctl32/propsheet.c 2017-09-07 12:58:14 +0100
961 +++ e:\reactos\dll\win32\comctl32/propsheet.c 2017-05-21 20:32:06 +0100
962 @@ -1176,8 +1176,13 @@ PROPSHEET_WizardSubclassProc(HWND hwnd,
963 return TRUE;
964
965 case WM_CTLCOLORSTATIC:
966 +#ifdef __REACTOS__
967 + SetBkMode((HDC)wParam, TRANSPARENT);
968 + return (INT_PTR)GetStockObject(HOLLOW_BRUSH);
969 +#else
970 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
971 return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
972 +#endif
973 }
974
975 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
976 @@ -2440,12 +2445,19 @@ static void PROPSHEET_SetWizButtons(HWND
977 HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON);
978 BOOL enable_finish = ((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH);
979
980 +#ifdef __REACTOS__
981 + HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL);
982 + INT iDefItem = 0;
983 + HWND hwndFocus;
984 +#endif
985 +
986 TRACE("%d\n", dwFlags);
987
988 EnableWindow(hwndBack, dwFlags & PSWIZB_BACK);
989 EnableWindow(hwndNext, dwFlags & PSWIZB_NEXT);
990 EnableWindow(hwndFinish, enable_finish);
991
992 +#ifndef __REACTOS__
993 /* set the default pushbutton to an enabled button */
994 if (enable_finish)
995 SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
996 @@ -2455,6 +2467,7 @@ static void PROPSHEET_SetWizButtons(HWND
997 SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
998 else
999 SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
1000 +#endif
1001
1002 if (!psInfo->hasFinish)
1003 {
1004 @@ -2474,6 +2487,25 @@ static void PROPSHEET_SetWizButtons(HWND
1005 ShowWindow(hwndNext, SW_SHOW);
1006 }
1007 }
1008 +
1009 +#ifdef __REACTOS__
1010 + /* set the default pushbutton to an enabled button */
1011 + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
1012 + iDefItem = IDC_FINISH_BUTTON;
1013 + else if (dwFlags & PSWIZB_NEXT)
1014 + iDefItem = IDC_NEXT_BUTTON;
1015 + else if (dwFlags & PSWIZB_BACK)
1016 + iDefItem = IDC_BACK_BUTTON;
1017 + else
1018 + iDefItem = IDCANCEL;
1019 + SendMessageW(hwndDlg, DM_SETDEFID, iDefItem, 0);
1020 +
1021 + /* Set focus if no control has it */
1022 + hwndFocus = GetFocus();
1023 + if (!hwndFocus || hwndFocus == hwndCancel)
1024 + SetFocus(GetDlgItem(hwndDlg, iDefItem));
1025 +#endif
1026 +
1027 }
1028
1029 /******************************************************************************
1030 @@ -3282,7 +3314,11 @@ static LRESULT PROPSHEET_Paint(HWND hwnd
1031
1032 hOldFont = SelectObject(hdc, psInfo->hFontBold);
1033
1034 +#ifdef __REACTOS__
1035 + if (psInfo->ppshheader.u5.hbmHeader)
1036 +#else
1037 if (psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)
1038 +#endif
1039 {
1040 hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader);
1041
1042 @@ -3357,7 +3393,11 @@ static LRESULT PROPSHEET_Paint(HWND hwnd
1043 if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) {
1044 SelectObject(hdc, psInfo->hFont);
1045 SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom);
1046 +#ifdef __REACTOS__
1047 + if (!IS_INTRESOURCE(ppshpage->pszHeaderSubTitle))
1048 +#else
1049 if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle))
1050 +#endif
1051 DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK);
1052 else
1053 {
1054 @@ -3379,7 +3419,12 @@ static LRESULT PROPSHEET_Paint(HWND hwnd
1055
1056 if ( (ppshpage && (ppshpage->dwFlags & PSP_HIDEHEADER)) &&
1057 (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
1058 +#ifdef __REACTOS__
1059 + (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
1060 + (psInfo->ppshheader.u4.hbmWatermark) )
1061 +#else
1062 (psInfo->ppshheader.dwFlags & PSH_WATERMARK) )
1063 +#endif
1064 {
1065 HWND hwndLine = GetDlgItem(hwnd, IDC_SUNKEN_LINE);
1066
1067 diff -pudN e:\wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c
1068 --- e:\wine\dlls\comctl32/rebar.c 2017-09-07 12:58:14 +0100
1069 +++ e:\reactos\dll\win32\comctl32/rebar.c 2017-05-07 14:47:57 +0100
1070 @@ -50,7 +50,6 @@
1071 * - WM_QUERYNEWPALETTE
1072 * - WM_RBUTTONDOWN
1073 * - WM_RBUTTONUP
1074 - * - WM_SYSCOLORCHANGE
1075 * - WM_VKEYTOITEM
1076 * - WM_WININICHANGE
1077 * Notifications:
1078 @@ -1819,16 +1818,43 @@ static LRESULT REBAR_EraseBkGnd (const R
1079 RECT cr;
1080 COLORREF old = CLR_NONE, new;
1081 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
1082 +#ifdef __REACTOS__
1083 + HRGN hrgn;
1084 +#endif
1085
1086 GetClientRect (infoPtr->hwndSelf, &cr);
1087
1088 +#ifdef __REACTOS__
1089 +
1090 + if (theme)
1091 + {
1092 + if (IsThemeBackgroundPartiallyTransparent(theme, RP_BACKGROUND, 0))
1093 + {
1094 + DrawThemeParentBackground (infoPtr->hwndSelf, hdc, &cr);
1095 + }
1096 + DrawThemeBackground (theme, hdc, 0, 0, &cr, NULL);
1097 + }
1098 +
1099 + hrgn = CreateRectRgn(cr.left, cr.top, cr.right, cr.bottom);
1100 +
1101 +#endif
1102 +
1103 oldrow = -1;
1104 for(i=0; i<infoPtr->uNumBands; i++) {
1105 RECT rcBand;
1106 +#ifdef __REACTOS__
1107 + RECT rcBandReal;
1108 + HRGN hrgnBand;
1109 +#endif
1110 +
1111 lpBand = REBAR_GetBand(infoPtr, i);
1112 if (HIDDENBAND(lpBand)) continue;
1113 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
1114
1115 +#ifdef __REACTOS__
1116 + rcBandReal = rcBand;
1117 +#endif
1118 +
1119 /* draw band separator between rows */
1120 if (lpBand->iRow != oldrow) {
1121 oldrow = lpBand->iRow;
1122 @@ -1853,6 +1879,9 @@ static LRESULT REBAR_EraseBkGnd (const R
1123 }
1124 TRACE ("drawing band separator bottom (%s)\n",
1125 wine_dbgstr_rect(&rcRowSep));
1126 +#ifdef __REACTOS__
1127 + rcBandReal = rcRowSep;
1128 +#endif
1129 }
1130 }
1131
1132 @@ -1863,6 +1892,9 @@ static LRESULT REBAR_EraseBkGnd (const R
1133 if (infoPtr->dwStyle & CCS_VERT) {
1134 rcSep.bottom = rcSep.top;
1135 rcSep.top -= SEP_WIDTH_SIZE;
1136 +#ifdef __REACTOS__
1137 + rcBandReal.top -= SEP_WIDTH_SIZE;
1138 +#endif
1139 if (theme)
1140 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_BOTTOM, NULL);
1141 else
1142 @@ -1871,6 +1903,9 @@ static LRESULT REBAR_EraseBkGnd (const R
1143 else {
1144 rcSep.right = rcSep.left;
1145 rcSep.left -= SEP_WIDTH_SIZE;
1146 +#ifdef __REACTOS__
1147 + rcBandReal.left -= SEP_WIDTH_SIZE;
1148 +#endif
1149 if (theme)
1150 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_RIGHT, NULL);
1151 else
1152 @@ -1901,6 +1936,9 @@ static LRESULT REBAR_EraseBkGnd (const R
1153 #endif
1154 }
1155
1156 +#ifdef __REACTOS__
1157 + if (!theme)
1158 +#else
1159 if (theme)
1160 {
1161 /* When themed, the background color is ignored (but not a
1162 @@ -1908,6 +1946,7 @@ static LRESULT REBAR_EraseBkGnd (const R
1163 DrawThemeBackground (theme, hdc, 0, 0, &cr, &rcBand);
1164 }
1165 else
1166 +#endif
1167 {
1168 old = SetBkColor (hdc, new);
1169 TRACE("%s background color=0x%06x, band %s\n",
1170 @@ -1918,7 +1957,26 @@ static LRESULT REBAR_EraseBkGnd (const R
1171 if (lpBand->clrBack != CLR_NONE)
1172 SetBkColor (hdc, old);
1173 }
1174 +
1175 +#ifdef __REACTOS__
1176 + hrgnBand = CreateRectRgn(rcBandReal.left, rcBandReal.top, rcBandReal.right, rcBandReal.bottom);
1177 + CombineRgn(hrgn, hrgn, hrgnBand, RGN_DIFF);
1178 + DeleteObject(hrgnBand);
1179 +#endif
1180 }
1181 +
1182 +#if 1
1183 +#ifdef __REACTOS__
1184 + if (!theme)
1185 +#endif
1186 + {
1187 + //FIXME: Apparently painting the remaining area is a v6 feature
1188 + HBRUSH hbrush = CreateSolidBrush(new);
1189 + FillRgn(hdc, hrgn, hbrush);
1190 + DeleteObject(hbrush);
1191 + }
1192 + DeleteObject(hrgn);
1193 +#endif
1194 return TRUE;
1195 }
1196
1197 @@ -2887,12 +2945,26 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT
1198
1199
1200 static LRESULT
1201 +#ifdef __REACTOS__
1202 +REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM flags, RECT *lpRect)
1203 +#else
1204 REBAR_SizeToRect (REBAR_INFO *infoPtr, const RECT *lpRect)
1205 +#endif
1206 {
1207 if (!lpRect) return FALSE;
1208
1209 TRACE("[%s]\n", wine_dbgstr_rect(lpRect));
1210 REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect));
1211 +
1212 +#ifdef __REACTOS__
1213 + /* Note that this undocumented flag is available on comctl32 v6 or later */
1214 + if ((flags & RBSTR_CHANGERECT) != 0)
1215 + {
1216 + RECT rcRebar;
1217 + GetClientRect(infoPtr->hwndSelf, &rcRebar);
1218 + lpRect->bottom = lpRect->top + (rcRebar.bottom - rcRebar.top);
1219 + }
1220 +#endif
1221 return TRUE;
1222 }
1223
1224 @@ -3199,7 +3271,11 @@ REBAR_NCCalcSize (const REBAR_INFO *info
1225 else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
1226 {
1227 /* FIXME: should use GetThemeInt */
1228 +#ifdef __REACTOS__
1229 + rect->top = (rect->top + 1 < rect->bottom) ? rect->top : rect->bottom;
1230 +#else
1231 rect->top = min(rect->top + 1, rect->bottom);
1232 +#endif
1233 }
1234 TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
1235 return 0;
1236 @@ -3300,7 +3376,11 @@ REBAR_NCHitTest (const REBAR_INFO *infoP
1237 (INT *)&nmmouse.dwItemSpec);
1238 nmmouse.dwItemData = 0;
1239 nmmouse.pt = clpt;
1240 +#ifdef __REACTOS__
1241 + nmmouse.dwHitInfo = scrap;
1242 +#else
1243 nmmouse.dwHitInfo = 0;
1244 +#endif
1245 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
1246 TRACE("notify changed return value from %ld to %d\n",
1247 ret, i);
1248 @@ -3372,6 +3452,9 @@ REBAR_Paint (const REBAR_INFO *infoPtr,
1249 {
1250 if (hdc) {
1251 TRACE("painting\n");
1252 +#ifdef __REACTOS__
1253 + REBAR_EraseBkGnd (infoPtr, hdc);
1254 +#endif
1255 REBAR_Refresh (infoPtr, hdc);
1256 } else {
1257 PAINTSTRUCT ps;
1258 @@ -3650,7 +3733,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
1259 return REBAR_ShowBand (infoPtr, wParam, lParam);
1260
1261 case RB_SIZETORECT:
1262 +#ifdef __REACTOS__
1263 + return REBAR_SizeToRect (infoPtr, wParam, (LPRECT)lParam);
1264 +#else
1265 return REBAR_SizeToRect (infoPtr, (LPCRECT)lParam);
1266 +#endif
1267
1268
1269 /* Messages passed to parent */
1270 @@ -3733,6 +3820,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
1271
1272 case WM_SYSCOLORCHANGE:
1273 COMCTL32_RefreshSysColors();
1274 +#ifdef __REACTOS__
1275 + /* r51522 - Properly support WM_SYSCOLORCHANGE */
1276 + infoPtr->clrBtnText = comctl32_color.clrBtnText;
1277 + infoPtr->clrBtnFace = comctl32_color.clrBtnFace;
1278 +#endif
1279 return 0;
1280
1281 /* case WM_VKEYTOITEM: supported according to ControlSpy */
1282 diff -pudN e:\wine\dlls\comctl32/syslink.c e:\reactos\dll\win32\comctl32/syslink.c
1283 --- e:\wine\dlls\comctl32/syslink.c 2017-09-07 12:58:14 +0100
1284 +++ e:\reactos\dll\win32\comctl32/syslink.c 2017-05-27 17:00:22 +0100
1285 @@ -29,8 +29,6 @@
1286
1287 #include "comctl32.h"
1288
1289 -#include <wine/list.h>
1290 -
1291 WINE_DEFAULT_DEBUG_CHANNEL(syslink);
1292
1293 typedef struct
1294 diff -pudN e:\wine\dlls\comctl32/theme_button.c e:\reactos\dll\win32\comctl32/theme_button.c
1295 --- e:\wine\dlls\comctl32/theme_button.c 2017-09-07 12:58:14 +0100
1296 +++ e:\reactos\dll\win32\comctl32/theme_button.c 2017-08-11 22:11:08 +0100
1297 @@ -34,7 +34,30 @@ typedef enum
1298 STATE_DEFAULTED
1299 } ButtonState;
1300
1301 +#ifdef __REACTOS__ /* r73885 */
1302 +typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag);
1303 +#else
1304 typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused);
1305 +#endif
1306 +
1307 +#ifdef __REACTOS__ /* r73885 & r73907 */
1308 +static inline LONG get_button_state( HWND hwnd )
1309 +{
1310 + return _GetButtonData(hwnd)->state;
1311 +}
1312 +
1313 +static inline HFONT get_button_font( HWND hwnd )
1314 +{
1315 + return (HFONT)_GetButtonData(hwnd)->font;
1316 +}
1317 +
1318 +static inline LONG_PTR get_button_image(HWND hwnd)
1319 +{
1320 + return _GetButtonData(hwnd)->image;
1321 +}
1322 +
1323 +BOOL BUTTON_DrawIml(HDC hdc, BUTTON_IMAGELIST *pimlData, RECT *prc, BOOL bOnlyCalc);
1324 +#endif
1325
1326 static UINT get_drawtext_flags(DWORD style, DWORD ex_style)
1327 {
1328 @@ -87,22 +110,56 @@ static inline WCHAR *get_button_text(HWN
1329 return text;
1330 }
1331
1332 +#ifdef __REACTOS__ /* r73885 */
1333 +static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag)
1334 +#else
1335 static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
1336 +#endif
1337 {
1338 static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
1339
1340 RECT bgRect, textRect;
1341 +#ifdef __REACTOS__ /* r73885 */
1342 + HFONT font = get_button_font(hwnd);
1343 +#else
1344 HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
1345 +#endif
1346 HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
1347 int state = states[ drawState ];
1348 WCHAR *text = get_button_text(hwnd);
1349 +#ifdef __REACTOS__ /* r74012 & r74406 */
1350 + PBUTTON_DATA pdata = _GetButtonData(hwnd);
1351 + HWND parent;
1352 + HBRUSH hBrush;
1353 +#endif
1354
1355 GetClientRect(hwnd, &bgRect);
1356 GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
1357
1358 +#ifdef __REACTOS__ /* r73885 & r74149 */
1359 + if (prfFlag == 0)
1360 + {
1361 + if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
1362 + DrawThemeParentBackground(hwnd, hDC, NULL);
1363 + }
1364 +#else
1365 if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
1366 DrawThemeParentBackground(hwnd, hDC, NULL);
1367 +#endif
1368 +
1369 +#ifdef __REACTOS__ /* r74406 */
1370 + parent = GetParent(hwnd);
1371 + if (!parent) parent = hwnd;
1372 + hBrush = (HBRUSH)SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
1373 + FillRect( hDC, &bgRect, hBrush );
1374 +#endif
1375 +
1376 DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1377 +
1378 +#ifdef __REACTOS__ /* r74012 */
1379 + BUTTON_DrawIml(hDC, &pdata->imlData, &textRect, FALSE);
1380 +#endif
1381 +
1382 if (text)
1383 {
1384 DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
1385 @@ -127,7 +184,11 @@ static void PB_draw(HTHEME theme, HWND h
1386 if (hPrevFont) SelectObject(hDC, hPrevFont);
1387 }
1388
1389 +#ifdef __REACTOS__ /* r73885 */
1390 +static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag)
1391 +#else
1392 static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
1393 +#endif
1394 {
1395 static const int cb_states[3][5] =
1396 {
1397 @@ -145,7 +206,11 @@ static void CB_draw(HTHEME theme, HWND h
1398 SIZE sz;
1399 RECT bgRect, textRect;
1400 HFONT font, hPrevFont = NULL;
1401 +#ifdef __REACTOS__ /* r73885 */
1402 + LRESULT checkState = get_button_state(hwnd) & 3;
1403 +#else
1404 LRESULT checkState = SendMessageW(hwnd, BM_GETCHECK, 0, 0);
1405 +#endif
1406 DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
1407 int part = ((dwStyle & BUTTON_TYPE) == BS_RADIOBUTTON) || ((dwStyle & BUTTON_TYPE) == BS_AUTORADIOBUTTON)
1408 ? BP_RADIOBUTTON
1409 @@ -156,6 +221,10 @@ static void CB_draw(HTHEME theme, HWND h
1410 WCHAR *text = get_button_text(hwnd);
1411 LOGFONTW lf;
1412 BOOL created_font = FALSE;
1413 +#ifdef __REACTOS__ /* r74406 */
1414 + HWND parent;
1415 + HBRUSH hBrush;
1416 +#endif
1417
1418 HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
1419 if (SUCCEEDED(hr)) {
1420 @@ -168,7 +237,11 @@ static void CB_draw(HTHEME theme, HWND h
1421 created_font = TRUE;
1422 }
1423 } else {
1424 +#ifdef __REACTOS__ /* r73885 */
1425 + font = get_button_font(hwnd);
1426 +#else
1427 font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
1428 +#endif
1429 hPrevFont = SelectObject(hDC, font);
1430 }
1431
1432 @@ -176,6 +249,23 @@ static void CB_draw(HTHEME theme, HWND h
1433 sz.cx = sz.cy = 13;
1434
1435 GetClientRect(hwnd, &bgRect);
1436 +
1437 +#ifdef __REACTOS__ /* r73885, r74149 and r74406 */
1438 + if (prfFlag == 0)
1439 + {
1440 + DrawThemeParentBackground(hwnd, hDC, NULL);
1441 + }
1442 +
1443 + parent = GetParent(hwnd);
1444 + if (!parent) parent = hwnd;
1445 + hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
1446 + (WPARAM)hDC, (LPARAM)hwnd);
1447 + if (!hBrush) /* did the app forget to call defwindowproc ? */
1448 + hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
1449 + (WPARAM)hDC, (LPARAM)hwnd );
1450 + FillRect( hDC, &bgRect, hBrush );
1451 +#endif
1452 +
1453 GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
1454
1455 if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */
1456 @@ -186,7 +276,9 @@ static void CB_draw(HTHEME theme, HWND h
1457 bgRect.right = bgRect.left + sz.cx;
1458 textRect.left = bgRect.right + 6;
1459
1460 +#ifndef __REACTOS__ /* r74406 */
1461 DrawThemeParentBackground(hwnd, hDC, NULL);
1462 +#endif
1463
1464 DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
1465 if (text)
1466 @@ -214,7 +306,11 @@ static void CB_draw(HTHEME theme, HWND h
1467 if (hPrevFont) SelectObject(hDC, hPrevFont);
1468 }
1469
1470 +#ifdef __REACTOS__ /* r73885 */
1471 +static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag)
1472 +#else
1473 static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
1474 +#endif
1475 {
1476 static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
1477
1478 @@ -224,6 +320,11 @@ static void GB_draw(HTHEME theme, HWND h
1479 LOGFONTW lf;
1480 HFONT font, hPrevFont = NULL;
1481 BOOL created_font = FALSE;
1482 +#ifdef __REACTOS__ /* r74406 */
1483 + HWND parent;
1484 + HBRUSH hBrush;
1485 + RECT clientRect;
1486 +#endif
1487
1488 HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
1489 if (SUCCEEDED(hr)) {
1490 @@ -235,7 +336,11 @@ static void GB_draw(HTHEME theme, HWND h
1491 created_font = TRUE;
1492 }
1493 } else {
1494 +#ifdef __REACTOS__ /* r73885 */
1495 + font = get_button_font(hwnd);
1496 +#else
1497 font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
1498 +#endif
1499 hPrevFont = SelectObject(hDC, font);
1500 }
1501
1502 @@ -257,8 +362,29 @@ static void GB_draw(HTHEME theme, HWND h
1503 GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
1504 ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
1505
1506 +#ifdef __REACTOS__ /* r73885 & r74149 */
1507 + if (prfFlag == 0)
1508 + {
1509 + if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
1510 + DrawThemeParentBackground(hwnd, hDC, NULL);
1511 + }
1512 +#else
1513 if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
1514 DrawThemeParentBackground(hwnd, hDC, NULL);
1515 +#endif
1516 +
1517 +#ifdef __REACTOS__ /* r74406 */
1518 + parent = GetParent(hwnd);
1519 + if (!parent) parent = hwnd;
1520 + hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
1521 + (WPARAM)hDC, (LPARAM)hwnd);
1522 + if (!hBrush) /* did the app forget to call defwindowproc ? */
1523 + hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
1524 + (WPARAM)hDC, (LPARAM)hwnd );
1525 + GetClientRect(hwnd, &clientRect);
1526 + FillRect( hDC, &clientRect, hBrush );
1527 +#endif
1528 +
1529 DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
1530
1531 SelectClipRgn(hDC, NULL);
1532 @@ -294,32 +420,84 @@ static const pfThemedPaint btnThemedPain
1533 NULL, /* Not defined */
1534 };
1535
1536 +#ifdef __REACTOS__ /* r73873 */
1537 +BOOL BUTTON_PaintWithTheme(HTHEME theme, HWND hwnd, HDC hParamDC, LPARAM prfFlag)
1538 +#else
1539 static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
1540 +#endif
1541 {
1542 +#ifdef __REACTOS__ /* r73873, r73897 and r74120 */
1543 + DWORD dwStyle;
1544 + DWORD dwStyleEx;
1545 + DWORD type;
1546 + UINT dtFlags;
1547 + int state;
1548 +#else
1549 PAINTSTRUCT ps;
1550 HDC hDC;
1551 DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
1552 DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
1553 UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx);
1554 int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
1555 +#endif
1556 ButtonState drawState;
1557 +#ifdef __REACTOS__ /* r73873, r73897, r73907 and r74120 */
1558 + pfThemedPaint paint;
1559 +
1560 + dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
1561 + type = dwStyle & BUTTON_TYPE;
1562 +
1563 + if (type != BS_PUSHBUTTON && type != BS_DEFPUSHBUTTON && (dwStyle & BS_PUSHLIKE))
1564 + type = BS_PUSHBUTTON;
1565 +
1566 + paint = btnThemedPaintFunc[type];
1567 + if (!paint)
1568 + return FALSE;
1569 +
1570 + if (get_button_image(hwnd) != 0)
1571 + return FALSE;
1572 +
1573 + dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
1574 + dtFlags = get_drawtext_flags(dwStyle, dwStyleEx);
1575 + state = get_button_state(hwnd);
1576 +#else
1577 pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
1578 +#endif
1579
1580 if(IsWindowEnabled(hwnd))
1581 {
1582 - if(state & BST_PUSHED) drawState = STATE_PRESSED;
1583 - else if(state & BST_HOT) drawState = STATE_HOT;
1584 - else if(state & BST_FOCUS) drawState = STATE_DEFAULTED;
1585 - else drawState = STATE_NORMAL;
1586 + if(state & BST_PUSHED)
1587 + drawState = STATE_PRESSED;
1588 + else if ((dwStyle & BS_PUSHLIKE) && (state & (BST_CHECKED|BST_INDETERMINATE)))
1589 + drawState = STATE_PRESSED;
1590 + else if(state & BST_HOT)
1591 + drawState = STATE_HOT;
1592 + else if(state & BST_FOCUS)
1593 + drawState = STATE_DEFAULTED;
1594 + else
1595 + drawState = STATE_NORMAL;
1596 }
1597 - else drawState = STATE_DISABLED;
1598 + else
1599 + drawState = STATE_DISABLED;
1600
1601 +#ifndef __REACTOS__ /* r73873 */
1602 hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
1603 if (paint) paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS);
1604 if (!hParamDC) EndPaint(hwnd, &ps);
1605 +#endif
1606 +
1607 +#ifdef __REACTOS__ /* r74074 & r74120 */
1608 + if (drawState == STATE_NORMAL && type == BS_DEFPUSHBUTTON)
1609 + {
1610 + drawState = STATE_DEFAULTED;
1611 + }
1612 +#endif
1613 +
1614 + paint(theme, hwnd, hParamDC, drawState, dtFlags, state & BST_FOCUS, prfFlag);
1615 return TRUE;
1616 }
1617
1618 +#ifndef __REACTOS__ /* r73873 */
1619 /**********************************************************************
1620 * The button control subclass window proc.
1621 */
1622 @@ -416,3 +594,4 @@ LRESULT CALLBACK THEMING_ButtonSubclassP
1623 }
1624 return 0;
1625 }
1626 +#endif /* !__REACTOS__ */
1627 diff -pudN e:\wine\dlls\comctl32/theme_edit.c e:\reactos\dll\win32\comctl32/theme_edit.c
1628 --- e:\wine\dlls\comctl32/theme_edit.c 2017-09-07 12:58:14 +0100
1629 +++ e:\reactos\dll\win32\comctl32/theme_edit.c 2017-05-21 20:36:43 +0100
1630 @@ -52,8 +52,15 @@ static void nc_paint (HTHEME theme, HWND
1631 CombineRgn (cliprgn, cliprgn, region, RGN_AND);
1632 OffsetRect(&r, -r.left, -r.top);
1633
1634 +#ifdef __REACTOS__ /* r73789 */
1635 + dc = GetWindowDC(hwnd);
1636 + /* Exclude client part */
1637 + ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge,
1638 + r.right - cxEdge, r.bottom -cyEdge);
1639 +#else
1640 dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
1641 OffsetRect(&r, -r.left, -r.top);
1642 +#endif
1643
1644 if (IsThemeBackgroundPartiallyTransparent (theme, part, state))
1645 DrawThemeParentBackground(hwnd, dc, &r);
1646 diff -pudN e:\wine\dlls\comctl32/theme_listbox.c e:\reactos\dll\win32\comctl32/theme_listbox.c
1647 --- e:\wine\dlls\comctl32/theme_listbox.c 2017-09-07 12:58:14 +0100
1648 +++ e:\reactos\dll\win32\comctl32/theme_listbox.c 2017-05-21 20:37:26 +0100
1649 @@ -42,8 +42,15 @@ static void nc_paint (HTHEME theme, HWND
1650 CombineRgn (cliprgn, cliprgn, region, RGN_AND);
1651 OffsetRect(&r, -r.left, -r.top);
1652
1653 +#ifdef __REACTOS__ /* r73789 */
1654 + dc = GetWindowDC(hwnd);
1655 + /* Exclude client part */
1656 + ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge,
1657 + r.right - cxEdge, r.bottom -cyEdge);
1658 +#else
1659 dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
1660 OffsetRect(&r, -r.left, -r.top);
1661 +#endif
1662
1663 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
1664 DrawThemeParentBackground(hwnd, dc, &r);
1665 diff -pudN e:\wine\dlls\comctl32/theming.c e:\reactos\dll\win32\comctl32/theming.c
1666 --- e:\wine\dlls\comctl32/theming.c 2017-09-07 12:58:14 +0100
1667 +++ e:\reactos\dll\win32\comctl32/theming.c 2017-05-21 20:45:56 +0100
1668 @@ -26,12 +26,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(theming);
1669 typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM,
1670 ULONG_PTR);
1671
1672 +#ifndef __REACTOS__ /* r73871 */
1673 extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
1674 ULONG_PTR) DECLSPEC_HIDDEN;
1675 +#endif
1676 extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
1677 ULONG_PTR) DECLSPEC_HIDDEN;
1678 +#ifndef __REACTOS__ /* r73803 */
1679 extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
1680 ULONG_PTR) DECLSPEC_HIDDEN;
1681 +#endif
1682 extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
1683 ULONG_PTR) DECLSPEC_HIDDEN;
1684 extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM,
1685 @@ -48,8 +52,10 @@ static const struct ThemingSubclass
1686 THEMING_SUBCLASSPROC subclassProc;
1687 } subclasses[] = {
1688 /* Note: list must be sorted by class name */
1689 +#ifndef __REACTOS__ /* r73803 & r73871 */
1690 {dialogClass, THEMING_DialogSubclassProc},
1691 {WC_BUTTONW, THEMING_ButtonSubclassProc},
1692 +#endif
1693 {WC_COMBOBOXW, THEMING_ComboSubclassProc},
1694 {comboLboxClass, THEMING_ListBoxSubclassProc},
1695 {WC_EDITW, THEMING_EditSubclassProc},
1696 @@ -89,17 +95,23 @@ MAKE_SUBCLASS_PROC(1)
1697 MAKE_SUBCLASS_PROC(2)
1698 MAKE_SUBCLASS_PROC(3)
1699 MAKE_SUBCLASS_PROC(4)
1700 +#ifndef __REACTOS__ /* r73803 & r73871 */
1701 MAKE_SUBCLASS_PROC(5)
1702 MAKE_SUBCLASS_PROC(6)
1703 +#endif
1704
1705 static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
1706 subclass_proc0,
1707 subclass_proc1,
1708 subclass_proc2,
1709 subclass_proc3,
1710 +#ifdef __REACTOS__ /* r73871 */
1711 + subclass_proc4
1712 +#else
1713 subclass_proc4,
1714 subclass_proc5,
1715 subclass_proc6
1716 +#endif
1717 };
1718
1719 /***********************************************************************
1720 @@ -108,15 +120,23 @@ static const WNDPROC subclassProcs[NUM_S
1721 * Register classes for standard controls that will shadow the system
1722 * classes.
1723 */
1724 +#ifdef __REACTOS__ /* r73803 */
1725 +void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6)
1726 +#else
1727 void THEMING_Initialize (void)
1728 +#endif
1729 {
1730 unsigned int i;
1731 static const WCHAR subclassPropName[] =
1732 { 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 };
1733 static const WCHAR refDataPropName[] =
1734 { 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 };
1735 -
1736 +#ifdef __REACTOS__ /* r73803 */
1737 + ULONG_PTR ulCookie;
1738 + BOOL ret, bActivated;
1739 +#else
1740 if (!IsThemeActive()) return;
1741 +#endif
1742
1743 atSubclassProp = GlobalAddAtomW (subclassPropName);
1744 atRefDataProp = GlobalAddAtomW (refDataPropName);
1745 @@ -126,7 +146,17 @@ void THEMING_Initialize (void)
1746 WNDCLASSEXW class;
1747
1748 class.cbSize = sizeof(class);
1749 +
1750 +#ifdef __REACTOS__ /* r73803 */
1751 + bActivated = ActivateActCtx(hActCtx5, &ulCookie);
1752 + ret = GetClassInfoExW (NULL, subclasses[i].className, &class);
1753 + if (bActivated)
1754 + DeactivateActCtx(0, ulCookie);
1755 +
1756 + if (!ret)
1757 +#else
1758 if (!GetClassInfoExW (NULL, subclasses[i].className, &class))
1759 +#endif
1760 {
1761 ERR("Could not retrieve information for class %s\n",
1762 debugstr_w (subclasses[i].className));
1763 @@ -134,6 +164,10 @@ void THEMING_Initialize (void)
1764 }
1765 originalProcs[i] = class.lpfnWndProc;
1766 class.lpfnWndProc = subclassProcs[i];
1767 +#ifdef __REACTOS__ /* r73803 */
1768 + class.style |= CS_GLOBALCLASS;
1769 + class.hInstance = COMCTL32_hModule;
1770 +#endif
1771
1772 if (!class.lpfnWndProc)
1773 {
1774 @@ -142,9 +176,16 @@ void THEMING_Initialize (void)
1775 continue;
1776 }
1777
1778 +#ifdef __REACTOS__ /* r73803 */
1779 + bActivated = ActivateActCtx(hActCtx6, &ulCookie);
1780 +#endif
1781 if (!RegisterClassExW (&class))
1782 {
1783 +#ifdef __REACTOS__ /* r73803 */
1784 + WARN("Could not re-register class %s: %x\n",
1785 +#else
1786 ERR("Could not re-register class %s: %x\n",
1787 +#endif
1788 debugstr_w (subclasses[i].className), GetLastError ());
1789 }
1790 else
1791 @@ -152,6 +193,11 @@ void THEMING_Initialize (void)
1792 TRACE("Re-registered class %s\n",
1793 debugstr_w (subclasses[i].className));
1794 }
1795 +
1796 +#ifdef __REACTOS__ /* r73803 */
1797 + if (bActivated)
1798 + DeactivateActCtx(0, ulCookie);
1799 +#endif
1800 }
1801 }
1802
1803 diff -pudN e:\wine\dlls\comctl32/toolbar.c e:\reactos\dll\win32\comctl32/toolbar.c
1804 --- e:\wine\dlls\comctl32/toolbar.c 2017-09-07 12:58:14 +0100
1805 +++ e:\reactos\dll\win32\comctl32/toolbar.c 2017-08-04 10:44:05 +0100
1806 @@ -33,11 +33,9 @@
1807 * - TBSTYLE_REGISTERDROP
1808 * - TBSTYLE_EX_DOUBLEBUFFER
1809 * - Messages:
1810 - * - TB_GETMETRICS
1811 * - TB_GETOBJECT
1812 * - TB_INSERTMARKHITTEST
1813 * - TB_SAVERESTORE
1814 - * - TB_SETMETRICS
1815 * - WM_WININICHANGE
1816 * - Notifications:
1817 * - NM_CHAR
1818 @@ -125,6 +123,11 @@ typedef struct
1819 INT nOldHit;
1820 INT nHotItem; /* index of the "hot" item */
1821 SIZE szPadding; /* padding values around button */
1822 +#ifdef __REACTOS__
1823 + SIZE szBarPadding; /* padding values around the toolbar (NOT USED BUT STORED) */
1824 + SIZE szSpacing; /* spacing values between buttons */
1825 + MARGINS themeMargins;
1826 +#endif
1827 INT iTopMargin; /* the top margin */
1828 INT iListGap; /* default gap between text and image for toolbar with list style */
1829 HFONT hDefaultFont;
1830 @@ -190,12 +193,24 @@ typedef enum
1831 #define ARROW_HEIGHT 3
1832 #define INSERTMARK_WIDTH 2
1833
1834 +/* default padding inside a button */
1835 #define DEFPAD_CX 7
1836 #define DEFPAD_CY 6
1837 +
1838 +#ifdef __REACTOS__
1839 +/* default space between buttons and between rows */
1840 +#define DEFSPACE_CX 7
1841 +#define DEFSPACE_CY 6
1842 +#endif
1843 +
1844 #define DEFLISTGAP 4
1845
1846 /* vertical padding used in list mode when image is present */
1847 +#ifdef __REACTOS__
1848 +#define LISTPAD_CY 2
1849 +#else
1850 #define LISTPAD_CY 9
1851 +#endif
1852
1853 /* how wide to treat the bitmap if it isn't present */
1854 #define NONLIST_NOTEXT_OFFSET 2
1855 @@ -239,6 +254,10 @@ static LRESULT TOOLBAR_SetButtonInfo(TOO
1856
1857 static inline int default_top_margin(const TOOLBAR_INFO *infoPtr)
1858 {
1859 +#ifdef __REACTOS__
1860 + if (infoPtr->iVersion == 6)
1861 + return 0;
1862 +#endif
1863 return (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
1864 }
1865
1866 @@ -598,6 +617,9 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *
1867 COLORREF clrOldBk = 0;
1868 int oldBkMode = 0;
1869 UINT state = tbcd->nmcd.uItemState;
1870 +#ifdef __REACTOS__
1871 + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
1872 +#endif
1873
1874 /* draw text */
1875 if (lpText && infoPtr->nMaxTextRows > 0) {
1876 @@ -627,6 +649,25 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *
1877 clrOld = SetTextColor (hdc, tbcd->clrText);
1878 }
1879
1880 +#ifdef __REACTOS__
1881 + if (theme)
1882 + {
1883 + int partId = TP_BUTTON;
1884 + int stateId = TS_NORMAL;
1885 +
1886 + if (state & CDIS_DISABLED)
1887 + stateId = TS_DISABLED;
1888 + else if (state & CDIS_SELECTED)
1889 + stateId = TS_PRESSED;
1890 + else if (state & CDIS_CHECKED)
1891 + stateId = (state & CDIS_HOT) ? TS_HOTCHECKED : TS_HOT;
1892 + else if (state & CDIS_HOT)
1893 + stateId = TS_HOT;
1894 +
1895 + DrawThemeText(theme, hdc, partId, stateId, lpText, -1, infoPtr->dwDTFlags, 0, rcText);
1896 + }
1897 + else
1898 +#endif
1899 DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
1900 SetTextColor (hdc, clrOld);
1901 if ((state & CDIS_MARKED) && !(dwItemCDFlag & TBCDRF_NOMARK))
1902 @@ -723,10 +764,14 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
1903 const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
1904 {
1905 HIMAGELIST himl = NULL;
1906 - BOOL draw_masked = FALSE;
1907 + BOOL draw_masked = FALSE, draw_desaturated = FALSE;
1908 INT index;
1909 INT offset = 0;
1910 UINT draw_flags = ILD_TRANSPARENT;
1911 +#ifdef __REACTOS__
1912 + IMAGEINFO info = {0};
1913 + BITMAP bm = {0};
1914 +#endif
1915
1916 if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
1917 {
1918 @@ -734,7 +779,22 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
1919 if (!himl)
1920 {
1921 himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
1922 +
1923 +#ifdef __REACTOS__
1924 + ImageList_GetImageInfo(himl, index, &info);
1925 + GetObjectW(info.hbmImage, sizeof(bm), &bm);
1926 +
1927 + if (bm.bmBitsPixel == 32)
1928 + {
1929 + draw_desaturated = TRUE;
1930 + }
1931 + else
1932 + {
1933 + draw_masked = TRUE;
1934 + }
1935 +#else
1936 draw_masked = TRUE;
1937 +#endif
1938 }
1939 }
1940 else if (tbcd->nmcd.uItemState & CDIS_CHECKED ||
1941 @@ -765,9 +825,34 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
1942 index, himl, left, top, offset);
1943
1944 if (draw_masked)
1945 + {
1946 + /* code path for drawing flat disabled icons without alpha channel */
1947 TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
1948 + }
1949 + else if (draw_desaturated)
1950 + {
1951 + /* code path for drawing disabled, alpha-blended (32bpp) icons */
1952 + IMAGELISTDRAWPARAMS imldp = {0};
1953 +
1954 + imldp.cbSize = sizeof(imldp);
1955 + imldp.himl = himl;
1956 + imldp.i = index;
1957 + imldp.hdcDst = tbcd->nmcd.hdc,
1958 + imldp.x = offset + left;
1959 + imldp.y = offset + top;
1960 + imldp.rgbBk = CLR_NONE;
1961 + imldp.rgbFg = CLR_DEFAULT;
1962 + imldp.fStyle = ILD_TRANSPARENT;
1963 + imldp.fState = ILS_ALPHA | ILS_SATURATE;
1964 + imldp.Frame = 192;
1965 +
1966 + ImageList_DrawIndirect (&imldp);
1967 + }
1968 else
1969 + {
1970 + /* code path for drawing standard icons as-is */
1971 ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
1972 + }
1973 }
1974
1975 /* draws a blank frame for a toolbar button */
1976 @@ -884,14 +969,15 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
1977 InflateRect(&rcsep, -infoPtr->szPadding.cx, -infoPtr->szPadding.cy);
1978 TOOLBAR_DrawFlatHorizontalSeparator (&rcsep, hdc, infoPtr);
1979 }
1980 - else
1981 - TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1982 - }
1983 - else if (btnPtr->fsStyle != BTNS_SEP) {
1984 - FIXME("Draw some kind of separator: fsStyle=%x\n",
1985 - btnPtr->fsStyle);
1986 - }
1987 - return;
1988 + else {
1989 + TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1990 + }
1991 + }
1992
1993 + else if (btnPtr->fsStyle != BTNS_SEP) {
1994 + FIXME("Draw some kind of separator: fsStyle=%x\n",
1995 + btnPtr->fsStyle);
1996 + }
1997 + return;
1998 }
1999
2000 /* get a pointer to the text */
2001 @@ -933,6 +1019,9 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
2002 rcBitmap.left += ((rc.right - rc.left) - infoPtr->nBitmapWidth) / 2;
2003
2004 rcBitmap.top += infoPtr->szPadding.cy / 2;
2005 +#ifdef __REACTOS__
2006 + rcBitmap.top += infoPtr->themeMargins.cyTopHeight;
2007 +#endif
2008
2009 TRACE("iBitmap=%d, start=(%d,%d) w=%d, h=%d\n",
2010 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
2011 @@ -1027,7 +1116,11 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
2012 }
2013 }
2014
2015 +#ifdef __REACTOS__
2016 + if (theme && !(dwItemCDFlag & TBCDRF_NOBACKGROUND))
2017 +#else
2018 if (theme)
2019 +#endif
2020 {
2021 int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
2022 int stateId = TS_NORMAL;
2023 @@ -1044,7 +1137,12 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
2024
2025 DrawThemeBackground (theme, hdc, partId, stateId, &rc, NULL);
2026 }
2027 +
2028 +#ifdef __REACTOS__
2029 + if (!theme)
2030 +#else
2031 else
2032 +#endif
2033 TOOLBAR_DrawFrame(infoPtr, &tbcd, &rc, dwItemCDFlag);
2034
2035 if (drawSepDropDownArrow)
2036 @@ -1570,9 +1668,14 @@ static inline SIZE TOOLBAR_MeasureButton
2037 /* ... add on the necessary padding */
2038 if (bValidImageList)
2039 {
2040 +#ifdef __REACTOS__
2041 + sizeButton.cy += infoPtr->szPadding.cy;
2042 + if (!bHasBitmap)
2043 +#else
2044 if (bHasBitmap)
2045 sizeButton.cy += DEFPAD_CY;
2046 else
2047 +#endif
2048 sizeButton.cy += LISTPAD_CY;
2049 }
2050 else
2051 @@ -1589,7 +1692,11 @@ static inline SIZE TOOLBAR_MeasureButton
2052 {
2053 if (bHasBitmap)
2054 {
2055 +#ifdef __REACTOS__
2056 + sizeButton.cy = infoPtr->nBitmapHeight + infoPtr->szPadding.cy;
2057 +#else
2058 sizeButton.cy = infoPtr->nBitmapHeight + DEFPAD_CY;
2059 +#endif
2060 if (sizeString.cy > 0)
2061 sizeButton.cy += 1 + sizeString.cy;
2062 sizeButton.cx = infoPtr->szPadding.cx +
2063 @@ -1603,6 +1710,12 @@ static inline SIZE TOOLBAR_MeasureButton
2064 max(2*GetSystemMetrics(SM_CXEDGE) + sizeString.cx, infoPtr->nBitmapWidth);
2065 }
2066 }
2067 +
2068 +#ifdef __REACTOS__
2069 + sizeButton.cx += infoPtr->themeMargins.cxLeftWidth + infoPtr->themeMargins.cxRightWidth;
2070 + sizeButton.cy += infoPtr->themeMargins.cyTopHeight + infoPtr->themeMargins.cyBottomHeight;
2071 +#endif
2072 +
2073 return sizeButton;
2074 }
2075
2076 @@ -1695,7 +1808,14 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
2077 {
2078 if (btnPtr->cx)
2079 cx = btnPtr->cx;
2080 +#ifdef __REACTOS__
2081 + /* Revert Wine Commit 5b7b911 as it breaks Explorer Toolbar Buttons
2082 + FIXME: Revisit this when the bug is fixed. CORE-9970 */
2083 + else if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
2084 + (btnPtr->fsStyle & BTNS_AUTOSIZE))
2085 +#else
2086 else if (btnPtr->fsStyle & BTNS_AUTOSIZE)
2087 +#endif
2088 {
2089 SIZE sz;
2090 HDC hdc;
2091 @@ -1747,14 +1867,14 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
2092 if( bWrap )
2093 {
2094 if ( !(btnPtr->fsStyle & BTNS_SEP) )
2095 - y += cy;
2096 + y += cy + infoPtr->szSpacing.cy;
2097 else
2098 {
2099 if ( !(infoPtr->dwStyle & CCS_VERT))
2100 y += cy + ( (btnPtr->cx > 0 ) ?
2101 btnPtr->cx : SEPARATOR_WIDTH) * 2 /3;
2102 else
2103 - y += cy;
2104 + y += cy + infoPtr->szSpacing.cy;
2105
2106 /* nSepRows is used to calculate the extra height following */
2107 /* the last row. */
2108 @@ -1768,7 +1888,7 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
2109 nRows++;
2110 }
2111 else
2112 - x += cx;
2113 + x += cx + infoPtr->szSpacing.cx;
2114 }
2115
2116 /* infoPtr->nRows is the number of rows on the toolbar */
2117 @@ -3540,6 +3660,34 @@ TOOLBAR_GetMaxSize (const TOOLBAR_INFO *
2118 return TRUE;
2119 }
2120
2121 +#ifdef __REACTOS__
2122 +static LRESULT
2123 +TOOLBAR_GetMetrics(const TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics)
2124 +{
2125 + if (pMetrics == NULL || pMetrics->cbSize != sizeof(TBMETRICS))
2126 + return 0;
2127 +
2128 + if (pMetrics->dwMask & TBMF_PAD)
2129 + {
2130 + pMetrics->cxPad = infoPtr->szPadding.cx;
2131 + pMetrics->cyPad = infoPtr->szPadding.cy;
2132 + }
2133 +
2134 + if (pMetrics->dwMask & TBMF_BARPAD)
2135 + {
2136 + pMetrics->cxBarPad = infoPtr->szBarPadding.cx;
2137 + pMetrics->cyBarPad = infoPtr->szBarPadding.cy;
2138 + }
2139 +
2140 + if (pMetrics->dwMask & TBMF_BUTTONSPACING)
2141 + {
2142 + pMetrics->cxButtonSpacing = infoPtr->szSpacing.cx;
2143 + pMetrics->cyButtonSpacing = infoPtr->szSpacing.cy;
2144 + }
2145 +
2146 + return 0;
2147 +}
2148 +#endif
2149
2150 /* << TOOLBAR_GetObject >> */
2151
2152 @@ -4337,7 +4485,7 @@ TOOLBAR_SetBitmapSize (TOOLBAR_INFO *inf
2153 short width = (short)LOWORD(lParam);
2154 short height = (short)HIWORD(lParam);
2155
2156 - TRACE("hwnd=%p, wParam=%ld, size %d x %d\n", infoPtr->hwndSelf, wParam, width, height);
2157 + TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", infoPtr->hwndSelf, wParam, lParam);
2158
2159 if (wParam != 0)
2160 FIXME("wParam is %ld. Perhaps image list index?\n", wParam);
2161 @@ -4455,8 +4603,13 @@ TOOLBAR_SetButtonSize (TOOLBAR_INFO *inf
2162 if (cx == 0) cx = 24;
2163 if (cy == 0) cy = 22;
2164
2165 +#ifdef __REACTOS__
2166 + cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth + infoPtr->themeMargins.cxLeftWidth + infoPtr->themeMargins.cxRightWidth);
2167 + cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight + infoPtr->themeMargins.cyTopHeight + infoPtr->themeMargins.cyBottomHeight);
2168 +#else
2169 cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth);
2170 cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight);
2171 +#endif
2172
2173 if (cx != infoPtr->nButtonWidth || cy != infoPtr->nButtonHeight ||
2174 top != infoPtr->iTopMargin)
2175 @@ -4794,6 +4947,44 @@ TOOLBAR_SetMaxTextRows (TOOLBAR_INFO *in
2176 return TRUE;
2177 }
2178
2179 +#ifdef __REACTOS__
2180 +static LRESULT
2181 +TOOLBAR_SetMetrics(TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics)
2182 +{
2183
2184 + BOOL changed = FALSE;
2185 +
2186 + if (!pMetrics)
2187 + return FALSE;
2188 +
2189 + /* TODO: check if cbSize is a valid value */
2190 +
2191 + if (pMetrics->dwMask & TBMF_PAD)
2192 + {
2193 + infoPtr->szPadding.cx = pMetrics->cxPad;
2194 + infoPtr->szPadding.cy = pMetrics->cyPad;
2195 + changed = TRUE;
2196 + }
2197 +
2198 + if (pMetrics->dwMask & TBMF_PAD)
2199 + {
2200 + infoPtr->szBarPadding.cx = pMetrics->cxBarPad;
2201 + infoPtr->szBarPadding.cy = pMetrics->cyBarPad;
2202 + changed = TRUE;
2203 + }
2204 +
2205 + if (pMetrics->dwMask & TBMF_BUTTONSPACING)
2206 + {
2207 + infoPtr->szSpacing.cx = pMetrics->cxButtonSpacing;
2208 + infoPtr->szSpacing.cy = pMetrics->cyButtonSpacing;
2209 + changed = TRUE;
2210 + }
2211 +
2212 + if (changed)
2213 + TOOLBAR_CalcToolbar(infoPtr);
2214 +
2215 + return TRUE;
2216 +}
2217 +#endif
2218
2219 /* MSDN gives slightly wrong info on padding.
2220 * 1. It is not only used on buttons with the BTNS_AUTOSIZE style
2221 @@ -5083,6 +5274,16 @@ TOOLBAR_SetVersion (TOOLBAR_INFO *infoPt
2222 {
2223 INT iOldVersion = infoPtr->iVersion;
2224
2225 +#ifdef __REACTOS__
2226 + /* The v6 control doesn't support changing its version */
2227 + if (iOldVersion == 6)
2228 + return iOldVersion;
2229 +
2230 + /* And a control that is not v6 can't be set to be a v6 one */
2231 + if (iVersion >= 6)
2232 + return -1;
2233 +#endif
2234 +
2235 infoPtr->iVersion = iVersion;
2236
2237 if (infoPtr->iVersion >= 5)
2238 @@ -5269,8 +5470,16 @@ TOOLBAR_Create (HWND hwnd, const CREATES
2239
2240 SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
2241 infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
2242 -
2243 +
2244 +#ifdef __REACTOS__
2245 + {
2246 + HTHEME theme = OpenThemeData (hwnd, themeClass);
2247 + if (theme)
2248 + GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
2249 + }
2250 +#else
2251 OpenThemeData (hwnd, themeClass);
2252 +#endif
2253
2254 TOOLBAR_CheckStyle (infoPtr);
2255
2256 @@ -5993,7 +6202,11 @@ TOOLBAR_NCCalcSize (HWND hwnd, WPARAM wP
2257
2258
2259 static LRESULT
2260 +#ifdef __REACTOS__
2261 +TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs, int iVersion)
2262 +#else
2263 TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
2264 +#endif
2265 {
2266 TOOLBAR_INFO *infoPtr;
2267 DWORD styleadd = 0;
2268 @@ -6027,13 +6240,22 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wPar
2269 infoPtr->dwDTFlags = (lpcs->style & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
2270 infoPtr->bAnchor = FALSE; /* no anchor highlighting */
2271 infoPtr->bDragOutSent = FALSE;
2272 +#ifdef __REACTOS__
2273 + infoPtr->iVersion = iVersion;
2274 +#else
2275 infoPtr->iVersion = 0;
2276 +#endif
2277 infoPtr->hwndSelf = hwnd;
2278 infoPtr->bDoRedraw = TRUE;
2279 infoPtr->clrBtnHighlight = CLR_DEFAULT;
2280 infoPtr->clrBtnShadow = CLR_DEFAULT;
2281 infoPtr->szPadding.cx = DEFPAD_CX;
2282 infoPtr->szPadding.cy = DEFPAD_CY;
2283 +#ifdef __REACTOS__
2284 + infoPtr->szSpacing.cx = 0;
2285 + infoPtr->szSpacing.cy = 0;
2286 + memset(&infoPtr->themeMargins, 0 , sizeof(infoPtr->themeMargins));
2287 +#endif
2288 infoPtr->iListGap = DEFLISTGAP;
2289 infoPtr->iTopMargin = default_top_margin(infoPtr);
2290 infoPtr->dwStyle = lpcs->style;
2291 @@ -6443,8 +6665,22 @@ TOOLBAR_SysColorChange (void)
2292 return 0;
2293 }
2294
2295 -
2296 +#ifdef __REACTOS__
2297 /* update theme after a WM_THEMECHANGED message */
2298 +static LRESULT theme_changed (TOOLBAR_INFO *infoPtr)
2299 +{
2300 + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
2301 + CloseThemeData (theme);
2302 + OpenThemeData (infoPtr->hwndSelf, themeClass);
2303 + theme = GetWindowTheme (infoPtr->hwndSelf);
2304 + if (theme)
2305 + GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
2306 + else
2307 + memset(&infoPtr->themeMargins, 0 ,sizeof(infoPtr->themeMargins));
2308 +
2309 + return 0;
2310 +}
2311 +#else
2312 static LRESULT theme_changed (HWND hwnd)
2313 {
2314 HTHEME theme = GetWindowTheme (hwnd);
2315 @@ -6452,7 +6688,7 @@ static LRESULT theme_changed (HWND hwnd)
2316 OpenThemeData (hwnd, themeClass);
2317 return 0;
2318 }
2319 -
2320 +#endif
2321
2322 static LRESULT WINAPI
2323 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2324 @@ -6557,6 +6793,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2325
2326 case TB_GETMAXSIZE:
2327 return TOOLBAR_GetMaxSize (infoPtr, (LPSIZE)lParam);
2328 +#ifdef __REACTOS__
2329 + case TB_GETMETRICS:
2330 + return TOOLBAR_GetMetrics (infoPtr, (TBMETRICS*)lParam);
2331 +#endif
2332
2333 /* case TB_GETOBJECT: */ /* 4.71 */
2334
2335 @@ -6698,6 +6938,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2336 case TB_SETMAXTEXTROWS:
2337 return TOOLBAR_SetMaxTextRows (infoPtr, wParam);
2338
2339 +#ifdef __REACTOS__
2340 + case TB_SETMETRICS:
2341 + return TOOLBAR_SetMetrics (infoPtr, (TBMETRICS*)lParam);
2342 +#endif
2343 +
2344 case TB_SETPADDING:
2345 return TOOLBAR_SetPadding (infoPtr, lParam);
2346
2347 @@ -6805,7 +7050,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2348 return TOOLBAR_NCCalcSize (hwnd, wParam, lParam);
2349
2350 case WM_NCCREATE:
2351 +#ifdef __REACTOS__
2352 + return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam, 0);
2353 +#else
2354 return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam);
2355 +#endif
2356
2357 case WM_NCPAINT:
2358 return TOOLBAR_NCPaint (hwnd, wParam, lParam);
2359 @@ -6837,9 +7086,12 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2360
2361 case WM_SYSCOLORCHANGE:
2362 return TOOLBAR_SysColorChange ();
2363 -
2364 - case WM_THEMECHANGED:
2365 + case WM_THEMECHANGED:
2366 +#ifdef __REACTOS__
2367 + return theme_changed (infoPtr);
2368 +#else
2369 return theme_changed (hwnd);
2370 +#endif
2371
2372 /* case WM_WININICHANGE: */
2373
2374 @@ -6887,6 +7139,40 @@ TOOLBAR_Unregister (void)
2375 UnregisterClassW (TOOLBARCLASSNAMEW, NULL);
2376 }
2377
2378 +#ifdef __REACTOS__
2379 +static LRESULT WINAPI
2380 +ToolbarV6WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2381 +{
2382 + if (uMsg == WM_NCCREATE)
2383 + return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam, 6);
2384 + else
2385 + return ToolbarWindowProc(hwnd, uMsg, wParam, lParam);
2386 +}
2387 +
2388 +VOID
2389 +TOOLBARv6_Register (void)
2390 +{
2391 + WNDCLASSW wndClass;
2392 +
2393 + ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2394 + wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
2395 + wndClass.lpfnWndProc = ToolbarV6WindowProc;
2396 + wndClass.cbClsExtra = 0;
2397 + wndClass.cbWndExtra = sizeof(TOOLBAR_INFO *);
2398 + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2399 + wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
2400 + wndClass.lpszClassName = TOOLBARCLASSNAMEW;
2401 +
2402 + RegisterClassW (&wndClass);
2403 +}
2404 +
2405 +VOID
2406 +TOOLBARv6_Unregister (void)
2407 +{
2408 + UnregisterClassW (TOOLBARCLASSNAMEW, NULL);
2409 +}
2410 +#endif
2411 +
2412 static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
2413 {
2414 HIMAGELIST himlold;
2415 diff -pudN e:\wine\dlls\comctl32/tooltips.c e:\reactos\dll\win32\comctl32/tooltips.c
2416 --- e:\wine\dlls\comctl32/tooltips.c 2017-09-07 12:58:14 +0100
2417 +++ e:\reactos\dll\win32\comctl32/tooltips.c 2017-02-13 10:18:27 +0100
2418 @@ -2009,7 +2009,36 @@ TOOLTIPS_NCHitTest (const TOOLTIPS_INFO
2419 static LRESULT
2420 TOOLTIPS_NotifyFormat (TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
2421 {
2422 +#ifdef __REACTOS__
2423 + TTTOOL_INFO *toolPtr = infoPtr->tools;
2424 + LRESULT nResult;
2425 +
2426 + TRACE("infoPtr=%p wParam=%lx lParam=%p\n", infoPtr, wParam, (PVOID)lParam);
2427 +
2428 + if (lParam == NF_QUERY) {
2429 + if (toolPtr->bNotifyUnicode) {
2430 + return NFR_UNICODE;
2431 + } else {
2432 + return NFR_ANSI;
2433 + }
2434 + }
2435 + else if (lParam == NF_REQUERY) {
2436 + nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
2437 + (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
2438 + if (nResult == NFR_ANSI) {
2439 + toolPtr->bNotifyUnicode = FALSE;
2440 + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
2441 + } else if (nResult == NFR_UNICODE) {
2442 + toolPtr->bNotifyUnicode = TRUE;
2443 + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
2444 + } else {
2445 + TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
2446 + }
2447 + return nResult;
2448 + }
2449 +#else
2450 FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", infoPtr->hwndSelf, wParam, lParam);
2451 +#endif
2452
2453 return 0;
2454 }
2455 diff -pudN e:\wine\dlls\comctl32/trackbar.c e:\reactos\dll\win32\comctl32/trackbar.c
2456 --- e:\wine\dlls\comctl32/trackbar.c 2017-09-07 12:58:14 +0100
2457 +++ e:\reactos\dll\win32\comctl32/trackbar.c 2017-05-07 14:47:57 +0100
2458 @@ -938,7 +938,11 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr
2459 if (GetWindowTheme (infoPtr->hwndSelf)) {
2460 DrawThemeParentBackground (infoPtr->hwndSelf, hdc, 0);
2461 }
2462 +#ifndef __REACTOS__
2463 else {
2464 +#else
2465 + {
2466 +#endif
2467 HBRUSH brush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
2468 (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
2469 FillRect (hdc, &rcClient, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));
2470 diff -pudN e:\wine\dlls\comctl32/treeview.c e:\reactos\dll\win32\comctl32/treeview.c
2471 --- e:\wine\dlls\comctl32/treeview.c 2017-09-07 12:58:14 +0100
2472 +++ e:\reactos\dll\win32\comctl32/treeview.c 2017-05-21 20:35:33 +0100
2473 @@ -2911,7 +2911,14 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr,
2474 }
2475 }
2476
2477 + //
2478 + // FIXME: This is correct, but is causes and infinite loop of WM_PAINT
2479 + // messages, resulting in continuous painting of the scroll bar in reactos.
2480 + // Comment out until the real bug is found. CORE-4912
2481 + //
2482 +#ifndef __REACTOS__
2483 TREEVIEW_UpdateScrollBars(infoPtr);
2484 +#endif
2485
2486 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
2487 infoPtr->cdmode =
2488 @@ -5439,8 +5446,15 @@ static BOOL TREEVIEW_NCPaint (const TREE
2489 CombineRgn (cliprgn, cliprgn, region, RGN_AND);
2490 OffsetRect(&r, -r.left, -r.top);
2491
2492 +#ifdef __REACTOS__ /* r73789 */
2493 + dc = GetWindowDC(infoPtr->hwnd);
2494 + /* Exclude client part */
2495 + ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge,
2496 + r.right - cxEdge, r.bottom -cyEdge);
2497 +#else
2498 dc = GetDCEx(infoPtr->hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
2499 OffsetRect(&r, -r.left, -r.top);
2500 +#endif
2501
2502 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
2503 DrawThemeParentBackground(infoPtr->hwnd, dc, &r);