]> git.sur5r.net Git - i3/i3/blobdiff - src/scratchpad.c
Merge pull request #1669 from Airblader/feature-docs-2
[i3/i3] / src / scratchpad.c
index 17df77dde624804e642a0934c9157a06bef07e18..06a7cc739452c2f04869ae49a8cdf38ce5521167 100644 (file)
@@ -4,7 +4,7 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  * scratchpad.c: Moving windows to the scratchpad and making them visible again.
  *
@@ -21,7 +21,8 @@
 void scratchpad_move(Con *con) {
     if (con->type == CT_WORKSPACE) {
         LOG("'move scratchpad' used on a workspace \"%s\". Calling it "
-            "recursively on all windows on this workspace.\n", con->name);
+            "recursively on all windows on this workspace.\n",
+            con->name);
         Con *current;
         current = TAILQ_FIRST(&(con->focus_head));
         while (current) {
@@ -119,14 +120,14 @@ void scratchpad_show(Con *con) {
         if (!con && (floating = con_inside_floating(walk_con)) &&
             floating->scratchpad_state != SCRATCHPAD_NONE &&
             floating != con_inside_floating(focused)) {
-                DLOG("Found an unfocused scratchpad window on this workspace\n");
-                DLOG("Focusing it: %p\n", walk_con);
-                /* use con_descend_tiling_focused to get the last focused
+            DLOG("Found an unfocused scratchpad window on this workspace\n");
+            DLOG("Focusing it: %p\n", walk_con);
+            /* use con_descend_tiling_focused to get the last focused
                  * window inside this scratch container in order to
                  * keep the focus the same within this container */
-                con_focus(con_descend_tiling_focused(walk_con));
-                return;
-            }
+            con_focus(con_descend_tiling_focused(walk_con));
+            return;
+        }
     }
 
     /* If this was 'scratchpad show' without criteria, we check if there is a
@@ -197,10 +198,7 @@ void scratchpad_show(Con *con) {
         con->rect.width = output->rect.width * 0.5;
         con->rect.height = output->rect.height * 0.75;
         floating_check_size(con);
-        con->rect.x = output->rect.x +
-                      ((output->rect.width / 2.0) - (con->rect.width / 2.0));
-        con->rect.y = output->rect.y +
-                      ((output->rect.height / 2.0) - (con->rect.height / 2.0));
+        floating_center(con, con_get_workspace(con)->rect);
     }
 
     /* Activate active workspace if window is from another workspace to ensure