mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-07-05 00:06:20 -04:00
feat: shield for layershell
This commit is contained in:
parent
186259cf44
commit
a55c10f005
4 changed files with 71 additions and 15 deletions
40
src/mango.c
40
src/mango.c
|
|
@ -522,6 +522,7 @@ typedef struct {
|
|||
Monitor *mon;
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_tree *popups;
|
||||
struct wlr_scene_rect *shield;
|
||||
struct wlr_scene_shadow *shadow;
|
||||
struct wlr_scene_blur *blur;
|
||||
struct wlr_scene_layer_surface_v1 *scene_layer;
|
||||
|
|
@ -542,6 +543,7 @@ typedef struct {
|
|||
int32_t noshadow;
|
||||
char *animation_type_open;
|
||||
char *animation_type_close;
|
||||
bool shield_when_capture;
|
||||
bool need_output_flush;
|
||||
bool being_unmapped;
|
||||
} LayerSurface;
|
||||
|
|
@ -2808,6 +2810,7 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||
|
||||
l->noanim = 0;
|
||||
l->dirty = false;
|
||||
l->shield_when_capture = false;
|
||||
l->noblur = 0;
|
||||
l->shadow = NULL;
|
||||
l->need_output_flush = true;
|
||||
|
|
@ -2820,6 +2823,7 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||
l->layer_surface->namespace)) {
|
||||
|
||||
r = &config.layer_rules[ji];
|
||||
APPLY_INT_PROP(l, r, shield_when_capture);
|
||||
APPLY_INT_PROP(l, r, noblur);
|
||||
APPLY_INT_PROP(l, r, noanim);
|
||||
APPLY_INT_PROP(l, r, noshadow);
|
||||
|
|
@ -2828,6 +2832,13 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
}
|
||||
|
||||
// 初始化屏蔽
|
||||
l->shield =
|
||||
wlr_scene_rect_create(l->scene, 0, 0, (float[4]){0, 0, 0, 0xff});
|
||||
l->shield->node.data = l;
|
||||
wlr_scene_node_lower_to_bottom(&l->shield->node);
|
||||
wlr_scene_node_set_enabled(&l->shield->node, false);
|
||||
|
||||
// 初始化阴影
|
||||
if (layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||
|
|
@ -2848,6 +2859,9 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||
l->animation.duration = config.animation_duration_open;
|
||||
l->animation.action = OPEN;
|
||||
layer_set_pending_state(l);
|
||||
} else {
|
||||
l->animainit_geom = l->animation.current = l->current = l->pending =
|
||||
l->geom;
|
||||
}
|
||||
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
||||
arrangelayers(l->mon);
|
||||
|
|
@ -2891,20 +2905,26 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||
|
||||
get_layer_target_geometry(l, &box);
|
||||
|
||||
if (config.animations && config.layer_animations && !l->noanim &&
|
||||
l->mapped &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND &&
|
||||
!wlr_box_equal(&box, &l->geom)) {
|
||||
|
||||
if (!wlr_box_equal(&box, &l->geom)) {
|
||||
l->geom.x = box.x;
|
||||
l->geom.y = box.y;
|
||||
l->geom.width = box.width;
|
||||
l->geom.height = box.height;
|
||||
l->animation.action = MOVE;
|
||||
l->animation.duration = config.animation_duration_move;
|
||||
l->need_output_flush = true;
|
||||
layer_set_pending_state(l);
|
||||
|
||||
if (config.animations && config.layer_animations && !l->noanim &&
|
||||
l->mapped &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||
layer_surface->current.layer !=
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||
l->animation.action = MOVE;
|
||||
l->animation.duration = config.animation_duration_move;
|
||||
l->need_output_flush = true;
|
||||
layer_set_pending_state(l);
|
||||
} else {
|
||||
l->animainit_geom = l->animation.current = l->current = l->pending =
|
||||
l->geom;
|
||||
l->need_output_flush = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.blur && config.blur_layer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue