From: John Lindgren Date: Mon, 21 Nov 2022 18:03:49 +0000 (-0500) Subject: view: Rename/move workspaces_send_to() to view_move_to_workspace() X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=c67c6691ac0653aa39e924a8f400632c12d4d861;p=proto%2Flabwc.git view: Rename/move workspaces_send_to() to view_move_to_workspace() This function semantically belongs in view.c since it modifies `struct view`. Also a minor formatting fix in view_toggle_always_on_top(). --- diff --git a/include/view.h b/include/view.h index 0df97d40..69d3f933 100644 --- a/include/view.h +++ b/include/view.h @@ -133,6 +133,7 @@ void view_set_fullscreen(struct view *view, bool fullscreen, void view_toggle_maximize(struct view *view); void view_toggle_decorations(struct view *view); void view_toggle_always_on_top(struct view *view); +void view_move_to_workspace(struct view *view, struct workspace *workspace); void view_set_decorations(struct view *view, bool decorations); void view_toggle_fullscreen(struct view *view); void view_adjust_for_layout_change(struct view *view); diff --git a/include/workspaces.h b/include/workspaces.h index 53dc4da3..809112c2 100644 --- a/include/workspaces.h +++ b/include/workspaces.h @@ -21,7 +21,6 @@ struct workspace { void workspaces_init(struct server *server); void workspaces_switch_to(struct workspace *target); -void workspaces_send_to(struct view *view, struct workspace *target); void workspaces_destroy(struct server *server); void workspaces_osd_hide(struct seat *seat); struct workspace *workspaces_find(struct workspace *anchor, const char *name); diff --git a/src/action.c b/src/action.c index b1561f72..c1e38d7d 100644 --- a/src/action.c +++ b/src/action.c @@ -353,7 +353,7 @@ actions_run(struct view *activator, struct server *server, char *target_name = action_str_from_arg(arg); target = workspaces_find(view->workspace, target_name); if (target) { - workspaces_send_to(view, target); + view_move_to_workspace(view, target); } } break; diff --git a/src/view.c b/src/view.c index a305ea51..ca67a622 100644 --- a/src/view.c +++ b/src/view.c @@ -522,13 +522,26 @@ view_toggle_always_on_top(struct view *view) assert(view); if (is_always_on_top(view)) { view->workspace = view->server->workspace_current; - wlr_scene_node_reparent(&view->scene_tree->node, view->workspace->tree); + wlr_scene_node_reparent(&view->scene_tree->node, + view->workspace->tree); } else { wlr_scene_node_reparent(&view->scene_tree->node, view->server->view_tree_always_on_top); } } +void +view_move_to_workspace(struct view *view, struct workspace *workspace) +{ + assert(view); + assert(workspace); + if (view->workspace != workspace) { + view->workspace = workspace; + wlr_scene_node_reparent(&view->scene_tree->node, + workspace->tree); + } +} + void view_set_decorations(struct view *view, bool decorations) { diff --git a/src/workspaces.c b/src/workspaces.c index 54d5ee4f..20abf011 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -270,18 +270,6 @@ workspaces_switch_to(struct workspace *target) _osd_show(target->server); } -void -workspaces_send_to(struct view *view, struct workspace *target) -{ - assert(view); - assert(target); - if (view->workspace == target) { - return; - } - wlr_scene_node_reparent(&view->scene_tree->node, target->tree); - view->workspace = target; -} - void workspaces_osd_hide(struct seat *seat) {