fix row consistent movement and focus
This commit is contained in:
@@ -146,6 +146,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
Client **tempClients = NULL; // 初始化为 NULL
|
Client **tempClients = NULL; // 初始化为 NULL
|
||||||
int last = -1;
|
int last = -1;
|
||||||
|
bool constrain_to_row = tc->mon && is_row_layout(tc->mon);
|
||||||
|
|
||||||
// 第一次遍历,计算客户端数量
|
// 第一次遍历,计算客户端数量
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
@@ -249,7 +250,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
if (!ignore_align) {
|
if (!ignore_align || constrain_to_row) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x < sel_x &&
|
if (tempClients[_i]->geom.x < sel_x &&
|
||||||
tempClients[_i]->geom.y == sel_y &&
|
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++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x < sel_x) {
|
if (tempClients[_i]->geom.x < sel_x) {
|
||||||
int dis_x = 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;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
if (!ignore_align) {
|
if (!ignore_align || constrain_to_row) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x > sel_x &&
|
if (tempClients[_i]->geom.x > sel_x &&
|
||||||
tempClients[_i]->geom.y == sel_y &&
|
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++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x > sel_x) {
|
if (tempClients[_i]->geom.x > sel_x) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
|
|||||||
@@ -29,6 +29,16 @@ bool is_scroller_layout(Monitor *m) {
|
|||||||
return false;
|
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) {
|
unsigned int get_tag_status(unsigned int tag, Monitor *m) {
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
unsigned int status = 0;
|
unsigned int status = 0;
|
||||||
|
|||||||
@@ -721,6 +721,7 @@ static struct wlr_scene_tree *
|
|||||||
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
|
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_tree *parent);
|
struct wlr_scene_tree *parent);
|
||||||
static bool is_scroller_layout(Monitor *m);
|
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 create_output(struct wlr_backend *backend, void *data);
|
||||||
static void get_layout_abbr(char *abbr, const char *full_name);
|
static void get_layout_abbr(char *abbr, const char *full_name);
|
||||||
static void apply_named_scratchpad(Client *target_client);
|
static void apply_named_scratchpad(Client *target_client);
|
||||||
|
|||||||
Reference in New Issue
Block a user