comctl32: Property sheets must be able to redraw themselves even if no page is selected.

This commit is contained in:
Francois Gouget 2011-09-06 00:13:38 +02:00 committed by Alexandre Julliard
parent 73f4e23938
commit 6deccab6c9
2 changed files with 34 additions and 5 deletions

View file

@ -3201,17 +3201,20 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
WCHAR szBuffer[256];
int nLength;
if (psInfo->active_page < 0) return 1;
hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps);
if (!hdc) return 1;
hdcSrc = CreateCompatibleDC(0);
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[psInfo->active_page].hpage;
if (psInfo->ppshheader.dwFlags & PSH_USEHPLWATERMARK)
hOldPal = SelectPalette(hdc, psInfo->ppshheader.hplWatermark, FALSE);
if ( (!(ppshpage->dwFlags & PSP_HIDEHEADER)) &&
if (psInfo->active_page < 0)
ppshpage = NULL;
else
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[psInfo->active_page].hpage;
if ( (ppshpage && !(ppshpage->dwFlags & PSP_HIDEHEADER)) &&
(psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
(psInfo->ppshheader.dwFlags & PSH_HEADER) )
{
@ -3318,7 +3321,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
SelectObject(hdcSrc, hbmp);
}
if ( (ppshpage->dwFlags & PSP_HIDEHEADER) &&
if ( (ppshpage && (ppshpage->dwFlags & PSP_HIDEHEADER)) &&
(psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
(psInfo->ppshheader.dwFlags & PSH_WATERMARK) )
{

View file

@ -33,6 +33,24 @@ static LONG active_page = -1;
#define IDC_APPLY_BUTTON 12321
/* try to make sure pending X events have been processed before continuing */
static void flush_events(void)
{
MSG msg;
int diff = 200;
int min_timeout = 100;
DWORD time = GetTickCount() + diff;
while (diff > 0)
{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
diff = time - GetTickCount();
}
}
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
{
switch(msg)
@ -121,7 +139,8 @@ static void test_nopage(void)
HPROPSHEETPAGE hpsp[1];
PROPSHEETPAGEA psp;
PROPSHEETHEADERA psh;
HWND hdlg;
HWND hdlg, hpage;
MSG msg;
memset(&psp, 0, sizeof(psp));
psp.dwSize = sizeof(psp);
@ -148,7 +167,14 @@ static void test_nopage(void)
ShowWindow(hdlg,SW_NORMAL);
SendMessage(hdlg, PSM_REMOVEPAGE, 0, 0);
hpage = PropSheet_GetCurrentPageHwnd(hdlg);
ok(hpage == NULL, "expected no current page, got %p, index=%d\n", hpage, PropSheet_HwndToIndex(hdlg, hpage));
flush_events();
RedrawWindow(hdlg,NULL,NULL,RDW_UPDATENOW|RDW_ERASENOW);
/* Check that the property sheet was fully redrawn */
ok(!PeekMessage(&msg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE),
"expected no pending WM_PAINT messages\n");
DestroyWindow(hdlg);
}