From: Giannis Adamopoulos Date: Mon, 28 Aug 2017 13:41:16 +0000 (+0000) Subject: [UXTHEME] -When calculating the size of caption buttons assume that they have the... X-Git-Tag: backups/GSoC_2017/rapps@75905~4^2~68 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=f6de9ccb3d03b451f0d79c32e647ce368f9069d1 [UXTHEME] -When calculating the size of caption buttons assume that they have the same size. Hacks in the theme files that change the way the buttons are drawn actually make them appear to have a different size. CORE-13512 svn path=/trunk/; revision=75696 --- diff --git a/reactos/dll/win32/uxtheme/nonclient.c b/reactos/dll/win32/uxtheme/nonclient.c index 14289d9b17a..fb40624fcbb 100644 --- a/reactos/dll/win32/uxtheme/nonclient.c +++ b/reactos/dll/win32/uxtheme/nonclient.c @@ -217,6 +217,7 @@ void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme) INT ButtonWidth, ButtonHeight, iPartId, i; WINDOWINFO wi = {sizeof(wi)}; RECT rcCurrent; + SIZE ButtonSize; /* First of all check if we have something to do here */ style = GetWindowLongW(hWnd, GWL_STYLE); @@ -243,36 +244,18 @@ void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme) InflateRect(&rcCurrent, -(int)wi.cyWindowBorders-BUTTON_GAP_SIZE, -(int)wi.cyWindowBorders-BUTTON_GAP_SIZE); - for (i = CLOSEBUTTON; i <= HELPBUTTON; i++) - { - SIZE ButtonSize; - - switch(i) - { - case CLOSEBUTTON: - iPartId = wi.dwExStyle & WS_EX_TOOLWINDOW ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON; - break; + iPartId = wi.dwExStyle & WS_EX_TOOLWINDOW ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON; - case MAXBUTTON: - iPartId = wi.dwStyle & WS_MAXIMIZE ? WP_RESTOREBUTTON : WP_MAXBUTTON; - break; + GetThemePartSize(htheme, NULL, iPartId, 0, NULL, TS_MIN, &ButtonSize); - case MINBUTTON: - iPartId = wi.dwStyle & WS_MINIMIZE ? WP_RESTOREBUTTON : WP_MINBUTTON; - break; + ButtonHeight = GetSystemMetrics( wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMSIZE : SM_CYSIZE); + ButtonWidth = MulDiv(ButtonSize.cx, ButtonHeight, ButtonSize.cy); - default: - iPartId = WP_HELPBUTTON ; - } - - GetThemePartSize(htheme, NULL, iPartId, 0, NULL, TS_MIN, &ButtonSize); - - ButtonHeight = GetSystemMetrics( wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMSIZE : SM_CYSIZE); - ButtonWidth = MulDiv(ButtonSize.cx, ButtonHeight, ButtonSize.cy); - - ButtonHeight -= 4; - ButtonWidth -= 4; + ButtonHeight -= 4; + ButtonWidth -= 4; + for (i = CLOSEBUTTON; i <= HELPBUTTON; i++) + { SetRect(&pwndData->rcCaptionButtons[i], rcCurrent.right - ButtonWidth, rcCurrent.top,