A followup with some observations I made:

When one sets the supportsResize property of the graphics context to false,
Windows lets one create windows that extend beyond the screen dimensions.
But as soon as resizing is permitted, Windows Vista and above enforces
sizing restrictions (that the previously posted code can work around by
issuing a SetWindowsPos with the SWP_NOSENDCHANGING flag)

Christian Buchner


2014-11-18 19:30 GMT+01:00 Christian Buchner <[email protected]>:

> Hi all,
>
> I've been trying to create an OSG window bigger than the screen on Windows
> 7
>
> Unfortunately viewer.setupViewInWindow() will not allow the window's
> client area to extend beyond the screen size.
>
> I've been using this dirty hack to get my OSG window to the desired width,
> height.  Is there a cleaner way to do this?
>
>     // make absolutelly sure we get the requested client area in the window
>     {
>         osgViewer::GraphicsWindowWin32* gw =
>             dynamic_cast<osgViewer::GraphicsWindowWin32*> (
>             viewer->getCamera()->getGraphicsContext());
>         HWND window = gw->getHWND();
>         RECT wrect, crect;
>         GetWindowRect(window, &wrect);
>         fprintf(stderr, "***GetWindowRect: %d, %d, %d, %d\n", wrect.left,
> wrect.top, wrect.right - wrect.left, wrect.bottom - wrect.top);
>         GetClientRect(window, &crect);
>         fprintf(stderr, "***GetClientRect: %d, %d, %d, %d\n", crect.left,
> crect.top, crect.right - crect.left, crect.bottom - crect.top);
>
>         if (crect.right - crect.left < width || crect.bottom - crect.top <
> height)
>         {
>             int dx = width - (crect.right - crect.left);
>             int dy = height - (crect.bottom - crect.top);
>             fprintf(stderr, "***Window size delta: %d, %d\n", dx, dy);
>
>             SetWindowPos(window, NULL, wrect.left, wrect.top, wrect.right
> - wrect.left + dx, wrect.bottom - wrect.top + dy, SWP_NOSENDCHANGING);
>
>             GetClientRect(window, &crect);
>             fprintf(stderr, "***GetClientRect (Corrected): %d, %d, %d,
> %d\n", crect.left, crect.top, crect.right - crect.left, crect.bottom -
> crect.top);
>         }
>     }
>
>
>
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to