diff --git a/modules/juce_gui_basics/native/juce_WaylandWindowState_linux.h b/modules/juce_gui_basics/native/juce_WaylandWindowState_linux.h index 370ef2c6a92..46d9a4ce1d8 100644 --- a/modules/juce_gui_basics/native/juce_WaylandWindowState_linux.h +++ b/modules/juce_gui_basics/native/juce_WaylandWindowState_linux.h @@ -54,4 +54,13 @@ JUCE_API bool setWaylandWindowMaximised (ComponentPeer&, bool shouldBeMaximised) */ JUCE_API bool isWaylandWindowMaximised (const ComponentPeer&); +/** Returns true if the compositor has configured a top-level Wayland window as maximised or + as tiled on at least one edge (half-tiled, snapped to a corner...). + + Like isWaylandWindowMaximised() it changes in the same configure as the window's size. It lets + an application that draws its own shadow around the window know that the compositor now + manages the window's edges, so the shadow should be dropped. +*/ +JUCE_API bool isWaylandWindowMaximisedOrTiled (const ComponentPeer&); + } // namespace juce diff --git a/modules/juce_gui_basics/native/juce_Windowing_wayland_linux.cpp b/modules/juce_gui_basics/native/juce_Windowing_wayland_linux.cpp index a148d15dfd4..a98c40cc2ed 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_wayland_linux.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_wayland_linux.cpp @@ -587,6 +587,11 @@ class WaylandComponentPeer final : public ComponentPeer, return maximised; } + bool isMaximisedOrTiled() const + { + return maximisedOrTiled; + } + void startHostManagedResize (Point, ResizableBorderComponent::Zone zone) override { if (updateToplevelSizeConstraints()) @@ -1379,6 +1384,7 @@ class WaylandComponentPeer final : public ComponentPeer, // The compositor discards all toplevel state on unmap. fullScreenState.toplevelDestroyed(); maximised = false; + maximisedOrTiled = false; wantsMinimised = false; dialogOwner = nullptr; } @@ -1892,6 +1898,7 @@ class WaylandComponentPeer final : public ComponentPeer, fullScreenState.configureReceived (info.fullScreen); maximised = info.maximised; + maximisedOrTiled = info.maximisedOrTiled; configured = true; // xdg-shell has no unminimise event, so an activated configure means the compositor showed us again. @@ -2450,6 +2457,7 @@ class WaylandComponentPeer final : public ComponentPeer, // As last configured, so it changes together with the size that goes with it. bool maximised = false; + bool maximisedOrTiled = false; std::optional configureScaleUpdate; WaylandResizeAxesTracker resizeAxesTracker; WaylandSurfaceScale surfaceScale; @@ -2580,6 +2588,14 @@ bool isWaylandWindowMaximised (const ComponentPeer& peer) return false; } +bool isWaylandWindowMaximisedOrTiled (const ComponentPeer& peer) +{ + if (auto* waylandPeer = dynamic_cast (&peer)) + return waylandPeer->isMaximisedOrTiled(); + + return false; +} + //============================================================================== class WaylandMouseCursor final {