mirror of
https://github.com/swaywm/sway.git
synced 2025-11-17 06:59:48 -05:00
Implement scratchpad
Implements the following commands: * move scratchpad * scratchpad show * [criteria] scratchpad show Also fixes these: * Fix memory leak when executing command with criteria (use `list_free(views)` instead of `free(views)`) * Fix crash when running `move to` with no further arguments
This commit is contained in:
parent
89dc047ca9
commit
81e8f31cc6
13 changed files with 290 additions and 5 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include "sway/input/seat.h"
|
||||
#include "sway/ipc-server.h"
|
||||
#include "sway/output.h"
|
||||
#include "sway/scratchpad.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/layout.h"
|
||||
|
|
@ -328,6 +329,10 @@ static struct sway_container *container_destroy_noreaping(
|
|||
con->destroying = true;
|
||||
container_set_dirty(con);
|
||||
|
||||
if (con->scratchpad) {
|
||||
scratchpad_remove_container(con);
|
||||
}
|
||||
|
||||
if (!con->parent) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -955,6 +960,9 @@ void container_set_floating(struct sway_container *container, bool enable) {
|
|||
container_reap_empty_recursive(workspace);
|
||||
} else {
|
||||
// Returning to tiled
|
||||
if (container->scratchpad) {
|
||||
scratchpad_remove_container(container);
|
||||
}
|
||||
container_remove_child(container);
|
||||
container_add_child(workspace, container);
|
||||
container->width = container->parent->width;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,10 @@ void container_add_child(struct sway_container *parent,
|
|||
list_add(parent->children, child);
|
||||
child->parent = parent;
|
||||
container_handle_fullscreen_reparent(child, old_parent);
|
||||
if (old_parent) {
|
||||
container_set_dirty(old_parent);
|
||||
}
|
||||
container_set_dirty(child);
|
||||
}
|
||||
|
||||
struct sway_container *container_remove_child(struct sway_container *child) {
|
||||
|
|
@ -153,6 +157,9 @@ struct sway_container *container_remove_child(struct sway_container *child) {
|
|||
child->parent = NULL;
|
||||
container_notify_subtree_changed(parent);
|
||||
|
||||
container_set_dirty(parent);
|
||||
container_set_dirty(child);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,7 @@ void view_update_marks_textures(struct sway_view *view) {
|
|||
}
|
||||
|
||||
bool view_is_visible(struct sway_view *view) {
|
||||
if (!view->swayc || view->swayc->destroying) {
|
||||
if (!view->swayc || view->swayc->destroying || !view->swayc->parent) {
|
||||
return false;
|
||||
}
|
||||
struct sway_container *workspace =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue