diff options
author | bretello <bretello@distruzione.org> | 2023-07-17 19:31:53 +0200 |
---|---|---|
committer | Ronan Pigott <ronan@rjp.ie> | 2023-07-23 11:10:26 -0700 |
commit | dc634c4a1328668afe2b7c74e8b5828e187ebddd (patch) | |
tree | 86ae0e5711dc83c009aa72dca562eb178199c634 | |
parent | Add Georgian README (diff) | |
download | sway-dc634c4a1328668afe2b7c74e8b5828e187ebddd.tar.gz sway-dc634c4a1328668afe2b7c74e8b5828e187ebddd.tar.zst sway-dc634c4a1328668afe2b7c74e8b5828e187ebddd.zip |
fix crash when resizing tiled scratchpad windows
Splitting and then hiding a scratchpad container results in
a segfault.
fixes #6693
-rw-r--r-- | sway/commands/resize.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index f59e2aeb..32b746ea 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -75,6 +75,10 @@ void container_resize_tiled(struct sway_container *con, | |||
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | 77 | ||
78 | if (container_is_scratchpad_hidden_or_child(con)) { | ||
79 | return; | ||
80 | } | ||
81 | |||
78 | // For HORIZONTAL or VERTICAL, we are growing in two directions so select | 82 | // For HORIZONTAL or VERTICAL, we are growing in two directions so select |
79 | // both adjacent siblings. For RIGHT or DOWN, just select the next sibling. | 83 | // both adjacent siblings. For RIGHT or DOWN, just select the next sibling. |
80 | // For LEFT or UP, convert it to a RIGHT or DOWN resize and reassign con to | 84 | // For LEFT or UP, convert it to a RIGHT or DOWN resize and reassign con to |
@@ -249,6 +253,10 @@ static struct cmd_results *resize_adjust_tiled(uint32_t axis, | |||
249 | struct movement_amount *amount) { | 253 | struct movement_amount *amount) { |
250 | struct sway_container *current = config->handler_context.container; | 254 | struct sway_container *current = config->handler_context.container; |
251 | 255 | ||
256 | if (container_is_scratchpad_hidden_or_child(current)) { | ||
257 | return cmd_results_new(CMD_FAILURE, "Cannot resize a hidden scratchpad container"); | ||
258 | } | ||
259 | |||
252 | if (amount->unit == MOVEMENT_UNIT_DEFAULT) { | 260 | if (amount->unit == MOVEMENT_UNIT_DEFAULT) { |
253 | amount->unit = MOVEMENT_UNIT_PPT; | 261 | amount->unit = MOVEMENT_UNIT_PPT; |
254 | } | 262 | } |
@@ -292,6 +300,11 @@ static struct cmd_results *resize_adjust_tiled(uint32_t axis, | |||
292 | */ | 300 | */ |
293 | static struct cmd_results *resize_set_tiled(struct sway_container *con, | 301 | static struct cmd_results *resize_set_tiled(struct sway_container *con, |
294 | struct movement_amount *width, struct movement_amount *height) { | 302 | struct movement_amount *width, struct movement_amount *height) { |
303 | |||
304 | if (container_is_scratchpad_hidden_or_child(con)) { | ||
305 | return cmd_results_new(CMD_FAILURE, "Cannot resize a hidden scratchpad container"); | ||
306 | } | ||
307 | |||
295 | if (width->amount) { | 308 | if (width->amount) { |
296 | if (width->unit == MOVEMENT_UNIT_PPT || | 309 | if (width->unit == MOVEMENT_UNIT_PPT || |
297 | width->unit == MOVEMENT_UNIT_DEFAULT) { | 310 | width->unit == MOVEMENT_UNIT_DEFAULT) { |