mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-18 22:05:28 -05: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));
|
||||
}
|
||||
|
||||
enum corner_location set_client_corner_location(Client *c) {
|
||||
enum corner_location current_corner_location = CORNER_LOCATION_ALL;
|
||||
struct fx_corner_radii set_client_corner_location(Client *c) {
|
||||
struct fx_corner_radii current_corner_location =
|
||||
corner_radii_all(border_radius);
|
||||
struct wlr_box target_geom = animations ? c->animation.current : c->geom;
|
||||
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 >=
|
||||
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) {
|
||||
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 >=
|
||||
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;
|
||||
}
|
||||
|
|
@ -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)
|
||||
return;
|
||||
|
||||
wlr_scene_buffer_set_corner_radius(buffer, border_radius,
|
||||
buffer_data->corner_location);
|
||||
wlr_scene_buffer_set_corner_radii(buffer, buffer_data->corner_location);
|
||||
}
|
||||
|
||||
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 &&
|
||||
c->mon->visible_tiling_clients == 1)) {
|
||||
data.corner_location = CORNER_LOCATION_NONE;
|
||||
data.corner_location = corner_radii_none();
|
||||
}
|
||||
|
||||
if (blur && !c->noblur) {
|
||||
wlr_scene_blur_set_corner_radius(c->blur, border_radius,
|
||||
data.corner_location);
|
||||
wlr_scene_blur_set_corner_radii(c->blur, data.corner_location);
|
||||
}
|
||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||
scene_buffer_apply_effect, &data);
|
||||
|
|
@ -264,11 +267,11 @@ void client_draw_shadow(Client *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->mon->visible_tiling_clients == 1)
|
||||
? CORNER_LOCATION_NONE
|
||||
: CORNER_LOCATION_ALL;
|
||||
? corner_radii_none()
|
||||
: set_client_corner_location(c);
|
||||
|
||||
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 = {
|
||||
.area = intersection_box,
|
||||
.corner_radius = border_radius,
|
||||
.corners = current_corner_location,
|
||||
};
|
||||
|
||||
|
|
@ -362,11 +364,11 @@ void apply_border(Client *c) {
|
|||
return;
|
||||
|
||||
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->mon->visible_tiling_clients == 1)
|
||||
? CORNER_LOCATION_NONE
|
||||
: CORNER_LOCATION_ALL;
|
||||
? corner_radii_none()
|
||||
: set_client_corner_location(c);
|
||||
|
||||
// Handle no-border cases
|
||||
if (hit_no_border && smartgaps) {
|
||||
|
|
@ -438,15 +440,13 @@ void apply_border(Client *c) {
|
|||
struct clipped_region clipped_region = {
|
||||
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
||||
inner_surface_height},
|
||||
.corner_radius = border_radius,
|
||||
.corners = current_corner_location,
|
||||
};
|
||||
|
||||
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_node_set_position(&c->border->node, rect_x, rect_y);
|
||||
wlr_scene_rect_set_corner_radius(c->border, border_radius,
|
||||
current_corner_location);
|
||||
wlr_scene_rect_set_corner_radii(c->border, current_corner_location);
|
||||
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;
|
||||
BufferData buffer_data;
|
||||
|
||||
enum corner_location current_corner_location =
|
||||
struct fx_corner_radii current_corner_location =
|
||||
set_client_corner_location(c);
|
||||
|
||||
int bw = (int)c->bw;
|
||||
|
|
|
|||
|
|
@ -154,9 +154,8 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
|||
|
||||
// Effects
|
||||
wlr_scene_buffer_set_opacity(snapshot_buffer, scene_buffer->opacity);
|
||||
wlr_scene_buffer_set_corner_radius(snapshot_buffer,
|
||||
scene_buffer->corner_radius,
|
||||
scene_buffer->corners);
|
||||
wlr_scene_buffer_set_corner_radii(snapshot_buffer,
|
||||
scene_buffer->corners);
|
||||
|
||||
snapshot_buffer->node.data = scene_buffer->node.data;
|
||||
|
||||
|
|
|
|||
|
|
@ -191,8 +191,7 @@ void layer_draw_shadow(LayerSurface *l) {
|
|||
|
||||
struct clipped_region clipped_region = {
|
||||
.area = intersection_box,
|
||||
.corner_radius = border_radius,
|
||||
.corners = border_radius_location_default,
|
||||
.corners = corner_radii_all(border_radius),
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
int border_radius = 0;
|
||||
int border_radius_location_default = CORNER_LOCATION_ALL;
|
||||
int blur = 0;
|
||||
int blur_layer = 0;
|
||||
int blur_optimized = 1;
|
||||
|
|
|
|||
11
src/mango.c
11
src/mango.c
|
|
@ -262,7 +262,7 @@ typedef struct {
|
|||
float height_scale;
|
||||
int width;
|
||||
int height;
|
||||
enum corner_location corner_location;
|
||||
struct fx_corner_radii corner_location;
|
||||
bool should_scale;
|
||||
} BufferData;
|
||||
|
||||
|
|
@ -369,6 +369,7 @@ struct Client {
|
|||
bool isleftstack;
|
||||
int tearing_hint;
|
||||
int force_tearing;
|
||||
int border_radius;
|
||||
};
|
||||
|
||||
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,
|
||||
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 struct wlr_scene_tree *
|
||||
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;
|
||||
|
||||
wlr_scene_node_set_enabled(&l->blur->node, true);
|
||||
wlr_scene_blur_set_mask_source(l->blur, &buffer->node,
|
||||
BLUR_MASK_IGNORE_TRANSPARENCY);
|
||||
wlr_scene_blur_set_transparency_mask_source(l->blur, buffer);
|
||||
wlr_scene_blur_set_size(l->blur, l->geom.width, l->geom.height);
|
||||
|
||||
if (blur_optimized) {
|
||||
|
|
@ -3646,8 +3646,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||
c->isurgent ? urgentcolor : bordercolor);
|
||||
wlr_scene_node_lower_to_bottom(&c->border->node);
|
||||
wlr_scene_node_set_position(&c->border->node, 0, 0);
|
||||
wlr_scene_rect_set_corner_radius(c->border, border_radius,
|
||||
border_radius_location_default);
|
||||
wlr_scene_rect_set_corner_radii(c->border, corner_radii_all(border_radius));
|
||||
wlr_scene_node_set_enabled(&c->border->node, true);
|
||||
|
||||
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue