From Jan Peciva, "please find attached proposed fix for ON_DEMAND rendering. The biggest issue was

that the windows did not act on repaint request (WM_PAINT, EXPOSE,...)

Detailed explanation:
- I implemented requestRedraw using the push approach (not using
GraphicsWindow::_requestRedraw flag that I was considering) as there may be
multiple viewers reading the flag and fighting to reset it after the paint
request, while some viewers may not spot the request to redraw
- I made windows call GraphicsWindow::requestRedraw when they receive
appropriate message (WM_PAINT, EXPOSE, RESIZE,...)
- There were issues on Linux that windows did not want to close using x
button. Resolved by moving the test for DeleteWindow event from
swapBuffersImplementation() to GraphicsWindowX11::checkEvents(). The difficulty
was that DeleteWindow event is not coming using _eventDisplay, but through
_display.
- The last difficulty was that it is necessary to call
ViewerBase::checkWindowStatus() to set _done to true when all windows are
closed. This did not happened recently in ON_DEMAND run scheme. I put the call
to checkWindowStatus() to eventTraversal.
"
This commit is contained in:
Robert Osfield
2011-04-19 12:01:38 +00:00
parent efec8a13a1
commit c13b7d26b7
9 changed files with 133 additions and 31 deletions

View File

@@ -1833,7 +1833,7 @@ bool GraphicsWindowWin32::realizeImplementation()
}
}
protected:
HDC _hdc;
HDC _hdc;
HGLRC _hglrc;
} restoreContext;
@@ -2355,6 +2355,7 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
PAINTSTRUCT paint;
::BeginPaint(hwnd, &paint);
::EndPaint(hwnd, &paint);
requestRedraw();
}
break;
@@ -2467,10 +2468,15 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
int windowWidth = (clientRect.right == 0) ? 1 : clientRect.right ;
int windowHeight = (clientRect.bottom == 0) ? 1 : clientRect.bottom;;
// send resize event if window position or size was changed
if (windowX!=_traits->x || windowY!=_traits->y || windowWidth!=_traits->width || windowHeight!=_traits->height)
{
resized(windowX, windowY, windowWidth, windowHeight);
getEventQueue()->windowResize(windowX, windowY, windowWidth, windowHeight, resizeTime);
// request redraw if window size was changed
if (windowWidth!=_traits->width || windowHeight!=_traits->height)
requestRedraw();
}
}
break;