From 47cf6a1a843bceb7c63d06a1275bb8d9352c3b97 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 14 May 2025 11:33:37 +0800 Subject: [PATCH] opt: opt func name --- src/client/client.h | 6 +++--- src/maomao.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/client.h b/src/client/client.h index 0eb79b8..4c4e783 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -363,7 +363,7 @@ static inline void client_set_suspended(Client *c, int suspended) { wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended); } -static inline int client_surface_wants_focus(Client *c) { +static inline int client_should_ignore_focus(Client *c) { #ifdef XWAYLAND if (client_is_x11(c)) { @@ -384,12 +384,12 @@ static inline int client_surface_wants_focus(Client *c) { for (size_t i = 0; i < sizeof(no_focus_types) / sizeof(no_focus_types[0]); ++i) { if (wlr_xwayland_surface_has_window_type(surface, no_focus_types[i])) { - return 0; + return 1; } } } #endif - return 1; + return 0; } static inline int client_wants_focus(Client *c) { diff --git a/src/maomao.c b/src/maomao.c index 9241567..465f78c 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -1763,7 +1763,7 @@ applyrulesgeom(Client *c) { c->geom.height = r->height > 0 ? r->height : c->geom.height; // 重新计算居中的坐标 if (r->offsetx || r->offsety || - (!client_is_x11(c) || client_surface_wants_focus(c))) + (!client_is_x11(c) || !client_should_ignore_focus(c))) c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety); hit = r->height > 0 || r->width > 0 || r->offsetx != 0 || r->offsety != 0 ? 1 @@ -1827,7 +1827,7 @@ applyrules(Client *c) { c->geom.height = r->height > 0 ? r->height : c->geom.height; // 重新计算居中的坐标 if (r->offsetx || r->offsety || - (!client_is_x11(c) || client_surface_wants_focus(c))) + (!client_is_x11(c) || !client_should_ignore_focus(c))) c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety); } @@ -3733,7 +3733,7 @@ void focusclient(Client *c, int lift) { if (c && c->animation.tagouting && !c->animation.tagouting) return; - if (c && !client_surface_wants_focus(c)) { + if (c && client_should_ignore_focus(c)) { return; } @@ -3877,7 +3877,7 @@ Client * // 0.5 focustop(Monitor *m) { Client *c; wl_list_for_each(c, &fstack, flink) { - if (c->iskilling || !client_surface_wants_focus(c)) + if (c->iskilling || client_should_ignore_focus(c)) continue; if (VISIBLEON(c, m)) return c; @@ -4310,7 +4310,7 @@ mapnotify(struct wl_listener *listener, void *data) { client_get_geometry(c, &c->geom); - if (client_is_unmanaged(c) || !client_surface_wants_focus(c)) { + if (client_is_unmanaged(c) || client_should_ignore_focus(c)) { c->bw = 0; c->isnoborder = 1; } else { @@ -5337,7 +5337,7 @@ setfloating(Client *c, int floating) { target_box.width = target_box.width * 0.8; } // 重新计算居中的坐标 - if (!client_is_x11(c) || client_surface_wants_focus(c)) + if (!client_is_x11(c) || !client_should_ignore_focus(c)) target_box = setclient_coordinate_center(target_box, 0, 0); backup_box = c->geom; hit = applyrulesgeom(c);