Simplify client_next_with_pos
This commit is contained in:
parent
0897fadc62
commit
3921a957c5
@ -122,15 +122,11 @@ client_next_with_pos(struct client *bc, Position p)
|
|||||||
{
|
{
|
||||||
struct client *c;
|
struct client *c;
|
||||||
int x, y;
|
int x, y;
|
||||||
const static char scanfac[4][2] =
|
const static char scanfac[PositionLast] = { +10, -10, 0, 0 };
|
||||||
{
|
|
||||||
{ 2, 0 }, { -2, 0 }, /* Right, Left */
|
|
||||||
{ 0, -2 }, { 0, 2 } /* Top, Bottom */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set start place of pointer (edge of base client)
|
* Set start place of pointer (edge with position
|
||||||
* for faster scanning
|
* of base client) for faster scanning.
|
||||||
*/
|
*/
|
||||||
x = bc->geo.x + ((p == Right) ? bc->geo.w : 0);
|
x = bc->geo.x + ((p == Right) ? bc->geo.w : 0);
|
||||||
y = bc->geo.y + ((p == Bottom) ? bc->geo.h : 0);
|
y = bc->geo.y + ((p == Bottom) ? bc->geo.h : 0);
|
||||||
@ -138,11 +134,10 @@ client_next_with_pos(struct client *bc, Position p)
|
|||||||
x += ((p > Left) ? (bc->geo.w >> 1) : 0);
|
x += ((p > Left) ? (bc->geo.w >> 1) : 0);
|
||||||
|
|
||||||
/* Scan in right direction to next(p) physical client */
|
/* Scan in right direction to next(p) physical client */
|
||||||
|
|
||||||
while((c = client_gb_pos(bc->tag, x, y)) == bc)
|
while((c = client_gb_pos(bc->tag, x, y)) == bc)
|
||||||
{
|
{
|
||||||
x += scanfac[p][0];
|
x += scanfac[p];
|
||||||
y += scanfac[p][1];
|
y += scanfac[Bottom - p];
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user