diff --git a/docs/configuration/monitors.md b/docs/configuration/monitors.md index 084db60c..a8001ae0 100644 --- a/docs/configuration/monitors.md +++ b/docs/configuration/monitors.md @@ -163,6 +163,8 @@ Some GPUs have compatibility issues with `syncobj_enable=1` — it may crash app ## Power Management You can control monitor power using the `mmsg` IPC tool. +> Notice: This command does not remove the monitor, it only turns it off. +> if you want completely remove monitor, just use `wlr-randr` ```bash # Turn off @@ -178,13 +180,13 @@ mmsg dispatch toggle_monitor,eDP-1 You can also use `wlr-randr` for monitor management: ```bash -# Turn off monitor +# remove a monitor wlr-randr --output eDP-1 --off -# Turn on monitor +# add a monitor wlr-randr --output eDP-1 --on -# Show all monitors +# Show all monitors spec wlr-randr ``` diff --git a/docs/window-management/rules.md b/docs/window-management/rules.md index 7e221bf1..b5ae81b1 100644 --- a/docs/window-management/rules.md +++ b/docs/window-management/rules.md @@ -183,6 +183,9 @@ tagrule=id:Values,monitor_make:xxx,monitor_model:xxx,Parameter:Values | `no_hide` | integer | `0` / `1` | Not hide even if the tag is empty | | `nmaster` | integer | 0, 99 | Number of master windows | | `mfact` | float | 0.1–0.9 | Master area factor | +| `scroller_default_proportion` | float | 0.1-1.0 | Set scroller default proportion. | +| `scroller_default_proportion_single` | float | 0.1-1.0 | Set scroller auto adjust proportion when it is single window(only apply when set `scroller_ignore_proportion_single` to `0`) | +| `scroller_ignore_proportion_single` | integer | `0` / `1` | Ignore scroller single proportion setting. | ### Examples @@ -204,6 +207,10 @@ tagrule=id:4,monitor_name:eDP-1,no_hide:1,layout_name:scroller # Advanced tag configuration with master layout settings tagrule=id:5,layout_name:tile,nmaster:2,mfact:0.6 tagrule=id:6,monitor_name:HDMI-A-1,layout_name:monocle,no_render_border:1 + +# set scroller proportion for specific tag +tagrule=id:1,layout_name:scroller,scroller_default_proportion_single:0.5,scroller_ignore_proportion_single:0,scroller_default_proportion:0.9,monitor_name:HDMI-A-1 + ``` > **Tip:** For Waybar configuration with persistent tags, see [Status Bar](/docs/visuals/status-bar) documentation. diff --git a/src/animation/client.h b/src/animation/client.h index 07d828ee..91920c4b 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -587,17 +587,6 @@ void client_set_drop_area(Client *c) { bool dwindle_familiar = cur_layout->id == DWINDLE && config.dwindle_drop_simple_split; - uint32_t nmaster = c->mon->pertag->nmasters[c->mon->pertag->curtag]; - - bool should_swap = - (cur_layout->id == DECK || cur_layout->id == VERTICAL_DECK || - cur_layout->id == MONOCLE || cur_layout->id == GRID || - cur_layout->id == FAIR || cur_layout->id == VERTICAL_FAIR || - cur_layout->id == VERTICAL_GRID) || - ((cur_layout->id == TILE || cur_layout->id == VERTICAL_TILE || - cur_layout->id == CENTER_TILE || cur_layout->id == RIGHT_TILE) && - nmaster == 1 && c->ismaster); - if (dwindle_familiar) { bool split_h = c->geom.width >= c->geom.height; float ratio = config.dwindle_split_ratio; @@ -631,42 +620,87 @@ void client_set_drop_area(Client *c) { client_height - (int32_t)(client_height * ratio); } } - } else if (should_swap) { - drop_box.x = bw; - drop_box.y = bw; - drop_box.width = client_width; - drop_box.height = client_height; - drop_direction = UNDIR; } else if (cur_layout->id == TILE || cur_layout->id == DECK || cur_layout->id == CENTER_TILE || cur_layout->id == RIGHT_TILE) { - if (rel_y < client_height * 0.5) { - drop_direction = UP; - drop_box.x = bw; - drop_box.y = bw; - drop_box.width = client_width; - drop_box.height = client_height / 2; + + if (c->ismaster) { + if (c->mon->visible_tiling_clients == 1) { + if (rel_x < client_width * 0.5) { + drop_direction = LEFT; + drop_box.x = bw; + drop_box.y = bw; + drop_box.width = client_width / 2; + drop_box.height = client_height; + } else { + drop_direction = RIGHT; + drop_box.x = bw + client_width / 2; + drop_box.y = bw; + drop_box.width = client_width / 2; + drop_box.height = client_height; + } + } else { + drop_box.x = bw; + drop_box.y = bw; + drop_box.width = client_width; + drop_box.height = client_height; + drop_direction = UNDIR; + } } else { - drop_direction = DOWN; - drop_box.x = bw; - drop_box.y = bw + client_height / 2; - drop_box.width = client_width; - drop_box.height = client_height / 2; + if (rel_y < client_height * 0.5) { + drop_direction = UP; + drop_box.x = bw; + drop_box.y = bw; + drop_box.width = client_width; + drop_box.height = client_height / 2; + } else { + drop_direction = DOWN; + drop_box.x = bw; + drop_box.y = bw + client_height / 2; + drop_box.width = client_width; + drop_box.height = client_height / 2; + } } } else if (cur_layout->id == VERTICAL_TILE || cur_layout->id == VERTICAL_DECK) { - if (rel_x < client_width * 0.5) { - drop_direction = LEFT; - drop_box.x = bw; - drop_box.y = bw; - drop_box.width = client_width / 2; - drop_box.height = client_height; + if (c->ismaster) { + if (c->mon->visible_tiling_clients == 1) { + if (rel_y < client_height * 0.5) { + drop_direction = UP; + drop_box.x = bw; + drop_box.y = bw; + drop_box.width = client_width; + drop_box.height = client_height / 2; + } else { + drop_direction = DOWN; + drop_box.x = bw; + drop_box.y = bw + client_height / 2; + drop_box.width = client_width; + drop_box.height = client_height / 2; + } + } else { + drop_box.x = bw; + drop_box.y = bw; + drop_box.width = client_width; + drop_box.height = client_height; + drop_direction = UNDIR; + } + } else { - drop_direction = RIGHT; - drop_box.x = bw + client_width / 2; - drop_box.y = bw; - drop_box.width = client_width / 2; - drop_box.height = client_height; + if (rel_x < client_width * 0.5) { + drop_direction = LEFT; + drop_box.x = bw; + drop_box.y = bw; + drop_box.width = client_width / 2; + drop_box.height = client_height; + } else { + drop_direction = RIGHT; + drop_box.x = bw + client_width / 2; + drop_box.y = bw; + drop_box.width = client_width / 2; + drop_box.height = client_height; + } } + } else { double dist_left = rel_x; double dist_right = client_width - rel_x; diff --git a/src/animation/tag.h b/src/animation/tag.h index c46b9fd0..893d4b0b 100644 --- a/src/animation/tag.h +++ b/src/animation/tag.h @@ -117,6 +117,9 @@ void set_arrange_hidden(Monitor *m, Client *c, bool want_animation) { c->animation.tagining = false; set_tagout_animation(m, c); } else { + c->animation.running = false; wlr_scene_node_set_enabled(&c->scene->node, false); + c->animainit_geom = c->current = c->pending = c->animation.current = + c->geom; } } diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 76574b5b..12243d76 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -165,6 +165,9 @@ typedef struct { char *monitor_serial; float mfact; int32_t nmaster; + float scroller_default_proportion; + float scroller_default_proportion_single; + int32_t scroller_ignore_proportion_single; int32_t no_render_border; int32_t open_as_floating; int32_t no_hide; @@ -1973,6 +1976,9 @@ bool parse_option(Config *config, char *key, char *value) { rule->no_render_border = 0; rule->open_as_floating = 0; rule->no_hide = 0; + rule->scroller_default_proportion = 0.0f; + rule->scroller_default_proportion_single = 0.0f; + rule->scroller_ignore_proportion_single = -1; bool parse_error = false; char *token = strtok(value, ","); @@ -2008,6 +2014,17 @@ bool parse_option(Config *config, char *key, char *value) { rule->nmaster = CLAMP_INT(atoi(val), 1, 99); } else if (strcmp(key, "mfact") == 0) { rule->mfact = CLAMP_FLOAT(atof(val), 0.1f, 0.9f); + } else if (strcmp(key, "scroller_default_proportion") == 0) { + rule->scroller_default_proportion = + CLAMP_FLOAT(atof(val), 0.0f, 1.0f); + } else if (strcmp(key, "scroller_default_proportion_single") == + 0) { + rule->scroller_default_proportion_single = + CLAMP_FLOAT(atof(val), 0.0f, 1.0f); + } else if (strcmp(key, "scroller_ignore_proportion_single") == + 0) { + rule->scroller_ignore_proportion_single = + CLAMP_INT(atoi(val), 0, 1); } else { fprintf(stderr, "\033[1m\033[31m[ERROR]:\033[33m Unknown " @@ -3771,6 +3788,12 @@ void parse_tagrule(Monitor *m) { for (i = 0; i <= LENGTH(tags); i++) { m->pertag->nmasters[i] = config.default_nmaster; m->pertag->mfacts[i] = config.default_mfact; + m->pertag->scroller_default_proportion[i] = + config.scroller_default_proportion; + m->pertag->scroller_default_proportion_single[i] = + config.scroller_default_proportion_single; + m->pertag->scroller_ignore_proportion_single[i] = + config.scroller_ignore_proportion_single; } for (i = 0; i < config.tag_rules_count; i++) { @@ -3825,6 +3848,15 @@ void parse_tagrule(Monitor *m) { m->pertag->no_render_border[tr.id] = tr.no_render_border; if (tr.open_as_floating >= 0) m->pertag->open_as_floating[tr.id] = tr.open_as_floating; + if (tr.scroller_default_proportion > 0.0f) + m->pertag->scroller_default_proportion[tr.id] = + tr.scroller_default_proportion; + if (tr.scroller_default_proportion_single > 0.0f) + m->pertag->scroller_default_proportion_single[tr.id] = + tr.scroller_default_proportion_single; + if (tr.scroller_ignore_proportion_single >= 0) + m->pertag->scroller_ignore_proportion_single[tr.id] = + tr.scroller_ignore_proportion_single; } } diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 43e6a6e5..1e39386c 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1356,9 +1356,9 @@ int32_t togglefullscreen(const Arg *arg) { sel->isnamedscratchpad = 0; if (sel->isfullscreen) - setfullscreen(sel, 0); + setfullscreen(sel, 0, true); else - setfullscreen(sel, 1); + setfullscreen(sel, 1, true); return 0; } @@ -1402,9 +1402,9 @@ int32_t togglemaximizescreen(const Arg *arg) { sel->isnamedscratchpad = 0; if (sel->ismaximizescreen) - setmaximizescreen(sel, 0); + setmaximizescreen(sel, 0, true); else - setmaximizescreen(sel, 1); + setmaximizescreen(sel, 1, true); setborder_color(sel); return 0; @@ -1761,7 +1761,12 @@ int32_t toggleoverview(const Arg *arg) { if (selmon->isoverview) { wlr_seat_pointer_clear_focus(seat); - wlr_cursor_set_xcursor(cursor, cursor_mgr, "default"); + + if (cursor_hidden) { + handlecursoractivity(); + } else { + wlr_cursor_set_xcursor(cursor, cursor_mgr, "default"); + } wl_list_for_each(c, &clients, link) { if (c && c->mon == selmon && !client_is_unmanaged(c) && diff --git a/src/ext-protocol/ext-workspace.h b/src/ext-protocol/ext-workspace.h index 5d040e48..82b7ef1f 100644 --- a/src/ext-protocol/ext-workspace.h +++ b/src/ext-protocol/ext-workspace.h @@ -188,10 +188,10 @@ void refresh_monitors_workspaces_status(Monitor *m) { int32_t i; if (m->isoverview) { + add_workspace_by_tag(0, m); for (i = 1; i <= LENGTH(tags); i++) { remove_workspace_by_tag(i, m); } - add_workspace_by_tag(0, m); } else { remove_workspace_by_tag(0, m); for (i = 1; i <= LENGTH(tags); i++) { diff --git a/src/ext-protocol/foreign-toplevel.h b/src/ext-protocol/foreign-toplevel.h index 4fdbbe98..a8c49c77 100644 --- a/src/ext-protocol/foreign-toplevel.h +++ b/src/ext-protocol/foreign-toplevel.h @@ -16,12 +16,12 @@ void handle_foreign_maximize_request(struct wl_listener *listener, void *data) { return; if (c->ismaximizescreen && !event->maximized) { - setmaximizescreen(c, 0); + setmaximizescreen(c, 0, true); return; } if (!c->ismaximizescreen && event->maximized) { - setmaximizescreen(c, 1); + setmaximizescreen(c, 1, true); return; } } @@ -59,12 +59,12 @@ void handle_foreign_fullscreen_request(struct wl_listener *listener, return; if (c->isfullscreen && !event->fullscreen) { - setfullscreen(c, 0); + setfullscreen(c, 0, true); return; } if (!c->isfullscreen && event->fullscreen) { - setfullscreen(c, 1); + setfullscreen(c, 1, true); return; } } diff --git a/src/fetch/common.h b/src/fetch/common.h index f58bd33a..acb5d0e8 100644 --- a/src/fetch/common.h +++ b/src/fetch/common.h @@ -160,11 +160,26 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, if (pl) *pl = l; - if (selmon && selmon->isoverview && (!l || layer_ignores_focus(l))) { + if (selmon && selmon->isoverview && config.ov_no_resize) { ovc = xytoclient(x, y); - if (pc) - *pc = ovc; - if (psurface && ovc) - *psurface = client_surface(ovc); + + bool is_below = false; + if (l && l->layer_surface) { + is_below = (l->layer_surface->current.layer == + ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || + l->layer_surface->current.layer == + ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM); + } + + if (ovc && (!l || layer_ignores_focus(l) || is_below)) { + if (pc) + *pc = ovc; + + if (psurface) + *psurface = ovc ? client_surface(ovc) : NULL; + + if (pl && ovc) + *pl = NULL; + } } } \ No newline at end of file diff --git a/src/layout/arrange.h b/src/layout/arrange.h index eab3ac00..0a39b248 100644 --- a/src/layout/arrange.h +++ b/src/layout/arrange.h @@ -25,6 +25,9 @@ void set_size_per(Monitor *m, Client *c) { c->master_inner_per = 1.0f; c->stack_inner_per = 1.0f; } + + c->scroller_proportion = + m->pertag->scroller_default_proportion[m->pertag->curtag]; } void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx, diff --git a/src/layout/scroll.h b/src/layout/scroll.h index f6852daa..b800c5cf 100644 --- a/src/layout/scroll.h +++ b/src/layout/scroll.h @@ -284,6 +284,10 @@ void scroller(Monitor *m) { uint32_t tag = m->pertag->curtag; struct TagScrollerState *st = ensure_scroller_state(m, tag); Client *c = NULL; + float scroller_default_proportion_single = + m->pertag->scroller_default_proportion_single[tag]; + int32_t scroller_ignore_proportion_single = + m->pertag->scroller_ignore_proportion_single[tag]; /* 按全局客户端链表顺序收集所有堆叠头,确保视觉顺序正确 */ struct ScrollerStackNode *heads[64]; @@ -323,14 +327,13 @@ void scroller(Monitor *m) { m->w.width - 2 * config.scroller_structs - cur_gappih; /* 单客户端特例 */ - if (n_heads == 1 && !config.scroller_ignore_proportion_single && + if (n_heads == 1 && !scroller_ignore_proportion_single && !heads[0]->client->isfullscreen && !heads[0]->client->ismaximizescreen) { struct ScrollerStackNode *head = heads[0]; - float single_proportion = - head->scroller_proportion_single > 0.0f - ? head->scroller_proportion_single - : config.scroller_default_proportion_single; + float single_proportion = head->scroller_proportion_single > 0.0f + ? head->scroller_proportion_single + : scroller_default_proportion_single; struct wlr_box target_geom; target_geom.height = m->w.height - 2 * cur_gappov; target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion; @@ -420,7 +423,7 @@ void scroller(Monitor *m) { max_client_width) > m->w.width - 2 * config.scroller_structs - cur_gappih))); - if (n_heads == 1 && config.scroller_ignore_proportion_single) { + if (n_heads == 1 && scroller_ignore_proportion_single) { need_scroller = true; } if (start_drag_window) @@ -507,6 +510,10 @@ void vertical_scroller(Monitor *m) { uint32_t tag = m->pertag->curtag; struct TagScrollerState *st = ensure_scroller_state(m, tag); Client *c = NULL; + float scroller_default_proportion_single = + m->pertag->scroller_default_proportion_single[tag]; + int32_t scroller_ignore_proportion_single = + m->pertag->scroller_ignore_proportion_single[tag]; /* 按全局顺序收集堆叠头 */ struct ScrollerStackNode *heads[64]; @@ -542,14 +549,13 @@ void vertical_scroller(Monitor *m) { int32_t max_client_height = m->w.height - 2 * config.scroller_structs - cur_gappiv; - if (n_heads == 1 && !config.scroller_ignore_proportion_single && + if (n_heads == 1 && !scroller_ignore_proportion_single && !heads[0]->client->isfullscreen && !heads[0]->client->ismaximizescreen) { struct ScrollerStackNode *head = heads[0]; - float single_proportion = - head->scroller_proportion_single > 0.0f - ? head->scroller_proportion_single - : config.scroller_default_proportion_single; + float single_proportion = head->scroller_proportion_single > 0.0f + ? head->scroller_proportion_single + : scroller_default_proportion_single; struct wlr_box target_geom; target_geom.width = m->w.width - 2 * cur_gappoh; target_geom.height = (m->w.height - 2 * cur_gappov) * single_proportion; @@ -638,7 +644,7 @@ void vertical_scroller(Monitor *m) { max_client_height) > m->w.height - 2 * config.scroller_structs - cur_gappiv))); - if (n_heads == 1 && config.scroller_ignore_proportion_single) { + if (n_heads == 1 && scroller_ignore_proportion_single) { need_scroller = true; } if (start_drag_window) @@ -743,9 +749,9 @@ void scroller_insert_stack(Client *c, Client *target_client, return; if (c->isfullscreen) - setfullscreen(c, 0); + setfullscreen(c, 0, true); if (c->ismaximizescreen) - setmaximizescreen(c, 0); + setmaximizescreen(c, 0, true); Monitor *m = c->mon; uint32_t tag = m->pertag->curtag; @@ -785,9 +791,9 @@ void scroller_insert_stack(Client *c, Client *target_client, head = head->prev_in_stack; Client *stack_head = head->client; if (stack_head->ismaximizescreen) - setmaximizescreen(stack_head, 0); + setmaximizescreen(stack_head, 0, true); if (stack_head->isfullscreen) - setfullscreen(stack_head, 0); + setfullscreen(stack_head, 0, true); /* 同步到 Client 字段 */ sync_scroller_state_to_clients(m, tag); diff --git a/src/mango.c b/src/mango.c index fe251837..0e274caf 100644 --- a/src/mango.c +++ b/src/mango.c @@ -746,8 +746,9 @@ static void run(char *startup_cmd); static void setcursor(struct wl_listener *listener, void *data); static void setfloating(Client *c, int32_t floating); static void setfakefullscreen(Client *c, int32_t fakefullscreen); -static void setfullscreen(Client *c, int32_t fullscreen); -static void setmaximizescreen(Client *c, int32_t maximizescreen); +static void setfullscreen(Client *c, int32_t fullscreen, bool rearrange); +static void setmaximizescreen(Client *c, int32_t maximizescreen, + bool rearrange); static void reset_maximizescreen_size(Client *c); static void setgaps(int32_t oh, int32_t ov, int32_t ih, int32_t iv); @@ -1045,6 +1046,9 @@ struct Pertag { int32_t no_hide[LENGTH(tags) + 1]; int32_t no_render_border[LENGTH(tags) + 1]; int32_t open_as_floating[LENGTH(tags) + 1]; + float scroller_default_proportion[LENGTH(tags) + 1]; + float scroller_default_proportion_single[LENGTH(tags) + 1]; + int32_t scroller_ignore_proportion_single[LENGTH(tags) + 1]; struct DwindleNode *dwindle_root[LENGTH(tags) + 1]; const Layout *ltidxs[LENGTH(tags) + 1]; struct TagScrollerState *scroller_state[LENGTH(tags) + 1]; @@ -1171,11 +1175,11 @@ void clear_fullscreen_flag(Client *c) { } if (c->isfullscreen) { - setfullscreen(c, false); + setfullscreen(c, false, true); } if (c->ismaximizescreen) { - setmaximizescreen(c, 0); + setmaximizescreen(c, 0, true); } } @@ -1767,7 +1771,7 @@ void applyrules(Client *c) { view_in_mon(&(Arg){.ui = c->tags}, true, c->mon, true); } - setfullscreen(c, fullscreen_state_backup); + setfullscreen(c, fullscreen_state_backup, true); if (c->isfakefullscreen) { setfakefullscreen(c, 1); @@ -2221,9 +2225,10 @@ void hold_end(struct wl_listener *listener, void *data) { Client *find_closest_tiled_client(Client *c) { Client *tc, *closest = NULL; long min_dist = LONG_MAX; + Monitor *cursor_mon = xytomon(cursor->x, cursor->y); wl_list_for_each(tc, &clients, link) { - if (tc == c || !ISTILED(tc) || !VISIBLEON(tc, c->mon)) + if (tc == c || !ISTILED(tc) || !VISIBLEON(tc, cursor_mon)) continue; if (cursor->x >= tc->geom.x && @@ -2255,7 +2260,9 @@ void place_drag_tile_client(Client *c) { if (closest->drop_direction == UNDIR) { setfloating(c, 0); - exchange_two_client(c, closest); + wl_list_remove(&c->link); + wl_list_insert(closest->link.prev, &c->link); + arrange(closest->mon, false, false); return; } @@ -2354,6 +2361,17 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) { } } + // overview模式下鼠标左键跳转,右键关闭窗口 + if (selmon && selmon->isoverview && event->button == BTN_LEFT && c) { + toggleoverview(&(Arg){.i = 1}); + return true; + } + + if (selmon && selmon->isoverview && event->button == BTN_RIGHT && c) { + pending_kill_client(c); + return true; + } + // 当鼠标焦点在layer上的时候,不检测虚拟键盘的mod状态, // 避免layer虚拟键盘锁死mod按键状态 hard_keyboard = &kb_group->wlr_group->keyboard; @@ -2370,16 +2388,6 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) { break; m = &config.mouse_bindings[ji]; - if (selmon->isoverview && event->button == BTN_LEFT && c) { - toggleoverview(&(Arg){.i = 1}); - return true; - } - - if (selmon->isoverview && event->button == BTN_RIGHT && c) { - pending_kill_client(c); - return true; - } - if (CLEANMASK(mods) == CLEANMASK(m->mod) && event->button == m->button && m->func && (CLEANMASK(m->mod) != 0 || @@ -3892,7 +3900,7 @@ fullscreennotify(struct wl_listener *listener, void *data) { if (!c || c->iskilling) return; - setfullscreen(c, client_wants_fullscreen(c)); + setfullscreen(c, client_wants_fullscreen(c), true); } void requestmonstate(struct wl_listener *listener, void *data) { @@ -4517,9 +4525,9 @@ void maximizenotify(struct wl_listener *listener, void *data) { } if (client_request_maximize(c, data)) { - setmaximizescreen(c, 1); + setmaximizescreen(c, 1, true); } else { - setmaximizescreen(c, 0); + setmaximizescreen(c, 0, true); } } @@ -5451,7 +5459,7 @@ void exit_scroller_stack(Client *c) { } } -void setmaximizescreen(Client *c, int32_t maximizescreen) { +void setmaximizescreen(Client *c, int32_t maximizescreen, bool rearrange) { struct wlr_box maximizescreen_box; if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling) return; @@ -5492,7 +5500,8 @@ void setmaximizescreen(Client *c, int32_t maximizescreen) { client_set_maximized(c, true); } - arrange(c->mon, false, false); + if (rearrange) + arrange(c->mon, false, false); } void setfakefullscreen(Client *c, int32_t fakefullscreen) { @@ -5501,12 +5510,13 @@ void setfakefullscreen(Client *c, int32_t fakefullscreen) { return; if (c->isfullscreen) - setfullscreen(c, 0); + setfullscreen(c, 0, true); client_set_fullscreen(c, fakefullscreen); } -void setfullscreen(Client *c, int32_t fullscreen) // 用自定义全屏代理自带全屏 +void setfullscreen(Client *c, int32_t fullscreen, + bool rearrange) // 用自定义全屏代理自带全屏 { if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling) @@ -5552,7 +5562,8 @@ void setfullscreen(Client *c, int32_t fullscreen) // 用自定义全屏代理自 layers[fullscreen || c->isfloating ? LyrTop : LyrTile]); } - arrange(c->mon, false, false); + if (rearrange) + arrange(c->mon, false, false); } void setgaps(int32_t oh, int32_t ov, int32_t ih, int32_t iv) { @@ -5681,7 +5692,8 @@ void setmon(Client *c, Monitor *m, uint32_t newtags, bool focus) { client_reset_mon_tags(c, m, newtags); check_match_tag_floating_rule(c, m); setfloating(c, c->isfloating); - setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ + setfullscreen(c, c->isfullscreen, + true); /* This will call arrange(c->mon) */ } if (focus && !client_is_x11_popup(c)) { @@ -6282,13 +6294,13 @@ void overview_restore(Client *c, const Arg *arg) { resize(c, c->overview_backup_geom, 0); } else if (c->isfullscreen || c->ismaximizescreen) { if (want_restore_fullscreen(c) && c->ismaximizescreen) { - setmaximizescreen(c, 1); + setmaximizescreen(c, 1, false); } else if (want_restore_fullscreen(c) && c->isfullscreen) { - setfullscreen(c, 1); + setfullscreen(c, 1, false); } else { client_pending_fullscreen_state(c, 0); client_pending_maximized_state(c, 0); - setfullscreen(c, false); + setfullscreen(c, false, false); } } else { if (c->is_restoring_from_ov) { @@ -6487,8 +6499,8 @@ void unmapnotify(struct wl_listener *listener, void *data) { } if (c->swallowedby) { - setmaximizescreen(c->swallowedby, c->ismaximizescreen); - setfullscreen(c->swallowedby, c->isfullscreen); + setmaximizescreen(c->swallowedby, c->ismaximizescreen, true); + setfullscreen(c->swallowedby, c->isfullscreen, true); c->swallowedby->swallowing = NULL; c->swallowedby = NULL; }