Skip to content

Commit

Permalink
Update scene node when an unmanaged window moves
Browse files Browse the repository at this point in the history
A null check had to be added because, since a view's scene isn't created
until .map, there's a possibility that .set_geometry is called before
the scene node exists.
  • Loading branch information
djpohly committed Oct 17, 2023
1 parent 2f4801a commit 31c129b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion view.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ view_position(struct cg_view *view)
/* We shouldn't position override-redirect windows. They set
their own (x,y) coordinates in handle_xwayland_surface_set_geometry. */
if (view->type == CAGE_XWAYLAND_VIEW && !xwayland_view_should_manage(view)) {
wlr_scene_node_set_position(&view->scene_tree->node, view->lx, view->ly);
/* The scene is created in .map, but .set_geometry can come
* before that. */
if (view->scene_tree != NULL) {
wlr_scene_node_set_position(&view->scene_tree->node, view->lx, view->ly);
}
} else
#endif
if (view_is_primary(view) || view_extends_output_layout(view, &layout_box)) {
Expand All @@ -119,6 +123,7 @@ view_unmap(struct cg_view *view)
wl_list_remove(&view->link);

wlr_scene_node_destroy(&view->scene_tree->node);
view->scene_tree = NULL;

view->wlr_surface->data = NULL;
view->wlr_surface = NULL;
Expand Down
1 change: 1 addition & 0 deletions xwayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ handle_xwayland_surface_set_geometry(struct wl_listener *listener, void *data)
if (!xwayland_view_should_manage(view)) {
view->lx = xwayland_view->xwayland_surface->x;
view->ly = xwayland_view->xwayland_surface->y;
view_position(view);
}
}

Expand Down

0 comments on commit 31c129b

Please sign in to comment.