mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-08 13:29:56 -05:00
optimize code struce
This commit is contained in:
parent
ca3a0833cd
commit
474589c7c1
1 changed files with 24 additions and 18 deletions
20
src/maomao.c
20
src/maomao.c
|
|
@ -1554,13 +1554,10 @@ void toggle_render_border(const Arg *arg) {
|
||||||
arrange(selmon, false);
|
arrange(selmon, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggle_named_scratch(const Arg *arg) {
|
Client *get_client_by_id_or_title(const char *arg_id, const char *arg_title) {
|
||||||
Client *c = NULL;
|
|
||||||
Client *target_client = NULL;
|
Client *target_client = NULL;
|
||||||
const char *appid, *title;
|
const char *appid, *title;
|
||||||
char *arg_id = arg->v;
|
Client *c = NULL;
|
||||||
char *arg_title = arg->v2;
|
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->mon != selmon) {
|
if (c->mon != selmon) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1585,6 +1582,16 @@ void toggle_named_scratch(const Arg *arg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return target_client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggle_named_scratch(const Arg *arg) {
|
||||||
|
Client *target_client = NULL;
|
||||||
|
Client *c = NULL;
|
||||||
|
char *arg_id = arg->v;
|
||||||
|
char *arg_title = arg->v2;
|
||||||
|
|
||||||
|
target_client = get_client_by_id_or_title(arg_id, arg_title);
|
||||||
|
|
||||||
if (!target_client)
|
if (!target_client)
|
||||||
return;
|
return;
|
||||||
|
|
@ -2112,8 +2119,7 @@ void apply_window_snap(Client *c) {
|
||||||
snap_left_screen = cx - c->mon->w.x;
|
snap_left_screen = cx - c->mon->w.x;
|
||||||
snap_right_screen = c->mon->w.x + c->mon->w.width - cx - cw;
|
snap_right_screen = c->mon->w.x + c->mon->w.width - cx - cw;
|
||||||
snap_up_screen = cy - c->mon->w.y;
|
snap_up_screen = cy - c->mon->w.y;
|
||||||
snap_down_screen =
|
snap_down_screen = c->mon->w.y + c->mon->w.height - cy - ch;
|
||||||
c->mon->w.y + c->mon->w.height - cy - ch;
|
|
||||||
|
|
||||||
if (snap_up_screen > 0 && snap_up_screen < snap_up)
|
if (snap_up_screen > 0 && snap_up_screen < snap_up)
|
||||||
snap_up = snap_up_screen;
|
snap_up = snap_up_screen;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue