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
|
|
@ -164,7 +164,8 @@ Client *center_tiled_select(Monitor *m) {
|
|||
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 *tempFocusClients = 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]))
|
||||
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;
|
||||
|
||||
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)) {
|
||||
match_dir = true;
|
||||
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;
|
||||
case RIGHT:
|
||||
if (c_cx > tc_cx || (c_cx == tc_cx && c_l > tc_l)) {
|
||||
match_dir = true;
|
||||
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;
|
||||
case UP:
|
||||
if (c_cy < tc_cy || (c_cy == tc_cy && c_t < tc_t)) {
|
||||
match_dir = true;
|
||||
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;
|
||||
case DOWN:
|
||||
if (c_cy > tc_cy || (c_cy == tc_cy && c_t > tc_t)) {
|
||||
match_dir = true;
|
||||
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;
|
||||
default:
|
||||
|
|
@ -258,8 +269,9 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating)
|
|||
no_overlap_penalty = 10000000LL;
|
||||
}
|
||||
|
||||
int64_t tmp_distance = penalty + no_overlap_penalty
|
||||
+ (main_dist * main_dist) + (orth_dist * orth_dist);
|
||||
int64_t tmp_distance = penalty + no_overlap_penalty +
|
||||
(main_dist * main_dist) +
|
||||
(orth_dist * orth_dist);
|
||||
|
||||
if (tmp_distance < distance) {
|
||||
distance = tmp_distance;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue