- /* non-normal clients has less rules, and windows that are being restored
- * from a session do also. we can assume you want it back where you
- * saved it */
- gint rude = client_normal(client) && !client->session;
- if (client->positioned)
- rude = 0;
- else if (place_transient(client, x, y) ||
- ((config_place_policy == OB_PLACE_POLICY_MOUSE) ?
- place_under_mouse(client, x, y) :
- place_smart(client, x, y, SMART_FULL) ||
- place_smart(client, x, y, SMART_GROUP) ||
- place_smart(client, x, y, SMART_FOCUSED) ||
- place_random(client, x, y)))
- {
- /* get where the client should be */
- frame_frame_gravity(client->frame, x, y);
- } else
- g_assert_not_reached(); /* the last one better succeed */
- /* make sure the window is visible. */
- client_find_onscreen(client, x, y,
- client->frame->area.width,
- client->frame->area.height,
- rude);
+ gboolean ret;
+ Rect *monitor_area;
+ int *x, *y, *w, *h;
+ Size frame_size;
+
+ monitor_area = choose_monitor(client, client_to_be_foregrounded, settings);
+
+ w = &client_area->width;
+ h = &client_area->height;
+ place_per_app_setting_size(client, monitor_area, w, h, settings);
+
+ if (!should_set_client_position(client, settings))
+ return FALSE;
+
+ x = &client_area->x;
+ y = &client_area->y;
+
+ SIZE_SET(frame_size,
+ *w + client->frame->size.left + client->frame->size.right,
+ *h + client->frame->size.top + client->frame->size.bottom);
+
+ ret =
+ place_per_app_setting_position(client, monitor_area, x, y, settings,
+ frame_size) ||
+ place_transient_splash(client, monitor_area, x, y, frame_size) ||
+ place_under_mouse(client, x, y, frame_size) ||
+ place_least_overlap(client, monitor_area, x, y, frame_size);
+ g_assert(ret);
+
+ g_slice_free(Rect, monitor_area);
+
+ /* get where the client should be */
+ frame_frame_gravity(client->frame, x, y);
+ return TRUE;