mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-16 14:33:36 -04:00
opt: format code
This commit is contained in:
parent
71689f6ef4
commit
405e8dbc1a
3 changed files with 113 additions and 101 deletions
|
|
@ -131,12 +131,12 @@ int32_t exchange_stack_client(const Arg *arg) {
|
||||||
|
|
||||||
int32_t focusdir(const Arg *arg) {
|
int32_t focusdir(const Arg *arg) {
|
||||||
|
|
||||||
if(!selmon)
|
if (!selmon)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
c = direction_select(arg);
|
c = direction_select(arg);
|
||||||
if(!selmon->isoverview)
|
if (!selmon->isoverview)
|
||||||
c = get_focused_stack_client(c, arg->tc);
|
c = get_focused_stack_client(c, arg->tc);
|
||||||
if (c) {
|
if (c) {
|
||||||
focusclient(c, 1);
|
focusclient(c, 1);
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,8 @@ Client *center_tiled_select(Monitor *m) {
|
||||||
return target_c;
|
return target_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating) {
|
Client *find_client_by_direction(Client *tc, const Arg *arg,
|
||||||
|
bool findfloating) {
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
Client *tempFocusClients = NULL;
|
Client *tempFocusClients = NULL;
|
||||||
Client *tempSameMonitorFocusClients = NULL;
|
Client *tempSameMonitorFocusClients = NULL;
|
||||||
|
|
@ -194,7 +195,9 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating)
|
||||||
if (!(c->tags & c->mon->tagset[c->mon->seltags]))
|
if (!(c->tags & c->mon->tagset[c->mon->seltags]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (step == 0 && ((!tc->mon->isoverview && !client_is_in_same_stack(tc, c, NULL)) || c->mon != tc->mon))
|
if (step == 0 && ((!tc->mon->isoverview &&
|
||||||
|
!client_is_in_same_stack(tc, c, NULL)) ||
|
||||||
|
c->mon != tc->mon))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32_t c_l = c->geom.x;
|
int32_t c_l = c->geom.x;
|
||||||
|
|
@ -213,28 +216,36 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating)
|
||||||
if (c_cx < tc_cx || (c_cx == tc_cx && c_l < tc_l)) {
|
if (c_cx < tc_cx || (c_cx == tc_cx && c_l < tc_l)) {
|
||||||
match_dir = true;
|
match_dir = true;
|
||||||
main_dist = tc_l - c_r;
|
main_dist = tc_l - c_r;
|
||||||
orth_dist = (c_b < tc_t) ? (tc_t - c_b) : ((c_t > tc_b) ? (c_t - tc_b) : 0);
|
orth_dist = (c_b < tc_t)
|
||||||
|
? (tc_t - c_b)
|
||||||
|
: ((c_t > tc_b) ? (c_t - tc_b) : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
if (c_cx > tc_cx || (c_cx == tc_cx && c_l > tc_l)) {
|
if (c_cx > tc_cx || (c_cx == tc_cx && c_l > tc_l)) {
|
||||||
match_dir = true;
|
match_dir = true;
|
||||||
main_dist = c_l - tc_r;
|
main_dist = c_l - tc_r;
|
||||||
orth_dist = (c_b < tc_t) ? (tc_t - c_b) : ((c_t > tc_b) ? (c_t - tc_b) : 0);
|
orth_dist = (c_b < tc_t)
|
||||||
|
? (tc_t - c_b)
|
||||||
|
: ((c_t > tc_b) ? (c_t - tc_b) : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
if (c_cy < tc_cy || (c_cy == tc_cy && c_t < tc_t)) {
|
if (c_cy < tc_cy || (c_cy == tc_cy && c_t < tc_t)) {
|
||||||
match_dir = true;
|
match_dir = true;
|
||||||
main_dist = tc_t - c_b;
|
main_dist = tc_t - c_b;
|
||||||
orth_dist = (c_r < tc_l) ? (tc_l - c_r) : ((c_l > tc_r) ? (c_l - tc_r) : 0);
|
orth_dist = (c_r < tc_l)
|
||||||
|
? (tc_l - c_r)
|
||||||
|
: ((c_l > tc_r) ? (c_l - tc_r) : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOWN:
|
case DOWN:
|
||||||
if (c_cy > tc_cy || (c_cy == tc_cy && c_t > tc_t)) {
|
if (c_cy > tc_cy || (c_cy == tc_cy && c_t > tc_t)) {
|
||||||
match_dir = true;
|
match_dir = true;
|
||||||
main_dist = c_t - tc_b;
|
main_dist = c_t - tc_b;
|
||||||
orth_dist = (c_r < tc_l) ? (tc_l - c_r) : ((c_l > tc_r) ? (c_l - tc_r) : 0);
|
orth_dist = (c_r < tc_l)
|
||||||
|
? (tc_l - c_r)
|
||||||
|
: ((c_l > tc_r) ? (c_l - tc_r) : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -258,8 +269,9 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating)
|
||||||
no_overlap_penalty = 10000000LL;
|
no_overlap_penalty = 10000000LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t tmp_distance = penalty + no_overlap_penalty
|
int64_t tmp_distance = penalty + no_overlap_penalty +
|
||||||
+ (main_dist * main_dist) + (orth_dist * orth_dist);
|
(main_dist * main_dist) +
|
||||||
|
(orth_dist * orth_dist);
|
||||||
|
|
||||||
if (tmp_distance < distance) {
|
if (tmp_distance < distance) {
|
||||||
distance = tmp_distance;
|
distance = tmp_distance;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue