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
8 -#include <wine/unicode.h>
9 #include <wine/debug.h>
10 +#include <wine/list.h>
11 +#include <wine/unicode.h>
15 extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN;
16 extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN;
18 -/* Property sheet / Wizard */
19 -#define IDD_PROPSHEET 1006
20 -#define IDD_WIZARD 1020
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
30 -#define IDS_CLOSE 4160
32 -/* Toolbar customization dialog */
33 -#define IDD_TBCUSTOMIZE 200
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
43 -#define IDS_SEPARATOR 1024
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
53 -#define IDM_TODAY 4163
54 -#define IDM_GOTODAY 4164
56 -/* Treeview Checkboxes */
58 -#define IDT_CHECK 401
62 -#define IDC_MOVEBUTTON 102
64 -#define IDC_DIVIDER 106
65 -#define IDC_DIVIDEROPEN 107
68 -/* DragList resources */
69 -#define IDI_DRAGARROW 501
71 -/* HOTKEY internal strings */
72 -#define HKY_NONE 2048
75 -#define IDI_TT_INFO_SM 22
76 -#define IDI_TT_WARN_SM 25
77 -#define IDI_TT_ERROR_SM 28
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
89 COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */
90 @@ -145,6 +77,21 @@ typedef struct
92 extern COMCTL32_SysColor comctl32_color DECLSPEC_HIDDEN;
94 +typedef struct _BUTTON_DATA {
101 + BUTTON_IMAGELIST imlData;
102 +} BUTTON_DATA, *PBUTTON_DATA;
104 +static inline PBUTTON_DATA _GetButtonData(HWND hwnd)
106 + return (PBUTTON_DATA)GetWindowLongPtrW( hwnd, 0 );
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;
116 -#define COMCTL32_VERSION_MINOR 81
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;
126 +extern void BUTTON_Register();
127 +extern void BUTTON_Unregister();
129 +extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
130 +extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;
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;
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
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
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
160 +#include <strsafe.h>
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"
169 +#elif defined __x86_64__
170 +#define ARCH L"amd64"
172 +#define ARCH L"none"
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";
178 +static WCHAR* GetManifestPath(BOOL create, BOOL bV6)
183 + pwszBuf = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
187 + GetWindowsDirectoryW(pwszBuf, MAX_PATH);
188 + hres = StringCchCatW(pwszBuf, MAX_PATH, L"\\winsxs");
192 + CreateDirectoryW(pwszBuf, NULL);
193 + hres = StringCchCatW(pwszBuf, MAX_PATH, L"\\manifests\\");
197 + CreateDirectoryW(pwszBuf, NULL);
199 + hres = StringCchCatW(pwszBuf, MAX_PATH, bV6 ? manifest_filename : manifest_filename_v5);
206 +static BOOL create_manifest(BOOL install, BOOL bV6)
212 + DWORD cbManifest, cbWritten;
217 + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", (LPWSTR)RT_MANIFEST);
219 + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFESTV5", (LPWSTR)RT_MANIFEST);
224 + cbManifest = SizeofResource(COMCTL32_hModule, hResInfo);
228 + hResData = LoadResource(COMCTL32_hModule, hResInfo);
232 + pManifest = LockResource(hResData);
236 + pwszBuf = GetManifestPath(TRUE, bV6);
242 + hFile = CreateFileW(pwszBuf, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
243 + if (hFile != INVALID_HANDLE_VALUE)
245 + if (WriteFile(hFile, pManifest, cbManifest, &cbWritten, NULL) && cbWritten == cbManifest)
248 + CloseHandle(hFile);
251 + DeleteFileW(pwszBuf);
253 + TRACE("created %s\n", debugstr_w(pwszBuf));
257 + bRet = DeleteFileW(pwszBuf);
259 + HeapFree(GetProcessHeap(), 0, pwszBuf);
264 +static HANDLE CreateComctl32ActCtx(BOOL bV6)
267 + WCHAR* pwstrSource;
268 + ACTCTXW ActCtx = {sizeof(ACTCTX)};
270 + pwstrSource = GetManifestPath(FALSE, bV6);
273 + ERR("GetManifestPath failed! bV6=%d\n", bV6);
274 + return INVALID_HANDLE_VALUE;
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);
284 +static void RegisterControls(BOOL bV6)
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 ();
297 + PROGRESS_Register ();
299 + STATUS_Register ();
300 + SYSLINK_Register ();
302 + TOOLTIPS_Register ();
303 + TRACKBAR_Register ();
304 + TREEVIEW_Register ();
305 + UPDOWN_Register ();
309 + TOOLBAR_Register ();
314 + TOOLBARv6_Register();
318 +static void UnregisterControls(BOOL bV6)
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 ();
336 + TOOLTIPS_Unregister ();
337 + TRACKBAR_Unregister ();
338 + TREEVIEW_Unregister ();
339 + UPDOWN_Unregister ();
343 + TOOLBAR_Unregister ();
347 + BUTTON_Unregister();
348 + TOOLBARv6_Unregister ();
353 +static void InitializeClasses()
355 + HANDLE hActCtx5, hActCtx6;
357 + ULONG_PTR ulCookie;
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);
366 + hActCtx6 = CreateComctl32ActCtx(TRUE);
367 + if (hActCtx6 != INVALID_HANDLE_VALUE)
369 + activated = ActivateActCtx(hActCtx6, &ulCookie);
370 + RegisterControls(TRUE); /* Register the classes pretending to be v6 */
371 + if (activated) DeactivateActCtx(0, ulCookie);
373 + /* Initialize the themed controls only when the v6 manifest is present */
374 + THEMING_Initialize (hActCtx5, hActCtx6);
378 +static void UninitializeClasses()
380 + HANDLE hActCtx5, hActCtx6;
382 + ULONG_PTR ulCookie;
384 + hActCtx5 = CreateComctl32ActCtx(FALSE);
385 + activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5, &ulCookie) : FALSE);
386 + UnregisterControls(FALSE);
387 + if (activated) DeactivateActCtx(0, ulCookie);
389 + hActCtx6 = CreateComctl32ActCtx(TRUE);
390 + if (hActCtx6 != INVALID_HANDLE_VALUE)
392 + activated = ActivateActCtx(hActCtx6, &ulCookie);
393 + THEMING_Uninitialize();
394 + UnregisterControls(TRUE);
395 + if (activated) DeactivateActCtx(0, ulCookie);
399 +/***********************************************************************
400 + * RegisterClassNameW [COMCTL32.@]
402 + * Register window class again while using as SxS module.
404 +BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className)
406 + InitializeClasses();
412 /***********************************************************************
414 @@ -118,6 +371,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
415 /* Get all the colors at DLL load */
416 COMCTL32_RefreshSysColors();
419 /* like comctl32 5.82+ register all the common control classes */
422 @@ -143,10 +397,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
424 /* subclass user32 controls */
425 THEMING_Initialize ();
427 + InitializeClasses();
432 case DLL_PROCESS_DETACH:
433 if (lpvReserved) break;
435 /* clean up subclassing */
436 THEMING_Uninitialize();
438 @@ -172,7 +431,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
439 TRACKBAR_Unregister ();
440 TREEVIEW_Unregister ();
441 UPDOWN_Unregister ();
444 + UninitializeClasses();
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)
452 TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
456 + if (!create_manifest(bInstall, TRUE))
458 + ERR("Failed to install comctl32 v6 manifest!\n");
459 + return HRESULT_FROM_WIN32(GetLastError());
462 + if (!create_manifest(bInstall, FALSE))
464 + ERR("Failed to install comctl32 v5 manifest!\n");
465 + return HRESULT_FROM_WIN32(GetLastError());
472 @@ -1580,33 +1857,113 @@ LRESULT WINAPI SetPathWordBreakProc(HWND
474 * Draw text with shadow.
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)
484 + COLORREF crOldText;
486 + INT iRet, x, y, x2, y2;
488 + HBITMAP hbm, hbmOld;
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);
507 + ERR("CreateDIBSection failed\n");
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);
517 + ERR("CreateCompatibleDC failed\n");
523 - /* FIXME: for shadow we need to render normally, blur it, and blend with current background. */
525 - OffsetRect(&r, 1, 1);
526 - DrawTextW(hdc, text, length, &r, flags);
527 + hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
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);
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 */
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)
551 + BYTE *pDest = &pBits[(y * bi.bmiHeader.biWidth + x) * 4];
555 + for (x2 = x - 4 + 1; x2 <= x; ++x2)
556 + for (y2 = y; y2 < y + 5; ++y2)
558 + if (x2 >= 0 && x2 < bi.bmiHeader.biWidth && y2 >= 0 && y2 < bi.bmiHeader.biHeight)
560 + BYTE *pSrc = &pBits[(y2 * bi.bmiHeader.biWidth + x2) * 4];
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)
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;
580 + /* Fix ixOffset of the shadow (tested on Win) */
584 + /* Alpha blend helper image to destination DC */
585 + bf.BlendOp = AC_SRC_OVER;
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);
591 + /* Delete the helper bitmap */
592 + SelectObject(hdcMem, hbmOld);
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);
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
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
618 @@ -1243,8 +1243,11 @@ ImageList_DrawEx (HIMAGELIST himl, INT i
619 return ImageList_DrawIndirect (&imldp);
624 +static BOOL alpha_blend_image( HIMAGELIST himl, HDC srce_dc, HDC dest_dc, int dest_x, int dest_y,
626 static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
628 int src_x, int src_y, int cx, int cy, BLENDFUNCTION func,
629 UINT style, COLORREF blend_col )
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;
636 + if (!(bmp = CreateDIBSection( srce_dc, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
638 if (!(bmp = CreateDIBSection( himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
640 SelectObject( hdc, bmp );
642 + BitBlt( hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY );
644 BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
647 if (blend_col != CLR_NONE)
649 @@ -1344,6 +1355,68 @@ done:
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)
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;
682 + /* bind both surfaces */
683 + SelectObject(hdc, bmp);
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);
688 + /* loop every pixel of the bitmap */
689 + for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
691 + COLORREF orig_color = *ptr;
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);
699 + *ptr = RGBA(mixed_color, mixed_color, mixed_color, GetAValue(orig_color));
708 + HeapFree(GetProcessHeap(), 0, info);
710 + /* return the handle to our desaturated dc, that will substitute its original counterpart in the next calls */
713 +#endif /* __REACTOS__ */
715 /*************************************************************************
716 * ImageList_DrawIndirect [COMCTL32.@]
718 @@ -1371,6 +1444,9 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
723 + HDC hdcSaturated = NULL;
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 ) );
734 + * If the ILS_SATURATE bit is enabled we should multiply the
735 + * RGB colors of the original image by the contents of rgbFg.
737 + if (fState & ILS_SATURATE)
739 + hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
740 + pt.x, pt.y, cx, cy, pimldp->rgbFg);
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 */
750 has_alpha = (himl->has_alpha && himl->has_alpha[pimldp->i]);
751 if (!bMask && (has_alpha || (fState & ILS_ALPHA)))
753 @@ -1440,7 +1534,11 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
758 + bResult = alpha_blend_image( himl, hImageListDC, pimldp->hdcDst, pimldp->x, pimldp->y,
760 bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y,
762 pt.x, pt.y, cx, cy, func, fStyle, blend_col );
765 @@ -1450,7 +1548,11 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
767 hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
768 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
770 + alpha_blend_image( himl, hImageListDC, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
772 alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
774 DeleteObject (SelectObject (hImageDC, hOldBrush));
775 bResult = BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCCOPY );
777 @@ -1544,7 +1646,9 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
782 if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n");
784 if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n");
785 if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n");
787 @@ -1572,6 +1676,10 @@ end:
788 SetTextColor(hImageDC, oldImageFg);
789 SelectObject(hImageDC, hOldImageBmp);
793 + DeleteDC(hdcSaturated);
795 DeleteObject(hBlendMaskBmp);
796 DeleteObject(hImageBmp);
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
807 + BOOL bDefaultBkColor;
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)
819 + if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
821 + DWORD dwOldBkColor, dwOldTextColor;
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);
831 return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
832 DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
836 /* Listview invalidation functions: use _only_ these functions to invalidate */
837 @@ -2202,8 +2221,9 @@ static void LISTVIEW_ShowFocusRect(const
838 SelectObject(hdc, hOldFont);
841 - LISTVIEW_InvalidateItem(infoPtr, infoPtr->nFocusedItem);
844 + LISTVIEW_DrawFocusRect(infoPtr, hdc);
847 ReleaseDC(infoPtr->hwndSelf, hdc);
849 @@ -4707,7 +4727,12 @@ static void LISTVIEW_DrawItemPart(LISTVI
850 if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
853 - DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
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);
859 + DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
863 @@ -5251,7 +5276,11 @@ enddraw:
865 /* Draw marquee rectangle if appropriate */
866 if (infoPtr->bMarqueeSelect)
868 + SetBkColor(hdc, RGB(255, 255, 255));
869 + SetTextColor(hdc, RGB(0, 0, 0));
870 DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
873 if (cdmode & CDRF_NOTIFYPOSTPAINT)
874 notify_postpaint(infoPtr, &nmlvcd);
875 @@ -8056,6 +8085,9 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW
877 TRACE("(color=%x)\n", color);
880 + infoPtr->bDefaultBkColor = FALSE;
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
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)
894 @@ -8742,8 +8774,8 @@ static inline void set_icon_size(SIZE *s
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);
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);
910 + infoPtr->bDefaultBkColor = TRUE;
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);
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);
925 dc = GetDCEx(infoPtr->hwndSelf, region, DCX_WINDOW|DCX_INTERSECTRGN);
926 OffsetRect(&r, -r.left, -r.top);
929 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
930 DrawThemeParentBackground(infoPtr->hwndSelf, dc, &r);
931 @@ -11761,6 +11803,14 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg
933 case WM_SYSCOLORCHANGE:
934 COMCTL32_RefreshSysColors();
936 + if (infoPtr->bDefaultBkColor)
938 + LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow);
939 + infoPtr->bDefaultBkColor = TRUE;
940 + LISTVIEW_InvalidateList(infoPtr);
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
951 WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
953 +/* FIXME: Inspect */
954 +#define MCS_NOSELCHANGEONNAV 0x0100
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,
965 case WM_CTLCOLORSTATIC:
967 + SetBkMode((HDC)wParam, TRANSPARENT);
968 + return (INT_PTR)GetStockObject(HOLLOW_BRUSH);
970 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
971 return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
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);
981 + HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL);
986 TRACE("%d\n", dwFlags);
988 EnableWindow(hwndBack, dwFlags & PSWIZB_BACK);
989 EnableWindow(hwndNext, dwFlags & PSWIZB_NEXT);
990 EnableWindow(hwndFinish, enable_finish);
993 /* set the default pushbutton to an enabled button */
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);
999 SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
1002 if (!psInfo->hasFinish)
1004 @@ -2474,6 +2487,25 @@ static void PROPSHEET_SetWizButtons(HWND
1005 ShowWindow(hwndNext, SW_SHOW);
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;
1018 + iDefItem = IDCANCEL;
1019 + SendMessageW(hwndDlg, DM_SETDEFID, iDefItem, 0);
1021 + /* Set focus if no control has it */
1022 + hwndFocus = GetFocus();
1023 + if (!hwndFocus || hwndFocus == hwndCancel)
1024 + SetFocus(GetDlgItem(hwndDlg, iDefItem));
1029 /******************************************************************************
1030 @@ -3282,7 +3314,11 @@ static LRESULT PROPSHEET_Paint(HWND hwnd
1032 hOldFont = SelectObject(hdc, psInfo->hFontBold);
1035 + if (psInfo->ppshheader.u5.hbmHeader)
1037 if (psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)
1040 hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader);
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);
1047 + if (!IS_INTRESOURCE(ppshpage->pszHeaderSubTitle))
1049 if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle))
1051 DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK);
1054 @@ -3379,7 +3419,12 @@ static LRESULT PROPSHEET_Paint(HWND hwnd
1056 if ( (ppshpage && (ppshpage->dwFlags & PSP_HIDEHEADER)) &&
1057 (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
1059 + (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
1060 + (psInfo->ppshheader.u4.hbmWatermark) )
1062 (psInfo->ppshheader.dwFlags & PSH_WATERMARK) )
1065 HWND hwndLine = GetDlgItem(hwnd, IDC_SUNKEN_LINE);
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
1071 * - WM_QUERYNEWPALETTE
1074 - * - WM_SYSCOLORCHANGE
1078 @@ -1819,16 +1818,43 @@ static LRESULT REBAR_EraseBkGnd (const R
1080 COLORREF old = CLR_NONE, new;
1081 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
1086 GetClientRect (infoPtr->hwndSelf, &cr);
1092 + if (IsThemeBackgroundPartiallyTransparent(theme, RP_BACKGROUND, 0))
1094 + DrawThemeParentBackground (infoPtr->hwndSelf, hdc, &cr);
1096 + DrawThemeBackground (theme, hdc, 0, 0, &cr, NULL);
1099 + hrgn = CreateRectRgn(cr.left, cr.top, cr.right, cr.bottom);
1104 for(i=0; i<infoPtr->uNumBands; i++) {
1111 lpBand = REBAR_GetBand(infoPtr, i);
1112 if (HIDDENBAND(lpBand)) continue;
1113 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
1116 + rcBandReal = rcBand;
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
1124 TRACE ("drawing band separator bottom (%s)\n",
1125 wine_dbgstr_rect(&rcRowSep));
1127 + rcBandReal = rcRowSep;
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;
1137 + rcBandReal.top -= SEP_WIDTH_SIZE;
1140 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_BOTTOM, NULL);
1142 @@ -1871,6 +1903,9 @@ static LRESULT REBAR_EraseBkGnd (const R
1144 rcSep.right = rcSep.left;
1145 rcSep.left -= SEP_WIDTH_SIZE;
1147 + rcBandReal.left -= SEP_WIDTH_SIZE;
1150 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_RIGHT, NULL);
1152 @@ -1901,6 +1936,9 @@ static LRESULT REBAR_EraseBkGnd (const R
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);
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);
1176 + hrgnBand = CreateRectRgn(rcBandReal.left, rcBandReal.top, rcBandReal.right, rcBandReal.bottom);
1177 + CombineRgn(hrgn, hrgn, hrgnBand, RGN_DIFF);
1178 + DeleteObject(hrgnBand);
1187 + //FIXME: Apparently painting the remaining area is a v6 feature
1188 + HBRUSH hbrush = CreateSolidBrush(new);
1189 + FillRgn(hdc, hrgn, hbrush);
1190 + DeleteObject(hbrush);
1192 + DeleteObject(hrgn);
1197 @@ -2887,12 +2945,26 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT
1202 +REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM flags, RECT *lpRect)
1204 REBAR_SizeToRect (REBAR_INFO *infoPtr, const RECT *lpRect)
1207 if (!lpRect) return FALSE;
1209 TRACE("[%s]\n", wine_dbgstr_rect(lpRect));
1210 REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect));
1213 + /* Note that this undocumented flag is available on comctl32 v6 or later */
1214 + if ((flags & RBSTR_CHANGERECT) != 0)
1217 + GetClientRect(infoPtr->hwndSelf, &rcRebar);
1218 + lpRect->bottom = lpRect->top + (rcRebar.bottom - rcRebar.top);
1224 @@ -3199,7 +3271,11 @@ REBAR_NCCalcSize (const REBAR_INFO *info
1225 else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
1227 /* FIXME: should use GetThemeInt */
1229 + rect->top = (rect->top + 1 < rect->bottom) ? rect->top : rect->bottom;
1231 rect->top = min(rect->top + 1, rect->bottom);
1234 TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
1236 @@ -3300,7 +3376,11 @@ REBAR_NCHitTest (const REBAR_INFO *infoP
1237 (INT *)&nmmouse.dwItemSpec);
1238 nmmouse.dwItemData = 0;
1241 + nmmouse.dwHitInfo = scrap;
1243 nmmouse.dwHitInfo = 0;
1245 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
1246 TRACE("notify changed return value from %ld to %d\n",
1248 @@ -3372,6 +3452,9 @@ REBAR_Paint (const REBAR_INFO *infoPtr,
1251 TRACE("painting\n");
1253 + REBAR_EraseBkGnd (infoPtr, hdc);
1255 REBAR_Refresh (infoPtr, hdc);
1258 @@ -3650,7 +3733,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
1259 return REBAR_ShowBand (infoPtr, wParam, lParam);
1263 + return REBAR_SizeToRect (infoPtr, wParam, (LPRECT)lParam);
1265 return REBAR_SizeToRect (infoPtr, (LPCRECT)lParam);
1269 /* Messages passed to parent */
1270 @@ -3733,6 +3820,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
1272 case WM_SYSCOLORCHANGE:
1273 COMCTL32_RefreshSysColors();
1275 + /* r51522 - Properly support WM_SYSCOLORCHANGE */
1276 + infoPtr->clrBtnText = comctl32_color.clrBtnText;
1277 + infoPtr->clrBtnFace = comctl32_color.clrBtnFace;
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
1287 #include "comctl32.h"
1289 -#include <wine/list.h>
1291 WINE_DEFAULT_DEBUG_CHANNEL(syslink);
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
1301 +#ifdef __REACTOS__ /* r73885 */
1302 +typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag);
1304 typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused);
1307 +#ifdef __REACTOS__ /* r73885 & r73907 */
1308 +static inline LONG get_button_state( HWND hwnd )
1310 + return _GetButtonData(hwnd)->state;
1313 +static inline HFONT get_button_font( HWND hwnd )
1315 + return (HFONT)_GetButtonData(hwnd)->font;
1318 +static inline LONG_PTR get_button_image(HWND hwnd)
1320 + return _GetButtonData(hwnd)->image;
1323 +BOOL BUTTON_DrawIml(HDC hdc, BUTTON_IMAGELIST *pimlData, RECT *prc, BOOL bOnlyCalc);
1326 static UINT get_drawtext_flags(DWORD style, DWORD ex_style)
1328 @@ -87,22 +110,56 @@ static inline WCHAR *get_button_text(HWN
1332 +#ifdef __REACTOS__ /* r73885 */
1333 +static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag)
1335 static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
1338 static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
1340 RECT bgRect, textRect;
1341 +#ifdef __REACTOS__ /* r73885 */
1342 + HFONT font = get_button_font(hwnd);
1344 HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
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);
1355 GetClientRect(hwnd, &bgRect);
1356 GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
1358 +#ifdef __REACTOS__ /* r73885 & r74149 */
1361 + if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
1362 + DrawThemeParentBackground(hwnd, hDC, NULL);
1365 if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state))
1366 DrawThemeParentBackground(hwnd, hDC, NULL);
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 );
1376 DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1378 +#ifdef __REACTOS__ /* r74012 */
1379 + BUTTON_DrawIml(hDC, &pdata->imlData, &textRect, FALSE);
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);
1389 +#ifdef __REACTOS__ /* r73885 */
1390 +static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag)
1392 static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
1395 static const int cb_states[3][5] =
1397 @@ -145,7 +206,11 @@ static void CB_draw(HTHEME theme, HWND h
1399 RECT bgRect, textRect;
1400 HFONT font, hPrevFont = NULL;
1401 +#ifdef __REACTOS__ /* r73885 */
1402 + LRESULT checkState = get_button_state(hwnd) & 3;
1404 LRESULT checkState = SendMessageW(hwnd, BM_GETCHECK, 0, 0);
1406 DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
1407 int part = ((dwStyle & BUTTON_TYPE) == BS_RADIOBUTTON) || ((dwStyle & BUTTON_TYPE) == BS_AUTORADIOBUTTON)
1409 @@ -156,6 +221,10 @@ static void CB_draw(HTHEME theme, HWND h
1410 WCHAR *text = get_button_text(hwnd);
1412 BOOL created_font = FALSE;
1413 +#ifdef __REACTOS__ /* r74406 */
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;
1424 +#ifdef __REACTOS__ /* r73885 */
1425 + font = get_button_font(hwnd);
1427 font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
1429 hPrevFont = SelectObject(hDC, font);
1432 @@ -176,6 +249,23 @@ static void CB_draw(HTHEME theme, HWND h
1435 GetClientRect(hwnd, &bgRect);
1437 +#ifdef __REACTOS__ /* r73885, r74149 and r74406 */
1440 + DrawThemeParentBackground(hwnd, hDC, NULL);
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 );
1453 GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
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;
1460 +#ifndef __REACTOS__ /* r74406 */
1461 DrawThemeParentBackground(hwnd, hDC, NULL);
1464 DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
1466 @@ -214,7 +306,11 @@ static void CB_draw(HTHEME theme, HWND h
1467 if (hPrevFont) SelectObject(hDC, hPrevFont);
1470 +#ifdef __REACTOS__ /* r73885 */
1471 +static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag)
1473 static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
1476 static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
1478 @@ -224,6 +320,11 @@ static void GB_draw(HTHEME theme, HWND h
1480 HFONT font, hPrevFont = NULL;
1481 BOOL created_font = FALSE;
1482 +#ifdef __REACTOS__ /* r74406 */
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;
1494 +#ifdef __REACTOS__ /* r73885 */
1495 + font = get_button_font(hwnd);
1497 font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
1499 hPrevFont = SelectObject(hDC, font);
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);
1506 +#ifdef __REACTOS__ /* r73885 & r74149 */
1509 + if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
1510 + DrawThemeParentBackground(hwnd, hDC, NULL);
1513 if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
1514 DrawThemeParentBackground(hwnd, hDC, NULL);
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 );
1529 DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
1531 SelectClipRgn(hDC, NULL);
1532 @@ -294,32 +420,84 @@ static const pfThemedPaint btnThemedPain
1533 NULL, /* Not defined */
1536 +#ifdef __REACTOS__ /* r73873 */
1537 +BOOL BUTTON_PaintWithTheme(HTHEME theme, HWND hwnd, HDC hParamDC, LPARAM prfFlag)
1539 static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
1542 +#ifdef __REACTOS__ /* r73873, r73897 and r74120 */
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);
1556 ButtonState drawState;
1557 +#ifdef __REACTOS__ /* r73873, r73897, r73907 and r74120 */
1558 + pfThemedPaint paint;
1560 + dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
1561 + type = dwStyle & BUTTON_TYPE;
1563 + if (type != BS_PUSHBUTTON && type != BS_DEFPUSHBUTTON && (dwStyle & BS_PUSHLIKE))
1564 + type = BS_PUSHBUTTON;
1566 + paint = btnThemedPaintFunc[type];
1570 + if (get_button_image(hwnd) != 0)
1573 + dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE);
1574 + dtFlags = get_drawtext_flags(dwStyle, dwStyleEx);
1575 + state = get_button_state(hwnd);
1577 pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
1580 if(IsWindowEnabled(hwnd))
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;
1595 + drawState = STATE_NORMAL;
1597 - else drawState = STATE_DISABLED;
1599 + drawState = STATE_DISABLED;
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);
1607 +#ifdef __REACTOS__ /* r74074 & r74120 */
1608 + if (drawState == STATE_NORMAL && type == BS_DEFPUSHBUTTON)
1610 + drawState = STATE_DEFAULTED;
1614 + paint(theme, hwnd, hParamDC, drawState, dtFlags, state & BST_FOCUS, prfFlag);
1618 +#ifndef __REACTOS__ /* r73873 */
1619 /**********************************************************************
1620 * The button control subclass window proc.
1622 @@ -416,3 +594,4 @@ LRESULT CALLBACK THEMING_ButtonSubclassP
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);
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);
1640 dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
1641 OffsetRect(&r, -r.left, -r.top);
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);
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);
1659 dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
1660 OffsetRect(&r, -r.left, -r.top);
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,
1672 +#ifndef __REACTOS__ /* r73871 */
1673 extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
1674 ULONG_PTR) DECLSPEC_HIDDEN;
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;
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;
1688 /* Note: list must be sorted by class name */
1689 +#ifndef __REACTOS__ /* r73803 & r73871 */
1690 {dialogClass, THEMING_DialogSubclassProc},
1691 {WC_BUTTONW, THEMING_ButtonSubclassProc},
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)
1705 static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
1710 +#ifdef __REACTOS__ /* r73871 */
1719 /***********************************************************************
1720 @@ -108,15 +120,23 @@ static const WNDPROC subclassProcs[NUM_S
1721 * Register classes for standard controls that will shadow the system
1724 +#ifdef __REACTOS__ /* r73803 */
1725 +void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6)
1727 void THEMING_Initialize (void)
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 };
1736 +#ifdef __REACTOS__ /* r73803 */
1737 + ULONG_PTR ulCookie;
1738 + BOOL ret, bActivated;
1740 if (!IsThemeActive()) return;
1743 atSubclassProp = GlobalAddAtomW (subclassPropName);
1744 atRefDataProp = GlobalAddAtomW (refDataPropName);
1745 @@ -126,7 +146,17 @@ void THEMING_Initialize (void)
1748 class.cbSize = sizeof(class);
1750 +#ifdef __REACTOS__ /* r73803 */
1751 + bActivated = ActivateActCtx(hActCtx5, &ulCookie);
1752 + ret = GetClassInfoExW (NULL, subclasses[i].className, &class);
1754 + DeactivateActCtx(0, ulCookie);
1758 if (!GetClassInfoExW (NULL, subclasses[i].className, &class))
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)
1765 originalProcs[i] = class.lpfnWndProc;
1766 class.lpfnWndProc = subclassProcs[i];
1767 +#ifdef __REACTOS__ /* r73803 */
1768 + class.style |= CS_GLOBALCLASS;
1769 + class.hInstance = COMCTL32_hModule;
1772 if (!class.lpfnWndProc)
1774 @@ -142,9 +176,16 @@ void THEMING_Initialize (void)
1778 +#ifdef __REACTOS__ /* r73803 */
1779 + bActivated = ActivateActCtx(hActCtx6, &ulCookie);
1781 if (!RegisterClassExW (&class))
1783 +#ifdef __REACTOS__ /* r73803 */
1784 + WARN("Could not re-register class %s: %x\n",
1786 ERR("Could not re-register class %s: %x\n",
1788 debugstr_w (subclasses[i].className), GetLastError ());
1791 @@ -152,6 +193,11 @@ void THEMING_Initialize (void)
1792 TRACE("Re-registered class %s\n",
1793 debugstr_w (subclasses[i].className));
1796 +#ifdef __REACTOS__ /* r73803 */
1798 + DeactivateActCtx(0, ulCookie);
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
1807 * - TBSTYLE_REGISTERDROP
1808 * - TBSTYLE_EX_DOUBLEBUFFER
1812 * - TB_INSERTMARKHITTEST
1818 @@ -125,6 +123,11 @@ typedef struct
1820 INT nHotItem; /* index of the "hot" item */
1821 SIZE szPadding; /* padding values around button */
1823 + SIZE szBarPadding; /* padding values around the toolbar (NOT USED BUT STORED) */
1824 + SIZE szSpacing; /* spacing values between buttons */
1825 + MARGINS themeMargins;
1827 INT iTopMargin; /* the top margin */
1828 INT iListGap; /* default gap between text and image for toolbar with list style */
1830 @@ -190,12 +193,24 @@ typedef enum
1831 #define ARROW_HEIGHT 3
1832 #define INSERTMARK_WIDTH 2
1834 +/* default padding inside a button */
1839 +/* default space between buttons and between rows */
1840 +#define DEFSPACE_CX 7
1841 +#define DEFSPACE_CY 6
1844 #define DEFLISTGAP 4
1846 /* vertical padding used in list mode when image is present */
1848 +#define LISTPAD_CY 2
1850 #define LISTPAD_CY 9
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
1857 static inline int default_top_margin(const TOOLBAR_INFO *infoPtr)
1860 + if (infoPtr->iVersion == 6)
1863 return (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
1866 @@ -598,6 +617,9 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *
1867 COLORREF clrOldBk = 0;
1869 UINT state = tbcd->nmcd.uItemState;
1871 + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
1875 if (lpText && infoPtr->nMaxTextRows > 0) {
1876 @@ -627,6 +649,25 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *
1877 clrOld = SetTextColor (hdc, tbcd->clrText);
1883 + int partId = TP_BUTTON;
1884 + int stateId = TS_NORMAL;
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)
1895 + DrawThemeText(theme, hdc, partId, stateId, lpText, -1, infoPtr->dwDTFlags, 0, rcText);
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)
1905 HIMAGELIST himl = NULL;
1906 - BOOL draw_masked = FALSE;
1907 + BOOL draw_masked = FALSE, draw_desaturated = FALSE;
1910 UINT draw_flags = ILD_TRANSPARENT;
1912 + IMAGEINFO info = {0};
1916 if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
1918 @@ -734,7 +779,22 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
1921 himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
1924 + ImageList_GetImageInfo(himl, index, &info);
1925 + GetObjectW(info.hbmImage, sizeof(bm), &bm);
1927 + if (bm.bmBitsPixel == 32)
1929 + draw_desaturated = TRUE;
1933 + draw_masked = TRUE;
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);
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);
1949 + else if (draw_desaturated)
1951 + /* code path for drawing disabled, alpha-blended (32bpp) icons */
1952 + IMAGELISTDRAWPARAMS imldp = {0};
1954 + imldp.cbSize = sizeof(imldp);
1955 + imldp.himl = himl;
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;
1966 + ImageList_DrawIndirect (&imldp);
1970 + /* code path for drawing standard icons as-is */
1971 ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
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);
1981 - TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1983 - else if (btnPtr->fsStyle != BTNS_SEP) {
1984 - FIXME("Draw some kind of separator: fsStyle=%x\n",
1989 + TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1993 + else if (btnPtr->fsStyle != BTNS_SEP) {
1994 + FIXME("Draw some kind of separator: fsStyle=%x\n",
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;
2004 rcBitmap.top += infoPtr->szPadding.cy / 2;
2006 + rcBitmap.top += infoPtr->themeMargins.cyTopHeight;
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 *
2016 + if (theme && !(dwItemCDFlag & TBCDRF_NOBACKGROUND))
2021 int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
2022 int stateId = TS_NORMAL;
2023 @@ -1044,7 +1137,12 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
2025 DrawThemeBackground (theme, hdc, partId, stateId, &rc, NULL);
2033 TOOLBAR_DrawFrame(infoPtr, &tbcd, &rc, dwItemCDFlag);
2035 if (drawSepDropDownArrow)
2036 @@ -1570,9 +1668,14 @@ static inline SIZE TOOLBAR_MeasureButton
2037 /* ... add on the necessary padding */
2038 if (bValidImageList)
2041 + sizeButton.cy += infoPtr->szPadding.cy;
2045 sizeButton.cy += DEFPAD_CY;
2048 sizeButton.cy += LISTPAD_CY;
2051 @@ -1589,7 +1692,11 @@ static inline SIZE TOOLBAR_MeasureButton
2056 + sizeButton.cy = infoPtr->nBitmapHeight + infoPtr->szPadding.cy;
2058 sizeButton.cy = infoPtr->nBitmapHeight + DEFPAD_CY;
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);
2069 + sizeButton.cx += infoPtr->themeMargins.cxLeftWidth + infoPtr->themeMargins.cxRightWidth;
2070 + sizeButton.cy += infoPtr->themeMargins.cyTopHeight + infoPtr->themeMargins.cyBottomHeight;
2076 @@ -1695,7 +1808,14 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
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))
2086 else if (btnPtr->fsStyle & BTNS_AUTOSIZE)
2091 @@ -1747,14 +1867,14 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
2094 if ( !(btnPtr->fsStyle & BTNS_SEP) )
2096 + y += cy + infoPtr->szSpacing.cy;
2099 if ( !(infoPtr->dwStyle & CCS_VERT))
2100 y += cy + ( (btnPtr->cx > 0 ) ?
2101 btnPtr->cx : SEPARATOR_WIDTH) * 2 /3;
2104 + y += cy + infoPtr->szSpacing.cy;
2106 /* nSepRows is used to calculate the extra height following */
2108 @@ -1768,7 +1888,7 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
2113 + x += cx + infoPtr->szSpacing.cx;
2116 /* infoPtr->nRows is the number of rows on the toolbar */
2117 @@ -3540,6 +3660,34 @@ TOOLBAR_GetMaxSize (const TOOLBAR_INFO *
2123 +TOOLBAR_GetMetrics(const TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics)
2125 + if (pMetrics == NULL || pMetrics->cbSize != sizeof(TBMETRICS))
2128 + if (pMetrics->dwMask & TBMF_PAD)
2130 + pMetrics->cxPad = infoPtr->szPadding.cx;
2131 + pMetrics->cyPad = infoPtr->szPadding.cy;
2134 + if (pMetrics->dwMask & TBMF_BARPAD)
2136 + pMetrics->cxBarPad = infoPtr->szBarPadding.cx;
2137 + pMetrics->cyBarPad = infoPtr->szBarPadding.cy;
2140 + if (pMetrics->dwMask & TBMF_BUTTONSPACING)
2142 + pMetrics->cxButtonSpacing = infoPtr->szSpacing.cx;
2143 + pMetrics->cyButtonSpacing = infoPtr->szSpacing.cy;
2150 /* << TOOLBAR_GetObject >> */
2152 @@ -4337,7 +4485,7 @@ TOOLBAR_SetBitmapSize (TOOLBAR_INFO *inf
2153 short width = (short)LOWORD(lParam);
2154 short height = (short)HIWORD(lParam);
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);
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;
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);
2169 cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth);
2170 cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight);
2173 if (cx != infoPtr->nButtonWidth || cy != infoPtr->nButtonHeight ||
2174 top != infoPtr->iTopMargin)
2175 @@ -4794,6 +4947,44 @@ TOOLBAR_SetMaxTextRows (TOOLBAR_INFO *in
2181 +TOOLBAR_SetMetrics(TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics)
2184 + BOOL changed = FALSE;
2189 + /* TODO: check if cbSize is a valid value */
2191 + if (pMetrics->dwMask & TBMF_PAD)
2193 + infoPtr->szPadding.cx = pMetrics->cxPad;
2194 + infoPtr->szPadding.cy = pMetrics->cyPad;
2198 + if (pMetrics->dwMask & TBMF_PAD)
2200 + infoPtr->szBarPadding.cx = pMetrics->cxBarPad;
2201 + infoPtr->szBarPadding.cy = pMetrics->cyBarPad;
2205 + if (pMetrics->dwMask & TBMF_BUTTONSPACING)
2207 + infoPtr->szSpacing.cx = pMetrics->cxButtonSpacing;
2208 + infoPtr->szSpacing.cy = pMetrics->cyButtonSpacing;
2213 + TOOLBAR_CalcToolbar(infoPtr);
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
2223 INT iOldVersion = infoPtr->iVersion;
2226 + /* The v6 control doesn't support changing its version */
2227 + if (iOldVersion == 6)
2228 + return iOldVersion;
2230 + /* And a control that is not v6 can't be set to be a v6 one */
2231 + if (iVersion >= 6)
2235 infoPtr->iVersion = iVersion;
2237 if (infoPtr->iVersion >= 5)
2238 @@ -5269,8 +5470,16 @@ TOOLBAR_Create (HWND hwnd, const CREATES
2240 SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
2241 infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
2246 + HTHEME theme = OpenThemeData (hwnd, themeClass);
2248 + GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
2251 OpenThemeData (hwnd, themeClass);
2254 TOOLBAR_CheckStyle (infoPtr);
2256 @@ -5993,7 +6202,11 @@ TOOLBAR_NCCalcSize (HWND hwnd, WPARAM wP
2261 +TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs, int iVersion)
2263 TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
2266 TOOLBAR_INFO *infoPtr;
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;
2273 + infoPtr->iVersion = iVersion;
2275 infoPtr->iVersion = 0;
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;
2284 + infoPtr->szSpacing.cx = 0;
2285 + infoPtr->szSpacing.cy = 0;
2286 + memset(&infoPtr->themeMargins, 0 , sizeof(infoPtr->themeMargins));
2288 infoPtr->iListGap = DEFLISTGAP;
2289 infoPtr->iTopMargin = default_top_margin(infoPtr);
2290 infoPtr->dwStyle = lpcs->style;
2291 @@ -6443,8 +6665,22 @@ TOOLBAR_SysColorChange (void)
2297 /* update theme after a WM_THEMECHANGED message */
2298 +static LRESULT theme_changed (TOOLBAR_INFO *infoPtr)
2300 + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
2301 + CloseThemeData (theme);
2302 + OpenThemeData (infoPtr->hwndSelf, themeClass);
2303 + theme = GetWindowTheme (infoPtr->hwndSelf);
2305 + GetThemeMargins(theme, NULL, TP_BUTTON, TS_NORMAL, TMT_CONTENTMARGINS, NULL, &infoPtr->themeMargins);
2307 + memset(&infoPtr->themeMargins, 0 ,sizeof(infoPtr->themeMargins));
2312 static LRESULT theme_changed (HWND hwnd)
2314 HTHEME theme = GetWindowTheme (hwnd);
2315 @@ -6452,7 +6688,7 @@ static LRESULT theme_changed (HWND hwnd)
2316 OpenThemeData (hwnd, themeClass);
2322 static LRESULT WINAPI
2323 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2324 @@ -6557,6 +6793,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2327 return TOOLBAR_GetMaxSize (infoPtr, (LPSIZE)lParam);
2329 + case TB_GETMETRICS:
2330 + return TOOLBAR_GetMetrics (infoPtr, (TBMETRICS*)lParam);
2333 /* case TB_GETOBJECT: */ /* 4.71 */
2335 @@ -6698,6 +6938,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2336 case TB_SETMAXTEXTROWS:
2337 return TOOLBAR_SetMaxTextRows (infoPtr, wParam);
2340 + case TB_SETMETRICS:
2341 + return TOOLBAR_SetMetrics (infoPtr, (TBMETRICS*)lParam);
2345 return TOOLBAR_SetPadding (infoPtr, lParam);
2347 @@ -6805,7 +7050,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2348 return TOOLBAR_NCCalcSize (hwnd, wParam, lParam);
2352 + return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam, 0);
2354 return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam);
2358 return TOOLBAR_NCPaint (hwnd, wParam, lParam);
2359 @@ -6837,9 +7086,12 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
2361 case WM_SYSCOLORCHANGE:
2362 return TOOLBAR_SysColorChange ();
2364 - case WM_THEMECHANGED:
2365 + case WM_THEMECHANGED:
2367 + return theme_changed (infoPtr);
2369 return theme_changed (hwnd);
2372 /* case WM_WININICHANGE: */
2374 @@ -6887,6 +7139,40 @@ TOOLBAR_Unregister (void)
2375 UnregisterClassW (TOOLBARCLASSNAMEW, NULL);
2379 +static LRESULT WINAPI
2380 +ToolbarV6WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2382 + if (uMsg == WM_NCCREATE)
2383 + return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam, 6);
2385 + return ToolbarWindowProc(hwnd, uMsg, wParam, lParam);
2389 +TOOLBARv6_Register (void)
2391 + WNDCLASSW wndClass;
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;
2402 + RegisterClassW (&wndClass);
2406 +TOOLBARv6_Unregister (void)
2408 + UnregisterClassW (TOOLBARCLASSNAMEW, NULL);
2412 static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
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
2420 TOOLTIPS_NotifyFormat (TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
2423 + TTTOOL_INFO *toolPtr = infoPtr->tools;
2426 + TRACE("infoPtr=%p wParam=%lx lParam=%p\n", infoPtr, wParam, (PVOID)lParam);
2428 + if (lParam == NF_QUERY) {
2429 + if (toolPtr->bNotifyUnicode) {
2430 + return NFR_UNICODE;
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");
2445 + TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
2450 FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", infoPtr->hwndSelf, wParam, lParam);
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);
2462 +#ifndef __REACTOS__
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,
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
2482 +#ifndef __REACTOS__
2483 TREEVIEW_UpdateScrollBars(infoPtr);
2486 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
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);
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);
2498 dc = GetDCEx(infoPtr->hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
2499 OffsetRect(&r, -r.left, -r.top);
2502 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
2503 DrawThemeParentBackground(infoPtr->hwnd, dc, &r);