From fc9f33a7c3c6a8461f85b610a39220ad824c7f58 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 17 May 2025 07:05:26 +0800 Subject: [PATCH] feat: support corner radius --- meson.build | 2 + src/client/client.h | 4 +- src/config/parse_config.h | 7 +- src/config/preset_config.h | 7 + src/maomao.c | 361 +++++++++++++++++++++++-------------- 5 files changed, 242 insertions(+), 139 deletions(-) diff --git a/meson.build b/meson.build index 791eda9b..0684df7a 100644 --- a/meson.build +++ b/meson.build @@ -37,6 +37,7 @@ wlroots_dep = dependency('wlroots-0.19') xkbcommon_dep = dependency('xkbcommon') libinput_dep = dependency('libinput') libwayland_client_dep = dependency('wayland-client') +libscenefx_dep = dependency('scenefx-0.2') # 获取 Git Commit Hash 和最新的 tag git = find_program('git', required : false) @@ -75,6 +76,7 @@ executable('maomao', xcb, xlibs, wayland_server_dep, + libscenefx_dep, wlroots_dep, xkbcommon_dep, libinput_dep, diff --git a/src/client/client.h b/src/client/client.h index 4c4e7830..b86e1c0e 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -302,9 +302,7 @@ static inline void client_send_close(Client *c) { static inline void client_set_border_color(Client *c, const float color[static 4]) { - int i; - for (i = 0; i < 4; i++) - wlr_scene_rect_set_color(c->border[i], color); + wlr_scene_rect_set_color(c->border, color); } static inline void client_set_fullscreen(Client *c, int fullscreen) { diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 3939830e..ef14783b 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -130,6 +130,8 @@ typedef struct { float *scroller_proportion_preset; int scroller_proportion_preset_count; + int border_radius; + char **circle_layout; int circle_layout_count; @@ -758,6 +760,8 @@ void parse_config_line(Config *config, const char *line) { config->focus_cross_monitor = atoi(value); } else if (strcmp(key, "focus_cross_tag") == 0) { config->focus_cross_tag = atoi(value); + } else if (strcmp(key, "border_radius") == 0) { + config->border_radius = atoi(value); } else if (strcmp(key, "single_scratchpad") == 0) { config->single_scratchpad = atoi(value); } else if (strcmp(key, "no_border_when_single") == 0) { @@ -1763,6 +1767,7 @@ void override_config(void) { scroller_focus_center = config.scroller_focus_center; focus_cross_monitor = config.focus_cross_monitor; focus_cross_tag = config.focus_cross_tag; + border_radius = config.border_radius; single_scratchpad = config.single_scratchpad; no_border_when_single = config.no_border_when_single; snap_distance = config.snap_distance; @@ -1865,6 +1870,7 @@ void set_value_default() { config.scroller_prefer_center = scroller_prefer_center; config.focus_cross_monitor = focus_cross_monitor; config.focus_cross_tag = focus_cross_tag; + config.border_radius = border_radius; config.single_scratchpad = single_scratchpad; config.no_border_when_single = no_border_when_single; config.snap_distance = snap_distance; @@ -2016,7 +2022,6 @@ void reload_config(const Arg *arg) { init_baked_points(); handlecursoractivity(); run_exec(); - // reset border width when config change wl_list_for_each(c, &clients, link) { if (c && !c->iskilling) { diff --git a/src/config/preset_config.h b/src/config/preset_config.h index 81c5a932..db643b7a 100644 --- a/src/config/preset_config.h +++ b/src/config/preset_config.h @@ -164,3 +164,10 @@ enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM; static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", }; + + +int border_radius = 10; +int border_radius_location_default = CORNER_LOCATION_ALL; + + + diff --git a/src/maomao.c b/src/maomao.c index 88fb124b..7d71cd55 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -13,6 +13,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include @@ -51,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -198,6 +202,7 @@ typedef struct { float height_scale; int width; int height; + enum corner_location corner_location; bool should_scale; } animationScale; @@ -209,7 +214,7 @@ struct Client { overview_backup_geom, current; /* layout-relative, includes border */ Monitor *mon; struct wlr_scene_tree *scene; - struct wlr_scene_rect *border[4]; /* top, bottom, left, right */ + struct wlr_scene_rect *border; /* top, bottom, left, right */ struct wlr_scene_tree *scene_surface; struct wl_list link; struct wl_list flink; @@ -621,7 +626,7 @@ static unsigned int get_tags_first_tag(unsigned int tags); static void client_commit(Client *c); static void apply_border(Client *c, struct wlr_box clip_box, int offsetx, - int offsety); + int offsety, enum corner_location current_corner_location); static void client_set_opacity(Client *c, double opacity); static void init_baked_points(void); static void scene_buffer_apply_opacity(struct wlr_scene_buffer *buffer, int sx, @@ -966,7 +971,7 @@ void fadeout_client_animation_next_tick(Client *c) { scale_data.width_scale = animation_passed; scale_data.height_scale = animation_passed; - wlr_scene_node_for_each_buffer(&c->scene->node, + wlr_scene_node_for_each_buffer(&c->scene_surface->node, snap_scene_buffer_apply_effect, &scale_data); } @@ -1063,7 +1068,7 @@ void set_rect_size(struct wlr_scene_rect *rect, int width, int height) { } void apply_border(Client *c, struct wlr_box clip_box, int offsetx, - int offsety) { + int offsety, enum corner_location border_radius_location) { int i; bool hit_no_border = false; @@ -1097,10 +1102,7 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx, c->bw = 0; c->fake_no_border = true; } else if (hit_no_border && !smartgaps) { - set_rect_size(c->border[0], 0, 0); - set_rect_size(c->border[1], 0, 0); - set_rect_size(c->border[2], 0, 0); - set_rect_size(c->border[3], 0, 0); + wlr_scene_rect_set_size(c->border, 0, 0); wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw); c->fake_no_border = true; return; @@ -1109,59 +1111,59 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx, c->fake_no_border = false; } - wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw); - set_rect_size(c->border[0], clip_box.width, c->bw); - set_rect_size(c->border[1], clip_box.width, c->bw); - set_rect_size(c->border[2], c->bw, clip_box.height - 2 * c->bw); - set_rect_size(c->border[3], c->bw, clip_box.height - 2 * c->bw); - wlr_scene_node_set_position(&c->border[0]->node, 0, 0); - wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); - wlr_scene_node_set_position(&c->border[1]->node, 0, clip_box.height - c->bw); - wlr_scene_node_set_position(&c->border[3]->node, clip_box.width - c->bw, - c->bw); + int clip_box_width = clip_box.width - 2 * c->bw; + int clip_box_height = clip_box.height - 2 * c->bw; - if (ISTILED(c) || c->animation.tagining || c->animation.tagouted || - c->animation.tagouting) { - if (c->animation.current.x < c->mon->m.x) { - set_rect_size(c->border[2], GEZERO(c->bw - offsetx), - clip_box.height - 2 * c->bw); - } else if (c->animation.current.x + c->animation.current.width > - c->mon->m.x + c->mon->m.width) { - set_rect_size(c->border[3], - GEZERO(c->bw - GEZERO(c->animation.current.x + - c->animation.current.width - - c->mon->m.x - c->mon->m.width)), - clip_box.height - 2 * c->bw); - set_rect_size(c->border[0], clip_box.width + c->bw, - GEZERO(c->bw - offsety)); - set_rect_size(c->border[1], clip_box.width + c->bw, - GEZERO(c->bw - GEZERO(c->animation.current.y + - c->animation.current.height - - c->mon->m.y - c->mon->m.height))); - } else if (c->animation.current.y < c->mon->m.y) { - set_rect_size(c->border[0], clip_box.width, GEZERO(c->bw - offsety)); - } else if (c->animation.current.y + c->animation.current.height > - c->mon->m.y + c->mon->m.height) { - set_rect_size(c->border[1], clip_box.width, - GEZERO(c->bw - GEZERO(c->animation.current.y + - c->animation.current.height - - c->mon->m.y - c->mon->m.height))); - set_rect_size(c->border[2], GEZERO(c->bw - offsetx), - clip_box.height - c->bw); - set_rect_size(c->border[3], - GEZERO(c->bw - GEZERO(c->animation.current.x + - c->animation.current.width - - c->mon->m.x - c->mon->m.width)), - clip_box.height - c->bw); - } + if(clip_box_width < 0) { + clip_box_width = 0; } - wlr_scene_node_set_position(&c->border[0]->node, offsetx, offsety); - wlr_scene_node_set_position(&c->border[2]->node, offsetx, c->bw + offsety); - wlr_scene_node_set_position(&c->border[1]->node, offsetx, - clip_box.height - c->bw + offsety); - wlr_scene_node_set_position( - &c->border[3]->node, clip_box.width - c->bw + offsetx, c->bw + offsety); + if(clip_box_height < 0) { + clip_box_height = 0; + } + + int clip_x = c->bw - offsetx; + int clip_y = c->bw - offsety; + + clip_x = clip_x < 0 ? 0 : clip_x; + clip_y = clip_y < 0 ? 0 : clip_y; + + struct clipped_region clipped_region = { + .area = { clip_x, clip_y, clip_box_width, clip_box_height }, + .corner_radius = border_radius, + .corners = border_radius_location, + }; + + int right_offset = GEZERO(c->animation.current.x + c->animation.current.width - c->mon->m.x - c->mon->m.width); + int bottom_offset = GEZERO(c->animation.current.y + c->animation.current.height - c->mon->m.y - c->mon->m.height); + int rect_width = clip_box.width; + int rect_height = clip_box.height; + + + if(right_offset > 0) { + clipped_region.area.width = MIN(clip_box.width,clipped_region.area.width + right_offset); + } + + if(bottom_offset > 0) { + clipped_region.area.height = MIN(clip_box.height,clipped_region.area.height + bottom_offset); + } + + if(rect_width < 0) { + rect_width = 0; + } + + if(rect_height < 0) { + rect_height = 0; + } + + int node_x = offsetx; + int node_y = offsety; + + 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, node_x, node_y); + wlr_scene_rect_set_corner_radius(c->border, border_radius, border_radius_location); + wlr_scene_rect_set_clipped_region(c->border, clipped_region); } struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) { @@ -1226,6 +1228,24 @@ struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) { return offset; } +enum corner_location set_client_corner_location(Client *c) { + enum corner_location current_corner_location = CORNER_LOCATION_ALL; + 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; // 清除左标志位 + } + if(target_geom.x + target_geom.width - border_radius >= c->mon->m.x + c->mon->m.width) { + current_corner_location &= ~CORNER_LOCATION_RIGHT; // 清除右标志位 + } + if(target_geom.y + border_radius <= c->mon->m.y) { + current_corner_location &= ~CORNER_LOCATION_TOP; // 清除上标志位 + } + if(target_geom.y + target_geom.height - border_radius >= c->mon->m.y + c->mon->m.height) { + current_corner_location &= ~CORNER_LOCATION_BOTTOM; // 清除下标志位 + } + return current_corner_location; +} + void client_apply_clip(Client *c) { if (c->iskilling || !client_surface(c)->mapped) @@ -1233,6 +1253,7 @@ void client_apply_clip(Client *c) { struct wlr_box clip_box; struct uvec2 offset; animationScale scale_data; + enum corner_location current_corner_location = set_client_corner_location(c); if (!animations) { c->animation.running = false; @@ -1241,9 +1262,13 @@ void client_apply_clip(Client *c) { c->geom; client_get_clip(c, &clip_box); offset = clip_to_hide(c, &clip_box); - apply_border(c, clip_box, offset.x, offset.y); + if(c->is_clip_to_hide) { + return; + } + apply_border(c, clip_box, offset.x, offset.y, current_corner_location); + wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box); - buffer_set_effect(c, (animationScale){0, 0, 0, 0, false}); + buffer_set_effect(c, (animationScale){0, 0, 0, 0, current_corner_location,false}); return; } @@ -1265,15 +1290,24 @@ void client_apply_clip(Client *c) { } offset = clip_to_hide(c, &clip_box); + apply_border(c, clip_box, offset.x, offset.y, current_corner_location); - wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box); - apply_border(c, clip_box, offset.x, offset.y); + struct wlr_box surface_clip; + surface_clip = clip_box; + surface_clip.width = surface_clip.width - 2 * c->bw; + surface_clip.height = surface_clip.height - 2 * c->bw; + + if(surface_clip.width <= 0 || surface_clip.height <= 0) { + return; + } + wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &surface_clip); scale_data.should_scale = true; scale_data.width = clip_box.width - 2 * c->bw; scale_data.height = clip_box.height - 2 * c->bw; scale_data.width_scale = (float)scale_data.width / geometry.width; scale_data.height_scale = (float)scale_data.height / geometry.height; + scale_data.corner_location = current_corner_location; buffer_set_effect(c, scale_data); } @@ -1289,7 +1323,8 @@ bool client_draw_frame(Client *c) { client_animation_next_tick(c); client_apply_clip(c); } else { - wlr_scene_node_set_position(&c->scene->node, c->pending.x, c->pending.y); + if(!c->is_clip_to_hide) + wlr_scene_node_set_position(&c->scene->node, c->pending.x, c->pending.y); c->animainit_geom = c->animation.initial = c->pending = c->current = c->geom; client_apply_clip(c); @@ -1661,7 +1696,7 @@ void gpureset(struct wl_listener *listener, void *data) { wlr_log(WLR_DEBUG, "gpu reset"); - if (!(drw = wlr_renderer_autocreate(backend))) + if (!(drw = fx_renderer_create(backend))) die("couldn't recreate renderer"); if (!(alloc = wlr_allocator_autocreate(backend, drw))) @@ -2080,7 +2115,7 @@ void apply_window_snap(Client *c) { snap_right_screen = 0; int snap_up_mon = 0, snap_down_mon = 0, snap_left_mon = 0, snap_right_mon = 0; - unsigned int cbw = !render_border || c->fake_no_border ? borderpx : 0; + unsigned int cbw = !render_border || c->fake_no_border ? c->bw : 0; unsigned int tcbw; unsigned int cx, cy, cw, ch, tcx, tcy, tcw, tch; cx = c->geom.x + cbw; @@ -2099,7 +2134,7 @@ void apply_window_snap(Client *c) { if (tc && tc->isfloating && !tc->iskilling && client_surface(tc)->mapped && VISIBLEON(tc, c->mon)) { - tcbw = !render_border || tc->fake_no_border ? borderpx : 0; + tcbw = !render_border || tc->fake_no_border ? c->bw : 0; tcx = tc->geom.x + tcbw; tcy = tc->geom.y + tcbw; tcw = tc->geom.width - 2 * tcbw; @@ -3180,6 +3215,7 @@ void createlayersurface(struct wl_listener *listener, void *data) { wl_list_insert(&l->mon->layers[layer_surface->pending.layer], &l->link); wlr_surface_send_enter(surface, layer_surface->output); + } void createlocksurface(struct wl_listener *listener, void *data) { @@ -3324,6 +3360,7 @@ void createmon(struct wl_listener *listener, void *data) { wlr_output_layout_add_auto(output_layout, wlr_output); else wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y); + } void // fix for 0.5 @@ -4248,78 +4285,126 @@ void keypressmod(struct wl_listener *listener, void *data) { } static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly, - struct wlr_scene_tree *snapshot_tree) { - if (!node->enabled && node->type != WLR_SCENE_NODE_TREE) { - return true; - } + struct wlr_scene_tree *snapshot_tree) { + if (!node->enabled && node->type != WLR_SCENE_NODE_TREE) { + return true; + } - lx += node->x; - ly += node->y; + lx += node->x; + ly += node->y; - struct wlr_scene_node *snapshot_node = NULL; - switch (node->type) { - case WLR_SCENE_NODE_TREE:; - struct wlr_scene_tree *scene_tree = wlr_scene_tree_from_node(node); - struct wlr_scene_node *child; - wl_list_for_each(child, &scene_tree->children, link) { - scene_node_snapshot(child, lx, ly, snapshot_tree); - } - break; - case WLR_SCENE_NODE_RECT:; + struct wlr_scene_node *snapshot_node = NULL; + switch (node->type) { + case WLR_SCENE_NODE_TREE: { + struct wlr_scene_tree *scene_tree = wlr_scene_tree_from_node(node); - struct wlr_scene_rect *scene_rect = wlr_scene_rect_from_node(node); + struct wlr_scene_node *child; + wl_list_for_each(child, &scene_tree->children, link) { + scene_node_snapshot(child, lx, ly, snapshot_tree); + } + break; + } + case WLR_SCENE_NODE_RECT: { + struct wlr_scene_rect *scene_rect = wlr_scene_rect_from_node(node); - struct wlr_scene_rect *snapshot_rect = - wlr_scene_rect_create(snapshot_tree, scene_rect->width, - scene_rect->height, scene_rect->color); - snapshot_rect->node.data = scene_rect->node.data; - if (snapshot_rect == NULL) { - return false; - } - snapshot_node = &snapshot_rect->node; - break; - case WLR_SCENE_NODE_BUFFER:; + struct wlr_scene_rect *snapshot_rect = + wlr_scene_rect_create(snapshot_tree, scene_rect->width, + scene_rect->height, scene_rect->color); + snapshot_rect->node.data = scene_rect->node.data; + if (snapshot_rect == NULL) { + return false; + } - struct wlr_scene_buffer *scene_buffer = wlr_scene_buffer_from_node(node); + wlr_scene_rect_set_clipped_region(scene_rect, + snapshot_rect->clipped_region); + wlr_scene_rect_set_backdrop_blur(scene_rect, + snapshot_rect->backdrop_blur); + wlr_scene_rect_set_backdrop_blur_optimized( + scene_rect, snapshot_rect->backdrop_blur_optimized); + wlr_scene_rect_set_corner_radius( + scene_rect, snapshot_rect->corner_radius, snapshot_rect->corners); + wlr_scene_rect_set_color(scene_rect, snapshot_rect->color); - struct wlr_scene_buffer *snapshot_buffer = - wlr_scene_buffer_create(snapshot_tree, NULL); - if (snapshot_buffer == NULL) { - return false; - } - snapshot_node = &snapshot_buffer->node; - snapshot_buffer->node.data = scene_buffer->node.data; + snapshot_node = &snapshot_rect->node; + break; + } + case WLR_SCENE_NODE_BUFFER: { + struct wlr_scene_buffer *scene_buffer = + wlr_scene_buffer_from_node(node); - wlr_scene_buffer_set_dest_size(snapshot_buffer, scene_buffer->dst_width, - scene_buffer->dst_height); - wlr_scene_buffer_set_opaque_region(snapshot_buffer, - &scene_buffer->opaque_region); - wlr_scene_buffer_set_source_box(snapshot_buffer, &scene_buffer->src_box); - wlr_scene_buffer_set_transform(snapshot_buffer, scene_buffer->transform); - wlr_scene_buffer_set_filter_mode(snapshot_buffer, - scene_buffer->filter_mode); + struct wlr_scene_buffer *snapshot_buffer = + wlr_scene_buffer_create(snapshot_tree, NULL); + if (snapshot_buffer == NULL) { + return false; + } + snapshot_node = &snapshot_buffer->node; + snapshot_buffer->node.data = scene_buffer->node.data; - // Effects - wlr_scene_buffer_set_opacity(snapshot_buffer, scene_buffer->opacity); + wlr_scene_buffer_set_dest_size(snapshot_buffer, scene_buffer->dst_width, + scene_buffer->dst_height); + wlr_scene_buffer_set_opaque_region(snapshot_buffer, + &scene_buffer->opaque_region); + wlr_scene_buffer_set_source_box(snapshot_buffer, + &scene_buffer->src_box); + wlr_scene_buffer_set_transform(snapshot_buffer, + scene_buffer->transform); + wlr_scene_buffer_set_filter_mode(snapshot_buffer, + scene_buffer->filter_mode); - snapshot_buffer->node.data = scene_buffer->node.data; + // 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); - struct wlr_scene_surface *scene_surface = - wlr_scene_surface_try_from_buffer(scene_buffer); - if (scene_surface != NULL && scene_surface->surface->buffer != NULL) { - wlr_scene_buffer_set_buffer(snapshot_buffer, - &scene_surface->surface->buffer->base); - } else { - wlr_scene_buffer_set_buffer(snapshot_buffer, scene_buffer->buffer); - } - break; - } + wlr_scene_buffer_set_backdrop_blur_optimized( + snapshot_buffer, scene_buffer->backdrop_blur_optimized); + wlr_scene_buffer_set_backdrop_blur_ignore_transparent( + snapshot_buffer, scene_buffer->backdrop_blur_ignore_transparent); + wlr_scene_buffer_set_backdrop_blur(snapshot_buffer, + scene_buffer->backdrop_blur); - if (snapshot_node != NULL) { - wlr_scene_node_set_position(snapshot_node, lx, ly); - } + snapshot_buffer->node.data = scene_buffer->node.data; - return true; + struct wlr_scene_surface *scene_surface = + wlr_scene_surface_try_from_buffer(scene_buffer); + if (scene_surface != NULL && scene_surface->surface->buffer != NULL) { + wlr_scene_buffer_set_buffer(snapshot_buffer, + &scene_surface->surface->buffer->base); + } else { + wlr_scene_buffer_set_buffer(snapshot_buffer, scene_buffer->buffer); + } + break; + } + case WLR_SCENE_NODE_SHADOW: { + struct wlr_scene_shadow *scene_shadow = + wlr_scene_shadow_from_node(node); + + struct wlr_scene_shadow *snapshot_shadow = wlr_scene_shadow_create( + snapshot_tree, scene_shadow->width, scene_shadow->height, + scene_shadow->corner_radius, scene_shadow->blur_sigma, + scene_shadow->color); + if (snapshot_shadow == NULL) { + return false; + } + snapshot_node = &snapshot_shadow->node; + + wlr_scene_shadow_set_clipped_region(snapshot_shadow, + scene_shadow->clipped_region); + + snapshot_shadow->node.data = scene_shadow->node.data; + + break; + } + case WLR_SCENE_NODE_OPTIMIZED_BLUR: + return true; + } + + if (snapshot_node != NULL) { + wlr_scene_node_set_position(snapshot_node, lx, ly); + } + + return true; } struct wlr_scene_tree *wlr_scene_tree_snapshot(struct wlr_scene_node *node, @@ -4384,7 +4469,6 @@ mapnotify(struct wl_listener *listener, void *data) { /* Called when the surface is mapped, or ready to display on-screen. */ Client *p = NULL; Client *c = wl_container_of(listener, c, map); - int i; /* Create scene tree for this client and its border */ c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]); wlr_scene_node_set_enabled(&c->scene->node, c->type != XDGShell); @@ -4416,11 +4500,12 @@ mapnotify(struct wl_listener *listener, void *data) { return; } - for (i = 0; i < 4; i++) { - c->border[i] = wlr_scene_rect_create( - c->scene, 0, 0, c->isurgent ? urgentcolor : bordercolor); - c->border[i]->node.data = c; - } + c->border = wlr_scene_rect_create(c->scene, 0, 0, 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_node_set_enabled(&c->border->node, true); + /* Initialize client geometry with room for border */ client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | @@ -4920,6 +5005,11 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy, } } // TODO: blur set, opacity set + + /* we dont round or blur popups */ + if(wlr_xdg_popup_try_from_wlr_surface(surface) != NULL) return; + + wlr_scene_buffer_set_corner_radius(buffer, border_radius, scale_data->corner_location); } void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, @@ -5258,7 +5348,7 @@ void resize(Client *c, struct wlr_box geo, int interact) { c->animainit_geom = c->current = c->pending = c->animation.current = c->geom; wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y); - apply_border(c, c->geom, 0, 0); + apply_border(c, c->geom, 0, 0, CORNER_LOCATION_ALL); client_get_clip(c, &clip); wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip); return; @@ -5898,6 +5988,7 @@ void setup(void) { /* Initialize the scene graph used to lay out windows */ scene = wlr_scene_create(); + root_bg = wlr_scene_rect_create(&scene->tree, 0, 0, rootcolor); for (i = 0; i < NUM_LAYERS; i++) layers[i] = wlr_scene_tree_create(&scene->tree); @@ -5905,7 +5996,7 @@ void setup(void) { wlr_scene_node_place_below(&drag_icon->node, &layers[LyrBlock]->node); /* Create a renderer with the default implementation */ - if (!(drw = wlr_renderer_autocreate(backend))) + if (!(drw = fx_renderer_create(backend))) die("couldn't create renderer"); wl_signal_add(&drw->events.lost, &gpu_reset);