From e867d1dbb4a083a9bba0199b951dc88931eb83f3 Mon Sep 17 00:00:00 2001 From: attila Date: Fri, 2 Jul 2021 20:11:22 +0200 Subject: [PATCH] Linux: Fix maximise when not using native titlebar X11 cannot maximise windows that have their maximum size set. When not using the native titlebar we now revert to setting the window bounds without involving the X11 maximise function. --- modules/juce_gui_basics/native/juce_linux_Windowing.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index ff742641b8..726c38eff8 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -185,10 +185,14 @@ public: if (fullScreen != shouldBeFullScreen) { - XWindowSystem::getInstance()->setMaximised (windowH, shouldBeFullScreen); + const auto usingNativeTitleBar = ((styleFlags & windowHasTitleBar) != 0); + + if (usingNativeTitleBar) + XWindowSystem::getInstance()->setMaximised (windowH, shouldBeFullScreen); if (shouldBeFullScreen) - r = XWindowSystem::getInstance()->getWindowBounds (windowH, parentWindow); + r = usingNativeTitleBar ? XWindowSystem::getInstance()->getWindowBounds (windowH, parentWindow) + : Desktop::getInstance().getDisplays().getDisplayForRect (bounds)->userArea; if (! r.isEmpty()) setBounds (ScalingHelpers::scaledScreenPosToUnscaled (component, r), shouldBeFullScreen);