mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 18:39:46 +00:00
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:
parent
01ed8b7dc5
commit
ab7f542d61
10 changed files with 133 additions and 17 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue