diff --git a/view.c b/view.c index 5aadd2a..ac06669 100644 --- a/view.c +++ b/view.c @@ -315,8 +315,8 @@ view_unmap(struct cg_view *view) { } void -view_map(struct cg_view *view, struct wlr_surface *surface) { - struct cg_output *output = view->workspace->output; +view_map(struct cg_view *view, struct wlr_surface *surface, struct cg_workspace *ws) { + struct cg_output *output = ws->output; view->wlr_surface = surface; struct wlr_subsurface *subsurface; @@ -328,18 +328,20 @@ view_map(struct cg_view *view, struct wlr_surface *surface) { wl_signal_add(&view->wlr_surface->events.new_subsurface, &view->new_subsurface); + view->workspace=ws; + #if CG_HAS_XWAYLAND /* We shouldn't position override-redirect windows. They set their own (x,y) coordinates in handle_wayland_surface_map. */ if(view->type == CG_XWAYLAND_VIEW && !xwayland_view_should_manage(view)) { wl_list_insert( - &output->workspaces[output->curr_workspace]->unmanaged_views, + &ws->unmanaged_views, &view->link); } else #endif { view_position(view); - wl_list_insert(&output->workspaces[output->curr_workspace]->views, + wl_list_insert(&ws->views, &view->link); } seat_set_focus(output->server->seat, view); diff --git a/view.h b/view.h index e9fe6ab..3623824 100644 --- a/view.h +++ b/view.h @@ -99,7 +99,7 @@ view_unmap(struct cg_view *view); void view_maximize(struct cg_view *view, const struct wlr_box *tile_box); void -view_map(struct cg_view *view, struct wlr_surface *surface); +view_map(struct cg_view *view, struct wlr_surface *surface, struct cg_workspace *ws); void view_destroy(struct cg_view *view); void diff --git a/xdg_shell.c b/xdg_shell.c index 6b3272c..22f911a 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -300,7 +300,7 @@ handle_xdg_shell_surface_map(struct wl_listener *listener, void *_data) { wl_signal_add(&xdg_shell_view->xdg_surface->surface->events.commit, &xdg_shell_view->commit); - view_map(view, xdg_shell_view->xdg_surface->surface); + view_map(view, xdg_shell_view->xdg_surface->surface,view->workspace->server->curr_output->workspaces[view->workspace->server->curr_output->curr_workspace]); view_damage_whole(view); } diff --git a/xwayland.c b/xwayland.c index 294dc0e..bce9a4b 100644 --- a/xwayland.c +++ b/xwayland.c @@ -188,7 +188,7 @@ handle_xwayland_surface_map(struct wl_listener *listener, void *_data) { wl_signal_add(&xwayland_view->xwayland_surface->surface->events.commit, &xwayland_view->commit); - view_map(view, xwayland_view->xwayland_surface->surface); + view_map(view, xwayland_view->xwayland_surface->surface,view->workspace->server->curr_output->workspaces[view->workspace->server->curr_output->curr_workspace]); view_damage_whole(view); }