Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 16 additions & 0 deletions modules/juce_gui_basics/native/juce_Windowing_wayland_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ class WaylandComponentPeer final : public ComponentPeer,
return maximised;
}

bool isMaximisedOrTiled() const
{
return maximisedOrTiled;
}

void startHostManagedResize (Point<int>, ResizableBorderComponent::Zone zone) override
{
if (updateToplevelSizeConstraints())
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<WaylandSurfaceScale::Update> configureScaleUpdate;
WaylandResizeAxesTracker resizeAxesTracker;
WaylandSurfaceScale surfaceScale;
Expand Down Expand Up @@ -2580,6 +2588,14 @@ bool isWaylandWindowMaximised (const ComponentPeer& peer)
return false;
}

bool isWaylandWindowMaximisedOrTiled (const ComponentPeer& peer)
{
if (auto* waylandPeer = dynamic_cast<const WaylandComponentPeer*> (&peer))
return waylandPeer->isMaximisedOrTiled();

return false;
}

//==============================================================================
class WaylandMouseCursor final
{
Expand Down
Loading