mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-06 13:29:53 -05:00
opt: optimzie floating snap for no border single window
This commit is contained in:
parent
c60f4e75c5
commit
2dbf3cfe92
1 changed files with 7 additions and 3 deletions
10
src/maomao.c
10
src/maomao.c
|
|
@ -273,6 +273,7 @@ struct Client {
|
||||||
Client *swallowing, *swallowedby;
|
Client *swallowing, *swallowedby;
|
||||||
bool is_clip_to_hide;
|
bool is_clip_to_hide;
|
||||||
bool drag_to_tile;
|
bool drag_to_tile;
|
||||||
|
bool fake_no_border;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -1093,16 +1094,18 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
||||||
|
|
||||||
if (hit_no_border && smartgaps) {
|
if (hit_no_border && smartgaps) {
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
|
c->fake_no_border = true;
|
||||||
} else if (hit_no_border && !smartgaps) {
|
} else if (hit_no_border && !smartgaps) {
|
||||||
set_rect_size(c->border[0], 0, 0);
|
set_rect_size(c->border[0], 0, 0);
|
||||||
set_rect_size(c->border[1], 0, 0);
|
set_rect_size(c->border[1], 0, 0);
|
||||||
set_rect_size(c->border[2], 0, 0);
|
set_rect_size(c->border[2], 0, 0);
|
||||||
set_rect_size(c->border[3], 0, 0);
|
set_rect_size(c->border[3], 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;
|
||||||
return;
|
return;
|
||||||
} else if (!c->isfullscreen && VISIBLEON(c, c->mon)) {
|
} else if (!c->isfullscreen && VISIBLEON(c, c->mon)) {
|
||||||
c->bw = c->isnoborder ? 0 : borderpx;
|
c->bw = c->isnoborder ? 0 : borderpx;
|
||||||
|
c->fake_no_border = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
@ -2045,7 +2048,7 @@ void apply_window_snap(Client *c) {
|
||||||
snap_right_screen = 0;
|
snap_right_screen = 0;
|
||||||
int snap_up_mon = 0, snap_down_mon = 0, snap_left_mon = 0, snap_right_mon = 0;
|
int snap_up_mon = 0, snap_down_mon = 0, snap_left_mon = 0, snap_right_mon = 0;
|
||||||
|
|
||||||
unsigned int cbw = !render_border ? c->bw : 0;
|
unsigned int cbw = !render_border || c->fake_no_border ? borderpx: 0;
|
||||||
unsigned int tcbw;
|
unsigned int tcbw;
|
||||||
unsigned int cx,cy,cw,ch,tcx,tcy,tcw,tch;
|
unsigned int cx,cy,cw,ch,tcx,tcy,tcw,tch;
|
||||||
cx = c->geom.x + cbw;
|
cx = c->geom.x + cbw;
|
||||||
|
|
@ -2064,7 +2067,7 @@ void apply_window_snap(Client *c) {
|
||||||
if (tc && tc->isfloating && !tc->iskilling && client_surface(tc)->mapped &&
|
if (tc && tc->isfloating && !tc->iskilling && client_surface(tc)->mapped &&
|
||||||
VISIBLEON(tc, c->mon)) {
|
VISIBLEON(tc, c->mon)) {
|
||||||
|
|
||||||
tcbw = !render_border ? tc->bw : 0;
|
tcbw = !render_border || tc->fake_no_border ? borderpx: 0;
|
||||||
tcx = tc->geom.x + tcbw;
|
tcx = tc->geom.x + tcbw;
|
||||||
tcy = tc->geom.y + tcbw;
|
tcy = tc->geom.y + tcbw;
|
||||||
tcw = tc->geom.width - 2 * tcbw;
|
tcw = tc->geom.width - 2 * tcbw;
|
||||||
|
|
@ -4410,6 +4413,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||||
c->scroller_proportion = scroller_default_proportion;
|
c->scroller_proportion = scroller_default_proportion;
|
||||||
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;
|
||||||
|
|
||||||
if (new_is_master &&
|
if (new_is_master &&
|
||||||
strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue