aboutsummaryrefslogtreecommitdiffstats
path: root/include/app_internal.h
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-29 14:26:28 +0200
committeruser <user@clank>2026-09-29 14:26:28 +0200
commitca1b5bdf5bf7b5ff01ab515846802b3487599d3a (patch)
treea047fc09bccbe077b98acd0bf2648c2e02616b04 /include/app_internal.h
parentpanes: read and write a pane by id, without taking focus (diff)
downloadslosh-ca1b5bdf5bf7b5ff01ab515846802b3487599d3a.tar.gz
slosh-ca1b5bdf5bf7b5ff01ab515846802b3487599d3a.tar.xz
slosh-ca1b5bdf5bf7b5ff01ab515846802b3487599d3a.zip
layouts, moves: build panes without pulling the view to them
Applying a layout landed on the first tab it made, and moving a pane into a tab took focus there. For a program building a pane in the background that is two failures at once: it yanks the view off the human mid-sentence, and it leaves the *next* caller to read focus as "where I am" and put its work in a stranger's tab. `apply-layout focus:false` builds the tabs and keeps looking at whatever was on screen; a layout naming an `active` tab still wins, because that is a statement about where to be. `move-pane` gains `beside` (which pane in the destination to split, rather than whatever it has focused) and `focus:false` -- the two things a caller placing a pane next to *itself* needs. That uncovered a sizing bug that was unreachable before: a pane's size comes from a layout pass, and a tab nobody has looked at never had one, so a pane built in the background stayed 1x1 and its program drew into a single cell. The jump is what used to size it. layout_tab() gives a background tab a real pass, borrowing the tab cursor for its length -- nothing composes, reads input or draws a frame in between.
Diffstat (limited to 'include/app_internal.h')
-rw-r--r--include/app_internal.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/app_internal.h b/include/app_internal.h
index c699be8..1466c89 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -328,6 +328,15 @@ struct app {
* the index is only meaningful once the array has stopped growing. */
size_t restore_tab;
+ /* Set for the duration of one app_apply_layout by `apply-layout focus:false`:
+ * build the tabs but keep looking at whatever was on screen. Applying a
+ * layout otherwise lands on the first tab it made, which for a program
+ * building a pane in the background means yanking the view off the human
+ * mid-sentence -- and, worse, leaving the *next* caller to read focus as
+ * "where I am" and land its own work in a stranger's tab. A layout that
+ * names an `active` tab still wins: that is a statement about where to be. */
+ bool layout_keep_view;
+
/* Set for the duration of one app_apply_layout: every pane it builds starts
* suspended whatever the file said. `open-workspace suspended:true` is the
* "open ten projects, run zero processes" case, which is a different question
@@ -481,6 +490,10 @@ void close_leaf(app_t *a, node_t *leaf);
node_t *first_leaf_of(node_t *n);
void focus_dir(app_t *a, int dx, int dy);
void layout(app_t *a);
+/* One layout pass over a tab by index, including one that is not on screen --
+ * how a pane in a background tab gets a real size instead of the 1x1 it was
+ * born with. Restores the viewed tab's geometry before returning. */
+void layout_tab(app_t *a, size_t ti);
node_t *pane_by_id(app_t *a, uint32_t id);
split_dir_t side_dir(char side);
bool split_fits(node_t *leaf, split_dir_t dir);