opt: optimize layer area bound code struct
This commit is contained in:
@@ -12,6 +12,15 @@ void layer_actual_size(LayerSurface *l, unsigned int *width,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_layer_area_bound(LayerSurface *l, struct wlr_box *bound) {
|
||||||
|
const struct wlr_layer_surface_v1_state *state = &l->layer_surface->current;
|
||||||
|
|
||||||
|
if (state->exclusive_zone > 0 || state->exclusive_zone == -1)
|
||||||
|
*bound = l->mon->m;
|
||||||
|
else
|
||||||
|
*bound = l->mon->w;
|
||||||
|
}
|
||||||
|
|
||||||
void get_layer_target_geometry(LayerSurface *l, struct wlr_box *target_box) {
|
void get_layer_target_geometry(LayerSurface *l, struct wlr_box *target_box) {
|
||||||
|
|
||||||
if (!l || !l->mapped)
|
if (!l || !l->mapped)
|
||||||
@@ -101,13 +110,8 @@ void set_layer_dir_animaiton(LayerSurface *l, struct wlr_box *geo) {
|
|||||||
if (!l)
|
if (!l)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const struct wlr_layer_surface_v1_state *state = &l->layer_surface->current;
|
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
get_layer_area_bound(l, &usable_area);
|
||||||
if (state->exclusive_zone > 0 || state->exclusive_zone == -1)
|
|
||||||
usable_area = l->mon->m;
|
|
||||||
else
|
|
||||||
usable_area = l->mon->w;
|
|
||||||
|
|
||||||
geo->width = l->geom.width;
|
geo->width = l->geom.width;
|
||||||
geo->height = l->geom.height;
|
geo->height = l->geom.height;
|
||||||
@@ -374,13 +378,8 @@ void init_fadeout_layers(LayerSurface *l) {
|
|||||||
|
|
||||||
LayerSurface *fadeout_layer = ecalloc(1, sizeof(*fadeout_layer));
|
LayerSurface *fadeout_layer = ecalloc(1, sizeof(*fadeout_layer));
|
||||||
|
|
||||||
const struct wlr_layer_surface_v1_state *state = &l->layer_surface->current;
|
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
get_layer_area_bound(l, &usable_area);
|
||||||
if (state->exclusive_zone > 0 || state->exclusive_zone == -1)
|
|
||||||
usable_area = l->mon->m;
|
|
||||||
else
|
|
||||||
usable_area = l->mon->w;
|
|
||||||
|
|
||||||
wlr_scene_node_set_enabled(&l->scene->node, true);
|
wlr_scene_node_set_enabled(&l->scene->node, true);
|
||||||
fadeout_layer->scene =
|
fadeout_layer->scene =
|
||||||
@@ -454,13 +453,9 @@ void layer_set_pending_state(LayerSurface *l) {
|
|||||||
if (!l || !l->mapped)
|
if (!l || !l->mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const struct wlr_layer_surface_v1_state *state = &l->layer_surface->current;
|
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
get_layer_area_bound(l, &usable_area);
|
||||||
|
|
||||||
if (state->exclusive_zone > 0 || state->exclusive_zone == -1)
|
|
||||||
usable_area = l->mon->m;
|
|
||||||
else
|
|
||||||
usable_area = l->mon->w;
|
|
||||||
l->pending = l->geom;
|
l->pending = l->geom;
|
||||||
|
|
||||||
if (l->animation.action == OPEN) {
|
if (l->animation.action == OPEN) {
|
||||||
|
|||||||
Reference in New Issue
Block a user