fix: root client shouldn't use invisble client and floating client

This commit is contained in:
DreamMaoMao 2025-09-20 20:16:47 +08:00
parent 980ada2658
commit 6d24ee3945
4 changed files with 8 additions and 8 deletions

View file

@ -121,14 +121,14 @@ static bool is_window_rule_matches(const ConfigWinRule *r, const char *appid,
regex_match(r->title, title));
}
Client *center_select(Monitor *m) {
Client *center_tiled_select(Monitor *m) {
Client *c = NULL;
Client *target_c = NULL;
long int mini_distance = -1;
int dirx, diry;
long int distance;
wl_list_for_each(c, &clients, link) {
if (c && VISIBLEON(c, m) && client_surface(c)->mapped &&
if (c && VISIBLEON(c, m) && ISTILED(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);

View file

@ -357,11 +357,11 @@ void scroller(Monitor *m) {
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
!m->sel->ismaxmizescreen && !m->sel->isfullscreen) {
root_client = m->sel;
} else if (m->prevsel && ISTILED(m->prevsel) &&
} else if (m->prevsel && ISTILED(m->prevsel) && VISIBLEON(m->prevsel, m) &&
!client_is_unmanaged(m->prevsel)) {
root_client = m->prevsel;
} else {
root_client = center_select(m);
root_client = center_tiled_select(m);
}
if (!root_client) {

View file

@ -344,11 +344,11 @@ void vertical_scroller(Monitor *m) {
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
!m->sel->ismaxmizescreen && !m->sel->isfullscreen) {
root_client = m->sel;
} else if (m->prevsel && ISTILED(m->prevsel) &&
} else if (m->prevsel && ISTILED(m->prevsel) && VISIBLEON(m->prevsel, m) &&
!client_is_unmanaged(m->prevsel)) {
root_client = m->prevsel;
} else {
root_client = center_select(m);
root_client = center_tiled_select(m);
}
if (!root_client) {

View file

@ -663,7 +663,7 @@ static void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer,
static void client_set_pending_state(Client *c);
static void layer_set_pending_state(LayerSurface *l);
static void set_rect_size(struct wlr_scene_rect *rect, int width, int height);
static Client *center_select(Monitor *m);
static Client *center_tiled_select(Monitor *m);
static void handlecursoractivity(void);
static int hidecursor(void *data);
static bool check_hit_no_border(Client *c);
@ -3593,7 +3593,7 @@ mapnotify(struct wl_listener *listener, void *data) {
VISIBLEON(selmon->sel, selmon)) {
at_client = selmon->sel;
} else {
at_client = center_select(selmon);
at_client = center_tiled_select(selmon);
}
at_client->link.next->prev = &c->link;