[PATCH] comctl32: Handle BM_SETSTATE sent to themed buttons.

Nikolay Sivov nsivov at codeweavers.com
Tue Mar 31 15:19:39 CDT 2015


On 03/31/2015 10:45 PM, Mark Harmstone wrote:
> This patch changes comctl32 to handle BM_SETSTATE itself when sent to
> a themed button, rather than forwarding it to user32. This way, the
> theming isn't temporarily lost when user32 repaints it.
>

> +    case BM_SETSTATE:
> +    {
> +        int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
> +        if (wParam)
> +            SetWindowLongW(hwnd, 0, state | BST_PUSHED);
> +        else
> +            SetWindowLongW(hwnd, 0, state & ~BST_PUSHED);
> +
> +        InvalidateRect(hwnd, NULL, FALSE);
> +        break;
> +    }
> +

I guess you can GetWindowLongW(...,0,...) instead of sending a message? 
But what's more important is that all these difference in behavior 
comparing to user32 controls should not be visible only when you have an 
active theme. It's actually another version of same Button control with 
additional messages and different behavior in some aspects, including 
theming-aware drawing. So my point is that theming support is secondary, 
what's important is class redirection support, and I'm worried if these 
theming-only changes will make it more difficult to fix properly later.

P.S. 0 window data index is actually implementation details of user32 (I 
don't know if it's compatible with native one with that regard or not).



More information about the wine-devel mailing list