Move common gravity application to screen.c
[dana/openbox.git] / openbox / place.c
index 91f87dc..aa3ff63 100644 (file)
@@ -295,25 +295,8 @@ static gboolean place_per_app_setting_position(ObClient *client, Rect *screen,
 
     ob_debug("placing by per-app settings");
 
-    if (settings->position.x.center)
-        *x = screen->x + screen->width / 2 - client->area.width / 2;
-    else if (settings->position.x.opposite)
-        *x = screen->x + screen->width - frame_size.width -
-            settings->position.x.pos;
-    else
-        *x = screen->x + settings->position.x.pos;
-    if (settings->position.x.denom)
-        *x = (*x * screen->width) / settings->position.x.denom;
-
-    if (settings->position.y.center)
-        *y = screen->y + screen->height / 2 - client->area.height / 2;
-    else if (settings->position.y.opposite)
-        *y = screen->y + screen->height - frame_size.height -
-            settings->position.y.pos;
-    else
-        *y = screen->y + settings->position.y.pos;
-    if (settings->position.y.denom)
-        *y = (*y * screen->height) / settings->position.y.denom;
+    screen_apply_gravity_point(x, y, frame_size.width, frame_size.height,
+                               &settings->position, screen);
 
     return TRUE;
 }