Q for AJ? Re: UT2003 Windowing Regression - Yet Another nights effort...

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Fri May 20 14:27:18 CDT 2005


>It only loops if the window procedure doesn't validate the window, so
>what you can do for instance is to have a window proc that does
>nothing the first 10 times around, and on the 11th call signals an
>error and validates the window to break the loop.

Would something like this suffice?

/* Global variables to trigger exit from loop */
static int  redrawComplete = 0;
static long WMPAINT_count = 0;

static LRESULT WINAPI redraw_window_procA(HWND hwnd, UINT msg, WPARAM
wparam, LPARAM lparam)
{
    switch (msg)
    {
    case WM_PAINT:
        trace("doing WM_PAINT %d\n", WMPAINT_count);
        WMPAINT_count++;
        if (WMPAINT_count > 10 && redrawComplete == 0) {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hwnd, &ps);
            EndPaint(hwnd, &ps);
            return 1;
        }
        return 0;
        break;
    }
    return DefWindowProc(hwnd, msg, wparam, lparam);
}

/* Ensure we exit from RedrawNow regardless of invalidated area */
static void test_redrawnow() {

   WNDCLASSA cls;
   HWND hwndMain;

   cls.style = CS_DBLCLKS;
   cls.lpfnWndProc = redraw_window_procA;
   cls.cbClsExtra = 0;
   cls.cbWndExtra = 0;
   cls.hInstance = GetModuleHandleA(0);
   cls.hIcon = 0;
   cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
   cls.hbrBackground = GetStockObject(WHITE_BRUSH);
   cls.lpszMenuName = NULL;
   cls.lpszClassName = "RedrawWindowClass";

   if(!RegisterClassA(&cls)) {
       trace("Register failed %d\n", GetLastError());
       return;
   }

   hwndMain = CreateWindowA("RedrawWindowClass", "Main Window",
WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, 0, NULL);

   ok( WMPAINT_count == 0, "Multiple unexpected WM_PAINT calls %d\n",
WMPAINT_count);
   ShowWindow(hwndMain, SW_SHOW);
   ok( WMPAINT_count == 0, "Multiple unexpected WM_PAINT calls %d\n",
WMPAINT_count);
   Sleep(10000);
   ok( WMPAINT_count == 0, "Multiple unexpected WM_PAINT calls %d\n",
WMPAINT_count);
   RedrawWindow(hwndMain, NULL,NULL,RDW_UPDATENOW | RDW_ALLCHILDREN);
   ok( WMPAINT_count == 1, "Multiple unexpected WM_PAINT calls %d\n",
WMPAINT_count);
   redrawComplete = TRUE;
   ok( WMPAINT_count < 10, "RedrawWindow (RDW_UPDATENOW) never completed
(%d)\n", WMPAINT_count);

   /* clean up */
   DestroyWindow( hwndMain);
}


Passes under XP, fails under wine (without patch) - Havent got win95,98 or
2k to test with

Jason




More information about the wine-devel mailing list