diff --git a/src/client/client.h b/src/client/client.h index 2b763fa..5480f62 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -402,7 +402,22 @@ static inline void client_set_suspended(Client *c, int suspended) { wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended); } -static inline int client_should_ignore_focus(Client *c) { +static inline int client_should_ignore_focus_always(Client *c) { + +#ifdef XWAYLAND + if (client_is_x11(c)) { + struct wlr_xwayland_surface *surface = c->surface.xwayland; + + if (!surface->hints) + return 0; + + return !surface->hints->input; + } +#endif + return 0; +} + +static inline int client_should_ignore_focus_open(Client *c) { #ifdef XWAYLAND if (client_is_x11(c)) { diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index b5a4482..bc43ef1 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -131,7 +131,7 @@ int focuslast(const Arg *arg) { wl_list_for_each(c, &fstack, flink) { if (c->iskilling || c->isminied || c->isunglobal || !client_surface(c)->mapped || client_is_unmanaged(c) || - client_should_ignore_focus(c)) + client_should_ignore_focus_open(c)) continue; if (selmon && !selmon->sel) { @@ -1460,7 +1460,7 @@ int toggleoverview(const Arg *arg) { wl_list_for_each(c, &clients, link) if (c && c->mon == selmon && !client_is_unmanaged(c) && - !client_should_ignore_focus(c) && + !client_should_ignore_focus_open(c) && !c->isminied && !c->isunglobal) { visible_client_number++; } @@ -1484,14 +1484,15 @@ int toggleoverview(const Arg *arg) { if (selmon->isoverview) { wl_list_for_each(c, &clients, link) { if (c && c->mon == selmon && !client_is_unmanaged(c) && - !client_should_ignore_focus(c) && !c->isunglobal) + !client_should_ignore_focus_open(c) && !c->isunglobal) overview_backup(c); } } else { wl_list_for_each(c, &clients, link) { if (c && c->mon == selmon && !c->iskilling && !client_is_unmanaged(c) && !c->isunglobal && - !client_should_ignore_focus(c) && client_surface(c)->mapped) + !client_should_ignore_focus_open(c) && + client_surface(c)->mapped) overview_restore(c, &(Arg){.ui = target}); } } diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index 3a376b5..9090688 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -28,7 +28,7 @@ void grid(Monitor *m) { ? 0 : borderpx; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_should_ignore_focus(c)) || + ((m->isoverview && !client_should_ignore_focus_open(c)) || ISTILED(c))) { cw = (m->w.width - 2 * target_gappo) * single_width_ratio; ch = (m->w.height - 2 * target_gappo) * single_height_ratio; @@ -55,7 +55,7 @@ void grid(Monitor *m) { ? 0 : borderpx; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_should_ignore_focus(c)) || + ((m->isoverview && !client_should_ignore_focus_open(c)) || ISTILED(c))) { if (i == 0) { c->geom.x = m->w.x + target_gappo; @@ -106,7 +106,8 @@ void grid(Monitor *m) { ? 0 : borderpx; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) { + ((m->isoverview && !client_should_ignore_focus_open(c)) || + ISTILED(c))) { cx = m->w.x + (i % cols) * (cw + target_gappi); cy = m->w.y + (i / cols) * (ch + target_gappi); if (overcols && i >= n - overcols) { diff --git a/src/layout/vertical.h b/src/layout/vertical.h index 7e1df68..585c2f0 100644 --- a/src/layout/vertical.h +++ b/src/layout/vertical.h @@ -310,7 +310,7 @@ void vertical_grid(Monitor *m) { ? 0 : borderpx; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_should_ignore_focus(c)) || + ((m->isoverview && !client_should_ignore_focus_open(c)) || ISTILED(c))) { ch = (m->w.height - 2 * target_gappo) * single_height_ratio; cw = (m->w.width - 2 * target_gappo) * single_width_ratio; @@ -338,7 +338,7 @@ void vertical_grid(Monitor *m) { ? 0 : borderpx; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_should_ignore_focus(c)) || + ((m->isoverview && !client_should_ignore_focus_open(c)) || ISTILED(c))) { if (i == 0) { c->geom.x = m->w.x + (m->w.width - cw) / 2 + target_gappo; @@ -385,7 +385,8 @@ void vertical_grid(Monitor *m) { ? 0 : borderpx; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) { + ((m->isoverview && !client_should_ignore_focus_open(c)) || + ISTILED(c))) { cx = m->w.x + (i / rows) * (cw + target_gappi); cy = m->w.y + (i % rows) * (ch + target_gappi); if (overrows && i >= n - overrows) { diff --git a/src/mango.c b/src/mango.c index 3a5d28b..061d39a 100644 --- a/src/mango.c +++ b/src/mango.c @@ -1305,7 +1305,7 @@ void applyrules(Client *c) { // if no geom rule hit and is normal winodw, use the center pos and record // the hit size if (!hit_rule_pos && - (!client_is_x11(c) || !client_should_ignore_focus(c))) { + (!client_is_x11(c) || !client_should_ignore_focus_open(c))) { c->float_geom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0); } @@ -3080,9 +3080,8 @@ void focusclient(Client *c, int lift) { if (c && !client_surface(c)->mapped) return; - if (c && client_should_ignore_focus(c)) { + if (c && client_should_ignore_focus_always(c)) return; - } /* Raise client in stacking order if requested */ if (c && lift) @@ -3598,7 +3597,7 @@ mapnotify(struct wl_listener *listener, void *data) { init_client_properties(c); // set special window properties - if (client_is_unmanaged(c) || client_should_ignore_focus(c)) { + if (client_is_unmanaged(c) || client_should_ignore_focus_open(c)) { c->bw = 0; c->isnoborder = 1; } else { @@ -4399,7 +4398,7 @@ setfloating(Client *c, int floating) { } // 重新计算居中的坐标 - if (!client_is_x11(c) || !client_should_ignore_focus(c)) + if (!client_is_x11(c) || !client_should_ignore_focus_open(c)) target_box = setclient_coordinate_center(c, target_box, 0, 0); backup_box = c->geom; hit = applyrulesgeom(c); @@ -4708,7 +4707,7 @@ void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus) { setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ } - if (focus) { + if (focus && !client_should_ignore_focus_open(c)) { focusclient(focustop(selmon), 1); }