update update comments for readability and presentation

This commit is contained in:
2025-11-16 20:06:34 +01:00
parent be6ed1764f
commit 481d87b0d9
3 changed files with 8 additions and 11 deletions

View File

@@ -132,7 +132,7 @@ int togglerow(const Arg *arg) {
if (c->isfloating || !ISSCROLLTILED(c) || !VISIBLEON(c, selmon)) if (c->isfloating || !ISSCROLLTILED(c) || !VISIBLEON(c, selmon))
return 0; return 0;
// Toggle the row (0 <-> 1) // Toggle the row
if (c->dual_scroller_row == 0) { if (c->dual_scroller_row == 0) {
c->dual_scroller_row = 1; c->dual_scroller_row = 1;
} else { } else {
@@ -1572,4 +1572,4 @@ int toggle_monitor(const Arg *arg) {
} }
} }
return 0; return 0;
} }

View File

@@ -31,8 +31,8 @@ bool is_scroller_layout(Monitor *m) {
bool is_row_layout(Monitor *m) { bool is_row_layout(Monitor *m) {
// Layout has independent horizontal rows where navigation should be constrained // Layout has independent horizontal rows where navigation should be constrained
// LEFT/RIGHT: stay within same row (same Y) // Moving left and right should keep clients in the same row
// UP/DOWN: move between rows // Moving up and down should move clients between rows (this has a dedicaded function)
if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER) if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER)
return true; return true;

View File

@@ -379,7 +379,6 @@ void scroller(Monitor *m) {
} }
// Dual-row scroller layout with independent scrolling // Dual-row scroller layout with independent scrolling
// Top row: 30% of screen height, Bottom row: 70% of screen height
void dual_scroller(Monitor *m) { void dual_scroller(Monitor *m) {
unsigned int i, n_top = 0, n_bottom = 0, n_total = 0; unsigned int i, n_top = 0, n_bottom = 0, n_total = 0;
@@ -411,12 +410,12 @@ void dual_scroller(Monitor *m) {
return; return;
} }
// First pass: count clients per row and assign unassigned clients // Count clients per row and assign unassigned clients
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) { if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
// Assign to bottom row by default if not assigned // Assign to bottom row by default if not assigned
if (c->dual_scroller_row == -1) { if (c->dual_scroller_row == -1) {
c->dual_scroller_row = 1; // Default to bottom row c->dual_scroller_row = 1;
} }
if (c->dual_scroller_row == 0) { if (c->dual_scroller_row == 0) {
@@ -455,13 +454,12 @@ void dual_scroller(Monitor *m) {
} }
} }
// Calculate row heights (30% top, 70% bottom)
unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * 0.3); unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * 0.3);
unsigned int bottom_row_height = m->w.height - 2 * cur_gappov - cur_gappiv - top_row_height; unsigned int bottom_row_height = m->w.height - 2 * cur_gappov - cur_gappiv - top_row_height;
unsigned int top_row_y = m->w.y + cur_gappov; unsigned int top_row_y = m->w.y + cur_gappov;
unsigned int bottom_row_y = top_row_y + top_row_height + cur_gappiv; unsigned int bottom_row_y = top_row_y + top_row_height + cur_gappiv;
// Helper function to layout a single row // Individual row function
void layout_row(Client **row_clients, unsigned int n_row, unsigned int row_y, void layout_row(Client **row_clients, unsigned int n_row, unsigned int row_y,
unsigned int row_height, bool is_top_row) { unsigned int row_height, bool is_top_row) {
if (n_row == 0) return; if (n_row == 0) return;
@@ -526,7 +524,7 @@ void dual_scroller(Monitor *m) {
m->w.width - 2 * scroller_structs - cur_gappih)) && m->w.width - 2 * scroller_structs - cur_gappih)) &&
scroller_prefer_center)); scroller_prefer_center));
// Top row: never center // Current configuration never centers top row
if (is_top_row) { if (is_top_row) {
should_center = false; should_center = false;
} }
@@ -579,7 +577,6 @@ void dual_scroller(Monitor *m) {
layout_row(top_row_clients, n_top, top_row_y, top_row_height, true); layout_row(top_row_clients, n_top, top_row_y, top_row_height, true);
layout_row(bottom_row_clients, n_bottom, bottom_row_y, bottom_row_height, false); layout_row(bottom_row_clients, n_bottom, bottom_row_y, bottom_row_height, false);
// Cleanup
free(top_row_clients); free(top_row_clients);
free(bottom_row_clients); free(bottom_row_clients);
} }