openbox/openbox/frame.c

105 lines
2.1 KiB
C

#include "frame.h"
void frame_client_gravity(Frame *self, int *x, int *y)
{
/* horizontal */
switch (self->client->gravity) {
default:
case NorthWestGravity:
case SouthWestGravity:
case WestGravity:
break;
case NorthGravity:
case SouthGravity:
case CenterGravity:
*x -= (self->size.left + self->size.right) / 2;
break;
case NorthEastGravity:
case SouthEastGravity:
case EastGravity:
*x -= self->size.left + self->size.right;
break;
case ForgetGravity:
case StaticGravity:
*x -= self->size.left;
break;
}
/* vertical */
switch (self->client->gravity) {
default:
case NorthWestGravity:
case NorthEastGravity:
case NorthGravity:
break;
case CenterGravity:
case EastGravity:
case WestGravity:
*y -= (self->size.top + self->size.bottom) / 2;
break;
case SouthWestGravity:
case SouthEastGravity:
case SouthGravity:
*y -= self->size.top + self->size.bottom;
break;
case ForgetGravity:
case StaticGravity:
*y -= self->size.top;
break;
}
}
void frame_frame_gravity(Frame *self, int *x, int *y)
{
/* horizontal */
switch (self->client->gravity) {
default:
case NorthWestGravity:
case WestGravity:
case SouthWestGravity:
break;
case NorthGravity:
case CenterGravity:
case SouthGravity:
*x += (self->size.left + self->size.right) / 2;
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
*x += self->size.left + self->size.right;
break;
case StaticGravity:
case ForgetGravity:
*x += self->size.left;
break;
}
/* vertical */
switch (self->client->gravity) {
default:
case NorthWestGravity:
case WestGravity:
case SouthWestGravity:
break;
case NorthGravity:
case CenterGravity:
case SouthGravity:
*y += (self->size.top + self->size.bottom) / 2;
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
*y += self->size.top + self->size.bottom;
break;
case StaticGravity:
case ForgetGravity:
*y += self->size.top;
break;
}
}