Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
7da9090569
7 changed files with 46 additions and 14 deletions
  1. +3
    -3
      build/linux/platform_specific_code/juce_linux_Windowing.cpp
  2. +2
    -2
      build/macosx/platform_specific_code/juce_mac_Windowing.cpp
  3. +7
    -5
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  4. +5
    -0
      src/juce_appframework/gui/components/juce_Component.cpp
  5. +10
    -0
      src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp
  6. +6
    -0
      src/juce_appframework/gui/components/windows/juce_ComponentPeer.h
  7. +13
    -4
      src/juce_appframework/gui/components/windows/juce_ResizableWindow.cpp

+ 3
- 3
build/linux/platform_specific_code/juce_linux_Windowing.cpp View File

@@ -867,14 +867,14 @@ public:
return minimised;
}
void setFullScreen (bool shouldBeFullScreen)
void setFullScreen (const bool shouldBeFullScreen)
{
Rectangle r (lastNonFullscreenBounds); // (get a copy of this before de-minimising)
setMinimised (false);
if (fullScreen != shouldBeFullScreen)
{
Rectangle r (lastNonFullscreenBounds);
if (shouldBeFullScreen)
r = Desktop::getInstance().getMainMonitorArea();


+ 2
- 2
build/macosx/platform_specific_code/juce_mac_Windowing.cpp View File

@@ -571,12 +571,12 @@ public:
{
if (! isSharedWindow)
{
Rectangle r (lastNonFullscreenBounds);

setMinimised (false);

if (fullScreen != shouldBeFullScreen)
{
Rectangle r (lastNonFullscreenBounds);

if (shouldBeFullScreen)
r = Desktop::getInstance().getMainMonitorArea();



+ 7
- 5
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

@@ -731,15 +731,17 @@ public:
if (! fullScreen)
{
const Rectangle boundsCopy (lastNonFullscreenBounds);
if (hasTitleBar())
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);
}
}


+ 5
- 0
src/juce_appframework/gui/components/juce_Component.cpp View File

@@ -465,12 +465,14 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo)
bool wasFullscreen = false;
bool wasMinimised = false;
ComponentBoundsConstrainer* currentConstainer = 0;
Rectangle oldNonFullScreenBounds;
if (peer != 0)
{
wasFullscreen = peer->isFullScreen();
wasMinimised = peer->isMinimised();
currentConstainer = peer->getConstrainer();
oldNonFullScreenBounds = peer->getNonFullScreenBounds();
removeFromDesktop();
}
@@ -492,7 +494,10 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo)
peer->setVisible (isVisible());
if (wasFullscreen)
{
peer->setFullScreen (true);
peer->setNonFullScreenBounds (oldNonFullScreenBounds);
}
if (wasMinimised)
peer->setMinimised (true);


+ 10
- 0
src/juce_appframework/gui/components/windows/juce_ComponentPeer.cpp View File

@@ -643,6 +643,16 @@ void ComponentPeer::handleScreenSizeChange()
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)
{


+ 6
- 0
src/juce_appframework/gui/components/windows/juce_ComponentPeer.h View File

@@ -174,6 +174,12 @@ public:
/** True if the window is currently full-screen. */
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.
*/
virtual void setIcon (const Image& newIcon) = 0;


+ 13
- 4
src/juce_appframework/gui/components/windows/juce_ResizableWindow.cpp View File

@@ -477,13 +477,22 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s)
return false;
lastNonFullScreenPos = r;
if (isOnDesktop())
{
ComponentPeer* const peer = getPeer();
if (peer != 0)
peer->setNonFullScreenBounds (r);
}
setFullScreen (fs);
if (! fs)
setBoundsConstrained (lastNonFullScreenPos.getX(),
lastNonFullScreenPos.getY(),
lastNonFullScreenPos.getWidth(),
lastNonFullScreenPos.getHeight());
setBoundsConstrained (r.getX(),
r.getY(),
r.getWidth(),
r.getHeight());
return true;
}


Loading…
Cancel
Save