opt: optimize x11 popup focus ignore
This commit is contained in:
@@ -402,7 +402,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_should_ignore_focus_always(Client *c) {
|
||||
static inline int client_should_ignore_focus(Client *c) {
|
||||
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
@@ -417,7 +417,7 @@ static inline int client_should_ignore_focus_always(Client *c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int client_should_ignore_focus_open(Client *c) {
|
||||
static inline int client_is_x11_popup(Client *c) {
|
||||
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
|
||||
@@ -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_open(c))
|
||||
client_is_x11_popup(c))
|
||||
continue;
|
||||
|
||||
if (selmon && !selmon->sel) {
|
||||
@@ -1457,11 +1457,11 @@ int toggleoverview(const Arg *arg) {
|
||||
unsigned int visible_client_number = 0;
|
||||
|
||||
if (selmon->isoverview) {
|
||||
wl_list_for_each(c, &clients,
|
||||
link) if (c && c->mon == selmon &&
|
||||
!client_is_unmanaged(c) &&
|
||||
!client_should_ignore_focus_open(c) &&
|
||||
!c->isminied && !c->isunglobal) {
|
||||
wl_list_for_each(c, &clients, link) if (c && c->mon == selmon &&
|
||||
!client_is_unmanaged(c) &&
|
||||
!client_is_x11_popup(c) &&
|
||||
!c->isminied &&
|
||||
!c->isunglobal) {
|
||||
visible_client_number++;
|
||||
}
|
||||
if (visible_client_number > 0) {
|
||||
@@ -1484,15 +1484,14 @@ 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_open(c) && !c->isunglobal)
|
||||
!client_is_x11_popup(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_open(c) &&
|
||||
client_surface(c)->mapped)
|
||||
!client_is_x11_popup(c) && client_surface(c)->mapped)
|
||||
overview_restore(c, &(Arg){.ui = target});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ void grid(Monitor *m) {
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus_open(c)) ||
|
||||
ISTILED(c))) {
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
cw = (m->w.width - 2 * target_gappo) * single_width_ratio;
|
||||
ch = (m->w.height - 2 * target_gappo) * single_height_ratio;
|
||||
c->geom.x = m->w.x + (m->w.width - cw) / 2;
|
||||
@@ -55,8 +54,7 @@ void grid(Monitor *m) {
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus_open(c)) ||
|
||||
ISTILED(c))) {
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
if (i == 0) {
|
||||
c->geom.x = m->w.x + target_gappo;
|
||||
c->geom.y = m->w.y + (m->w.height - ch) / 2 + target_gappo;
|
||||
@@ -106,8 +104,7 @@ void grid(Monitor *m) {
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus_open(c)) ||
|
||||
ISTILED(c))) {
|
||||
((m->isoverview && !client_is_x11_popup(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) {
|
||||
|
||||
@@ -310,8 +310,7 @@ void vertical_grid(Monitor *m) {
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus_open(c)) ||
|
||||
ISTILED(c))) {
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
ch = (m->w.height - 2 * target_gappo) * single_height_ratio;
|
||||
cw = (m->w.width - 2 * target_gappo) * single_width_ratio;
|
||||
c->geom.x = m->w.x + (m->w.width - cw) / 2;
|
||||
@@ -338,8 +337,7 @@ void vertical_grid(Monitor *m) {
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus_open(c)) ||
|
||||
ISTILED(c))) {
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
if (i == 0) {
|
||||
c->geom.x = m->w.x + (m->w.width - cw) / 2 + target_gappo;
|
||||
c->geom.y = m->w.y + target_gappo;
|
||||
@@ -385,8 +383,7 @@ void vertical_grid(Monitor *m) {
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus_open(c)) ||
|
||||
ISTILED(c))) {
|
||||
((m->isoverview && !client_is_x11_popup(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) {
|
||||
|
||||
11
src/mango.c
11
src/mango.c
@@ -1304,8 +1304,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_open(c))) {
|
||||
if (!hit_rule_pos && (!client_is_x11(c) || !client_is_x11_popup(c))) {
|
||||
c->float_geom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
}
|
||||
|
||||
@@ -3080,7 +3079,7 @@ void focusclient(Client *c, int lift) {
|
||||
if (c && !client_surface(c)->mapped)
|
||||
return;
|
||||
|
||||
if (c && client_should_ignore_focus_always(c))
|
||||
if (c && client_should_ignore_focus(c) && client_is_x11_popup(c))
|
||||
return;
|
||||
|
||||
/* Raise client in stacking order if requested */
|
||||
@@ -3597,7 +3596,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_open(c)) {
|
||||
if (client_is_unmanaged(c) || client_is_x11_popup(c)) {
|
||||
c->bw = 0;
|
||||
c->isnoborder = 1;
|
||||
} else {
|
||||
@@ -4398,7 +4397,7 @@ setfloating(Client *c, int floating) {
|
||||
}
|
||||
|
||||
// 重新计算居中的坐标
|
||||
if (!client_is_x11(c) || !client_should_ignore_focus_open(c))
|
||||
if (!client_is_x11(c) || !client_is_x11_popup(c))
|
||||
target_box = setclient_coordinate_center(c, target_box, 0, 0);
|
||||
backup_box = c->geom;
|
||||
hit = applyrulesgeom(c);
|
||||
@@ -4707,7 +4706,7 @@ void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus) {
|
||||
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
|
||||
}
|
||||
|
||||
if (focus && !client_should_ignore_focus_open(c)) {
|
||||
if (focus && !client_is_x11_popup(c)) {
|
||||
focusclient(focustop(selmon), 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user