user32: Send WM_CTLCOLOR* message only for visible buttons.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexander Lakhin 2016-04-19 22:15:24 +02:00 committed by Alexandre Julliard
parent 2c180741e1
commit bc3f40e21a
2 changed files with 28 additions and 25 deletions

View File

@ -385,6 +385,8 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
case WM_SETTEXT:
{
/* Clear an old text here as Windows does */
if (IsWindowVisible(hWnd))
{
HDC hdc = GetDC(hWnd);
HBRUSH hbrush;
RECT client, rc;
@ -410,6 +412,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
if (rc.bottom > client.bottom) rc.bottom = client.bottom;
FillRect(hdc, &rc, hbrush);
ReleaseDC(hWnd, hdc);
}
if (unicode) DefWindowProcW( hWnd, WM_SETTEXT, wParam, lParam );
else DefWindowProcA( hWnd, WM_SETTEXT, wParam, lParam );

View File

@ -5938,7 +5938,7 @@ static void test_button_messages(void)
SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"Text 2");
sprintf(desc, "button[%i]: WM_SETTEXT on an invisible button", i);
ok_sequence(WmSetTextInvisibleSeq, desc, TRUE);
ok_sequence(WmSetTextInvisibleSeq, desc, FALSE);
ShowWindow(hwnd, SW_SHOW);
ShowWindow(parent, SW_HIDE);
@ -5947,7 +5947,7 @@ static void test_button_messages(void)
SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"Text 3");
sprintf(desc, "button[%i]: WM_SETTEXT on an invisible button", i);
ok_sequence(WmSetTextInvisibleSeq, desc, TRUE);
ok_sequence(WmSetTextInvisibleSeq, desc, FALSE);
ShowWindow(parent, SW_SHOW);
flush_events();