mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-04-12 08:21:26 -04:00
初步修复scale混乱
This commit is contained in:
parent
fa3f5d7204
commit
8837fe775c
1 changed files with 37 additions and 10 deletions
47
maomao.c
47
maomao.c
|
|
@ -130,6 +130,12 @@ typedef struct {
|
||||||
unsigned int ui;
|
unsigned int ui;
|
||||||
} Arg;
|
} Arg;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float scale;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
} animationScale;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned int mod;
|
unsigned int mod;
|
||||||
unsigned int button;
|
unsigned int button;
|
||||||
|
|
@ -354,7 +360,7 @@ typedef struct {
|
||||||
|
|
||||||
/* function declarations */
|
/* function declarations */
|
||||||
static void logtofile(const char *fmt, ...); // 日志函数
|
static void logtofile(const char *fmt, ...); // 日志函数
|
||||||
static void lognumtofile(unsigned int num); // 日志函数
|
static void lognumtofile(float num); // 日志函数
|
||||||
static void applybounds(
|
static void applybounds(
|
||||||
Client *c,
|
Client *c,
|
||||||
struct wlr_box *bbox); // 设置边界规则,能让一些窗口拥有比较适合的大小
|
struct wlr_box *bbox); // 设置边界规则,能让一些窗口拥有比较适合的大小
|
||||||
|
|
@ -544,7 +550,7 @@ void incohgaps(const Arg *arg);
|
||||||
void incovgaps(const Arg *arg);
|
void incovgaps(const Arg *arg);
|
||||||
void incigaps(const Arg *arg);
|
void incigaps(const Arg *arg);
|
||||||
void defaultgaps(const Arg *arg);
|
void defaultgaps(const Arg *arg);
|
||||||
void buffer_set_size(Client *c, struct wlr_box box);
|
void buffer_set_size(Client *c, animationScale scale_data);
|
||||||
|
|
||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
|
|
||||||
|
|
@ -765,7 +771,7 @@ bool client_animation_next_tick(Client *c) {
|
||||||
if (surface && pointer_c == selmon->sel) {
|
if (surface && pointer_c == selmon->sel) {
|
||||||
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
|
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
|
||||||
}
|
}
|
||||||
|
c->need_set_position = false;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
c->animation.passed_frames++;
|
c->animation.passed_frames++;
|
||||||
|
|
@ -862,7 +868,17 @@ void client_apply_clip(Client *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_set_size(c, clip_box);
|
animationScale scale_data;
|
||||||
|
scale_data.width = clip_box.width;
|
||||||
|
scale_data.height = clip_box.height;
|
||||||
|
|
||||||
|
if(c->animation.running) {
|
||||||
|
scale_data.scale = (float)clip_box.width/c->geom.width;
|
||||||
|
buffer_set_size(c, scale_data);
|
||||||
|
} else {
|
||||||
|
scale_data.scale = 1.0;
|
||||||
|
buffer_set_size(c, scale_data);
|
||||||
|
}
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||||
apply_border(c, clip_box, offset);
|
apply_border(c, clip_box, offset);
|
||||||
}
|
}
|
||||||
|
|
@ -1102,9 +1118,9 @@ void logtofile(const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function implementations */
|
/* function implementations */
|
||||||
void lognumtofile(unsigned int num) {
|
void lognumtofile(float num) {
|
||||||
char cmd[256];
|
char cmd[256];
|
||||||
sprintf(cmd, "echo '%d' >> ~/log", num);
|
sprintf(cmd, "echo '%f' >> ~/log", num);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3610,13 +3626,24 @@ void scene_buffer_apply_opacity(struct wlr_scene_buffer *buffer, int sx, int sy,
|
||||||
}
|
}
|
||||||
|
|
||||||
void scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx, int sy, void *data) {
|
void scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx, int sy, void *data) {
|
||||||
struct wlr_box *box = (struct wlr_box *)data;
|
animationScale *scale_data = (animationScale *)data;
|
||||||
wlr_scene_buffer_set_dest_size(buffer, box->width, box->height);
|
struct wlr_scene_surface *surface = wlr_scene_surface_try_from_buffer(buffer);
|
||||||
|
if(wlr_subsurface_try_from_wlr_surface(surface->surface) != NULL) {
|
||||||
|
wlr_scene_buffer_set_dest_size(buffer, buffer->dst_width * scale_data->scale, buffer->dst_height * scale_data->scale);
|
||||||
|
} else {
|
||||||
|
wlr_scene_buffer_set_dest_size(buffer, scale_data->width, scale_data->height);
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// wlr_scene_buffer_set_dest_size(buffer, buffer->dst_width * *scale_factor, buffer->dst_height * *scale_factor);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// wlr_scene_buffer_set_dest_size(buffer, -1, -1);
|
||||||
|
// lognumtofile(buffer->dst_width **scale_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_set_size(Client *c, struct wlr_box box) {
|
void buffer_set_size(Client *c, animationScale data) {
|
||||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||||
scene_buffer_apply_size, &box);
|
scene_buffer_apply_size, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_opacity(Client *c, double opacity) {
|
void client_set_opacity(Client *c, double opacity) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue