From ccb2a99bfbfba2c7ff13ad221ed401f64fc95535 Mon Sep 17 00:00:00 2001 From: rasmusq Date: Sun, 16 Nov 2025 00:29:13 +0100 Subject: [PATCH] fix row consistent movement and focus --- src/fetch/client.h | 9 +++++---- src/fetch/monitor.h | 10 ++++++++++ src/mango.c | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/fetch/client.h b/src/fetch/client.h index f81dea7..467d62b 100644 --- a/src/fetch/client.h +++ b/src/fetch/client.h @@ -146,6 +146,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating, Client *c = NULL; Client **tempClients = NULL; // 初始化为 NULL int last = -1; + bool constrain_to_row = tc->mon && is_row_layout(tc->mon); // 第一次遍历,计算客户端数量 wl_list_for_each(c, &clients, link) { @@ -249,7 +250,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating, } break; case LEFT: - if (!ignore_align) { + if (!ignore_align || constrain_to_row) { for (int _i = 0; _i <= last; _i++) { if (tempClients[_i]->geom.x < sel_x && tempClients[_i]->geom.y == sel_y && @@ -265,7 +266,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating, } } } - if (!tempFocusClients) { + if (!tempFocusClients && !constrain_to_row) { for (int _i = 0; _i <= last; _i++) { if (tempClients[_i]->geom.x < sel_x) { int dis_x = tempClients[_i]->geom.x - sel_x; @@ -281,7 +282,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating, } break; case RIGHT: - if (!ignore_align) { + if (!ignore_align || constrain_to_row) { for (int _i = 0; _i <= last; _i++) { if (tempClients[_i]->geom.x > sel_x && tempClients[_i]->geom.y == sel_y && @@ -297,7 +298,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating, } } } - if (!tempFocusClients) { + if (!tempFocusClients && !constrain_to_row) { for (int _i = 0; _i <= last; _i++) { if (tempClients[_i]->geom.x > sel_x) { int dis_x = tempClients[_i]->geom.x - sel_x; diff --git a/src/fetch/monitor.h b/src/fetch/monitor.h index 16f1dc8..8711dbc 100644 --- a/src/fetch/monitor.h +++ b/src/fetch/monitor.h @@ -29,6 +29,16 @@ bool is_scroller_layout(Monitor *m) { return false; } +bool is_row_layout(Monitor *m) { + // Layout has independent horizontal rows where navigation should be constrained + // LEFT/RIGHT: stay within same row (same Y) + // UP/DOWN: move between rows + if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER) + return true; + + return false; +} + unsigned int get_tag_status(unsigned int tag, Monitor *m) { Client *c = NULL; unsigned int status = 0; diff --git a/src/mango.c b/src/mango.c index 7754b86..bee4c05 100644 --- a/src/mango.c +++ b/src/mango.c @@ -721,6 +721,7 @@ static struct wlr_scene_tree * wlr_scene_tree_snapshot(struct wlr_scene_node *node, struct wlr_scene_tree *parent); static bool is_scroller_layout(Monitor *m); +static bool is_row_layout(Monitor *m); static void create_output(struct wlr_backend *backend, void *data); static void get_layout_abbr(char *abbr, const char *full_name); static void apply_named_scratchpad(Client *target_client);