mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-24 09:06:31 -04:00
opt: shield clip when over screen
This commit is contained in:
parent
d9aaf4df3f
commit
a7803bd2a5
1 changed files with 7 additions and 8 deletions
|
|
@ -350,13 +350,12 @@ void client_draw_shadow(Client *c) {
|
||||||
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
|
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_shield(Client *c) {
|
void apply_shield(Client *c, struct wlr_box clip_box) {
|
||||||
if (active_capture_count > 0 && c->shield_when_capture) {
|
if (active_capture_count > 0 && c->shield_when_capture) {
|
||||||
wlr_scene_node_raise_to_top(&c->shield->node);
|
wlr_scene_node_raise_to_top(&c->shield->node);
|
||||||
wlr_scene_node_set_position(&c->shield->node, c->bw, c->bw);
|
wlr_scene_node_set_position(&c->shield->node, clip_box.x + c->bw,
|
||||||
wlr_scene_rect_set_size(c->shield,
|
clip_box.y + c->bw);
|
||||||
c->animation.current.width - 2 * c->bw,
|
wlr_scene_rect_set_size(c->shield, clip_box.width, clip_box.height);
|
||||||
c->animation.current.height - 2 * c->bw);
|
|
||||||
wlr_scene_node_set_enabled(&c->shield->node, true);
|
wlr_scene_node_set_enabled(&c->shield->node, true);
|
||||||
} else {
|
} else {
|
||||||
if (c->shield->node.enabled) {
|
if (c->shield->node.enabled) {
|
||||||
|
|
@ -553,12 +552,12 @@ void client_apply_clip(Client *c, float factor) {
|
||||||
|
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
client_draw_shadow(c);
|
client_draw_shadow(c);
|
||||||
apply_shield(c);
|
|
||||||
|
|
||||||
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply_shield(c, clip_box);
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||||
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
||||||
clip_box.height,
|
clip_box.height,
|
||||||
|
|
@ -591,7 +590,6 @@ void client_apply_clip(Client *c, float factor) {
|
||||||
// 应用窗口装饰
|
// 应用窗口装饰
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
client_draw_shadow(c);
|
client_draw_shadow(c);
|
||||||
apply_shield(c);
|
|
||||||
|
|
||||||
// 如果窗口剪切区域已经剪切到0,则不渲染窗口表面
|
// 如果窗口剪切区域已经剪切到0,则不渲染窗口表面
|
||||||
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
||||||
|
|
@ -608,6 +606,7 @@ void client_apply_clip(Client *c, float factor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 应用窗口表面剪切
|
// 应用窗口表面剪切
|
||||||
|
apply_shield(c, clip_box);
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||||
|
|
||||||
// 获取剪切后的表面的实际大小用于计算缩放
|
// 获取剪切后的表面的实际大小用于计算缩放
|
||||||
|
|
@ -1020,8 +1019,8 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
||||||
|
|
||||||
client_draw_shadow(c);
|
client_draw_shadow(c);
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
apply_shield(c);
|
|
||||||
client_get_clip(c, &clip);
|
client_get_clip(c, &clip);
|
||||||
|
apply_shield(c, clip);
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue