mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: test csd buffer scale
This commit is contained in:
parent
4954711b3b
commit
23dff8c58d
2 changed files with 17 additions and 6 deletions
|
|
@ -180,12 +180,15 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||
return;
|
||||
|
||||
struct wlr_surface *surface = scene_surface->surface;
|
||||
unsigned int surface_width = surface->current.width;
|
||||
unsigned int surface_height = surface->current.height;
|
||||
|
||||
if (buffer_data->iscsd &&
|
||||
wlr_subsurface_try_from_wlr_surface(surface) == NULL &&
|
||||
buffer_data->width_scale <= 1 && buffer_data->height_scale <= 1)
|
||||
buffer_data->should_scale = false;
|
||||
|
||||
if (buffer_data->should_scale) {
|
||||
|
||||
unsigned int surface_width = surface->current.width;
|
||||
unsigned int surface_height = surface->current.height;
|
||||
|
||||
surface_width = buffer_data->width_scale < 1
|
||||
? surface_width
|
||||
: buffer_data->width_scale * surface_width;
|
||||
|
|
@ -548,7 +551,8 @@ void client_apply_clip(Client *c, float factor) {
|
|||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
||||
clip_box.height, opacity, opacity,
|
||||
current_corner_location, true});
|
||||
current_corner_location, true,
|
||||
c->iscsd});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -616,6 +620,7 @@ void client_apply_clip(Client *c, float factor) {
|
|||
buffer_data.corner_location = current_corner_location;
|
||||
buffer_data.percent = percent;
|
||||
buffer_data.opacity = opacity;
|
||||
buffer_data.iscsd = c->iscsd;
|
||||
|
||||
if (factor == 1.0) {
|
||||
buffer_data.width_scale = 1.0;
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ typedef struct {
|
|||
float opacity;
|
||||
enum corner_location corner_location;
|
||||
bool should_scale;
|
||||
bool iscsd;
|
||||
} BufferData;
|
||||
|
||||
struct Client {
|
||||
|
|
@ -346,6 +347,7 @@ struct Client {
|
|||
bool ismaster;
|
||||
bool cursor_in_upper_half, cursor_in_left_half;
|
||||
bool isleftstack;
|
||||
bool iscsd;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -3524,6 +3526,7 @@ void init_client_properties(Client *c) {
|
|||
c->isterm = 0;
|
||||
c->allow_csd = 0;
|
||||
c->force_maximize = 1;
|
||||
c->iscsd = false;
|
||||
}
|
||||
|
||||
void // old fix to 0.5
|
||||
|
|
@ -4129,11 +4132,14 @@ void requestdecorationmode(struct wl_listener *listener, void *data) {
|
|||
|
||||
// 如果客户端没有指定,使用默认模式
|
||||
if (!c->allow_csd) {
|
||||
c->iscsd = false;
|
||||
requested_mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||
} else if (requested_mode ==
|
||||
WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) {
|
||||
c->iscsd = true;
|
||||
} else {
|
||||
c->iscsd = false;
|
||||
}
|
||||
|
||||
wlr_xdg_toplevel_decoration_v1_set_mode(c->decoration, requested_mode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue