mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-04-04 07:15:55 -04:00
chase: chase scenefx api change
This commit is contained in:
parent
fc677558f8
commit
c934afcd4a
5 changed files with 30 additions and 34 deletions
|
|
@ -8,22 +8,27 @@ void set_rect_size(struct wlr_scene_rect *rect, int width, int height) {
|
||||||
wlr_scene_rect_set_size(rect, GEZERO(width), GEZERO(height));
|
wlr_scene_rect_set_size(rect, GEZERO(width), GEZERO(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum corner_location set_client_corner_location(Client *c) {
|
struct fx_corner_radii set_client_corner_location(Client *c) {
|
||||||
enum corner_location current_corner_location = CORNER_LOCATION_ALL;
|
struct fx_corner_radii current_corner_location =
|
||||||
|
corner_radii_all(border_radius);
|
||||||
struct wlr_box target_geom = animations ? c->animation.current : c->geom;
|
struct wlr_box target_geom = animations ? c->animation.current : c->geom;
|
||||||
if (target_geom.x + border_radius <= c->mon->m.x) {
|
if (target_geom.x + border_radius <= c->mon->m.x) {
|
||||||
current_corner_location &= ~CORNER_LOCATION_LEFT; // 清除左标志位
|
current_corner_location.top_left = 0; // 清除左标志位
|
||||||
|
current_corner_location.bottom_left = 0; // 清除左标志位
|
||||||
}
|
}
|
||||||
if (target_geom.x + target_geom.width - border_radius >=
|
if (target_geom.x + target_geom.width - border_radius >=
|
||||||
c->mon->m.x + c->mon->m.width) {
|
c->mon->m.x + c->mon->m.width) {
|
||||||
current_corner_location &= ~CORNER_LOCATION_RIGHT; // 清除右标志位
|
current_corner_location.top_right = 0; // 清除右标志位
|
||||||
|
current_corner_location.bottom_right = 0; // 清除右标志位
|
||||||
}
|
}
|
||||||
if (target_geom.y + border_radius <= c->mon->m.y) {
|
if (target_geom.y + border_radius <= c->mon->m.y) {
|
||||||
current_corner_location &= ~CORNER_LOCATION_TOP; // 清除上标志位
|
current_corner_location.top_left = 0; // 清除上标志位
|
||||||
|
current_corner_location.top_right = 0; // 清除上标志位
|
||||||
}
|
}
|
||||||
if (target_geom.y + target_geom.height - border_radius >=
|
if (target_geom.y + target_geom.height - border_radius >=
|
||||||
c->mon->m.y + c->mon->m.height) {
|
c->mon->m.y + c->mon->m.height) {
|
||||||
current_corner_location &= ~CORNER_LOCATION_BOTTOM; // 清除下标志位
|
current_corner_location.bottom_left = 0; // 清除下标志位
|
||||||
|
current_corner_location.bottom_right = 0; // 清除下标志位
|
||||||
}
|
}
|
||||||
return current_corner_location;
|
return current_corner_location;
|
||||||
}
|
}
|
||||||
|
|
@ -223,8 +228,7 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
||||||
if (wlr_xdg_popup_try_from_wlr_surface(surface) != NULL)
|
if (wlr_xdg_popup_try_from_wlr_surface(surface) != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wlr_scene_buffer_set_corner_radius(buffer, border_radius,
|
wlr_scene_buffer_set_corner_radii(buffer, buffer_data->corner_location);
|
||||||
buffer_data->corner_location);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_set_effect(Client *c, BufferData data) {
|
void buffer_set_effect(Client *c, BufferData data) {
|
||||||
|
|
@ -242,12 +246,11 @@ void buffer_set_effect(Client *c, BufferData data) {
|
||||||
|
|
||||||
if (c->isfullscreen || (no_radius_when_single && c->mon &&
|
if (c->isfullscreen || (no_radius_when_single && c->mon &&
|
||||||
c->mon->visible_tiling_clients == 1)) {
|
c->mon->visible_tiling_clients == 1)) {
|
||||||
data.corner_location = CORNER_LOCATION_NONE;
|
data.corner_location = corner_radii_none();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blur && !c->noblur) {
|
if (blur && !c->noblur) {
|
||||||
wlr_scene_blur_set_corner_radius(c->blur, border_radius,
|
wlr_scene_blur_set_corner_radii(c->blur, data.corner_location);
|
||||||
data.corner_location);
|
|
||||||
}
|
}
|
||||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||||
scene_buffer_apply_effect, &data);
|
scene_buffer_apply_effect, &data);
|
||||||
|
|
@ -264,11 +267,11 @@ void client_draw_shadow(Client *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hit_no_border = check_hit_no_border(c);
|
bool hit_no_border = check_hit_no_border(c);
|
||||||
enum corner_location current_corner_location =
|
struct fx_corner_radii current_corner_location =
|
||||||
c->isfullscreen || (no_radius_when_single && c->mon &&
|
c->isfullscreen || (no_radius_when_single && c->mon &&
|
||||||
c->mon->visible_tiling_clients == 1)
|
c->mon->visible_tiling_clients == 1)
|
||||||
? CORNER_LOCATION_NONE
|
? corner_radii_none()
|
||||||
: CORNER_LOCATION_ALL;
|
: set_client_corner_location(c);
|
||||||
|
|
||||||
unsigned int bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
|
unsigned int bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
|
||||||
|
|
||||||
|
|
@ -301,7 +304,6 @@ void client_draw_shadow(Client *c) {
|
||||||
|
|
||||||
struct clipped_region clipped_region = {
|
struct clipped_region clipped_region = {
|
||||||
.area = intersection_box,
|
.area = intersection_box,
|
||||||
.corner_radius = border_radius,
|
|
||||||
.corners = current_corner_location,
|
.corners = current_corner_location,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -362,11 +364,11 @@ void apply_border(Client *c) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool hit_no_border = check_hit_no_border(c);
|
bool hit_no_border = check_hit_no_border(c);
|
||||||
enum corner_location current_corner_location =
|
struct fx_corner_radii current_corner_location =
|
||||||
c->isfullscreen || (no_radius_when_single && c->mon &&
|
c->isfullscreen || (no_radius_when_single && c->mon &&
|
||||||
c->mon->visible_tiling_clients == 1)
|
c->mon->visible_tiling_clients == 1)
|
||||||
? CORNER_LOCATION_NONE
|
? corner_radii_none()
|
||||||
: CORNER_LOCATION_ALL;
|
: set_client_corner_location(c);
|
||||||
|
|
||||||
// Handle no-border cases
|
// Handle no-border cases
|
||||||
if (hit_no_border && smartgaps) {
|
if (hit_no_border && smartgaps) {
|
||||||
|
|
@ -438,15 +440,13 @@ void apply_border(Client *c) {
|
||||||
struct clipped_region clipped_region = {
|
struct clipped_region clipped_region = {
|
||||||
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
||||||
inner_surface_height},
|
inner_surface_height},
|
||||||
.corner_radius = border_radius,
|
|
||||||
.corners = current_corner_location,
|
.corners = current_corner_location,
|
||||||
};
|
};
|
||||||
|
|
||||||
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||||
wlr_scene_rect_set_size(c->border, rect_width, rect_height);
|
wlr_scene_rect_set_size(c->border, rect_width, rect_height);
|
||||||
wlr_scene_node_set_position(&c->border->node, rect_x, rect_y);
|
wlr_scene_node_set_position(&c->border->node, rect_x, rect_y);
|
||||||
wlr_scene_rect_set_corner_radius(c->border, border_radius,
|
wlr_scene_rect_set_corner_radii(c->border, current_corner_location);
|
||||||
current_corner_location);
|
|
||||||
wlr_scene_rect_set_clipped_region(c->border, clipped_region);
|
wlr_scene_rect_set_clipped_region(c->border, clipped_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,7 +524,7 @@ void client_apply_clip(Client *c, float factor) {
|
||||||
struct ivec2 offset;
|
struct ivec2 offset;
|
||||||
BufferData buffer_data;
|
BufferData buffer_data;
|
||||||
|
|
||||||
enum corner_location current_corner_location =
|
struct fx_corner_radii current_corner_location =
|
||||||
set_client_corner_location(c);
|
set_client_corner_location(c);
|
||||||
|
|
||||||
int bw = (int)c->bw;
|
int bw = (int)c->bw;
|
||||||
|
|
|
||||||
|
|
@ -154,9 +154,8 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
||||||
|
|
||||||
// Effects
|
// Effects
|
||||||
wlr_scene_buffer_set_opacity(snapshot_buffer, scene_buffer->opacity);
|
wlr_scene_buffer_set_opacity(snapshot_buffer, scene_buffer->opacity);
|
||||||
wlr_scene_buffer_set_corner_radius(snapshot_buffer,
|
wlr_scene_buffer_set_corner_radii(snapshot_buffer,
|
||||||
scene_buffer->corner_radius,
|
scene_buffer->corners);
|
||||||
scene_buffer->corners);
|
|
||||||
|
|
||||||
snapshot_buffer->node.data = scene_buffer->node.data;
|
snapshot_buffer->node.data = scene_buffer->node.data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,7 @@ void layer_draw_shadow(LayerSurface *l) {
|
||||||
|
|
||||||
struct clipped_region clipped_region = {
|
struct clipped_region clipped_region = {
|
||||||
.area = intersection_box,
|
.area = intersection_box,
|
||||||
.corner_radius = border_radius,
|
.corners = corner_radii_all(border_radius),
|
||||||
.corners = border_radius_location_default,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wlr_scene_node_set_position(&l->shadow->node, shadow_box.x, shadow_box.y);
|
wlr_scene_node_set_position(&l->shadow->node, shadow_box.x, shadow_box.y);
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,6 @@ float focused_opacity = 1.0;
|
||||||
float unfocused_opacity = 1.0;
|
float unfocused_opacity = 1.0;
|
||||||
|
|
||||||
int border_radius = 0;
|
int border_radius = 0;
|
||||||
int border_radius_location_default = CORNER_LOCATION_ALL;
|
|
||||||
int blur = 0;
|
int blur = 0;
|
||||||
int blur_layer = 0;
|
int blur_layer = 0;
|
||||||
int blur_optimized = 1;
|
int blur_optimized = 1;
|
||||||
|
|
|
||||||
11
src/mango.c
11
src/mango.c
|
|
@ -262,7 +262,7 @@ typedef struct {
|
||||||
float height_scale;
|
float height_scale;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
enum corner_location corner_location;
|
struct fx_corner_radii corner_location;
|
||||||
bool should_scale;
|
bool should_scale;
|
||||||
} BufferData;
|
} BufferData;
|
||||||
|
|
||||||
|
|
@ -369,6 +369,7 @@ struct Client {
|
||||||
bool isleftstack;
|
bool isleftstack;
|
||||||
int tearing_hint;
|
int tearing_hint;
|
||||||
int force_tearing;
|
int force_tearing;
|
||||||
|
int border_radius;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -694,7 +695,7 @@ static double find_animation_curve_at(double t, int type);
|
||||||
|
|
||||||
static void apply_opacity_to_rect_nodes(Client *c, struct wlr_scene_node *node,
|
static void apply_opacity_to_rect_nodes(Client *c, struct wlr_scene_node *node,
|
||||||
double animation_passed);
|
double animation_passed);
|
||||||
static enum corner_location set_client_corner_location(Client *c);
|
static struct fx_corner_radii set_client_corner_location(Client *c);
|
||||||
static double all_output_frame_duration_ms();
|
static double all_output_frame_duration_ms();
|
||||||
static struct wlr_scene_tree *
|
static struct wlr_scene_tree *
|
||||||
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
|
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
|
||||||
|
|
@ -2086,8 +2087,7 @@ static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
||||||
LayerSurface *l = (LayerSurface *)user_data;
|
LayerSurface *l = (LayerSurface *)user_data;
|
||||||
|
|
||||||
wlr_scene_node_set_enabled(&l->blur->node, true);
|
wlr_scene_node_set_enabled(&l->blur->node, true);
|
||||||
wlr_scene_blur_set_mask_source(l->blur, &buffer->node,
|
wlr_scene_blur_set_transparency_mask_source(l->blur, buffer);
|
||||||
BLUR_MASK_IGNORE_TRANSPARENCY);
|
|
||||||
wlr_scene_blur_set_size(l->blur, l->geom.width, l->geom.height);
|
wlr_scene_blur_set_size(l->blur, l->geom.width, l->geom.height);
|
||||||
|
|
||||||
if (blur_optimized) {
|
if (blur_optimized) {
|
||||||
|
|
@ -3646,8 +3646,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||||
c->isurgent ? urgentcolor : bordercolor);
|
c->isurgent ? urgentcolor : bordercolor);
|
||||||
wlr_scene_node_lower_to_bottom(&c->border->node);
|
wlr_scene_node_lower_to_bottom(&c->border->node);
|
||||||
wlr_scene_node_set_position(&c->border->node, 0, 0);
|
wlr_scene_node_set_position(&c->border->node, 0, 0);
|
||||||
wlr_scene_rect_set_corner_radius(c->border, border_radius,
|
wlr_scene_rect_set_corner_radii(c->border, corner_radii_all(border_radius));
|
||||||
border_radius_location_default);
|
|
||||||
wlr_scene_node_set_enabled(&c->border->node, true);
|
wlr_scene_node_set_enabled(&c->border->node, true);
|
||||||
|
|
||||||
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue