mirror of
https://github.com/swaywm/sway.git
synced 2025-11-26 06:59:59 -05:00
Implement atomic layout updates for tree operations
This implements atomic layout updates for when views map, reparent or unmap.
This commit is contained in:
parent
1c89f32533
commit
38398e2d77
18 changed files with 545 additions and 389 deletions
|
|
@ -143,16 +143,12 @@ static void _close(struct sway_view *view) {
|
|||
}
|
||||
}
|
||||
|
||||
static void destroy(struct sway_view *view) {
|
||||
static void _free(struct sway_view *view) {
|
||||
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
|
||||
xdg_shell_v6_view_from_view(view);
|
||||
if (xdg_shell_v6_view == NULL) {
|
||||
return;
|
||||
}
|
||||
wl_list_remove(&xdg_shell_v6_view->destroy.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->map.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->unmap.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->request_fullscreen.link);
|
||||
free(xdg_shell_v6_view);
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +160,7 @@ static const struct sway_view_impl view_impl = {
|
|||
.wants_floating = wants_floating,
|
||||
.for_each_surface = for_each_surface,
|
||||
.close = _close,
|
||||
.destroy = destroy,
|
||||
.free = _free,
|
||||
};
|
||||
|
||||
static void handle_commit(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -173,7 +169,10 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
|||
struct sway_view *view = &xdg_shell_v6_view->view;
|
||||
struct wlr_xdg_surface_v6 *xdg_surface_v6 = view->wlr_xdg_surface_v6;
|
||||
|
||||
if (view->instructions->length) {
|
||||
if (!view->swayc) {
|
||||
return;
|
||||
}
|
||||
if (view->swayc->instructions->length) {
|
||||
transaction_notify_view_ready(view, xdg_surface_v6->configure_serial);
|
||||
}
|
||||
|
||||
|
|
@ -191,11 +190,18 @@ static void handle_new_popup(struct wl_listener *listener, void *data) {
|
|||
static void handle_unmap(struct wl_listener *listener, void *data) {
|
||||
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
|
||||
wl_container_of(listener, xdg_shell_v6_view, unmap);
|
||||
struct sway_view *view = &xdg_shell_v6_view->view;
|
||||
|
||||
view_unmap(&xdg_shell_v6_view->view);
|
||||
if (!sway_assert(view->surface, "Cannot unmap unmapped view")) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct sway_container *parent = view_unmap(view);
|
||||
arrange_and_commit(parent);
|
||||
|
||||
wl_list_remove(&xdg_shell_v6_view->commit.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->new_popup.link);
|
||||
view->surface = NULL;
|
||||
}
|
||||
|
||||
static void handle_map(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -230,7 +236,13 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
|||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
|
||||
wl_container_of(listener, xdg_shell_v6_view, destroy);
|
||||
view_destroy(&xdg_shell_v6_view->view);
|
||||
struct sway_view *view = &xdg_shell_v6_view->view;
|
||||
wl_list_remove(&xdg_shell_v6_view->destroy.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->map.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->unmap.link);
|
||||
wl_list_remove(&xdg_shell_v6_view->request_fullscreen.link);
|
||||
view->wlr_xdg_surface_v6 = NULL;
|
||||
view_destroy(view);
|
||||
}
|
||||
|
||||
static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue