summaryrefslogtreecommitdiff
path: root/src/web.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-09 01:26:08 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commit09c35b22793153d201fa202b52671a6442e5e2e1 (patch)
tree1eb84c955dc96f4c6bcb75b36f6113ccad8e2f1e /src/web.zig
parent475cc49ccbe9e81f8ec8aa2371c20fc632d110b9 (diff)
downloadpardes-09c35b22793153d201fa202b52671a6442e5e2e1.tar.gz
pardes-09c35b22793153d201fa202b52671a6442e5e2e1.zip
a builtin to put the pane taglines at the bottom
Diffstat (limited to 'src/web.zig')
-rw-r--r--src/web.zig19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/web.zig b/src/web.zig
index 42359329..b8abf27e 100644
--- a/src/web.zig
+++ b/src/web.zig
@@ -489,13 +489,19 @@ fn putU32(s: *State, value: u32) void {
const Target = struct { col: u16, row: u16 };
+/// The tag row and the stacked-pair seam, the way the core's own hit test
+/// derives them: Tagbottom puts a pane's tag on its LAST row, which makes its
+/// FIRST row an ordinary scrollable body row and moves the h-handle down to
+/// the lower pane's first. Kept a line-for-line clone of gui.zig's
+/// webChromeTarget — the two must classify a finger identically.
fn chromeTarget(core: *const pardes.Pardes, col: u16, row: u16) ?Target {
if (row < pardes.TOPBAR_H) return .{ .col = col, .row = row };
for (core.panes, 0..) |slot, id| {
if (slot == null) continue;
const rect = core.rects[id];
- if (row == rect.y and col >= rect.x and col < rect.x + rect.w and col < rect.x + pardes.config.GUTTER)
- return .{ .col = col, .row = rect.y };
+ const tag = if (core.tag_bottom) rect.y + rect.h -| pardes.BOX_H else rect.y;
+ if (row == tag and col >= rect.x and col < rect.x + rect.w and col < rect.x + pardes.config.GUTTER)
+ return .{ .col = col, .row = tag };
}
for (0..core.ncol -| 1) |column| {
const handle = core.col_x[column] + core.col_w[column] -| 1;
@@ -505,15 +511,16 @@ fn chromeTarget(core: *const pardes.Pardes, col: u16, row: u16) ?Target {
if (col < core.col_x[column] or col >= core.col_x[column] + core.col_w[column]) continue;
for (0..core.col_n[column] -| 1) |index| {
const rect = core.rects[core.col_terms[column][index]];
- const handle = rect.y + rect.h -| 1;
+ const handle = if (core.tag_bottom) rect.y +| rect.h else rect.y + rect.h -| 1;
if (row == handle) return .{ .col = col, .row = handle };
}
}
for (core.panes, 0..) |slot, id| {
if (slot == null) continue;
const rect = core.rects[id];
- if (row == rect.y and col >= rect.x and col < rect.x + rect.w)
- return .{ .col = col, .row = rect.y };
+ const tag = if (core.tag_bottom) rect.y + rect.h -| pardes.BOX_H else rect.y;
+ if (row == tag and col >= rect.x and col < rect.x + rect.w)
+ return .{ .col = col, .row = tag };
}
for (0..core.ncol -| 1) |column| {
const handle = core.col_x[column] + core.col_w[column] -| 1;
@@ -523,7 +530,7 @@ fn chromeTarget(core: *const pardes.Pardes, col: u16, row: u16) ?Target {
if (col < core.col_x[column] or col >= core.col_x[column] + core.col_w[column]) continue;
for (0..core.col_n[column] -| 1) |index| {
const rect = core.rects[core.col_terms[column][index]];
- const handle = rect.y + rect.h -| 1;
+ const handle = if (core.tag_bottom) rect.y +| rect.h else rect.y + rect.h -| 1;
if (distance(row, handle) == 1) return .{ .col = col, .row = handle };
}
}