Fix black frames of the simple window and rename its setting

Without the shadow and the resize border composeFrame() only forced the
alpha channel, so the buffer the driver reallocated after a size change was
presented as it is, which showed up as a black frame on every resize step.
The content is now always painted from the cache and only the shadow itself
is skipped when there are no margins.

The setting is named simple-window and means the opposite of the previous
shadow-and-border: it is off by default, so the window keeps its shadow and
the outer border for resizing.
This commit is contained in:
alexei-zebra 2026-10-10 00:38:06 +03:00
parent ab7f542d61
commit 27a58b584e
No known key found for this signature in database
GPG key ID: D19D450AC3D9A80E
6 changed files with 19 additions and 18 deletions

View file

@ -282,7 +282,7 @@ void WaylandWindow::setMaximized(bool enabled) {
int WaylandWindow::marginSize() const {
if (!barEnabled || !shadowEnabled ||
(settings != nullptr && !settings->windowShadow.get())) {
(settings != nullptr && settings->simpleWindow.get())) {
return 0;
}
if (fullscreen || maximized || Window::mode != WindowMode::WINDOWED) {
@ -307,9 +307,9 @@ void WaylandWindow::updateSettings() {
if (settings == nullptr) {
return;
}
const bool shadow = settings->windowShadow.get();
if (shadow != shadowSetting) {
shadowSetting = shadow;
const bool simple = settings->simpleWindow.get();
if (simple != simpleWindowSetting) {
simpleWindowSetting = simple;
// The surface size depends on whether the frame around the content is
// drawn at all, so the egl window and the toplevel geometry change.
resize(size.x, size.y);
@ -610,18 +610,19 @@ void WaylandWindow::composeFrame() {
const int margin = marginSize();
GlStateGuard state;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
if (margin <= 0) {
makeContentOpaque(0, 0, size.x, size.y);
return;
}
const auto surface = surfaceSize();
glViewport(0, 0, surface.x, surface.y);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// Without the shadow the surface is exactly the content, but it still has
// to be painted from the cache: a buffer the driver reallocated after a
// resize holds nothing until something is drawn into it.
glClearColor(0.0f, 0.0f, 0.0f, margin > 0 ? 0.0f : 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
drawShadow();
if (margin > 0) {
drawShadow();
}
if (stretchProgram == 0 || cacheWidth == 0) {
glEnable(GL_SCISSOR_TEST);
glScissor(margin, margin, size.x, size.y);

View file

@ -133,7 +133,7 @@ class WaylandWindow : public Window {
static constexpr int SHADOW_MARGIN = 10;
static constexpr int RESIZE_GRAB_EXTRA = 2;
bool shadowEnabled = false;
bool shadowSetting = true;
bool simpleWindowSetting = false;
bool compactBarSetting = false;
GLuint shadowProgram = 0;