Merge branch 'main' into feature/dual-row-scroller

This commit is contained in:
rasmusq
2025-12-04 16:26:20 +01:00
22 changed files with 472 additions and 421 deletions

View File

@@ -41,10 +41,21 @@ Client *get_client_by_id_or_title(const char *arg_id, const char *arg_title) {
continue;
}
if (!(appid = client_get_appid(c)))
if (c->swallowedby) {
appid = client_get_appid(c->swallowedby);
title = client_get_title(c->swallowedby);
} else {
appid = client_get_appid(c);
title = client_get_title(c);
}
if (!appid) {
appid = broken;
if (!(title = client_get_title(c)))
}
if (!title) {
title = broken;
}
if (arg_id && strncmp(arg_id, "none", 4) == 0)
arg_id = NULL;
@@ -70,7 +81,7 @@ setclient_coordinate_center(Client *c, struct wlr_box geom, int offsetx,
int len = 0;
Monitor *m = c->mon ? c->mon : selmon;
unsigned int cbw = check_hit_no_border(c) ? c->bw : 0;
uint32_t cbw = check_hit_no_border(c) ? c->bw : 0;
if (!c->no_force_center) {
tempbox.x = m->w.x + (m->w.width - geom.width) / 2;
@@ -128,8 +139,9 @@ Client *center_tiled_select(Monitor *m) {
int dirx, diry;
long int distance;
wl_list_for_each(c, &clients, link) {
if (c && VISIBLEON(c, m) && ISTILED(c) && client_surface(c)->mapped &&
!c->isfloating && !client_is_unmanaged(c)) {
if (c && VISIBLEON(c, m) && ISSCROLLTILED(c) &&
client_surface(c)->mapped && !c->isfloating &&
!client_is_unmanaged(c)) {
dirx = c->geom.x + c->geom.width / 2 - (m->w.x + m->w.width / 2);
diry = c->geom.y + c->geom.height / 2 - (m->w.y + m->w.height / 2);
distance = dirx * dirx + diry * diry;
@@ -182,7 +194,9 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
int sel_x = tc->geom.x;
int sel_y = tc->geom.y;
long long int distance = LLONG_MAX;
long long int same_monitor_distance = LLONG_MAX;
Client *tempFocusClients = NULL;
Client *tempSameMonitorFocusClients = NULL;
switch (arg->i) {
case UP:
@@ -213,6 +227,11 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
distance = tmp_distance;
tempFocusClients = tempClients[_i];
}
if (tempClients[_i]->mon == tc->mon &&
tmp_distance < same_monitor_distance) {
same_monitor_distance = tmp_distance;
tempSameMonitorFocusClients = tempClients[_i];
}
}
}
}
@@ -245,6 +264,11 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
distance = tmp_distance;
tempFocusClients = tempClients[_i];
}
if (tempClients[_i]->mon == tc->mon &&
tmp_distance < same_monitor_distance) {
same_monitor_distance = tmp_distance;
tempSameMonitorFocusClients = tempClients[_i];
}
}
}
}
@@ -277,6 +301,11 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
distance = tmp_distance;
tempFocusClients = tempClients[_i];
}
if (tempClients[_i]->mon == tc->mon &&
tmp_distance < same_monitor_distance) {
same_monitor_distance = tmp_distance;
tempSameMonitorFocusClients = tempClients[_i];
}
}
}
}
@@ -309,6 +338,11 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
distance = tmp_distance;
tempFocusClients = tempClients[_i];
}
if (tempClients[_i]->mon == tc->mon &&
tmp_distance < same_monitor_distance) {
same_monitor_distance = tmp_distance;
tempSameMonitorFocusClients = tempClients[_i];
}
}
}
}
@@ -316,7 +350,11 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
}
free(tempClients); // 释放内存
return tempFocusClients;
if(tempSameMonitorFocusClients) {
return tempSameMonitorFocusClients;
} else {
return tempFocusClients;
}
}
Client *direction_select(const Arg *arg) {