ssd: fix pixman error when SSD is created for tiny windows

set_squared_corners(false) was always called when titlebar is created.
However, set_squared_corners(false) sets the width of the titlebar
background buffer to (view width) - (corner radius), which causes pixman
errors due to the negative width set for titlebar background buffer when
the view is so small.
This commit is contained in:
tokyo4j 2024-11-19 07:18:36 +09:00 committed by Johan Malm
parent 23582c814e
commit 5847508eb2

View file

@ -95,14 +95,16 @@ ssd_titlebar_create(struct ssd *ssd)
ssd_update_title(ssd);
ssd_update_window_icon(ssd);
set_squared_corners(ssd, false);
bool maximized = view->maximized == VIEW_AXIS_BOTH;
bool squared = ssd_should_be_squared(ssd);
if (maximized) {
set_squared_corners(ssd, true);
set_alt_button_icon(ssd, LAB_SSD_BUTTON_MAXIMIZE, true);
ssd->state.was_maximized = true;
}
if (squared) {
ssd->state.was_squared = true;
}
set_squared_corners(ssd, maximized || squared);
if (view->shaded) {
set_alt_button_icon(ssd, LAB_SSD_BUTTON_SHADE, true);
@ -111,11 +113,6 @@ ssd_titlebar_create(struct ssd *ssd)
if (view->visible_on_all_workspaces) {
set_alt_button_icon(ssd, LAB_SSD_BUTTON_OMNIPRESENT, true);
}
if (ssd_should_be_squared(ssd)) {
set_squared_corners(ssd, true);
ssd->state.was_squared = true;
}
}
static void