+</div>\r
+<div class="sect2">\r
+<h3 id="_introducing_a_new_command">18.2. Introducing a new command</h3>\r
+<div class="paragraph"><p>The following steps have to be taken in order to properly introduce a new\r
+command (or possibly extend an existing command):</p></div>\r
+<div class="olist arabic"><ol class="arabic">\r
+<li>\r
+<p>\r
+Define a function beginning with <tt>cmd_</tt> in the file <tt>src/commands.c</tt>. Copy\r
+ the prototype of an existing function.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+After adding a comment on what the function does, copy the comment and\r
+ function definition to <tt>include/commands.h</tt>. Make the comment in the header\r
+ file use double asterisks to make doxygen pick it up.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Write a test case (or extend an existing test case) for your feature, see\r
+ <a href="testsuite.html">i3 testsuite</a>. For now, it is sufficient to simply call\r
+ your command in all the various possible ways.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Extend the parser specification in <tt>parser-specs/commands.spec</tt>. Run the\r
+ testsuite and see if your new function gets called with the appropriate\r
+ arguments for the appropriate input.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Actually implement the feature.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+Document the feature in the <a href="userguide.html">User’s Guide</a>.\r
+</p>\r
+</li>\r
+</ol></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_moving_containers">19. Moving containers</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>The movement code is pretty delicate. You need to consider all cases before\r
+making any changes or before being able to fully understand how it works.</p></div>\r
+<div class="sect2">\r
+<h3 id="_case_1_moving_inside_the_same_container">19.1. Case 1: Moving inside the same container</h3>\r
+<div class="paragraph"><p>The reference layout for this case is a single workspace in horizontal\r
+orientation with two containers on it. Focus is on the left container (1).</p></div>\r
+<div class="tableblock">\r
+<table rules="all"\r
+width="15%"\r
+frame="border"\r
+cellspacing="0" cellpadding="4">\r
+<col width="50%" />\r
+<col width="50%" />\r
+<tbody>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">1</p></td>\r
+<td align="center" valign="top"><p class="table">2</p></td>\r
+</tr>\r
+</tbody>\r
+</table>\r
+</div>\r
+<div class="paragraph"><p>When moving the left window to the right (command <tt>move right</tt>), tree_move will\r
+look for a container with horizontal orientation and finds the parent of the\r
+left container, that is, the workspace. Afterwards, it runs the code branch\r
+commented with "the easy case": it calls TAILQ_NEXT to get the container right\r
+of the current one and swaps both containers.</p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_case_2_move_a_container_into_a_split_container">19.2. Case 2: Move a container into a split container</h3>\r
+<div class="paragraph"><p>The reference layout for this case is a horizontal workspace with two\r
+containers. The right container is a v-split with two containers. Focus is on\r
+the left container (1).</p></div>\r
+<div class="tableblock">\r
+<table rules="all"\r
+width="15%"\r
+frame="border"\r
+cellspacing="0" cellpadding="4">\r
+<col width="50%" />\r
+<col width="50%" />\r
+<tbody>\r
+<tr>\r
+<td rowspan="2" align="center" valign="middle"><p class="table">1</p></td>\r
+<td align="center" valign="top"><p class="table">2</p></td>\r
+</tr>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">3</p></td>\r
+</tr>\r
+</tbody>\r
+</table>\r
+</div>\r
+<div class="paragraph"><p>When moving to the right (command <tt>move right</tt>), i3 will work like in case 1\r
+("the easy case"). However, as the right container is not a leaf container, but\r
+a v-split, the left container (1) will be inserted at the right position (below\r
+2, assuming that 2 is focused inside the v-split) by calling <tt>insert_con_into</tt>.</p></div>\r
+<div class="paragraph"><p><tt>insert_con_into</tt> detaches the container from its parent and inserts it\r
+before/after the given target container. Afterwards, the on_remove_child\r
+callback is called on the old parent container which will then be closed, if\r
+empty.</p></div>\r
+<div class="paragraph"><p>Afterwards, <tt>con_focus</tt> will be called to fix the focus stack and the tree will\r
+be flattened.</p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_case_3_moving_to_non_existent_top_bottom">19.3. Case 3: Moving to non-existent top/bottom</h3>\r
+<div class="paragraph"><p>Like in case 1, the reference layout for this case is a single workspace in\r
+horizontal orientation with two containers on it. Focus is on the left\r
+container:</p></div>\r
+<div class="tableblock">\r
+<table rules="all"\r
+width="15%"\r
+frame="border"\r
+cellspacing="0" cellpadding="4">\r
+<col width="50%" />\r
+<col width="50%" />\r
+<tbody>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">1</p></td>\r
+<td align="center" valign="top"><p class="table">2</p></td>\r
+</tr>\r
+</tbody>\r
+</table>\r
+</div>\r
+<div class="paragraph"><p>This time however, the command is <tt>move up</tt> or <tt>move down</tt>. tree_move will look\r
+for a container with vertical orientation. As it will not find any,\r
+<tt>same_orientation</tt> is NULL and therefore i3 will perform a forced orientation\r
+change on the workspace by creating a new h-split container, moving the\r
+workspace contents into it and then changing the workspace orientation to\r
+vertical. Now it will again search for parent containers with vertical\r
+orientation and it will find the workspace.</p></div>\r
+<div class="paragraph"><p>This time, the easy case code path will not be run as we are not moving inside\r
+the same container. Instead, <tt>insert_con_into</tt> will be called with the focused\r
+container and the container above/below the current one (on the level of\r
+<tt>same_orientation</tt>).</p></div>\r
+<div class="paragraph"><p>Now, <tt>con_focus</tt> will be called to fix the focus stack and the tree will be\r
+flattened.</p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_case_4_moving_to_existent_top_bottom">19.4. Case 4: Moving to existent top/bottom</h3>\r
+<div class="paragraph"><p>The reference layout for this case is a vertical workspace with two containers.\r
+The bottom one is a h-split containing two containers (1 and 2). Focus is on\r
+the bottom left container (1).</p></div>\r
+<div class="tableblock">\r
+<table rules="all"\r
+width="15%"\r
+frame="border"\r
+cellspacing="0" cellpadding="4">\r
+<col width="50%" />\r
+<col width="50%" />\r
+<tbody>\r
+<tr>\r
+<td colspan="2" align="center" valign="top"><p class="table">3</p></td>\r
+</tr>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">1</p></td>\r
+<td align="center" valign="top"><p class="table">2</p></td>\r
+</tr>\r
+</tbody>\r
+</table>\r
+</div>\r
+<div class="paragraph"><p>This case is very much like case 3, only this time the forced workspace\r
+orientation change does not need to be performed because the workspace already\r
+is in vertical orientation.</p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_case_5_moving_in_one_child_h_split">19.5. Case 5: Moving in one-child h-split</h3>\r
+<div class="paragraph"><p>The reference layout for this case is a horizontal workspace with two\r
+containers having a v-split on the left side with a one-child h-split on the\r
+bottom. Focus is on the bottom left container (2(h)):</p></div>\r
+<div class="tableblock">\r
+<table rules="all"\r
+width="15%"\r
+frame="border"\r
+cellspacing="0" cellpadding="4">\r
+<col width="50%" />\r
+<col width="50%" />\r
+<tbody>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">1</p></td>\r
+<td rowspan="2" align="center" valign="middle"><p class="table">3</p></td>\r
+</tr>\r
+<tr>\r
+<td align="center" valign="top"><p class="table">2(h)</p></td>\r
+</tr>\r
+</tbody>\r
+</table>\r
+</div>\r
+<div class="paragraph"><p>In this case, <tt>same_orientation</tt> will be set to the h-split container around\r
+the focused container. However, when trying the easy case, the next/previous\r
+container <tt>swap</tt> will be NULL. Therefore, i3 will search again for a\r
+<tt>same_orientation</tt> container, this time starting from the parent of the h-split\r
+container.</p></div>\r
+<div class="paragraph"><p>After determining a new <tt>same_orientation</tt> container (if it is NULL, the\r
+orientation will be force-changed), this case is equivalent to case 2 or case\r
+4.</p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_case_6_floating_containers">19.6. Case 6: Floating containers</h3>\r
+<div class="paragraph"><p>The reference layout for this case is a horizontal workspace with two\r
+containers plus one floating h-split container. Focus is on the floating\r
+container.</p></div>\r
+<div class="paragraph"><p>TODO: nice illustration. table not possible?</p></div>\r
+<div class="paragraph"><p>When moving up/down, the container needs to leave the floating container and it\r
+needs to be placed on the workspace (at workspace level). This is accomplished\r
+by calling the function <tt>attach_to_workspace</tt>.</p></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_click_handling">20. Click handling</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Without much ado, here is the list of cases which need to be considered:</p></div>\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+click to focus (tiling + floating) and raise (floating)\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+click to focus/raise when in stacked/tabbed mode\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+floating_modifier + left mouse button to drag a floating con\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+floating_modifier + right mouse button to resize a floating con\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+click on decoration in a floating con to either initiate a resize (if there\r
+ is more than one child in the floating con) or to drag the\r
+ floating con (if it’s the one at the top).\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+click on border in a floating con to resize the floating con\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+floating_modifier + right mouse button to resize a tiling con\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+click on border/decoration to resize a tiling con\r
+</p>\r
+</li>\r
+</ul></div>\r