Add display settings for the wayland window frame

The frame the native wayland backend draws gets three switches in the
display tab: a narrow 24px bar instead of the 48px one, the shadow with
the outer resize area, and redrawing the content while the window is
resized (off keeps the previous behaviour of stretching the last frame).

The settings are applied at runtime: the bar geometry is rebuilt and the
surface is resized together with the toplevel geometry, no restart needed.
The narrow bar drops the insets and the gap of its controls, so that they
sit flush against the window edge.

The switches are hidden outside of the wayland backend, which reports its
name through Window::getBackendName().
This commit is contained in:
alexei-zebra 2026-10-10 00:12:37 +03:00
parent 01ed8b7dc5
commit ab7f542d61
No known key found for this signature in database
GPG key ID: D19D450AC3D9A80E
10 changed files with 133 additions and 17 deletions

View file

@ -114,10 +114,18 @@ class WaylandWindow : public Window {
void focus() override;
void setTitle(const std::string& title) override;
const std::string& getTitle() const override;
const char* getBackendName() const override {
return "wayland";
}
/// @brief Whether the narrow window bar is selected
bool compactBar() const;
int getDecorationHeight() const override;
int getDecorationHoveredButton() const override;
static constexpr int BAR_HEIGHT = 48;
static constexpr int BAR_HEIGHT_COMPACT = 24;
static constexpr int BAR_BUTTON = 24;
static constexpr int BAR_PADDING = 12;
static constexpr int BAR_GAP = 12;
@ -125,12 +133,23 @@ class WaylandWindow : public Window {
static constexpr int SHADOW_MARGIN = 10;
static constexpr int RESIZE_GRAB_EXTRA = 2;
bool shadowEnabled = false;
bool shadowSetting = true;
bool compactBarSetting = false;
GLuint shadowProgram = 0;
GLint shadowUniforms[8] {};
int marginSize() const;
/// @brief Window bar height, which the display settings may reduce
int barHeight() const;
/// @brief Whether the content is redrawn every frame during a resize
bool liveResizeEnabled() const;
/// @brief Applies the display settings that affect the window frame
void updateSettings();
double contentX(double x) const {
return x - marginSize();
}