From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 519aa9dde2a..f6d8af245ca 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -65,7 +65,6 @@ typedef struct #define DEFAULT_ADDBOT 0 /* amount to extend below the buddy window */ #define DEFAULT_BUDDYBORDER 2 /* Width/height of the buddy border */ #define DEFAULT_BUDDYSPACER 2 /* Spacer between the buddy and the ctrl */ -#define DEFAULT_BUDDYBORDER_THEMED 1 /* buddy border when theming is enabled */ #define DEFAULT_BUDDYSPACER_THEMED 0 /* buddy spacer when theming is enabled */
/* Work constants */ @@ -161,6 +160,13 @@ static BOOL UPDOWN_HasBuddyBorder(const UPDOWN_INFO *infoPtr) UPDOWN_IsBuddyEdit(infoPtr) ); }
+static int UPDOWN_GetBuddyBorderSize(HWND hwnd) +{ + if (GetWindowTheme(hwnd)) return 1; + + return DEFAULT_BUDDYBORDER; +} + /*********************************************************************** * UPDOWN_GetArrowRect * wndPtr - pointer to the up-down wnd @@ -171,7 +177,7 @@ static BOOL UPDOWN_HasBuddyBorder(const UPDOWN_INFO *infoPtr) static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, unsigned int arrow) { HTHEME theme = GetWindowTheme (infoPtr->Self); - const int border = theme ? DEFAULT_BUDDYBORDER_THEMED : DEFAULT_BUDDYBORDER; + const int border = UPDOWN_GetBuddyBorderSize(infoPtr->Self); const int spacer = theme ? DEFAULT_BUDDYSPACER_THEMED : DEFAULT_BUDDYSPACER; int size;
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index f6d8af245ca..7c67f2d3567 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -65,7 +65,6 @@ typedef struct #define DEFAULT_ADDBOT 0 /* amount to extend below the buddy window */ #define DEFAULT_BUDDYBORDER 2 /* Width/height of the buddy border */ #define DEFAULT_BUDDYSPACER 2 /* Spacer between the buddy and the ctrl */ -#define DEFAULT_BUDDYSPACER_THEMED 0 /* buddy spacer when theming is enabled */
/* Work constants */
@@ -167,6 +166,13 @@ static int UPDOWN_GetBuddyBorderSize(HWND hwnd) return DEFAULT_BUDDYBORDER; }
+static int UPDOWN_GetBuddySpacerSize(HWND hwnd) +{ + if (GetWindowTheme(hwnd)) return 0; + + return DEFAULT_BUDDYSPACER; +} + /*********************************************************************** * UPDOWN_GetArrowRect * wndPtr - pointer to the up-down wnd @@ -176,9 +182,8 @@ static int UPDOWN_GetBuddyBorderSize(HWND hwnd) */ static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, unsigned int arrow) { - HTHEME theme = GetWindowTheme (infoPtr->Self); const int border = UPDOWN_GetBuddyBorderSize(infoPtr->Self); - const int spacer = theme ? DEFAULT_BUDDYSPACER_THEMED : DEFAULT_BUDDYSPACER; + const int spacer = UPDOWN_GetBuddySpacerSize(infoPtr->Self); int size;
assert(arrow && (arrow & (FLAG_INCR | FLAG_DECR)) != (FLAG_INCR | FLAG_DECR));
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 7c67f2d3567..b90e0f965d8 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -381,6 +381,26 @@ static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) return TRUE; }
+static BOOL UPDOWN_IsUpArrowPressed(const UPDOWN_INFO *infoPtr) +{ + return infoPtr->Flags & FLAG_PRESSED && infoPtr->Flags & FLAG_INCR; +} + +static BOOL UPDOWN_IsUpArrowHot(const UPDOWN_INFO *infoPtr) +{ + return infoPtr->Flags & FLAG_INCR && infoPtr->Flags & FLAG_MOUSEIN; +} + +static BOOL UPDOWN_IsDownArrowPressed(const UPDOWN_INFO *infoPtr) +{ + return infoPtr->Flags & FLAG_PRESSED && infoPtr->Flags & FLAG_DECR; +} + +static BOOL UPDOWN_IsDownArrowHot(const UPDOWN_INFO *infoPtr) +{ + return infoPtr->Flags & FLAG_DECR && infoPtr->Flags & FLAG_MOUSEIN; +} + /*********************************************************************** * UPDOWN_Draw * @@ -394,10 +414,10 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) int uPart = 0, uState = 0, dPart = 0, dState = 0; BOOL needBuddyBg = FALSE;
- uPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR); - uHot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN); - dPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR); - dHot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN); + uPressed = UPDOWN_IsUpArrowPressed(infoPtr); + uHot = UPDOWN_IsUpArrowHot(infoPtr); + dPressed = UPDOWN_IsDownArrowPressed(infoPtr); + dHot = UPDOWN_IsDownArrowHot(infoPtr); if (theme) { uPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_UPHORZ : SPNP_UP; uState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index b90e0f965d8..154ee76b10f 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -401,6 +401,26 @@ static BOOL UPDOWN_IsDownArrowHot(const UPDOWN_INFO *infoPtr) return infoPtr->Flags & FLAG_DECR && infoPtr->Flags & FLAG_MOUSEIN; }
+static void UPDOWN_GetUpArrowThemePartAndState(const UPDOWN_INFO *infoPtr, int *part, int *state) +{ + BOOL pressed, hot; + + pressed = UPDOWN_IsUpArrowPressed(infoPtr); + hot = UPDOWN_IsUpArrowHot(infoPtr); + *part = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_UPHORZ : SPNP_UP; + *state = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED : (pressed ? DNS_PRESSED : (hot ? DNS_HOT : DNS_NORMAL)); +} + +static void UPDOWN_GetDownArrowThemePartAndState(const UPDOWN_INFO *infoPtr, int *part, int *state) +{ + BOOL pressed, hot; + + pressed = UPDOWN_IsDownArrowPressed(infoPtr); + hot = UPDOWN_IsDownArrowHot(infoPtr); + *part = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_DOWNHORZ : SPNP_DOWN; + *state = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED : (pressed ? DNS_PRESSED : (hot ? DNS_HOT : DNS_NORMAL)); +} + /*********************************************************************** * UPDOWN_Draw * @@ -419,12 +439,8 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) dPressed = UPDOWN_IsDownArrowPressed(infoPtr); dHot = UPDOWN_IsDownArrowHot(infoPtr); if (theme) { - uPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_UPHORZ : SPNP_UP; - uState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED - : (uPressed ? DNS_PRESSED : (uHot ? DNS_HOT : DNS_NORMAL)); - dPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_DOWNHORZ : SPNP_DOWN; - dState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED - : (dPressed ? DNS_PRESSED : (dHot ? DNS_HOT : DNS_NORMAL)); + UPDOWN_GetUpArrowThemePartAndState(infoPtr, &uPart, &uState); + UPDOWN_GetDownArrowThemePartAndState(infoPtr, &dPart, &dState); needBuddyBg = IsWindow (infoPtr->Buddy) && (IsThemeBackgroundPartiallyTransparent (theme, uPart, uState) || IsThemeBackgroundPartiallyTransparent (theme, dPart, dState));
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 154ee76b10f..6e08975d567 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -421,6 +421,26 @@ static void UPDOWN_GetDownArrowThemePartAndState(const UPDOWN_INFO *infoPtr, int *state = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED : (pressed ? DNS_PRESSED : (hot ? DNS_HOT : DNS_NORMAL)); }
+static BOOL UPDOWN_NeedBuddyBackground(const UPDOWN_INFO *infoPtr) +{ + HTHEME theme = GetWindowTheme(infoPtr->Self); + + if (theme) + { + int up_part = 0, up_state = 0, down_part = 0, down_state = 0; + BOOL up_transparent, down_transparent, need_buddy_bg; + + UPDOWN_GetUpArrowThemePartAndState(infoPtr, &up_part, &up_state); + UPDOWN_GetDownArrowThemePartAndState(infoPtr, &down_part, &down_state); + up_transparent = IsThemeBackgroundPartiallyTransparent(theme, up_part, up_state); + down_transparent = IsThemeBackgroundPartiallyTransparent(theme, down_part, down_state); + need_buddy_bg = IsWindow(infoPtr->Buddy) && (up_transparent || down_transparent); + return UPDOWN_HasBuddyBorder(infoPtr) || need_buddy_bg; + } + + return UPDOWN_HasBuddyBorder(infoPtr); +} + /*********************************************************************** * UPDOWN_Draw * @@ -432,7 +452,6 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) RECT rect; HTHEME theme = GetWindowTheme (infoPtr->Self); int uPart = 0, uState = 0, dPart = 0, dState = 0; - BOOL needBuddyBg = FALSE;
uPressed = UPDOWN_IsUpArrowPressed(infoPtr); uHot = UPDOWN_IsUpArrowHot(infoPtr); @@ -441,13 +460,10 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) if (theme) { UPDOWN_GetUpArrowThemePartAndState(infoPtr, &uPart, &uState); UPDOWN_GetDownArrowThemePartAndState(infoPtr, &dPart, &dState); - needBuddyBg = IsWindow (infoPtr->Buddy) - && (IsThemeBackgroundPartiallyTransparent (theme, uPart, uState) - || IsThemeBackgroundPartiallyTransparent (theme, dPart, dState)); }
/* Draw the common border between ourselves and our buddy */ - if (UPDOWN_HasBuddyBorder(infoPtr) || needBuddyBg) { + if (UPDOWN_NeedBuddyBackground(infoPtr)) { if (!theme || !UPDOWN_DrawBuddyBackground (infoPtr, hdc)) { GetClientRect(infoPtr->Self, &rect); DrawEdge(hdc, &rect, EDGE_SUNKEN,
Tobias Markus (@tobbi) commented about dlls/comctl32/updown.c:
UPDOWN_IsBuddyEdit(infoPtr) );}
+static int UPDOWN_GetBuddyBorderSize(HWND hwnd) +{
- if (GetWindowTheme(hwnd)) return 1;
Shouldn't you return `DEFAULT_BUDDYBORDER_THEMED` like in the original implementation?
tobbi (@tobbi) commented about dlls/comctl32/updown.c:
UPDOWN_IsBuddyEdit(infoPtr) );}
+static int UPDOWN_GetBuddyBorderSize(HWND hwnd) +{
- if (GetWindowTheme(hwnd)) return 1;
- return DEFAULT_BUDDYBORDER;
+}
+static int UPDOWN_GetBuddySpacerSize(HWND hwnd) +{
- if (GetWindowTheme(hwnd)) return 0;
Same here, re. returning `DEFAULT_BUDDYSPACER_THEMED`.
On Tue Nov 18 02:33:44 2025 +0000, tobbi wrote:
Shouldn't you return `DEFAULT_BUDDYBORDER_THEMED` like in the original implementation?
DEFAULT_BUDDYSPACER_THEMED is not used in other places. I think the logic is obvious enough that DEFAULT_BUDDYSPACER_THEMED can be removed. Same for DEFAULT_BUDDYSPACER_THEMED.
On Tue Nov 18 02:40:48 2025 +0000, Zhiyi Zhang wrote:
DEFAULT_BUDDYSPACER_THEMED is not used in other places. I think the logic is obvious enough that DEFAULT_BUDDYSPACER_THEMED can be removed. Same for DEFAULT_BUDDYSPACER_THEMED.
Also, when the "__WINE_COMCTL32_VERSION == 6" macro check is added, DEFAULT_BUDDYSPACER_THEMED will be unused if it's still there.
This merge request was approved by Nikolay Sivov.