| @@ -867,14 +867,14 @@ public: | |||||
| return minimised; | return minimised; | ||||
| } | } | ||||
| void setFullScreen (bool shouldBeFullScreen) | |||||
| void setFullScreen (const bool shouldBeFullScreen) | |||||
| { | { | ||||
| Rectangle r (lastNonFullscreenBounds); // (get a copy of this before de-minimising) | |||||
| setMinimised (false); | setMinimised (false); | ||||
| if (fullScreen != shouldBeFullScreen) | if (fullScreen != shouldBeFullScreen) | ||||
| { | { | ||||
| Rectangle r (lastNonFullscreenBounds); | |||||
| if (shouldBeFullScreen) | if (shouldBeFullScreen) | ||||
| r = Desktop::getInstance().getMainMonitorArea(); | r = Desktop::getInstance().getMainMonitorArea(); | ||||
| @@ -571,12 +571,12 @@ public: | |||||
| { | { | ||||
| if (! isSharedWindow) | if (! isSharedWindow) | ||||
| { | { | ||||
| Rectangle r (lastNonFullscreenBounds); | |||||
| setMinimised (false); | setMinimised (false); | ||||
| if (fullScreen != shouldBeFullScreen) | if (fullScreen != shouldBeFullScreen) | ||||
| { | { | ||||
| Rectangle r (lastNonFullscreenBounds); | |||||
| if (shouldBeFullScreen) | if (shouldBeFullScreen) | ||||
| r = Desktop::getInstance().getMainMonitorArea(); | r = Desktop::getInstance().getMainMonitorArea(); | ||||
| @@ -731,15 +731,17 @@ public: | |||||
| if (! fullScreen) | if (! fullScreen) | ||||
| { | { | ||||
| const Rectangle boundsCopy (lastNonFullscreenBounds); | |||||
| if (hasTitleBar()) | if (hasTitleBar()) | ||||
| ShowWindow (hwnd, SW_SHOWNORMAL); | ShowWindow (hwnd, SW_SHOWNORMAL); | ||||
| if (! lastNonFullscreenBounds.isEmpty()) | |||||
| if (! boundsCopy.isEmpty()) | |||||
| { | { | ||||
| setBounds (lastNonFullscreenBounds.getX(), | |||||
| lastNonFullscreenBounds.getY(), | |||||
| lastNonFullscreenBounds.getWidth(), | |||||
| lastNonFullscreenBounds.getHeight(), | |||||
| setBounds (boundsCopy.getX(), | |||||
| boundsCopy.getY(), | |||||
| boundsCopy.getWidth(), | |||||
| boundsCopy.getHeight(), | |||||
| false); | false); | ||||
| } | } | ||||
| } | } | ||||
| @@ -465,12 +465,14 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) | |||||
| bool wasFullscreen = false; | bool wasFullscreen = false; | ||||
| bool wasMinimised = false; | bool wasMinimised = false; | ||||
| ComponentBoundsConstrainer* currentConstainer = 0; | ComponentBoundsConstrainer* currentConstainer = 0; | ||||
| Rectangle oldNonFullScreenBounds; | |||||
| if (peer != 0) | if (peer != 0) | ||||
| { | { | ||||
| wasFullscreen = peer->isFullScreen(); | wasFullscreen = peer->isFullScreen(); | ||||
| wasMinimised = peer->isMinimised(); | wasMinimised = peer->isMinimised(); | ||||
| currentConstainer = peer->getConstrainer(); | currentConstainer = peer->getConstrainer(); | ||||
| oldNonFullScreenBounds = peer->getNonFullScreenBounds(); | |||||
| removeFromDesktop(); | removeFromDesktop(); | ||||
| } | } | ||||
| @@ -492,7 +494,10 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) | |||||
| peer->setVisible (isVisible()); | peer->setVisible (isVisible()); | ||||
| if (wasFullscreen) | if (wasFullscreen) | ||||
| { | |||||
| peer->setFullScreen (true); | peer->setFullScreen (true); | ||||
| peer->setNonFullScreenBounds (oldNonFullScreenBounds); | |||||
| } | |||||
| if (wasMinimised) | if (wasMinimised) | ||||
| peer->setMinimised (true); | peer->setMinimised (true); | ||||
| @@ -643,6 +643,16 @@ void ComponentPeer::handleScreenSizeChange() | |||||
| handleMovedOrResized(); | handleMovedOrResized(); | ||||
| } | } | ||||
| void ComponentPeer::setNonFullScreenBounds (const Rectangle& newBounds) throw() | |||||
| { | |||||
| lastNonFullscreenBounds = newBounds; | |||||
| } | |||||
| const Rectangle& ComponentPeer::getNonFullScreenBounds() const throw() | |||||
| { | |||||
| return lastNonFullscreenBounds; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| void ComponentPeer::handleFilesDropped (int x, int y, const StringArray& files) | void ComponentPeer::handleFilesDropped (int x, int y, const StringArray& files) | ||||
| { | { | ||||
| @@ -174,6 +174,12 @@ public: | |||||
| /** True if the window is currently full-screen. */ | /** True if the window is currently full-screen. */ | ||||
| virtual bool isFullScreen() const = 0; | virtual bool isFullScreen() const = 0; | ||||
| /** Sets the size to restore to if fullscreen mode is turned off. */ | |||||
| void setNonFullScreenBounds (const Rectangle& newBounds) throw(); | |||||
| /** Returns the size to restore to if fullscreen mode is turned off. */ | |||||
| const Rectangle& getNonFullScreenBounds() const throw(); | |||||
| /** Attempts to change the icon associated with this window. | /** Attempts to change the icon associated with this window. | ||||
| */ | */ | ||||
| virtual void setIcon (const Image& newIcon) = 0; | virtual void setIcon (const Image& newIcon) = 0; | ||||
| @@ -477,13 +477,22 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s) | |||||
| return false; | return false; | ||||
| lastNonFullScreenPos = r; | lastNonFullScreenPos = r; | ||||
| if (isOnDesktop()) | |||||
| { | |||||
| ComponentPeer* const peer = getPeer(); | |||||
| if (peer != 0) | |||||
| peer->setNonFullScreenBounds (r); | |||||
| } | |||||
| setFullScreen (fs); | setFullScreen (fs); | ||||
| if (! fs) | if (! fs) | ||||
| setBoundsConstrained (lastNonFullScreenPos.getX(), | |||||
| lastNonFullScreenPos.getY(), | |||||
| lastNonFullScreenPos.getWidth(), | |||||
| lastNonFullScreenPos.getHeight()); | |||||
| setBoundsConstrained (r.getX(), | |||||
| r.getY(), | |||||
| r.getWidth(), | |||||
| r.getHeight()); | |||||
| return true; | return true; | ||||
| } | } | ||||