diff --git a/src/mango.c b/src/mango.c index f5583c3..54b99ad 100644 --- a/src/mango.c +++ b/src/mango.c @@ -689,7 +689,7 @@ static Client *termforwin(Client *w); static void swallow(Client *c, Client *w); static void warp_cursor_to_selmon(Monitor *m); -uint32_t want_restore_fullscreen(Client *target_client); +static bool want_restore_fullscreen(Client *target_client); static void overview_restore(Client *c, const Arg *arg); static void overview_backup(Client *c); static void set_minimized(Client *c); @@ -1003,11 +1003,7 @@ void clear_fullscreen_and_maximized_state(Monitor *m) { /*清除全屏标志,还原全屏时清0的border*/ void clear_fullscreen_flag(Client *c) { - if ((c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id == - SCROLLER || - c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id == - VERTICAL_SCROLLER) && - !c->isfloating) { + if (is_scroller_layout(c->mon) && !c->isfloating) { return; } @@ -1167,9 +1163,8 @@ void apply_named_scratchpad(Client *target_client) { if (!target_client->is_in_scratchpad) { set_minimized(target_client); - switch_scratchpad_client_state(target_client); - } else - switch_scratchpad_client_state(target_client); + } + switch_scratchpad_client_state(target_client); } void gpureset(struct wl_listener *listener, void *data) { @@ -2246,11 +2241,7 @@ static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer, wlr_scene_buffer_set_backdrop_blur(buffer, true); wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true); - if (blur_optimized) { - wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true); - } else { - wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false); - } + wlr_scene_buffer_set_backdrop_blur_optimized(buffer, blur_optimized); } void maplayersurfacenotify(struct wl_listener *listener, void *data) { @@ -3761,11 +3752,7 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int32_t sx, if (blur && c && !c->noblur) { wlr_scene_buffer_set_backdrop_blur(buffer, true); wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, false); - if (blur_optimized) { - wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true); - } else { - wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false); - } + wlr_scene_buffer_set_backdrop_blur_optimized(buffer, blur_optimized); } else { wlr_scene_buffer_set_backdrop_blur(buffer, false); } @@ -4385,10 +4372,8 @@ void rendermon(struct wl_listener *listener, void *data) { skip: // 发送帧完成通知 clock_gettime(CLOCK_MONOTONIC, &now); - if (allow_tearing && frame_allow_tearing) { - wlr_scene_output_send_frame_done(m->scene_output, &now); - } else { - wlr_scene_output_send_frame_done(m->scene_output, &now); + wlr_scene_output_send_frame_done(m->scene_output, &now); + if (!allow_tearing || !frame_allow_tearing) { wlr_output_state_finish(&pending); } @@ -5459,20 +5444,16 @@ void tag_client(const Arg *arg, Client *target_client) { void overview(Monitor *m) { grid(m); } // 目标窗口有其他窗口和它同个tag就返回0 -uint32_t want_restore_fullscreen(Client *target_client) { +bool want_restore_fullscreen(Client *target_client) { Client *c = NULL; wl_list_for_each(c, &clients, link) { if (c && c != target_client && c->tags == target_client->tags && - c == selmon->sel && - c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id != - SCROLLER && - c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id != - VERTICAL_SCROLLER) { - return 0; + c == selmon->sel && !is_scroller_layout(c->mon)) { + return false; } } - return 1; + return true; } // 普通视图切换到overview时保存窗口的旧状态 @@ -5910,16 +5891,14 @@ toggleseltags: void view(const Arg *arg, bool want_animation) { Monitor *m = NULL; + view_in_mon(arg, want_animation, selmon, true); if (arg->i) { - view_in_mon(arg, want_animation, selmon, true); wl_list_for_each(m, &mons, link) { if (!m->wlr_output->enabled || m == selmon) continue; // only arrange, not change monitor focus view_in_mon(arg, want_animation, m, false); } - } else { - view_in_mon(arg, want_animation, selmon, true); } }