mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-24 21:37:30 -04:00
feat: dont resize client when in overview
This commit is contained in:
parent
9e4fade55e
commit
a6a765caff
9 changed files with 446 additions and 137 deletions
|
|
@ -73,6 +73,14 @@ int32_t is_special_animation_rule(Client *c) {
|
|||
}
|
||||
}
|
||||
|
||||
void set_overview_enter_animation(Client *c) {
|
||||
struct wlr_box geo = c->geom;
|
||||
c->animainit_geom.width = geo.width * 1.2;
|
||||
c->animainit_geom.height = geo.height * 1.2;
|
||||
c->animainit_geom.x = geo.x + (geo.width - c->animainit_geom.width) / 2;
|
||||
c->animainit_geom.y = geo.y + (geo.height - c->animainit_geom.height) / 2;
|
||||
}
|
||||
|
||||
void set_client_open_animation(Client *c, struct wlr_box geo) {
|
||||
int32_t slide_direction;
|
||||
int32_t horizontal, horizontal_value;
|
||||
|
|
@ -231,6 +239,19 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int32_t sx,
|
|||
buffer_data->corner_location);
|
||||
}
|
||||
|
||||
void scene_buffer_apply_overview_effect(struct wlr_scene_buffer *buffer,
|
||||
int32_t sx, int32_t sy, void *data) {
|
||||
BufferData *buffer_data = (BufferData *)data;
|
||||
|
||||
if (buffer_data->width > 0 && buffer_data->height > 0) {
|
||||
wlr_scene_buffer_set_dest_size(buffer, buffer_data->width,
|
||||
buffer_data->height);
|
||||
}
|
||||
|
||||
wlr_scene_buffer_set_corner_radius(buffer, config.border_radius,
|
||||
buffer_data->corner_location);
|
||||
}
|
||||
|
||||
void buffer_set_effect(Client *c, BufferData data) {
|
||||
|
||||
if (!c || c->iskilling)
|
||||
|
|
@ -250,8 +271,13 @@ void buffer_set_effect(Client *c, BufferData data) {
|
|||
data.corner_location = CORNER_LOCATION_NONE;
|
||||
}
|
||||
|
||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||
scene_buffer_apply_effect, &data);
|
||||
if (c->mon->isoverview && config.ov_no_resize) {
|
||||
wlr_scene_node_for_each_buffer(
|
||||
&c->scene_surface->node, scene_buffer_apply_overview_effect, &data);
|
||||
} else {
|
||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||
scene_buffer_apply_effect, &data);
|
||||
}
|
||||
}
|
||||
|
||||
void client_draw_shadow(Client *c) {
|
||||
|
|
@ -793,7 +819,11 @@ void client_apply_clip(Client *c, float factor) {
|
|||
return;
|
||||
}
|
||||
|
||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||
if (!c->mon->isoverview || !config.ov_no_resize) {
|
||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node,
|
||||
&clip_box);
|
||||
}
|
||||
|
||||
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
||||
clip_box.height,
|
||||
current_corner_location, true});
|
||||
|
|
@ -841,7 +871,9 @@ void client_apply_clip(Client *c, float factor) {
|
|||
}
|
||||
|
||||
// 应用窗口表面剪切
|
||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||
if (!c->mon->isoverview || !config.ov_no_resize) {
|
||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||
}
|
||||
|
||||
// 获取剪切后的表面的实际大小用于计算缩放
|
||||
int32_t acutal_surface_width = geometry.width - offset.x - offset.width;
|
||||
|
|
@ -987,6 +1019,7 @@ void client_animation_next_tick(Client *c) {
|
|||
|
||||
c->animation.tagining = false;
|
||||
c->animation.running = false;
|
||||
c->animation.overining = false;
|
||||
|
||||
if (c->animation.tagouting) {
|
||||
c->animation.tagouting = false;
|
||||
|
|
@ -1125,9 +1158,8 @@ void client_set_pending_state(Client *c) {
|
|||
c->animation.should_animate = false;
|
||||
} else if (config.animations && c->animation.tagining) {
|
||||
c->animation.should_animate = true;
|
||||
} else if (!config.animations || c == grabc ||
|
||||
(!c->is_pending_open_animation &&
|
||||
wlr_box_equal(&c->current, &c->pending))) {
|
||||
} else if (c == grabc || (!c->is_pending_open_animation &&
|
||||
wlr_box_equal(&c->current, &c->pending))) {
|
||||
c->animation.should_animate = false;
|
||||
} else {
|
||||
c->animation.should_animate = true;
|
||||
|
|
@ -1201,8 +1233,11 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
c->animation.begin_fade_in = false;
|
||||
}
|
||||
|
||||
if (c->animation.action == OPEN && !c->animation.tagining &&
|
||||
!c->animation.tagouting && wlr_box_equal(&c->geom, &c->current)) {
|
||||
if (c->animation.overining) {
|
||||
c->animation.action = OVERVIEW;
|
||||
} else if (c->animation.action == OPEN && !c->animation.tagining &&
|
||||
!c->animation.tagouting &&
|
||||
wlr_box_equal(&c->geom, &c->current)) {
|
||||
c->animation.action = c->animation.action;
|
||||
} else if (c->animation.tagouting) {
|
||||
c->animation.duration = config.animation_duration_tag;
|
||||
|
|
@ -1241,8 +1276,10 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
}
|
||||
|
||||
// c->geom 是真实的窗口大小和位置,跟过度的动画无关,用于计算布局
|
||||
c->configure_serial = client_set_size(c, c->geom.width - 2 * c->bw,
|
||||
c->geom.height - 2 * c->bw);
|
||||
if (!c->mon->isoverview || !config.ov_no_resize) {
|
||||
c->configure_serial = client_set_size(c, c->geom.width - 2 * c->bw,
|
||||
c->geom.height - 2 * c->bw);
|
||||
}
|
||||
|
||||
if (c->configure_serial != 0) {
|
||||
c->mon->resizing_count_pending++;
|
||||
|
|
@ -1285,6 +1322,15 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
|||
c->animainit_geom = c->geom;
|
||||
}
|
||||
|
||||
if (config.animations && config.ov_no_resize && c->mon->isoverview &&
|
||||
c != c->mon->sel && c->animation.action == OVERVIEW) {
|
||||
set_overview_enter_animation(c);
|
||||
}
|
||||
|
||||
if (!config.animations && config.ov_no_resize && c->mon->isoverview) {
|
||||
c->animainit_geom = c->geom;
|
||||
}
|
||||
|
||||
// 开始应用动画设置
|
||||
client_set_pending_state(c);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue