-static void calc_position(Options *o, gint *x, gint *y)
-{
- gint monitor = -1;
- const Rect *area;
- if (o->monitor >= 0)
- monitor = o->monitor;
- else switch (o->monitor_type) {
- case OB_PLACE_MONITOR_ANY:
- case OB_PLACE_MONITOR_PRIMARY:
- monitor = screen_monitor_primary(FALSE);
- break;
- case OB_PLACE_MONITOR_MOUSE:
- monitor = screen_monitor_pointer();
- break;
- case OB_PLACE_MONITOR_ACTIVE:
- monitor = screen_monitor_active();
- break;
- case OB_PLACE_MONITOR_ALL:
- monitor = screen_num_monitors;
- break;
- default:
- g_assert_not_reached();
- }
- area = screen_physical_area_monitor(monitor);
-
- if (o->x.center)
- *x = area->width / 2; /* - client->area.width / 2; */
- else {
- *x = o->x.pos;
- if (o->x.denom)
- *x = (*x * area->width) / o->x.denom;
- if (o->x.opposite)
- *x = area->width /* - frame_size.width */ - *x;
- }
-
- if (o->y.center)
- *y = area->height / 2; /* - client->area.height / 2; */
- else {
- *y = o->y.pos;
- if (o->y.denom)
- *y = (*y * area->height) / o->y.denom;
- if (o->y.opposite)
- *y = area->height /* - frame_size.height */ - *y;
- }
-
- *x += area->x;
- *y += area->y;
-}
-