Compare commits

...

6 Commits

Author SHA1 Message Date
mTvare
0af65cf767
Merge d4a1ab7b86 into 4cfcb3643b 2024-11-04 19:04:31 +01:00
Alexander Orzechowski
4cfcb3643b container: Properly constrain title bar padding
Important for centered titles
2024-11-04 19:02:16 +01:00
mtvare6
d4a1ab7b86 desktop/transaction: clamp vertical border length to 0 2024-10-31 11:54:55 +05:30
Kenny Levinsen
26292e4a12 desktop/output: Add missing output config allocation checks 2024-10-31 11:44:55 +05:30
Kenny Levinsen
3379adebe1 desktop/output: Store output config on request_state
An output backend might request any change to an output state at any
time, although currently only this is currently only used for changing
window size on the wayland and x11 backend.

Applying the configuration directly means that the current output state
becomes inconsistent with the configured state, which can cause the new
state to be reverted later if apply_stored_output_configs is called.

Before 4f9ce4675c. the output geometry would be updated by
arrange_outputs, but this is only done by the modeset logic now,
resulting in the stored geometry never being updated on wayland backend
window resize. This was not discovered as the stored geometry is not
used particularly often.

Solve both by storing a new output configuration and relying on the
modeset logic to apply a new state.

Fixes: 4f9ce4675c ("tree/arrange: Remove redundant output geometry update")
2024-10-31 11:44:55 +05:30
mtvare6
a070903a23 desktop/transaction: clamp vertical border length to 0
Fixes #8120. More changes might be required within IPC to prevent
other issues.
2024-10-29 14:56:33 +05:30
4 changed files with 15 additions and 5 deletions

View File

@ -13,6 +13,10 @@ int wrap(int i, int max) {
return ((i % max) + max) % max; return ((i % max) + max) % max;
} }
int max(int a, int b){
return a > b ? a : b;
}
bool parse_color(const char *color, uint32_t *result) { bool parse_color(const char *color, uint32_t *result) {
if (color[0] == '#') { if (color[0] == '#') {
++color; ++color;

View File

@ -34,6 +34,11 @@ int parse_movement_amount(int argc, char **argv,
*/ */
int wrap(int i, int max); int wrap(int i, int max);
/**
* Returns maximum of a and b
*/
int max(int a, int b);
/** /**
* Given a string that represents an RGB(A) color, result will be set to a * Given a string that represents an RGB(A) color, result will be set to a
* uint32_t version of the color, as long as it is valid. If it is invalid, * uint32_t version of the color, as long as it is valid. If it is invalid,

View File

@ -17,6 +17,7 @@
#include "sway/tree/workspace.h" #include "sway/tree/workspace.h"
#include "list.h" #include "list.h"
#include "log.h" #include "log.h"
#include "util.h"
struct sway_transaction { struct sway_transaction {
struct wl_event_source *timer; struct wl_event_source *timer;
@ -424,13 +425,13 @@ static void arrange_container(struct sway_container *con,
int border_bottom = con->current.border_bottom ? border_width : 0; int border_bottom = con->current.border_bottom ? border_width : 0;
int border_left = con->current.border_left ? border_width : 0; int border_left = con->current.border_left ? border_width : 0;
int border_right = con->current.border_right ? border_width : 0; int border_right = con->current.border_right ? border_width : 0;
int vert_border_height = max(0, height- border_top - border_bottom);
wlr_scene_rect_set_size(con->border.top, width, border_top); wlr_scene_rect_set_size(con->border.top, width, border_top);
wlr_scene_rect_set_size(con->border.bottom, width, border_bottom); wlr_scene_rect_set_size(con->border.bottom, width, border_bottom);
wlr_scene_rect_set_size(con->border.left, wlr_scene_rect_set_size(con->border.left,
border_left, height - border_top - border_bottom); border_left, vert_border_height);
wlr_scene_rect_set_size(con->border.right, wlr_scene_rect_set_size(con->border.right,
border_right, height - border_top - border_bottom); border_right, vert_border_height);
wlr_scene_node_set_position(&con->border.top->node, 0, 0); wlr_scene_node_set_position(&con->border.top->node, 0, 0);
wlr_scene_node_set_position(&con->border.bottom->node, wlr_scene_node_set_position(&con->border.bottom->node,

View File

@ -349,7 +349,7 @@ void container_arrange_title_bar(struct sway_container *con) {
h_padding = width - config->titlebar_h_padding - marks_buffer_width; h_padding = width - config->titlebar_h_padding - marks_buffer_width;
} }
h_padding = MAX(h_padding, 0); h_padding = MAX(h_padding, config->titlebar_h_padding);
int alloc_width = MIN((int)node->width, int alloc_width = MIN((int)node->width,
width - h_padding - config->titlebar_h_padding); width - h_padding - config->titlebar_h_padding);
@ -375,7 +375,7 @@ void container_arrange_title_bar(struct sway_container *con) {
h_padding = config->titlebar_h_padding; h_padding = config->titlebar_h_padding;
} }
h_padding = MAX(h_padding, 0); h_padding = MAX(h_padding, config->titlebar_h_padding);
int alloc_width = MIN((int) node->width, int alloc_width = MIN((int) node->width,
width - h_padding - config->titlebar_h_padding); width - h_padding - config->titlebar_h_padding);