opt: improve some risk judgments

This commit is contained in:
DreamMaoMao 2026-02-21 16:37:37 +08:00
parent 4ec2366498
commit bcace97c30
3 changed files with 113 additions and 6 deletions

View file

@ -1401,6 +1401,9 @@ void applyrules(Client *c) {
Client *fc = NULL;
Client *parent = NULL;
if (!c)
return;
parent = client_get_parent(c);
Monitor *mon = parent && parent->mon ? parent->mon : selmon;
@ -1489,7 +1492,8 @@ void applyrules(Client *c) {
/*-----------------------apply rule action-------------------------*/
// rule action only apply after map not apply in the init commit
if (!client_surface(c)->mapped)
struct wlr_surface *surface = client_surface(c);
if (!surface || !surface->mapped)
return;
// apply swallow rule
@ -1515,6 +1519,7 @@ void applyrules(Client *c) {
setmon(c, mon, newtags,
!c->isopensilent &&
!(client_is_x11_popup(c) && client_should_ignore_focus(c)) &&
mon &&
(!c->istagsilent || !newtags ||
newtags & mon->tagset[mon->seltags]));
@ -1536,7 +1541,7 @@ void applyrules(Client *c) {
window in the current tag will exit fullscreen and participate in tiling
*/
wl_list_for_each(fc, &clients,
link) if (fc && fc != c && c->tags & fc->tags &&
link) if (fc && fc != c && c->tags & fc->tags && c->mon &&
VISIBLEON(fc, c->mon) && ISFULLSCREEN(fc) &&
!c->isfloating) {
clear_fullscreen_flag(fc);
@ -1555,7 +1560,7 @@ void applyrules(Client *c) {
}
// apply overlay rule
if (c->isoverlay) {
if (c->isoverlay && c->scene) {
wlr_scene_node_reparent(&c->scene->node, layers[LyrOverlay]);
wlr_scene_node_raise_to_top(&c->scene->node);
}