mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: optimzie var name
This commit is contained in:
parent
1facac13d7
commit
d64e654c2d
3 changed files with 45 additions and 42 deletions
|
|
@ -908,7 +908,7 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||
c->need_output_flush = true;
|
||||
c->dirty = true;
|
||||
|
||||
// oldgeom = c->geom;
|
||||
// float_geom = c->geom;
|
||||
bbox = (interact || c->isfloating || c->isfullscreen) ? &sgeom : &c->mon->w;
|
||||
|
||||
if (is_scroller_layout(c->mon) && (!c->isfloating || c == grabc)) {
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ void movewin(const Arg *arg) {
|
|||
}
|
||||
|
||||
c->iscustomsize = 1;
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
resize(c, c->geom, 0);
|
||||
}
|
||||
|
||||
|
|
@ -386,7 +386,7 @@ void resizewin(const Arg *arg) {
|
|||
}
|
||||
|
||||
c->iscustomsize = 1;
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
resize(c, c->geom, 0);
|
||||
}
|
||||
|
||||
|
|
@ -534,10 +534,10 @@ void smartmovewin(const Arg *arg) {
|
|||
break;
|
||||
}
|
||||
|
||||
c->oldgeom = (struct wlr_box){
|
||||
c->float_geom = (struct wlr_box){
|
||||
.x = nx, .y = ny, .width = c->geom.width, .height = c->geom.height};
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->oldgeom, 1);
|
||||
resize(c, c->float_geom, 1);
|
||||
}
|
||||
|
||||
void smartresizewin(const Arg *arg) {
|
||||
|
|
@ -603,10 +603,10 @@ void smartresizewin(const Arg *arg) {
|
|||
break;
|
||||
}
|
||||
|
||||
c->oldgeom = (struct wlr_box){
|
||||
c->float_geom = (struct wlr_box){
|
||||
.x = c->geom.x, .y = c->geom.y, .width = nw, .height = nh};
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->oldgeom, 1);
|
||||
resize(c, c->float_geom, 1);
|
||||
}
|
||||
|
||||
void centerwin(const Arg *arg) {
|
||||
|
|
@ -618,9 +618,9 @@ void centerwin(const Arg *arg) {
|
|||
if (!c->isfloating)
|
||||
setfloating(c, true);
|
||||
|
||||
c->oldgeom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->float_geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->oldgeom, 1);
|
||||
resize(c, c->float_geom, 1);
|
||||
}
|
||||
|
||||
void spawn_shell(const Arg *arg) {
|
||||
|
|
@ -953,7 +953,7 @@ void tagmon(const Arg *arg) {
|
|||
target = get_tags_first_tag(c->tags);
|
||||
view(&(Arg){.ui = target}, true);
|
||||
focusclient(c, 1);
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
resize(c, c->geom, 1);
|
||||
} else {
|
||||
selmon = c->mon;
|
||||
|
|
|
|||
67
src/mango.c
67
src/mango.c
|
|
@ -249,8 +249,8 @@ typedef struct Client Client;
|
|||
struct Client {
|
||||
/* Must keep these three elements in this order */
|
||||
unsigned int type; /* XDGShell or X11* */
|
||||
struct wlr_box geom, pending, oldgeom, animainit_geom, overview_backup_geom,
|
||||
current; /* layout-relative, includes border */
|
||||
struct wlr_box geom, pending, float_geom, animainit_geom,
|
||||
overview_backup_geom, current; /* layout-relative, includes border */
|
||||
Monitor *mon;
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_rect *border; /* top, bottom, left, right */
|
||||
|
|
@ -857,7 +857,7 @@ void client_change_mon(Client *c, Monitor *m) {
|
|||
setmon(c, m, c->tags, true);
|
||||
reset_foreign_tolevel(c);
|
||||
if (c->isfloating) {
|
||||
c->oldgeom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->float_geom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -905,13 +905,13 @@ void show_scratchpad(Client *c) {
|
|||
if (!c->isfloating) {
|
||||
setfloating(c, 1);
|
||||
c->geom.width = c->iscustomsize
|
||||
? c->oldgeom.width
|
||||
? c->float_geom.width
|
||||
: c->mon->w.width * scratchpad_width_ratio;
|
||||
c->geom.height = c->iscustomsize
|
||||
? c->oldgeom.height
|
||||
? c->float_geom.height
|
||||
: c->mon->w.height * scratchpad_height_ratio;
|
||||
// 重新计算居中的坐标
|
||||
c->oldgeom = c->geom = c->animainit_geom = c->animation.current =
|
||||
c->float_geom = c->geom = c->animainit_geom = c->animation.current =
|
||||
setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->geom, 0);
|
||||
|
|
@ -943,7 +943,7 @@ void swallow(Client *c, Client *w) {
|
|||
c->is_scratchpad_show = w->is_scratchpad_show;
|
||||
c->tags = w->tags;
|
||||
c->geom = w->geom;
|
||||
c->oldgeom = w->oldgeom;
|
||||
c->float_geom = w->float_geom;
|
||||
c->scroller_proportion = w->scroller_proportion;
|
||||
wl_list_insert(&w->link, &c->link);
|
||||
wl_list_insert(&w->flink, &c->flink);
|
||||
|
|
@ -1175,19 +1175,20 @@ void applyrules(Client *c) {
|
|||
// set geometry of floating client
|
||||
|
||||
if (r->width > 0)
|
||||
c->oldgeom.width = r->width;
|
||||
c->float_geom.width = r->width;
|
||||
if (r->height > 0)
|
||||
c->oldgeom.height = r->height;
|
||||
c->float_geom.height = r->height;
|
||||
|
||||
if (r->offsetx || r->offsety || r->width > 0 || r->height > 0) {
|
||||
hit_rule_pos = true;
|
||||
c->iscustomsize = 1;
|
||||
c->oldgeom = setclient_coordinate_center(c, c->oldgeom, r->offsetx,
|
||||
r->offsety);
|
||||
c->float_geom = setclient_coordinate_center(c, c->float_geom,
|
||||
r->offsetx, r->offsety);
|
||||
}
|
||||
if (c->isfloating) {
|
||||
c->geom = c->oldgeom.width > 0 && c->oldgeom.height > 0 ? c->oldgeom
|
||||
: c->geom;
|
||||
c->geom = c->float_geom.width > 0 && c->float_geom.height > 0
|
||||
? c->float_geom
|
||||
: c->geom;
|
||||
if (!c->isnosizehint)
|
||||
client_set_size_bound(c);
|
||||
}
|
||||
|
|
@ -1197,7 +1198,7 @@ void applyrules(Client *c) {
|
|||
// the hit size
|
||||
if (!hit_rule_pos &&
|
||||
(!client_is_x11(c) || !client_should_ignore_focus(c))) {
|
||||
c->oldgeom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->float_geom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
}
|
||||
|
||||
/*-----------------------apply rule action-------------------------*/
|
||||
|
|
@ -1516,7 +1517,7 @@ void apply_window_snap(Client *c) {
|
|||
c->geom.y = c->geom.y + snap_down;
|
||||
}
|
||||
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
resize(c, c->geom, 0);
|
||||
}
|
||||
|
||||
|
|
@ -3788,20 +3789,21 @@ void motionnotify(unsigned int time, struct wlr_input_device *device, double dx,
|
|||
if (cursor_mode == CurMove) {
|
||||
/* Move the grabbed client to the new position. */
|
||||
grabc->iscustomsize = 1;
|
||||
grabc->oldgeom = (struct wlr_box){.x = (int)round(cursor->x) - grabcx,
|
||||
.y = (int)round(cursor->y) - grabcy,
|
||||
.width = grabc->geom.width,
|
||||
.height = grabc->geom.height};
|
||||
resize(grabc, grabc->oldgeom, 1);
|
||||
grabc->float_geom =
|
||||
(struct wlr_box){.x = (int)round(cursor->x) - grabcx,
|
||||
.y = (int)round(cursor->y) - grabcy,
|
||||
.width = grabc->geom.width,
|
||||
.height = grabc->geom.height};
|
||||
resize(grabc, grabc->float_geom, 1);
|
||||
return;
|
||||
} else if (cursor_mode == CurResize) {
|
||||
grabc->iscustomsize = 1;
|
||||
grabc->oldgeom =
|
||||
grabc->float_geom =
|
||||
(struct wlr_box){.x = grabc->geom.x,
|
||||
.y = grabc->geom.y,
|
||||
.width = (int)round(cursor->x) - grabc->geom.x,
|
||||
.height = (int)round(cursor->y) - grabc->geom.y};
|
||||
resize(grabc, grabc->oldgeom, 1);
|
||||
resize(grabc, grabc->float_geom, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4271,19 +4273,20 @@ setfloating(Client *c, int floating) {
|
|||
c->geom = backup_box;
|
||||
|
||||
// restore to the memeroy geom
|
||||
if (c->oldgeom.width > 0 && c->oldgeom.height > 0) {
|
||||
if (c->mon && c->oldgeom.width >= c->mon->w.width - gappoh) {
|
||||
c->oldgeom.width = c->mon->w.width * 0.9;
|
||||
if (c->float_geom.width > 0 && c->float_geom.height > 0) {
|
||||
if (c->mon && c->float_geom.width >= c->mon->w.width - gappoh) {
|
||||
c->float_geom.width = c->mon->w.width * 0.9;
|
||||
window_size_outofrange = true;
|
||||
}
|
||||
if (c->mon && c->oldgeom.height >= c->mon->w.height - gappov) {
|
||||
c->oldgeom.height = c->mon->w.height * 0.9;
|
||||
if (c->mon && c->float_geom.height >= c->mon->w.height - gappov) {
|
||||
c->float_geom.height = c->mon->w.height * 0.9;
|
||||
window_size_outofrange = true;
|
||||
}
|
||||
if (window_size_outofrange) {
|
||||
c->oldgeom = setclient_coordinate_center(c, c->oldgeom, 0, 0);
|
||||
c->float_geom =
|
||||
setclient_coordinate_center(c, c->float_geom, 0, 0);
|
||||
}
|
||||
resize(c, c->oldgeom, 0);
|
||||
resize(c, c->float_geom, 0);
|
||||
} else {
|
||||
resize(c, target_box, 0);
|
||||
}
|
||||
|
|
@ -4339,7 +4342,7 @@ void setmaxmizescreen(Client *c, int maxmizescreen) {
|
|||
setfullscreen(c, 0);
|
||||
|
||||
if (c->isfloating)
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
if (selmon->isoverview) {
|
||||
Arg arg = {0};
|
||||
toggleoverview(&arg);
|
||||
|
|
@ -4389,7 +4392,7 @@ void setfullscreen(Client *c, int fullscreen) // 用自定义全屏代理自带
|
|||
setmaxmizescreen(c, 0);
|
||||
|
||||
if (c->isfloating)
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
if (selmon->isoverview) {
|
||||
Arg arg = {0};
|
||||
toggleoverview(&arg);
|
||||
|
|
@ -5250,7 +5253,7 @@ void updatemons(struct wl_listener *listener, void *data) {
|
|||
if (c->isfloating && c->mon == m) {
|
||||
c->geom.x += mon_pos_offsetx;
|
||||
c->geom.y += mon_pos_offsety;
|
||||
c->oldgeom = c->geom;
|
||||
c->float_geom = c->geom;
|
||||
resize(c, c->geom, 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue