mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
fix: apply rect size asser fail
This commit is contained in:
parent
90c364a55c
commit
07f4eac17b
1 changed files with 14 additions and 11 deletions
25
maomao.c
25
maomao.c
|
|
@ -83,6 +83,7 @@
|
||||||
/* macros */
|
/* macros */
|
||||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||||
|
#define GEZERO(A) ((A) >= 0 ? (A) : 0)
|
||||||
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
|
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
|
||||||
#define VISIBLEON(C, M) \
|
#define VISIBLEON(C, M) \
|
||||||
((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
|
((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
|
||||||
|
|
@ -599,6 +600,7 @@ void buffer_set_size(Client *c, animationScale scale_data);
|
||||||
void snap_scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx,
|
void snap_scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx,
|
||||||
int sy, void *data);
|
int sy, void *data);
|
||||||
void client_set_pending_state(Client *c);
|
void client_set_pending_state(Client *c);
|
||||||
|
void set_rect_size(struct wlr_scene_rect *rect, int width, int height);
|
||||||
|
|
||||||
// int timer_tick_action(void *data);
|
// int timer_tick_action(void *data);
|
||||||
|
|
||||||
|
|
@ -1019,20 +1021,21 @@ void client_actual_size(Client *c, uint32_t *width, uint32_t *height) {
|
||||||
*height = c->animation.current.height;
|
*height = c->animation.current.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_rect_size(struct wlr_scene_rect *rect, int width, int height) {
|
||||||
|
wlr_scene_rect_set_size(rect, GEZERO(width), GEZERO(height));
|
||||||
|
}
|
||||||
|
|
||||||
void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
||||||
int offsety) {
|
int offsety) {
|
||||||
|
|
||||||
if (c->iskilling || !client_surface(c)->mapped)
|
if (c->iskilling || !client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(clip_box.width < 0 || clip_box.height < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
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);
|
||||||
wlr_scene_rect_set_size(c->border[0], clip_box.width, c->bw);
|
set_rect_size(c->border[0], clip_box.width, c->bw);
|
||||||
wlr_scene_rect_set_size(c->border[1], clip_box.width, c->bw);
|
set_rect_size(c->border[1], clip_box.width, c->bw);
|
||||||
wlr_scene_rect_set_size(c->border[2], c->bw, clip_box.height - 2 * c->bw);
|
set_rect_size(c->border[2], c->bw, clip_box.height - 2 * c->bw);
|
||||||
wlr_scene_rect_set_size(c->border[3], 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[0]->node, 0, 0);
|
||||||
wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw);
|
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[1]->node, 0, clip_box.height - c->bw);
|
||||||
|
|
@ -1041,15 +1044,15 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
||||||
|
|
||||||
if (c->animation.running && c->animation.action != MOVE) {
|
if (c->animation.running && c->animation.action != MOVE) {
|
||||||
if (c->animation.current.x < c->mon->m.x) {
|
if (c->animation.current.x < c->mon->m.x) {
|
||||||
wlr_scene_rect_set_size(c->border[2], 0, 0);
|
set_rect_size(c->border[2], 0, 0);
|
||||||
} else if (c->animation.current.x + c->animation.current.width >
|
} else if (c->animation.current.x + c->animation.current.width >
|
||||||
c->mon->m.x + c->mon->m.width) {
|
c->mon->m.x + c->mon->m.width) {
|
||||||
wlr_scene_rect_set_size(c->border[3], 0, 0);
|
set_rect_size(c->border[3], 0, 0);
|
||||||
} else if (c->animation.current.y < c->mon->m.y) {
|
} else if (c->animation.current.y < c->mon->m.y) {
|
||||||
wlr_scene_rect_set_size(c->border[0], 0, 0);
|
set_rect_size(c->border[0], 0, 0);
|
||||||
} else if (c->animation.current.y + c->animation.current.height >
|
} else if (c->animation.current.y + c->animation.current.height >
|
||||||
c->mon->m.y + c->mon->m.height) {
|
c->mon->m.y + c->mon->m.height) {
|
||||||
wlr_scene_rect_set_size(c->border[1], 0, 0);
|
set_rect_size(c->border[1], 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue