Merge pull request #116 from DreamMaoMao/scenefx
feat: blur corner_radius shadow opacity
This commit is contained in:
@@ -18,6 +18,7 @@ This project's development is based on [dwl](https://codeberg.org/dwl/dwl/).
|
|||||||
- Sway-like scratchpad and named scratchpad
|
- Sway-like scratchpad and named scratchpad
|
||||||
- Minimize window to scratchpad
|
- Minimize window to scratchpad
|
||||||
- Hycov-like overview
|
- Hycov-like overview
|
||||||
|
- Window effects from scenefx(blur, shadow, corner radius, opacity)
|
||||||
|
|
||||||
Master-Stack Layout
|
Master-Stack Layout
|
||||||
|
|
||||||
@@ -58,6 +59,11 @@ cd wlroots
|
|||||||
meson build -Dprefix=/usr
|
meson build -Dprefix=/usr
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
|
git clone https://github.com/wlrfx/scenefx.git
|
||||||
|
cd scenefx
|
||||||
|
meson build -Dprefix=/usr
|
||||||
|
sudo ninja -C build install
|
||||||
|
|
||||||
git clone https://github.com/DreamMaoMao/maomaowm.git
|
git clone https://github.com/DreamMaoMao/maomaowm.git
|
||||||
cd maomaowm
|
cd maomaowm
|
||||||
meson build -Dprefix=/usr
|
meson build -Dprefix=/usr
|
||||||
@@ -176,3 +182,5 @@ Here's an example of using the modules in a flake:
|
|||||||
- https://codeberg.org/dwl/dwl - Basal dwl feature
|
- https://codeberg.org/dwl/dwl - Basal dwl feature
|
||||||
|
|
||||||
- https://github.com/swaywm/sway - Sample of Wayland protocol
|
- https://github.com/swaywm/sway - Sample of Wayland protocol
|
||||||
|
|
||||||
|
- https://github.com/wlrfx/scenefx - Make it simple to add window effect.
|
||||||
@@ -38,6 +38,8 @@ xkbcommon_dep = dependency('xkbcommon')
|
|||||||
libinput_dep = dependency('libinput')
|
libinput_dep = dependency('libinput')
|
||||||
libwayland_client_dep = dependency('wayland-client')
|
libwayland_client_dep = dependency('wayland-client')
|
||||||
pcre2_dep = dependency('libpcre2-8')
|
pcre2_dep = dependency('libpcre2-8')
|
||||||
|
libscenefx_dep = dependency('scenefx-0.4')
|
||||||
|
|
||||||
|
|
||||||
# 获取 Git Commit Hash 和最新的 tag
|
# 获取 Git Commit Hash 和最新的 tag
|
||||||
git = find_program('git', required : false)
|
git = find_program('git', required : false)
|
||||||
@@ -74,6 +76,7 @@ executable('maomao',
|
|||||||
libm,
|
libm,
|
||||||
xcb,
|
xcb,
|
||||||
xlibs,
|
xlibs,
|
||||||
|
libscenefx_dep,
|
||||||
wayland_server_dep,
|
wayland_server_dep,
|
||||||
wlroots_dep,
|
wlroots_dep,
|
||||||
xkbcommon_dep,
|
xkbcommon_dep,
|
||||||
|
|||||||
@@ -308,9 +308,7 @@ static inline void client_send_close(Client *c) {
|
|||||||
|
|
||||||
static inline void client_set_border_color(Client *c,
|
static inline void client_set_border_color(Client *c,
|
||||||
const float color[static 4]) {
|
const float color[static 4]) {
|
||||||
int i;
|
wlr_scene_rect_set_color(c->border, color);
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
wlr_scene_rect_set_color(c->border[i], color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_set_fullscreen(Client *c, int fullscreen) {
|
static inline void client_set_fullscreen(Client *c, int fullscreen) {
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ typedef struct {
|
|||||||
int noswallow;
|
int noswallow;
|
||||||
int scratchpad_width;
|
int scratchpad_width;
|
||||||
int scratchpad_height;
|
int scratchpad_height;
|
||||||
|
float focused_opacity;
|
||||||
|
float unfocused_opacity;
|
||||||
uint32_t passmod;
|
uint32_t passmod;
|
||||||
xkb_keysym_t keysym;
|
xkb_keysym_t keysym;
|
||||||
KeyBinding globalkeybinding;
|
KeyBinding globalkeybinding;
|
||||||
@@ -147,10 +149,13 @@ typedef struct {
|
|||||||
int focus_cross_monitor;
|
int focus_cross_monitor;
|
||||||
int focus_cross_tag;
|
int focus_cross_tag;
|
||||||
int no_border_when_single;
|
int no_border_when_single;
|
||||||
|
int no_radius_when_single;
|
||||||
int snap_distance;
|
int snap_distance;
|
||||||
int enable_floating_snap;
|
int enable_floating_snap;
|
||||||
int drag_tile_to_tile;
|
int drag_tile_to_tile;
|
||||||
unsigned int swipe_min_threshold;
|
unsigned int swipe_min_threshold;
|
||||||
|
float focused_opacity;
|
||||||
|
float unfocused_opacity;
|
||||||
float *scroller_proportion_preset;
|
float *scroller_proportion_preset;
|
||||||
int scroller_proportion_preset_count;
|
int scroller_proportion_preset_count;
|
||||||
|
|
||||||
@@ -192,6 +197,17 @@ typedef struct {
|
|||||||
unsigned int accel_profile;
|
unsigned int accel_profile;
|
||||||
double accel_speed;
|
double accel_speed;
|
||||||
|
|
||||||
|
int blur;
|
||||||
|
int blur_layer;
|
||||||
|
int border_radius;
|
||||||
|
struct blur_data blur_params;
|
||||||
|
int shadows;
|
||||||
|
unsigned int shadows_size;
|
||||||
|
float shadows_blur;
|
||||||
|
int shadows_position_x;
|
||||||
|
int shadows_position_y;
|
||||||
|
float shadowscolor[4];
|
||||||
|
|
||||||
int smartgaps;
|
int smartgaps;
|
||||||
unsigned int gappih;
|
unsigned int gappih;
|
||||||
unsigned int gappiv;
|
unsigned int gappiv;
|
||||||
@@ -873,6 +889,36 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
config->focus_cross_monitor = atoi(value);
|
config->focus_cross_monitor = atoi(value);
|
||||||
} else if (strcmp(key, "focus_cross_tag") == 0) {
|
} else if (strcmp(key, "focus_cross_tag") == 0) {
|
||||||
config->focus_cross_tag = atoi(value);
|
config->focus_cross_tag = atoi(value);
|
||||||
|
} else if (strcmp(key, "focus_cross_tag") == 0) {
|
||||||
|
config->focus_cross_tag = atoi(value);
|
||||||
|
} else if (strcmp(key, "blur") == 0) {
|
||||||
|
config->blur = atoi(value);
|
||||||
|
} else if (strcmp(key, "blur_layer") == 0) {
|
||||||
|
config->blur_layer = atoi(value);
|
||||||
|
} else if (strcmp(key, "border_radius") == 0) {
|
||||||
|
config->border_radius = atoi(value);
|
||||||
|
} else if (strcmp(key, "blur_params_num_passes") == 0) {
|
||||||
|
config->blur_params.num_passes = atoi(value);
|
||||||
|
} else if (strcmp(key, "blur_params_radius") == 0) {
|
||||||
|
config->blur_params.radius = atoi(value);
|
||||||
|
} else if (strcmp(key, "blur_params_noise") == 0) {
|
||||||
|
config->blur_params.noise = atof(value);
|
||||||
|
} else if (strcmp(key, "blur_params_brightness") == 0) {
|
||||||
|
config->blur_params.brightness = atof(value);
|
||||||
|
} else if (strcmp(key, "blur_params_contrast") == 0) {
|
||||||
|
config->blur_params.contrast = atof(value);
|
||||||
|
} else if (strcmp(key, "blur_params_saturation") == 0) {
|
||||||
|
config->blur_params.saturation = atof(value);
|
||||||
|
} else if (strcmp(key, "shadows") == 0) {
|
||||||
|
config->shadows = atoi(value);
|
||||||
|
} else if (strcmp(key, "shadows_size") == 0) {
|
||||||
|
config->shadows_size = atoi(value);
|
||||||
|
} else if (strcmp(key, "shadows_blur") == 0) {
|
||||||
|
config->shadows_blur = atof(value);
|
||||||
|
} else if (strcmp(key, "shadows_position_x") == 0) {
|
||||||
|
config->shadows_position_x = atoi(value);
|
||||||
|
} else if (strcmp(key, "shadows_position_y") == 0) {
|
||||||
|
config->shadows_position_y = atoi(value);
|
||||||
} else if (strcmp(key, "single_scratchpad") == 0) {
|
} else if (strcmp(key, "single_scratchpad") == 0) {
|
||||||
config->single_scratchpad = atoi(value);
|
config->single_scratchpad = atoi(value);
|
||||||
} else if (strcmp(key, "xwayland_persistence") == 0) {
|
} else if (strcmp(key, "xwayland_persistence") == 0) {
|
||||||
@@ -881,6 +927,8 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
config->syncobj_enable = atoi(value);
|
config->syncobj_enable = atoi(value);
|
||||||
} else if (strcmp(key, "no_border_when_single") == 0) {
|
} else if (strcmp(key, "no_border_when_single") == 0) {
|
||||||
config->no_border_when_single = atoi(value);
|
config->no_border_when_single = atoi(value);
|
||||||
|
} else if (strcmp(key, "no_radius_when_single") == 0) {
|
||||||
|
config->no_radius_when_single = atoi(value);
|
||||||
} else if (strcmp(key, "snap_distance") == 0) {
|
} else if (strcmp(key, "snap_distance") == 0) {
|
||||||
config->snap_distance = atoi(value);
|
config->snap_distance = atoi(value);
|
||||||
} else if (strcmp(key, "enable_floating_snap") == 0) {
|
} else if (strcmp(key, "enable_floating_snap") == 0) {
|
||||||
@@ -889,6 +937,10 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
config->drag_tile_to_tile = atoi(value);
|
config->drag_tile_to_tile = atoi(value);
|
||||||
} else if (strcmp(key, "swipe_min_threshold") == 0) {
|
} else if (strcmp(key, "swipe_min_threshold") == 0) {
|
||||||
config->swipe_min_threshold = atoi(value);
|
config->swipe_min_threshold = atoi(value);
|
||||||
|
} else if (strcmp(key, "focused_opacity") == 0) {
|
||||||
|
config->focused_opacity = atof(value);
|
||||||
|
} else if (strcmp(key, "unfocused_opacity") == 0) {
|
||||||
|
config->unfocused_opacity = atof(value);
|
||||||
} else if (strcmp(key, "xkb_rules_rules") == 0) {
|
} else if (strcmp(key, "xkb_rules_rules") == 0) {
|
||||||
strncpy(xkb_rules_rules, value, sizeof(xkb_rules_rules) - 1);
|
strncpy(xkb_rules_rules, value, sizeof(xkb_rules_rules) - 1);
|
||||||
xkb_rules_rules[sizeof(xkb_rules_rules) - 1] =
|
xkb_rules_rules[sizeof(xkb_rules_rules) - 1] =
|
||||||
@@ -1109,6 +1161,14 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
} else {
|
} else {
|
||||||
convert_hex_to_rgba(config->rootcolor, color);
|
convert_hex_to_rgba(config->rootcolor, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (strcmp(key, "shadowscolor") == 0) {
|
||||||
|
long int color = parse_color(value);
|
||||||
|
if (color == -1) {
|
||||||
|
fprintf(stderr, "Error: Invalid shadowscolor format: %s\n", value);
|
||||||
|
} else {
|
||||||
|
convert_hex_to_rgba(config->shadowscolor, color);
|
||||||
|
}
|
||||||
} else if (strcmp(key, "bordercolor") == 0) {
|
} else if (strcmp(key, "bordercolor") == 0) {
|
||||||
long int color = parse_color(value);
|
long int color = parse_color(value);
|
||||||
if (color == -1) {
|
if (color == -1) {
|
||||||
@@ -1238,6 +1298,8 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
rule->no_force_center = -1;
|
rule->no_force_center = -1;
|
||||||
rule->scratchpad_width = 0;
|
rule->scratchpad_width = 0;
|
||||||
rule->scratchpad_height = 0;
|
rule->scratchpad_height = 0;
|
||||||
|
rule->focused_opacity = 0;
|
||||||
|
rule->unfocused_opacity = 0;
|
||||||
rule->width = 0;
|
rule->width = 0;
|
||||||
rule->height = 0;
|
rule->height = 0;
|
||||||
rule->animation_type_open = NULL;
|
rule->animation_type_open = NULL;
|
||||||
@@ -1301,6 +1363,10 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
rule->isunglobal = atoi(val);
|
rule->isunglobal = atoi(val);
|
||||||
} else if (strcmp(key, "isglobal") == 0) {
|
} else if (strcmp(key, "isglobal") == 0) {
|
||||||
rule->isglobal = atoi(val);
|
rule->isglobal = atoi(val);
|
||||||
|
} else if (strcmp(key, "unfocused_opacity") == 0) {
|
||||||
|
rule->unfocused_opacity = atof(val);
|
||||||
|
} else if (strcmp(key, "focused_opacity") == 0) {
|
||||||
|
rule->focused_opacity = atof(val);
|
||||||
} else if (strcmp(key, "isoverlay") == 0) {
|
} else if (strcmp(key, "isoverlay") == 0) {
|
||||||
rule->isoverlay = atoi(val);
|
rule->isoverlay = atoi(val);
|
||||||
} else if (strcmp(key, "isterm") == 0) {
|
} else if (strcmp(key, "isterm") == 0) {
|
||||||
@@ -1986,6 +2052,7 @@ void override_config(void) {
|
|||||||
snap_distance = CLAMP_INT(config.snap_distance, 0, 99999);
|
snap_distance = CLAMP_INT(config.snap_distance, 0, 99999);
|
||||||
cursor_size = CLAMP_INT(config.cursor_size, 4, 512);
|
cursor_size = CLAMP_INT(config.cursor_size, 4, 512);
|
||||||
no_border_when_single = CLAMP_INT(config.no_border_when_single, 0, 1);
|
no_border_when_single = CLAMP_INT(config.no_border_when_single, 0, 1);
|
||||||
|
no_radius_when_single = CLAMP_INT(config.no_radius_when_single, 0, 1);
|
||||||
cursor_hide_timeout =
|
cursor_hide_timeout =
|
||||||
CLAMP_INT(config.cursor_hide_timeout, 0, 36000); // 0-10小时
|
CLAMP_INT(config.cursor_hide_timeout, 0, 36000); // 0-10小时
|
||||||
drag_tile_to_tile = CLAMP_INT(config.drag_tile_to_tile, 0, 1);
|
drag_tile_to_tile = CLAMP_INT(config.drag_tile_to_tile, 0, 1);
|
||||||
@@ -2020,6 +2087,24 @@ void override_config(void) {
|
|||||||
borderpx = CLAMP_INT(config.borderpx, 0, 200);
|
borderpx = CLAMP_INT(config.borderpx, 0, 200);
|
||||||
smartgaps = CLAMP_INT(config.smartgaps, 0, 1);
|
smartgaps = CLAMP_INT(config.smartgaps, 0, 1);
|
||||||
|
|
||||||
|
blur = CLAMP_INT(config.blur, 0, 1);
|
||||||
|
blur_layer = CLAMP_INT(config.blur_layer, 0, 1);
|
||||||
|
border_radius = CLAMP_INT(config.border_radius, 0, 100);
|
||||||
|
blur_params.num_passes = CLAMP_INT(config.blur_params.num_passes, 0, 10);
|
||||||
|
blur_params.radius = CLAMP_INT(config.blur_params.radius, 0, 100);
|
||||||
|
blur_params.noise = CLAMP_FLOAT(config.blur_params.noise, 0, 1);
|
||||||
|
blur_params.brightness = CLAMP_FLOAT(config.blur_params.brightness, 0, 1);
|
||||||
|
blur_params.contrast = CLAMP_FLOAT(config.blur_params.contrast, 0, 1);
|
||||||
|
blur_params.saturation = CLAMP_FLOAT(config.blur_params.saturation, 0, 1);
|
||||||
|
shadows = CLAMP_INT(config.shadows, 0, 1);
|
||||||
|
shadows_size = CLAMP_INT(config.shadows_size, 0, 100);
|
||||||
|
shadows_blur = CLAMP_INT(config.shadows_blur, 0, 100);
|
||||||
|
shadows_position_x = CLAMP_INT(config.shadows_position_x, -1000, 1000);
|
||||||
|
shadows_position_y = CLAMP_INT(config.shadows_position_y, -1000, 1000);
|
||||||
|
focused_opacity = CLAMP_FLOAT(config.focused_opacity, 0.0f, 1.0f);
|
||||||
|
unfocused_opacity = CLAMP_FLOAT(config.unfocused_opacity, 0.0f, 1.0f);
|
||||||
|
memcpy(shadowscolor, config.shadowscolor, sizeof(shadowscolor));
|
||||||
|
|
||||||
// 复制颜色数组
|
// 复制颜色数组
|
||||||
memcpy(rootcolor, config.rootcolor, sizeof(rootcolor));
|
memcpy(rootcolor, config.rootcolor, sizeof(rootcolor));
|
||||||
memcpy(bordercolor, config.bordercolor, sizeof(bordercolor));
|
memcpy(bordercolor, config.bordercolor, sizeof(bordercolor));
|
||||||
@@ -2097,6 +2182,7 @@ void set_value_default() {
|
|||||||
config.xwayland_persistence = xwayland_persistence;
|
config.xwayland_persistence = xwayland_persistence;
|
||||||
config.syncobj_enable = syncobj_enable;
|
config.syncobj_enable = syncobj_enable;
|
||||||
config.no_border_when_single = no_border_when_single;
|
config.no_border_when_single = no_border_when_single;
|
||||||
|
config.no_radius_when_single = no_radius_when_single;
|
||||||
config.snap_distance = snap_distance;
|
config.snap_distance = snap_distance;
|
||||||
config.drag_tile_to_tile = drag_tile_to_tile;
|
config.drag_tile_to_tile = drag_tile_to_tile;
|
||||||
config.enable_floating_snap = enable_floating_snap;
|
config.enable_floating_snap = enable_floating_snap;
|
||||||
@@ -2131,6 +2217,24 @@ void set_value_default() {
|
|||||||
config.accel_profile = accel_profile;
|
config.accel_profile = accel_profile;
|
||||||
config.accel_speed = accel_speed;
|
config.accel_speed = accel_speed;
|
||||||
|
|
||||||
|
config.blur = blur;
|
||||||
|
config.blur_layer = blur_layer;
|
||||||
|
config.border_radius = border_radius;
|
||||||
|
config.blur_params.num_passes = blur_params_num_passes;
|
||||||
|
config.blur_params.radius = blur_params_radius;
|
||||||
|
config.blur_params.noise = blur_params_noise;
|
||||||
|
config.blur_params.brightness = blur_params_brightness;
|
||||||
|
config.blur_params.contrast = blur_params_contrast;
|
||||||
|
config.blur_params.saturation = blur_params_saturation;
|
||||||
|
config.shadows = shadows;
|
||||||
|
config.shadows_size = shadows_size;
|
||||||
|
config.shadows_blur = shadows_blur;
|
||||||
|
config.shadows_position_x = shadows_position_x;
|
||||||
|
config.shadows_position_y = shadows_position_y;
|
||||||
|
config.focused_opacity = focused_opacity;
|
||||||
|
config.unfocused_opacity = unfocused_opacity;
|
||||||
|
memcpy(config.shadowscolor, shadowscolor, sizeof(shadowscolor));
|
||||||
|
|
||||||
memcpy(config.animation_curve_move, animation_curve_move,
|
memcpy(config.animation_curve_move, animation_curve_move,
|
||||||
sizeof(animation_curve_move));
|
sizeof(animation_curve_move));
|
||||||
memcpy(config.animation_curve_open, animation_curve_open,
|
memcpy(config.animation_curve_open, animation_curve_open,
|
||||||
@@ -2241,6 +2345,33 @@ void parse_config(void) {
|
|||||||
override_config();
|
override_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_blur_params(void) {
|
||||||
|
if (blur) {
|
||||||
|
Monitor *m;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
if (m->blur != NULL) {
|
||||||
|
wlr_scene_node_destroy(&m->blur->node);
|
||||||
|
}
|
||||||
|
m->blur = wlr_scene_optimized_blur_create(&scene->tree, 0, 0);
|
||||||
|
wlr_scene_node_reparent(&m->blur->node, layers[LyrBlur]);
|
||||||
|
wlr_scene_optimized_blur_set_size(m->blur, m->m.width, m->m.height);
|
||||||
|
wlr_scene_set_blur_data(
|
||||||
|
scene, blur_params.num_passes, blur_params.radius,
|
||||||
|
blur_params.noise, blur_params.brightness, blur_params.contrast,
|
||||||
|
blur_params.saturation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Monitor *m;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
|
||||||
|
if (m->blur) {
|
||||||
|
wlr_scene_node_destroy(&m->blur->node);
|
||||||
|
m->blur = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void reload_config(const Arg *arg) {
|
void reload_config(const Arg *arg) {
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
@@ -2250,6 +2381,7 @@ void reload_config(const Arg *arg) {
|
|||||||
init_baked_points();
|
init_baked_points();
|
||||||
handlecursoractivity();
|
handlecursoractivity();
|
||||||
reset_keyboard_layout();
|
reset_keyboard_layout();
|
||||||
|
reset_blur_params();
|
||||||
run_exec();
|
run_exec();
|
||||||
|
|
||||||
// reset border width when config change
|
// reset border width when config change
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ int scroller_prefer_center = 0;
|
|||||||
int focus_cross_monitor = 0;
|
int focus_cross_monitor = 0;
|
||||||
int focus_cross_tag = 0;
|
int focus_cross_tag = 0;
|
||||||
int no_border_when_single = 0;
|
int no_border_when_single = 0;
|
||||||
|
int no_radius_when_single = 0;
|
||||||
int snap_distance = 30;
|
int snap_distance = 30;
|
||||||
int enable_floating_snap = 0;
|
int enable_floating_snap = 0;
|
||||||
int drag_tile_to_tile = 0;
|
int drag_tile_to_tile = 0;
|
||||||
@@ -180,3 +181,36 @@ enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
|||||||
static const char *tags[] = {
|
static const char *tags[] = {
|
||||||
"1", "2", "3", "4", "5", "6", "7", "8", "9",
|
"1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
float focused_opacity = 1.0;
|
||||||
|
float unfocused_opacity = 0.8;
|
||||||
|
|
||||||
|
int border_radius = 0;
|
||||||
|
int border_radius_location_default = CORNER_LOCATION_ALL;
|
||||||
|
int blur = 0;
|
||||||
|
int blur_layer = 0;
|
||||||
|
|
||||||
|
struct blur_data {
|
||||||
|
int num_passes;
|
||||||
|
int radius;
|
||||||
|
float noise;
|
||||||
|
float brightness;
|
||||||
|
float contrast;
|
||||||
|
float saturation;
|
||||||
|
};
|
||||||
|
struct blur_data blur_params;
|
||||||
|
|
||||||
|
int blur_params_num_passes = 1;
|
||||||
|
int blur_params_radius = 5;
|
||||||
|
float blur_params_noise = 0.02;
|
||||||
|
float blur_params_brightness = 0.9;
|
||||||
|
float blur_params_contrast = 0.9;
|
||||||
|
float blur_params_saturation = 1.2;
|
||||||
|
|
||||||
|
int shadows = 0;
|
||||||
|
unsigned int shadows_size = 10;
|
||||||
|
double shadows_blur = 15;
|
||||||
|
int shadows_position_x = 0;
|
||||||
|
int shadows_position_y = 0;
|
||||||
|
float shadowscolor[] = COLOR(0x000000ff);
|
||||||
|
;
|
||||||
548
src/maomao.c
548
src/maomao.c
@@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* See LICENSE file for copyright and license details.
|
* See LICENSE file for copyright and license details.
|
||||||
*/
|
*/
|
||||||
|
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||||
#include "wlr/util/box.h"
|
#include "wlr/util/box.h"
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <linux/input-event-codes.h>
|
#include <linux/input-event-codes.h>
|
||||||
|
#include <scenefx/render/fx_renderer/fx_renderer.h>
|
||||||
|
#include <scenefx/types/fx/blur_data.h>
|
||||||
|
#include <scenefx/types/fx/clipped_region.h>
|
||||||
|
#include <scenefx/types/fx/corner_location.h>
|
||||||
|
#include <scenefx/types/wlr_scene.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -55,7 +61,6 @@
|
|||||||
#include <wlr/types/wlr_primary_selection.h>
|
#include <wlr/types/wlr_primary_selection.h>
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
#include <wlr/types/wlr_relative_pointer_v1.h>
|
||||||
#include <wlr/types/wlr_scene.h>
|
|
||||||
#include <wlr/types/wlr_screencopy_v1.h>
|
#include <wlr/types/wlr_screencopy_v1.h>
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
#include <wlr/types/wlr_server_decoration.h>
|
#include <wlr/types/wlr_server_decoration.h>
|
||||||
@@ -119,6 +124,7 @@ enum { XDGShell, LayerShell, X11 }; /* client types */
|
|||||||
enum { AxisUp, AxisDown, AxisLeft, AxisRight }; // 滚轮滚动的方向
|
enum { AxisUp, AxisDown, AxisLeft, AxisRight }; // 滚轮滚动的方向
|
||||||
enum {
|
enum {
|
||||||
LyrBg,
|
LyrBg,
|
||||||
|
LyrBlur,
|
||||||
LyrBottom,
|
LyrBottom,
|
||||||
LyrTile,
|
LyrTile,
|
||||||
LyrFloat,
|
LyrFloat,
|
||||||
@@ -201,6 +207,9 @@ typedef struct {
|
|||||||
float height_scale;
|
float height_scale;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
double percent;
|
||||||
|
float opacity;
|
||||||
|
enum corner_location corner_location;
|
||||||
bool should_scale;
|
bool should_scale;
|
||||||
} animationScale;
|
} animationScale;
|
||||||
|
|
||||||
@@ -212,7 +221,8 @@ struct Client {
|
|||||||
overview_backup_geom, current; /* layout-relative, includes border */
|
overview_backup_geom, current; /* layout-relative, includes border */
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
struct wlr_scene_tree *scene;
|
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_shadow *shadow;
|
||||||
struct wlr_scene_tree *scene_surface;
|
struct wlr_scene_tree *scene_surface;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wl_list flink;
|
struct wl_list flink;
|
||||||
@@ -285,6 +295,8 @@ struct Client {
|
|||||||
int nofadeout;
|
int nofadeout;
|
||||||
int no_force_center;
|
int no_force_center;
|
||||||
int isunglobal;
|
int isunglobal;
|
||||||
|
float focused_opacity;
|
||||||
|
float unfocused_opacity;
|
||||||
char oldmonname[128];
|
char oldmonname[128];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -384,6 +396,7 @@ struct Monitor {
|
|||||||
int gamma_lut_changed;
|
int gamma_lut_changed;
|
||||||
int asleep;
|
int asleep;
|
||||||
unsigned int visible_clients;
|
unsigned int visible_clients;
|
||||||
|
struct wlr_scene_optimized_blur *blur;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -846,39 +859,14 @@ double find_animation_curve_at(double t, int type) {
|
|||||||
|
|
||||||
void apply_opacity_to_rect_nodes(Client *c, struct wlr_scene_node *node,
|
void apply_opacity_to_rect_nodes(Client *c, struct wlr_scene_node *node,
|
||||||
double animation_passed) {
|
double animation_passed) {
|
||||||
int offsetx = 0;
|
|
||||||
int offsety = 0;
|
|
||||||
if (node->type == WLR_SCENE_NODE_RECT) {
|
if (node->type == WLR_SCENE_NODE_RECT) {
|
||||||
struct wlr_scene_rect *rect = wlr_scene_rect_from_node(node);
|
struct wlr_scene_rect *rect = wlr_scene_rect_from_node(node);
|
||||||
// Assuming the rect has a color field and we can modify it
|
// Assuming the rect has a color field and we can modify it
|
||||||
rect->color[0] = (1 - animation_passed) * rect->color[0];
|
rect->color[0] = 0;
|
||||||
rect->color[1] = (1 - animation_passed) * rect->color[1];
|
rect->color[1] = 0;
|
||||||
rect->color[2] = (1 - animation_passed) * rect->color[2];
|
rect->color[2] = 0;
|
||||||
rect->color[3] = (1 - animation_passed) * rect->color[3];
|
rect->color[3] = 0;
|
||||||
wlr_scene_rect_set_color(rect, rect->color);
|
wlr_scene_rect_set_color(rect, rect->color);
|
||||||
|
|
||||||
offsetx = c->geom.width - c->animation.current.width;
|
|
||||||
offsety = c->geom.height - c->animation.current.height;
|
|
||||||
if (node->y > c->geom.y + c->geom.height / 2) {
|
|
||||||
wlr_scene_node_set_position(node, c->geom.x,
|
|
||||||
c->geom.y + c->geom.height - offsety);
|
|
||||||
wlr_scene_rect_set_size(rect, c->animation.current.width,
|
|
||||||
c->bw); // down
|
|
||||||
} else if (node->y < c->geom.y + c->geom.height / 2 &&
|
|
||||||
rect->width > rect->height) {
|
|
||||||
wlr_scene_node_set_position(node, c->geom.x, c->geom.y);
|
|
||||||
wlr_scene_rect_set_size(rect, c->animation.current.width,
|
|
||||||
c->bw); // up
|
|
||||||
} else if (node->x < c->geom.x + c->geom.width / 2 &&
|
|
||||||
rect->width < rect->height) {
|
|
||||||
wlr_scene_rect_set_size(rect, c->bw,
|
|
||||||
c->animation.current.height); // left
|
|
||||||
} else {
|
|
||||||
wlr_scene_node_set_position(
|
|
||||||
node, c->geom.x + c->geom.width - offsetx, c->geom.y);
|
|
||||||
wlr_scene_rect_set_size(rect, c->bw,
|
|
||||||
c->animation.current.height); // right
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the node is a tree, recursively traverse its children
|
// If the node is a tree, recursively traverse its children
|
||||||
@@ -985,19 +973,9 @@ void client_animation_next_tick(Client *c) {
|
|||||||
.height = height,
|
.height = height,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!c->iskilling && (c->is_open_animation || c->animation.begin_fade_in) &&
|
|
||||||
animation_fade_in && !c->nofadein) {
|
|
||||||
c->animation.begin_fade_in = true;
|
|
||||||
client_set_opacity(c,
|
|
||||||
MIN(animation_passed + fadein_begin_opacity, 1.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
c->is_open_animation = false;
|
c->is_open_animation = false;
|
||||||
|
|
||||||
if (animation_passed == 1.0) {
|
if (animation_passed == 1.0) {
|
||||||
if (c->animation.begin_fade_in) {
|
|
||||||
c->animation.begin_fade_in = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clear the open action state
|
// clear the open action state
|
||||||
// To prevent him from being mistaken that
|
// To prevent him from being mistaken that
|
||||||
@@ -1068,19 +1046,72 @@ bool check_hit_no_border(Client *c) {
|
|||||||
return hit_no_border;
|
return hit_no_border;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_border(Client *c) {
|
void client_draw_shadow(Client *c) {
|
||||||
|
|
||||||
if (c->iskilling || !client_surface(c)->mapped)
|
if (c->iskilling || !client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!shadows || !c->isfloating) {
|
||||||
|
wlr_scene_shadow_set_size(c->shadow, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t width, height;
|
||||||
|
client_actual_size(c, &width, &height);
|
||||||
|
|
||||||
|
uint32_t delta = shadows_size + c->bw;
|
||||||
|
|
||||||
|
/* we calculate where to clip the shadow */
|
||||||
|
struct wlr_box client_box = {
|
||||||
|
.x = 0,
|
||||||
|
.y = 0,
|
||||||
|
.width = width,
|
||||||
|
.height = height,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wlr_box shadow_box = {
|
||||||
|
.x = shadows_position_x,
|
||||||
|
.y = shadows_position_y,
|
||||||
|
.width = width + 2 * delta,
|
||||||
|
.height = height + 2 * delta,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wlr_box intersection_box;
|
||||||
|
wlr_box_intersection(&intersection_box, &client_box, &shadow_box);
|
||||||
|
/* clipped region takes shadow relative coords, so we translate everything
|
||||||
|
* by its position */
|
||||||
|
intersection_box.x -= shadows_position_x;
|
||||||
|
intersection_box.y -= shadows_position_y;
|
||||||
|
|
||||||
|
struct clipped_region clipped_region = {
|
||||||
|
.area = intersection_box,
|
||||||
|
.corner_radius = border_radius,
|
||||||
|
.corners = border_radius_location_default,
|
||||||
|
};
|
||||||
|
|
||||||
|
wlr_scene_node_set_position(&c->shadow->node, shadow_box.x, shadow_box.y);
|
||||||
|
|
||||||
|
wlr_scene_shadow_set_size(c->shadow, shadow_box.width, shadow_box.height);
|
||||||
|
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apply_border(Client *c) {
|
||||||
|
if (!c || c->iskilling || !client_surface(c)->mapped)
|
||||||
|
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 =
|
||||||
|
c->isfullscreen || (no_radius_when_single && c->mon &&
|
||||||
|
c->mon->visible_clients == 1)
|
||||||
|
? CORNER_LOCATION_NONE
|
||||||
|
: CORNER_LOCATION_ALL;
|
||||||
|
|
||||||
// Handle no-border cases
|
// Handle no-border cases
|
||||||
if (hit_no_border && smartgaps) {
|
if (hit_no_border && smartgaps) {
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
c->fake_no_border = true;
|
c->fake_no_border = true;
|
||||||
} else if (hit_no_border && !smartgaps) {
|
} else if (hit_no_border && !smartgaps) {
|
||||||
for (int i = 0; i < 4; i++)
|
wlr_scene_rect_set_size(c->border, 0, 0);
|
||||||
set_rect_size(c->border[i], 0, 0);
|
|
||||||
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);
|
||||||
c->fake_no_border = true;
|
c->fake_no_border = true;
|
||||||
return;
|
return;
|
||||||
@@ -1089,92 +1120,83 @@ void apply_border(Client *c) {
|
|||||||
c->fake_no_border = false;
|
c->fake_no_border = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box geom = c->animation.current;
|
struct wlr_box clip_box = c->animation.current;
|
||||||
int bw = c->bw;
|
// 一但在GEZERO如果使用无符号,那么其他数据也会转换为无符号导致没有负数出错
|
||||||
|
int bw = (int)c->bw;
|
||||||
|
|
||||||
// Calculate how much the window is outside the monitor
|
int right_offset =
|
||||||
// These values will be positive when window is outside the monitor
|
GEZERO(c->animation.current.x + c->animation.current.width -
|
||||||
int outside_left = GEZERO(c->mon->m.x - c->animation.current.x);
|
c->mon->m.x - c->mon->m.width);
|
||||||
int outside_top = GEZERO(c->mon->m.y - c->animation.current.y);
|
int bottom_offset =
|
||||||
int outside_right =
|
GEZERO(c->animation.current.y + c->animation.current.height -
|
||||||
GEZERO((c->animation.current.x + c->animation.current.width) -
|
c->mon->m.y - c->mon->m.height);
|
||||||
(c->mon->m.x + c->mon->m.width));
|
|
||||||
int outside_bottom =
|
|
||||||
GEZERO((c->animation.current.y + c->animation.current.height) -
|
|
||||||
(c->mon->m.y + c->mon->m.height));
|
|
||||||
|
|
||||||
// Initialize border dimensions
|
int left_offset = GEZERO(c->mon->m.x - c->animation.current.x);
|
||||||
int top_width = geom.width;
|
int top_offset = GEZERO(c->mon->m.y - c->animation.current.y);
|
||||||
int top_height = bw;
|
|
||||||
int bottom_width = geom.width;
|
|
||||||
int bottom_height = bw;
|
|
||||||
int left_width = bw;
|
|
||||||
int left_height = geom.height - 2 * bw;
|
|
||||||
int right_width = bw;
|
|
||||||
int right_height = geom.height - 2 * bw;
|
|
||||||
|
|
||||||
// Initialize border positions
|
int inner_surface_width = GEZERO(clip_box.width - 2 * bw);
|
||||||
int top_x = 0;
|
int inner_surface_height = GEZERO(clip_box.height - 2 * bw);
|
||||||
int top_y = 0;
|
|
||||||
int bottom_x = 0;
|
|
||||||
int bottom_y = geom.height - bottom_height;
|
|
||||||
int left_x = 0;
|
|
||||||
int left_y = bw;
|
|
||||||
int right_x = geom.width - right_width;
|
|
||||||
int right_y = bw;
|
|
||||||
|
|
||||||
// Adjust borders when window is outside monitor
|
int inner_surface_x = GEZERO(bw - left_offset);
|
||||||
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted ||
|
int inner_surface_y = GEZERO(bw - top_offset);
|
||||||
c->animation.tagouting) {
|
|
||||||
// Top border - reduce height when window goes above monitor
|
int rect_x = left_offset;
|
||||||
if (outside_top > 0) {
|
int rect_y = top_offset;
|
||||||
top_height = GEZERO(bw - outside_top);
|
|
||||||
top_y = top_y + outside_top;
|
int rect_width =
|
||||||
left_height = left_height - outside_top;
|
GEZERO(c->animation.current.width - left_offset - right_offset);
|
||||||
right_height = right_height - outside_top;
|
int rect_height =
|
||||||
left_y = left_y + outside_top;
|
GEZERO(c->animation.current.height - top_offset - bottom_offset);
|
||||||
right_y = right_y + outside_top;
|
|
||||||
|
if (left_offset > c->bw)
|
||||||
|
inner_surface_width = inner_surface_width - left_offset + c->bw;
|
||||||
|
|
||||||
|
if (top_offset > c->bw)
|
||||||
|
inner_surface_height = inner_surface_height - top_offset + c->bw;
|
||||||
|
|
||||||
|
if (right_offset > 0) {
|
||||||
|
inner_surface_width =
|
||||||
|
MIN(clip_box.width, inner_surface_width + right_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bottom border - reduce height when window goes below monitor
|
if (bottom_offset > 0) {
|
||||||
if (outside_bottom > 0) {
|
inner_surface_height =
|
||||||
bottom_height = GEZERO(bw - outside_bottom);
|
MIN(clip_box.height, inner_surface_height + bottom_offset);
|
||||||
left_height = left_height - outside_bottom;
|
|
||||||
right_height = right_height - outside_bottom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Left border - reduce width when window goes left of monitor
|
struct clipped_region clipped_region = {
|
||||||
if (outside_left > 0) {
|
.area = {inner_surface_x, inner_surface_y, inner_surface_width,
|
||||||
left_width = GEZERO(bw - outside_left);
|
inner_surface_height},
|
||||||
left_x = left_x + outside_left;
|
.corner_radius = border_radius,
|
||||||
top_width = top_width - outside_left;
|
.corners = current_corner_location,
|
||||||
bottom_width = bottom_width - outside_left;
|
};
|
||||||
top_x = top_x + outside_left;
|
|
||||||
bottom_x = bottom_x + outside_left;
|
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_clipped_region(c->border, clipped_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right border - reduce width when window goes right of monitor
|
enum corner_location set_client_corner_location(Client *c) {
|
||||||
if (outside_right > 0) {
|
enum corner_location current_corner_location = CORNER_LOCATION_ALL;
|
||||||
right_width = GEZERO(bw - outside_right);
|
struct wlr_box target_geom = animations ? c->animation.current : c->geom;
|
||||||
top_width = top_width - outside_right;
|
if (target_geom.x + border_radius <= c->mon->m.x) {
|
||||||
bottom_width = bottom_width - outside_right;
|
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) {
|
||||||
// Position the surface within the borders
|
current_corner_location &= ~CORNER_LOCATION_TOP; // 清除上标志位
|
||||||
wlr_scene_node_set_position(&c->scene_surface->node, bw, bw);
|
}
|
||||||
|
if (target_geom.y + target_geom.height - border_radius >=
|
||||||
// Set border sizes
|
c->mon->m.y + c->mon->m.height) {
|
||||||
set_rect_size(c->border[0], top_width, top_height); // Top
|
current_corner_location &= ~CORNER_LOCATION_BOTTOM; // 清除下标志位
|
||||||
set_rect_size(c->border[1], bottom_width, bottom_height); // Bottom
|
}
|
||||||
set_rect_size(c->border[2], left_width, left_height); // Left
|
return current_corner_location;
|
||||||
set_rect_size(c->border[3], right_width, right_height); // Right
|
|
||||||
|
|
||||||
// Position borders with offsets
|
|
||||||
wlr_scene_node_set_position(&c->border[0]->node, top_x, top_y);
|
|
||||||
wlr_scene_node_set_position(&c->border[1]->node, bottom_x, bottom_y);
|
|
||||||
wlr_scene_node_set_position(&c->border[2]->node, left_x, left_y);
|
|
||||||
wlr_scene_node_set_position(&c->border[3]->node, right_x, right_y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
||||||
@@ -1250,8 +1272,21 @@ void client_apply_clip(Client *c) {
|
|||||||
if (c->iskilling || !client_surface(c)->mapped)
|
if (c->iskilling || !client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
struct wlr_box clip_box;
|
struct wlr_box clip_box;
|
||||||
|
bool should_render_client_surface = false;
|
||||||
struct ivec2 offset;
|
struct ivec2 offset;
|
||||||
animationScale scale_data;
|
animationScale scale_data;
|
||||||
|
struct wlr_box surface_clip;
|
||||||
|
enum corner_location current_corner_location =
|
||||||
|
set_client_corner_location(c);
|
||||||
|
|
||||||
|
float percent =
|
||||||
|
c->animation.action == OPEN && animation_fade_in && !c->nofadein
|
||||||
|
? (double)c->animation.passed_frames / c->animation.total_frames
|
||||||
|
: 1.0;
|
||||||
|
float opacity = c->isfullscreen ? 1
|
||||||
|
: c == selmon->sel ? c->focused_opacity
|
||||||
|
: c->unfocused_opacity;
|
||||||
|
|
||||||
int bw = (int)c->bw;
|
int bw = (int)c->bw;
|
||||||
|
|
||||||
if (!animations) {
|
if (!animations) {
|
||||||
@@ -1259,15 +1294,31 @@ void client_apply_clip(Client *c) {
|
|||||||
c->need_output_flush = false;
|
c->need_output_flush = false;
|
||||||
c->animainit_geom = c->current = c->pending = c->animation.current =
|
c->animainit_geom = c->current = c->pending = c->animation.current =
|
||||||
c->geom;
|
c->geom;
|
||||||
|
|
||||||
client_get_clip(c, &clip_box);
|
client_get_clip(c, &clip_box);
|
||||||
|
|
||||||
offset = clip_to_hide(c, &clip_box);
|
offset = clip_to_hide(c, &clip_box);
|
||||||
|
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
|
|
||||||
if (clip_box.width <= 0 || clip_box.height <= 0)
|
client_draw_shadow(c);
|
||||||
return;
|
|
||||||
|
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
surface_clip = clip_box;
|
||||||
buffer_set_effect(c, (animationScale){0, 0, 0, 0, false});
|
surface_clip.width = surface_clip.width - GEZERO(bw - offset.width);
|
||||||
|
surface_clip.height = surface_clip.height - GEZERO(bw - offset.height);
|
||||||
|
|
||||||
|
scale_data.opacity = c->isfullscreen ? 1
|
||||||
|
: c == selmon->sel ? c->focused_opacity
|
||||||
|
: c->unfocused_opacity;
|
||||||
|
|
||||||
|
if (surface_clip.width <= 0 || surface_clip.height <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node,
|
||||||
|
&surface_clip);
|
||||||
|
buffer_set_effect(c, (animationScale){0, 0, 0, 0, opacity, opacity,
|
||||||
|
current_corner_location, false});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1289,12 +1340,29 @@ void client_apply_clip(Client *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
offset = clip_to_hide(c, &clip_box);
|
offset = clip_to_hide(c, &clip_box);
|
||||||
|
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
|
|
||||||
if (clip_box.width <= 0 || clip_box.height <= 0)
|
surface_clip = clip_box;
|
||||||
return;
|
surface_clip.width = surface_clip.width - GEZERO(bw - offset.width);
|
||||||
|
surface_clip.height = surface_clip.height - GEZERO(bw - offset.height);
|
||||||
|
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
if (surface_clip.width <= 0 || surface_clip.height <= 0) {
|
||||||
|
should_render_client_surface = false;
|
||||||
|
wlr_scene_node_set_enabled(&c->scene_surface->node, false);
|
||||||
|
} else {
|
||||||
|
should_render_client_surface = true;
|
||||||
|
wlr_scene_node_set_enabled(&c->scene_surface->node, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_border(c);
|
||||||
|
client_draw_shadow(c);
|
||||||
|
|
||||||
|
if (!should_render_client_surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &surface_clip);
|
||||||
|
|
||||||
scale_data.should_scale = true;
|
scale_data.should_scale = true;
|
||||||
scale_data.width = clip_box.width - GEZERO(bw - offset.width);
|
scale_data.width = clip_box.width - GEZERO(bw - offset.width);
|
||||||
@@ -1303,6 +1371,9 @@ void client_apply_clip(Client *c) {
|
|||||||
(float)scale_data.width / (geometry.width - offset.x);
|
(float)scale_data.width / (geometry.width - offset.x);
|
||||||
scale_data.height_scale =
|
scale_data.height_scale =
|
||||||
(float)scale_data.height / (geometry.height - offset.y);
|
(float)scale_data.height / (geometry.height - offset.y);
|
||||||
|
scale_data.corner_location = current_corner_location;
|
||||||
|
scale_data.percent = percent;
|
||||||
|
scale_data.opacity = opacity;
|
||||||
buffer_set_effect(c, scale_data);
|
buffer_set_effect(c, scale_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,6 +1382,14 @@ bool client_draw_frame(Client *c) {
|
|||||||
if (!c || !client_surface(c)->mapped)
|
if (!c || !client_surface(c)->mapped)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (c->isfullscreen) {
|
||||||
|
client_set_opacity(c, 1);
|
||||||
|
} else if (c == selmon->sel && !c->animation.running) {
|
||||||
|
client_set_opacity(c, c->focused_opacity);
|
||||||
|
} else if (!c->animation.running) {
|
||||||
|
client_set_opacity(c, c->unfocused_opacity);
|
||||||
|
}
|
||||||
|
|
||||||
if (!c->need_output_flush)
|
if (!c->need_output_flush)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1652,7 +1731,7 @@ void gpureset(struct wl_listener *listener, void *data) {
|
|||||||
|
|
||||||
wlr_log(WLR_DEBUG, "gpu reset");
|
wlr_log(WLR_DEBUG, "gpu reset");
|
||||||
|
|
||||||
if (!(drw = wlr_renderer_autocreate(backend)))
|
if (!(drw = fx_renderer_create(backend)))
|
||||||
die("couldn't recreate renderer");
|
die("couldn't recreate renderer");
|
||||||
|
|
||||||
if (!(alloc = wlr_allocator_autocreate(backend, drw)))
|
if (!(alloc = wlr_allocator_autocreate(backend, drw)))
|
||||||
@@ -1855,6 +1934,11 @@ applyrules(Client *c) {
|
|||||||
c->isglobal = r->isglobal >= 0 ? r->isglobal : c->isglobal;
|
c->isglobal = r->isglobal >= 0 ? r->isglobal : c->isglobal;
|
||||||
c->isoverlay = r->isoverlay >= 0 ? r->isoverlay : c->isoverlay;
|
c->isoverlay = r->isoverlay >= 0 ? r->isoverlay : c->isoverlay;
|
||||||
c->isunglobal = r->isunglobal >= 0 ? r->isunglobal : c->isunglobal;
|
c->isunglobal = r->isunglobal >= 0 ? r->isunglobal : c->isunglobal;
|
||||||
|
c->focused_opacity = r->focused_opacity > 0.0f ? r->focused_opacity
|
||||||
|
: c->focused_opacity;
|
||||||
|
c->unfocused_opacity = r->unfocused_opacity > 0.0f
|
||||||
|
? r->unfocused_opacity
|
||||||
|
: c->unfocused_opacity;
|
||||||
|
|
||||||
newtags = r->tags > 0 ? r->tags | newtags : newtags;
|
newtags = r->tags > 0 ? r->tags | newtags : newtags;
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -2901,6 +2985,10 @@ void cleanupmon(struct wl_listener *listener, void *data) {
|
|||||||
wlr_scene_output_destroy(m->scene_output);
|
wlr_scene_output_destroy(m->scene_output);
|
||||||
|
|
||||||
closemon(m);
|
closemon(m);
|
||||||
|
if (m->blur) {
|
||||||
|
wlr_scene_node_destroy(&m->blur->node);
|
||||||
|
m->blur = NULL;
|
||||||
|
}
|
||||||
// wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
// wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||||
free(m);
|
free(m);
|
||||||
}
|
}
|
||||||
@@ -2940,6 +3028,25 @@ void closemon(Monitor *m) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
||||||
|
int sy, void *user_data) {
|
||||||
|
LayerSurface *l = user_data;
|
||||||
|
|
||||||
|
struct wlr_scene_surface *scene_surface =
|
||||||
|
wlr_scene_surface_try_from_buffer(buffer);
|
||||||
|
if (!scene_surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blur && blur_layer && l) {
|
||||||
|
wlr_scene_buffer_set_backdrop_blur(buffer, true);
|
||||||
|
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
|
||||||
|
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true);
|
||||||
|
} else {
|
||||||
|
wlr_scene_buffer_set_backdrop_blur(buffer, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
LayerSurface *l = wl_container_of(listener, l, surface_commit);
|
LayerSurface *l = wl_container_of(listener, l, surface_commit);
|
||||||
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
||||||
@@ -2981,6 +3088,28 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
arrangelayers(l->mon);
|
arrangelayers(l->mon);
|
||||||
|
|
||||||
|
if (blur) {
|
||||||
|
// Rerender the optimized blur on change
|
||||||
|
struct wlr_layer_surface_v1 *wlr_layer_surface = l->layer_surface;
|
||||||
|
|
||||||
|
if (wlr_layer_surface->current.layer !=
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||||
|
wlr_layer_surface->current.layer !=
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||||
|
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||||
|
iter_layer_scene_buffers, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wlr_layer_surface->current.layer ==
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND ||
|
||||||
|
wlr_layer_surface->current.layer ==
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) {
|
||||||
|
if (l->mon) {
|
||||||
|
wlr_scene_optimized_blur_mark_dirty(l->mon->blur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_pending_state(Client *c) {
|
void client_set_pending_state(Client *c) {
|
||||||
@@ -3397,6 +3526,14 @@ void createmon(struct wl_listener *listener, void *data) {
|
|||||||
wlr_output_layout_add_auto(output_layout, wlr_output);
|
wlr_output_layout_add_auto(output_layout, wlr_output);
|
||||||
else
|
else
|
||||||
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
||||||
|
|
||||||
|
if (blur) {
|
||||||
|
m->blur = wlr_scene_optimized_blur_create(&scene->tree, 0, 0);
|
||||||
|
wlr_scene_node_set_position(&m->blur->node, m->m.x, m->m.y);
|
||||||
|
wlr_scene_node_reparent(&m->blur->node, layers[LyrBlur]);
|
||||||
|
wlr_scene_optimized_blur_set_size(m->blur, m->m.width, m->m.height);
|
||||||
|
// wlr_scene_node_set_enabled(&m->blur->node, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void // fix for 0.5
|
void // fix for 0.5
|
||||||
@@ -3904,7 +4041,13 @@ void incovgaps(const Arg *arg) {
|
|||||||
|
|
||||||
void requestmonstate(struct wl_listener *listener, void *data) {
|
void requestmonstate(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output_event_request_state *event = data;
|
struct wlr_output_event_request_state *event = data;
|
||||||
|
Monitor *m = wl_container_of(listener, m, frame);
|
||||||
|
|
||||||
wlr_output_commit_state(event->output, event->state);
|
wlr_output_commit_state(event->output, event->state);
|
||||||
|
if (blur) {
|
||||||
|
wlr_scene_node_set_position(&m->blur->node, m->m.x, m->m.y);
|
||||||
|
wlr_scene_optimized_blur_set_size(m->blur, m->m.width, m->m.height);
|
||||||
|
}
|
||||||
updatemons(NULL, NULL);
|
updatemons(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4151,15 +4294,16 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
|||||||
|
|
||||||
struct wlr_scene_node *snapshot_node = NULL;
|
struct wlr_scene_node *snapshot_node = NULL;
|
||||||
switch (node->type) {
|
switch (node->type) {
|
||||||
case WLR_SCENE_NODE_TREE:;
|
case WLR_SCENE_NODE_TREE: {
|
||||||
struct wlr_scene_tree *scene_tree = wlr_scene_tree_from_node(node);
|
struct wlr_scene_tree *scene_tree = wlr_scene_tree_from_node(node);
|
||||||
|
|
||||||
struct wlr_scene_node *child;
|
struct wlr_scene_node *child;
|
||||||
wl_list_for_each(child, &scene_tree->children, link) {
|
wl_list_for_each(child, &scene_tree->children, link) {
|
||||||
scene_node_snapshot(child, lx, ly, snapshot_tree);
|
scene_node_snapshot(child, lx, ly, snapshot_tree);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WLR_SCENE_NODE_RECT:;
|
}
|
||||||
|
case WLR_SCENE_NODE_RECT: {
|
||||||
struct wlr_scene_rect *scene_rect = wlr_scene_rect_from_node(node);
|
struct wlr_scene_rect *scene_rect = wlr_scene_rect_from_node(node);
|
||||||
|
|
||||||
struct wlr_scene_rect *snapshot_rect =
|
struct wlr_scene_rect *snapshot_rect =
|
||||||
@@ -4169,10 +4313,20 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
|||||||
if (snapshot_rect == NULL) {
|
if (snapshot_rect == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_scene_rect_set_clipped_region(scene_rect,
|
||||||
|
snapshot_rect->clipped_region);
|
||||||
|
wlr_scene_rect_set_backdrop_blur(scene_rect, false);
|
||||||
|
// 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);
|
||||||
|
|
||||||
snapshot_node = &snapshot_rect->node;
|
snapshot_node = &snapshot_rect->node;
|
||||||
break;
|
break;
|
||||||
case WLR_SCENE_NODE_BUFFER:;
|
}
|
||||||
|
case WLR_SCENE_NODE_BUFFER: {
|
||||||
struct wlr_scene_buffer *scene_buffer =
|
struct wlr_scene_buffer *scene_buffer =
|
||||||
wlr_scene_buffer_from_node(node);
|
wlr_scene_buffer_from_node(node);
|
||||||
|
|
||||||
@@ -4197,6 +4351,15 @@ 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,
|
||||||
|
scene_buffer->corner_radius,
|
||||||
|
scene_buffer->corners);
|
||||||
|
|
||||||
|
// 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, false);
|
||||||
|
|
||||||
snapshot_buffer->node.data = scene_buffer->node.data;
|
snapshot_buffer->node.data = scene_buffer->node.data;
|
||||||
|
|
||||||
@@ -4210,6 +4373,31 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
|||||||
}
|
}
|
||||||
break;
|
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;
|
||||||
|
|
||||||
|
wlr_scene_node_set_enabled(&snapshot_shadow->node, false);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WLR_SCENE_NODE_OPTIMIZED_BLUR:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (snapshot_node != NULL) {
|
if (snapshot_node != NULL) {
|
||||||
wlr_scene_node_set_position(snapshot_node, lx, ly);
|
wlr_scene_node_set_position(snapshot_node, lx, ly);
|
||||||
@@ -4300,12 +4488,35 @@ void locksession(struct wl_listener *listener, void *data) {
|
|||||||
wlr_session_lock_v1_send_locked(session_lock);
|
wlr_session_lock_v1_send_locked(session_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
||||||
|
int sy, void *user_data) {
|
||||||
|
Client *c = user_data;
|
||||||
|
|
||||||
|
struct wlr_scene_surface *scene_surface =
|
||||||
|
wlr_scene_surface_try_from_buffer(buffer);
|
||||||
|
if (!scene_surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wlr_surface *surface = scene_surface->surface;
|
||||||
|
/* we dont blur subsurfaces */
|
||||||
|
if (wlr_subsurface_try_from_wlr_surface(surface) != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (blur && c) {
|
||||||
|
wlr_scene_buffer_set_backdrop_blur(buffer, true);
|
||||||
|
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
|
||||||
|
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true);
|
||||||
|
} else {
|
||||||
|
wlr_scene_buffer_set_backdrop_blur(buffer, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void // old fix to 0.5
|
void // old fix to 0.5
|
||||||
mapnotify(struct wl_listener *listener, void *data) {
|
mapnotify(struct wl_listener *listener, void *data) {
|
||||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
Client *p = NULL;
|
Client *p = NULL;
|
||||||
Client *c = wl_container_of(listener, c, map);
|
Client *c = wl_container_of(listener, c, map);
|
||||||
int i;
|
|
||||||
/* Create scene tree for this client and its border */
|
/* Create scene tree for this client and its border */
|
||||||
c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]);
|
c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]);
|
||||||
wlr_scene_node_set_enabled(&c->scene->node, c->type != XDGShell);
|
wlr_scene_node_set_enabled(&c->scene->node, c->type != XDGShell);
|
||||||
@@ -4342,11 +4553,22 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
c->border = wlr_scene_rect_create(c->scene, 0, 0,
|
||||||
c->border[i] = wlr_scene_rect_create(
|
c->isurgent ? urgentcolor : bordercolor);
|
||||||
c->scene, 0, 0, c->isurgent ? urgentcolor : bordercolor);
|
wlr_scene_node_lower_to_bottom(&c->border->node);
|
||||||
c->border[i]->node.data = c;
|
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);
|
||||||
|
|
||||||
|
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
||||||
|
shadows_blur, shadowscolor);
|
||||||
|
|
||||||
|
wlr_scene_node_lower_to_bottom(&c->shadow->node);
|
||||||
|
wlr_scene_node_set_enabled(&c->shadow->node, true);
|
||||||
|
|
||||||
|
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||||
|
iter_xdg_scene_buffers, c);
|
||||||
|
|
||||||
/* Initialize client geometry with room for border */
|
/* Initialize client geometry with room for border */
|
||||||
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
|
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
|
||||||
@@ -4373,6 +4595,8 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
c->is_open_animation = true;
|
c->is_open_animation = true;
|
||||||
c->drag_to_tile = false;
|
c->drag_to_tile = false;
|
||||||
c->fake_no_border = false;
|
c->fake_no_border = false;
|
||||||
|
c->focused_opacity = focused_opacity;
|
||||||
|
c->unfocused_opacity = unfocused_opacity;
|
||||||
c->nofadein = 0;
|
c->nofadein = 0;
|
||||||
c->nofadeout = 0;
|
c->nofadeout = 0;
|
||||||
c->no_force_center = 0;
|
c->no_force_center = 0;
|
||||||
@@ -4864,6 +5088,18 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: blur set, opacity set
|
// TODO: blur set, opacity set
|
||||||
|
|
||||||
|
if (wlr_xdg_popup_try_from_wlr_surface(surface) != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wlr_scene_buffer_set_corner_radius(buffer, border_radius,
|
||||||
|
scale_data->corner_location);
|
||||||
|
|
||||||
|
float target_opacity = scale_data->percent + fadein_begin_opacity;
|
||||||
|
if (target_opacity > scale_data->opacity) {
|
||||||
|
target_opacity = scale_data->opacity;
|
||||||
|
}
|
||||||
|
wlr_scene_buffer_set_opacity(buffer, target_opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||||
@@ -4875,7 +5111,10 @@ void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
|||||||
|
|
||||||
void buffer_set_effect(Client *c, animationScale data) {
|
void buffer_set_effect(Client *c, animationScale data) {
|
||||||
|
|
||||||
if (c->iskilling || c->animation.tagouting || c->animation.tagouted ||
|
if (!c || c->iskilling)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (c->animation.tagouting || c->animation.tagouted ||
|
||||||
c->animation.tagining) {
|
c->animation.tagining) {
|
||||||
data.should_scale = false;
|
data.should_scale = false;
|
||||||
}
|
}
|
||||||
@@ -4883,6 +5122,11 @@ void buffer_set_effect(Client *c, animationScale data) {
|
|||||||
if (c == grabc)
|
if (c == grabc)
|
||||||
data.should_scale = false;
|
data.should_scale = false;
|
||||||
|
|
||||||
|
if (c->isfullscreen ||
|
||||||
|
(no_radius_when_single && c->mon && c->mon->visible_clients == 1)) {
|
||||||
|
data.corner_location = CORNER_LOCATION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -4892,18 +5136,6 @@ void client_set_opacity(Client *c, double opacity) {
|
|||||||
scene_buffer_apply_opacity, &opacity);
|
scene_buffer_apply_opacity, &opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_handle_opacity(Client *c) {
|
|
||||||
if (!c || !c->mon || !client_surface(c)->mapped)
|
|
||||||
return;
|
|
||||||
|
|
||||||
double opacity = c->isfullscreen || c->ismaxmizescreen ? 1.0
|
|
||||||
: c == selmon->sel ? 0.8
|
|
||||||
: 0.5;
|
|
||||||
|
|
||||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
|
||||||
scene_buffer_apply_opacity, &opacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rendermon(struct wl_listener *listener, void *data) {
|
void rendermon(struct wl_listener *listener, void *data) {
|
||||||
Monitor *m = wl_container_of(listener, m, frame);
|
Monitor *m = wl_container_of(listener, m, frame);
|
||||||
Client *c, *tmp;
|
Client *c, *tmp;
|
||||||
@@ -5156,7 +5388,6 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||||||
|
|
||||||
if (!c->is_open_animation) {
|
if (!c->is_open_animation) {
|
||||||
c->animation.begin_fade_in = false;
|
c->animation.begin_fade_in = false;
|
||||||
client_set_opacity(c, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->animation.action == OPEN && !c->animation.tagining &&
|
if (c->animation.action == OPEN && !c->animation.tagining &&
|
||||||
@@ -5202,12 +5433,13 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||||||
c->animainit_geom = c->current = c->pending = c->animation.current =
|
c->animainit_geom = c->current = c->pending = c->animation.current =
|
||||||
c->geom;
|
c->geom;
|
||||||
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
|
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
|
||||||
|
|
||||||
|
client_draw_shadow(c);
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
client_get_clip(c, &clip);
|
client_get_clip(c, &clip);
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
|
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
|
||||||
// c->pending 决定动画的终点,一般在其他调用resize的函数的附近设置了
|
// c->pending 决定动画的终点,一般在其他调用resize的函数的附近设置了
|
||||||
if (!c->animation.tagouting && !c->iskilling) {
|
if (!c->animation.tagouting && !c->iskilling) {
|
||||||
@@ -6053,7 +6285,7 @@ void setup(void) {
|
|||||||
wlr_scene_node_place_below(&drag_icon->node, &layers[LyrBlock]->node);
|
wlr_scene_node_place_below(&drag_icon->node, &layers[LyrBlock]->node);
|
||||||
|
|
||||||
/* Create a renderer with the default implementation */
|
/* Create a renderer with the default implementation */
|
||||||
if (!(drw = wlr_renderer_autocreate(backend)))
|
if (!(drw = fx_renderer_create(backend)))
|
||||||
die("couldn't create renderer");
|
die("couldn't create renderer");
|
||||||
|
|
||||||
wl_signal_add(&drw->events.lost, &gpu_reset);
|
wl_signal_add(&drw->events.lost, &gpu_reset);
|
||||||
@@ -6245,6 +6477,11 @@ void setup(void) {
|
|||||||
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
|
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
|
||||||
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
|
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
|
||||||
|
|
||||||
|
// blur
|
||||||
|
wlr_scene_set_blur_data(scene, blur_params.num_passes, blur_params.radius,
|
||||||
|
blur_params.noise, blur_params.brightness,
|
||||||
|
blur_params.contrast, blur_params.saturation);
|
||||||
|
|
||||||
/* create text_input-, and input_method-protocol relevant globals */
|
/* create text_input-, and input_method-protocol relevant globals */
|
||||||
input_method_manager = wlr_input_method_manager_v2_create(dpy);
|
input_method_manager = wlr_input_method_manager_v2_create(dpy);
|
||||||
text_input_manager = wlr_text_input_manager_v3_create(dpy);
|
text_input_manager = wlr_text_input_manager_v3_create(dpy);
|
||||||
@@ -6998,6 +7235,11 @@ void updatemons(struct wl_listener *listener, void *data) {
|
|||||||
// wlr_scene_node_set_position(&m->fullscreen_bg->node, m->m.x, m->m.y);
|
// wlr_scene_node_set_position(&m->fullscreen_bg->node, m->m.x, m->m.y);
|
||||||
// wlr_scene_rect_set_size(m->fullscreen_bg, m->m.width, m->m.height);
|
// wlr_scene_rect_set_size(m->fullscreen_bg, m->m.width, m->m.height);
|
||||||
|
|
||||||
|
if (blur && m->blur) {
|
||||||
|
wlr_scene_node_set_position(&m->blur->node, m->m.x, m->m.y);
|
||||||
|
wlr_scene_optimized_blur_set_size(m->blur, m->m.width, m->m.height);
|
||||||
|
}
|
||||||
|
|
||||||
if (m->lock_surface) {
|
if (m->lock_surface) {
|
||||||
struct wlr_scene_tree *scene_tree = m->lock_surface->surface->data;
|
struct wlr_scene_tree *scene_tree = m->lock_surface->surface->data;
|
||||||
wlr_scene_node_set_position(&scene_tree->node, m->m.x, m->m.y);
|
wlr_scene_node_set_position(&scene_tree->node, m->m.x, m->m.y);
|
||||||
|
|||||||
Reference in New Issue
Block a user