Fullscreen with multi monitor


#1

Here is a fix that makes ResizableWindow::setFullscreen go to the correct display device, instead of the default one :

in juce_win32_Windowing.cpp, line 1686 :
(juce 1.26)

// ..
        if (fullScreen && ! isMinimised())
        {
// here :
           RECT rect;
           GetWindowRect(hwnd, &rect);
           const int centerX = rect.left + (rect.right - rect.left) / 2;
           const int centerY = rect.top + (rect.bottom - rect.top) / 2;
           const Rectangle r = Desktop::getInstance().getMonitorAreaContaining(centerX, centerY);

// instead of :
//         const Rectangle r (Desktop::getInstance().getMainMonitorArea());

           SetWindowPos (hwnd, 0,
                          r.getX(), r.getY(), r.getWidth(), r.getHeight(),
                          SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
        }
 // ..

#2

ok, that’s a fair point. An easier way of writing it would be:

if (fullScreen && ! isMinimised())
        {
            const Rectangle r (component->getParentMonitorArea());

            SetWindowPos (hwnd, 0,
                          r.getX(), r.getY(), r.getWidth(), r.getHeight(),
                          SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
        }

(I’m assuming that’ll work, I’ve only got one monitor here to try it on…)


#3

yes much nicer
thanks !


#4