Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > c67c6057ffd14254a26624517a2352e6 > files > 558

i3-doc-3.e-3.bf1.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>i3: src/resize.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>src/resize.c</h1><a href="a00074.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * vim:ts=8:expandtab</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * i3 - an improved dynamic tiling window manager</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * © 2009-2010 Michael Stapelberg and contributors</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * See file LICENSE for license information.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * This file contains the functions for resizing table columns/rows because</span>
<a name="l00011"></a>00011 <span class="comment"> * it’s actually lots of work, compared to the other handlers.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> */</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;assert.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;xcb/xcb.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;xcb/xcb_event.h&gt;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="a00041.html">i3.h</a>&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;<a class="code" href="a00036.html">data.h</a>&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="a00049.html">resize.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="a00052.html">util.h</a>&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="a00054.html">xcb.h</a>&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="a00037.html">debug.h</a>&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="a00043.html">layout.h</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="a00048.html">randr.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="a00034.html">config.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;<a class="code" href="a00039.html">floating.h</a>&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="a00053.html">workspace.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="a00044.html">log.h</a>&quot;</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="comment">/*</span>
<a name="l00034"></a>00034 <span class="comment"> * This is an ugly data structure which we need because there is no standard</span>
<a name="l00035"></a>00035 <span class="comment"> * way of having nested functions (only available as a gcc extension at the</span>
<a name="l00036"></a>00036 <span class="comment"> * moment, clang doesn’t support it) or blocks (only available as a clang</span>
<a name="l00037"></a>00037 <span class="comment"> * extension and only on Mac OS X systems at the moment).</span>
<a name="l00038"></a>00038 <span class="comment"> *</span>
<a name="l00039"></a>00039 <span class="comment"> */</span>
<a name="l00040"></a><a class="code" href="a00005.html">00040</a> <span class="keyword">struct </span><a class="code" href="a00005.html">callback_params</a> {
<a name="l00041"></a><a class="code" href="a00005.html#ab90688c79550c1ebbd085c7fcc227aa8">00041</a>         <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048">resize_orientation_t</a> <a class="code" href="a00005.html#ab90688c79550c1ebbd085c7fcc227aa8">orientation</a>;
<a name="l00042"></a><a class="code" href="a00005.html#a60993da7e659eb05cbe304a4cd0908c6">00042</a>         <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *<a class="code" href="a00005.html#a60993da7e659eb05cbe304a4cd0908c6">screen</a>;
<a name="l00043"></a><a class="code" href="a00005.html#a230a09146392c1d9c6b539dbd22b07a1">00043</a>         xcb_window_t <a class="code" href="a00005.html#a230a09146392c1d9c6b539dbd22b07a1">helpwin</a>;
<a name="l00044"></a><a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">00044</a>         uint32_t *<a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">new_position</a>;
<a name="l00045"></a>00045 };
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="a00074.html#a14622d3948077559dc238d42578111fb">00047</a> <a class="code" href="a00039.html#a1b6cf5fbd1cee4e32a102b1da9b7a0a7" title="Macro to create a callback function for dragging.">DRAGGING_CB</a>(resize_callback) {
<a name="l00048"></a>00048         <span class="keyword">struct </span><a class="code" href="a00005.html">callback_params</a> *params = extra;
<a name="l00049"></a>00049         <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *<a class="code" href="a00005.html#a60993da7e659eb05cbe304a4cd0908c6">screen</a> = params-&gt;<a class="code" href="a00005.html#a60993da7e659eb05cbe304a4cd0908c6">screen</a>;
<a name="l00050"></a>00050         <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;new x = %d, y = %d\n&quot;</span>, new_x, new_y);
<a name="l00051"></a>00051         <span class="keywordflow">if</span> (params-&gt;<a class="code" href="a00005.html#ab90688c79550c1ebbd085c7fcc227aa8">orientation</a> == <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048adf2421ce8287797fba766ef7785fd15f">O_VERTICAL</a>) {
<a name="l00052"></a>00052                 <span class="comment">/* Check if the new coordinates are within screen boundaries */</span>
<a name="l00053"></a>00053                 <span class="keywordflow">if</span> (new_x &gt; (screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> - 25) ||
<a name="l00054"></a>00054                     new_x &lt; (screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + 25))
<a name="l00055"></a>00055                         <span class="keywordflow">return</span>;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057                 *(params-&gt;<a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">new_position</a>) = new_x;
<a name="l00058"></a>00058                 xcb_configure_window(conn, params-&gt;<a class="code" href="a00005.html#a230a09146392c1d9c6b539dbd22b07a1">helpwin</a>, XCB_CONFIG_WINDOW_X, params-&gt;<a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">new_position</a>);
<a name="l00059"></a>00059         } <span class="keywordflow">else</span> {
<a name="l00060"></a>00060                 <span class="keywordflow">if</span> (new_y &gt; (screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> - 25) ||
<a name="l00061"></a>00061                     new_y &lt; (screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + 25))
<a name="l00062"></a>00062                         <span class="keywordflow">return</span>;
<a name="l00063"></a>00063 
<a name="l00064"></a>00064                 *(params-&gt;<a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">new_position</a>) = new_y;
<a name="l00065"></a>00065                 xcb_configure_window(conn, params-&gt;<a class="code" href="a00005.html#a230a09146392c1d9c6b539dbd22b07a1">helpwin</a>, XCB_CONFIG_WINDOW_Y, params-&gt;<a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">new_position</a>);
<a name="l00066"></a>00066         }
<a name="l00067"></a>00067 
<a name="l00068"></a>00068         xcb_flush(conn);
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 
<a name="l00071"></a>00071 <span class="comment">/*</span>
<a name="l00072"></a>00072 <span class="comment"> * Renders the resize window between the first/second container and resizes</span>
<a name="l00073"></a>00073 <span class="comment"> * the table column/row.</span>
<a name="l00074"></a>00074 <span class="comment"> *</span>
<a name="l00075"></a>00075 <span class="comment"> */</span>
<a name="l00076"></a><a class="code" href="a00049.html#a27c4cf5725c0f69ee91992c98f38dc5c">00076</a> <span class="keywordtype">int</span> <a class="code" href="a00074.html#a27c4cf5725c0f69ee91992c98f38dc5c" title="Renders the resize window between the first/second container and resizes the table...">resize_graphical_handler</a>(xcb_connection_t *conn, <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *ws, <span class="keywordtype">int</span> first, <span class="keywordtype">int</span> second,
<a name="l00077"></a>00077                              <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048">resize_orientation_t</a> <a class="code" href="a00005.html#ab90688c79550c1ebbd085c7fcc227aa8">orientation</a>, xcb_button_press_event_t *event) {
<a name="l00078"></a>00078         uint32_t <a class="code" href="a00005.html#a3df0526af55453cb0f9871ca92cf03d7">new_position</a>;
<a name="l00079"></a>00079         <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *<a class="code" href="a00005.html#a60993da7e659eb05cbe304a4cd0908c6">screen</a> = <a class="code" href="a00073.html#abb7e75366265212195afd09ab85235f6" title="Returns the active (!) output which contains the coordinates x, y or NULL if there...">get_output_containing</a>(event-&gt;root_x, event-&gt;root_y);
<a name="l00080"></a>00080         <span class="keywordflow">if</span> (screen == NULL) {
<a name="l00081"></a>00081                 <a class="code" href="a00044.html#a6828c68e0feb4b7fdfe0fc3ba9f3038b">ELOG</a>(<span class="stringliteral">&quot;BUG: No screen found at this position (%d, %d)\n&quot;</span>, event-&gt;root_x, event-&gt;root_y);
<a name="l00082"></a>00082                 <span class="keywordflow">return</span> 1;
<a name="l00083"></a>00083         }
<a name="l00084"></a>00084 
<a name="l00085"></a>00085         <span class="comment">/* We cannot use the X root window&#39;s width_in_pixels or height_in_pixels</span>
<a name="l00086"></a>00086 <span class="comment">         * attributes here since they are not updated when you configure new</span>
<a name="l00087"></a>00087 <span class="comment">         * screens during runtime. Instead, we just use the most right and most</span>
<a name="l00088"></a>00088 <span class="comment">         * bottom Xinerama screen and use their position + width/height to get</span>
<a name="l00089"></a>00089 <span class="comment">         * the area of pixels currently in use */</span>
<a name="l00090"></a>00090         <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *most_right = <a class="code" href="a00073.html#ab437b557cdb16bda702e52c99efcfe4a" title="Gets the output which is the last one in the given direction, for example the output...">get_output_most</a>(<a class="code" href="a00036.html#ae9ae980041e438eed7a3af43ce4e9f6ba07fb0d616c46d4120eb541871fbdfd2d">D_RIGHT</a>, screen),
<a name="l00091"></a>00091                *most_bottom = <a class="code" href="a00073.html#ab437b557cdb16bda702e52c99efcfe4a" title="Gets the output which is the last one in the given direction, for example the output...">get_output_most</a>(<a class="code" href="a00036.html#ae9ae980041e438eed7a3af43ce4e9f6baee5b9399d89b358fa6fb0adef67d3a4b">D_DOWN</a>, screen);
<a name="l00092"></a>00092 
<a name="l00093"></a>00093         <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;event-&gt;event_x = %d, event-&gt;root_x = %d\n&quot;</span>, event-&gt;event_x, event-&gt;root_x);
<a name="l00094"></a>00094 
<a name="l00095"></a>00095         <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Screen dimensions: (%d, %d) %d x %d\n&quot;</span>, screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a>, screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a>, screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a>, screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a>);
<a name="l00096"></a>00096 
<a name="l00097"></a>00097         uint32_t mask = 0;
<a name="l00098"></a>00098         uint32_t values[2];
<a name="l00099"></a>00099 
<a name="l00100"></a>00100         mask = XCB_CW_OVERRIDE_REDIRECT;
<a name="l00101"></a>00101         values[0] = 1;
<a name="l00102"></a>00102 
<a name="l00103"></a>00103         <span class="comment">/* Open a new window, the resizebar. Grab the pointer and move the window around</span>
<a name="l00104"></a>00104 <span class="comment">           as the user moves the pointer. */</span>
<a name="l00105"></a>00105         <a class="code" href="a00020.html" title="Stores a rectangle, for example the size of a window, the child window etc.">Rect</a> grabrect = {0,
<a name="l00106"></a>00106                          0,
<a name="l00107"></a>00107                          most_right-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + most_right-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a>,
<a name="l00108"></a>00108                          most_bottom-&gt;rect.x + most_bottom-&gt;rect.height};
<a name="l00109"></a>00109         xcb_window_t grabwin = <a class="code" href="a00079.html#a1c6bb71a9f8e0501e2228dd3dca3bd6a" title="Convenience wrapper around xcb_create_window which takes care of depth, generating...">create_window</a>(conn, grabrect, XCB_WINDOW_CLASS_INPUT_ONLY, -1, <span class="keyword">true</span>, mask, values);
<a name="l00110"></a>00110 
<a name="l00111"></a>00111         <a class="code" href="a00020.html" title="Stores a rectangle, for example the size of a window, the child window etc.">Rect</a> helprect;
<a name="l00112"></a>00112         <span class="keywordflow">if</span> (orientation == <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048adf2421ce8287797fba766ef7785fd15f">O_VERTICAL</a>) {
<a name="l00113"></a>00113                 helprect.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> = <span class="keyword">event</span>-&gt;root_x;
<a name="l00114"></a>00114                 helprect.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> = screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a>;
<a name="l00115"></a>00115                 helprect.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> = 2;
<a name="l00116"></a>00116                 helprect.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> = screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a>;
<a name="l00117"></a>00117                 new_position = <span class="keyword">event</span>-&gt;root_x;
<a name="l00118"></a>00118         } <span class="keywordflow">else</span> {
<a name="l00119"></a>00119                 helprect.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> = screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a>;
<a name="l00120"></a>00120                 helprect.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> = <span class="keyword">event</span>-&gt;root_y;
<a name="l00121"></a>00121                 helprect.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> = screen-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a>;
<a name="l00122"></a>00122                 helprect.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> = 2;
<a name="l00123"></a>00123                 new_position = <span class="keyword">event</span>-&gt;root_y;
<a name="l00124"></a>00124         }
<a name="l00125"></a>00125 
<a name="l00126"></a>00126         mask = XCB_CW_BACK_PIXEL;
<a name="l00127"></a>00127         values[0] = <a class="code" href="a00062.html#a4a8dd3a2de125b72d4fe6251a0a271b5">config</a>.<a class="code" href="a00010.html#a2cfc8e52ae874b8a76b8103b8da7b520">client</a>.<a class="code" href="a00012.html#a099c67879c7e681a9679a2215b9a5345">focused</a>.<a class="code" href="a00009.html#abc8ad1d75ff1d44e27aeb6c2eb7713a0">border</a>;
<a name="l00128"></a>00128 
<a name="l00129"></a>00129         mask |= XCB_CW_OVERRIDE_REDIRECT;
<a name="l00130"></a>00130         values[1] = 1;
<a name="l00131"></a>00131 
<a name="l00132"></a>00132         xcb_window_t <a class="code" href="a00005.html#a230a09146392c1d9c6b539dbd22b07a1">helpwin</a> = <a class="code" href="a00079.html#a1c6bb71a9f8e0501e2228dd3dca3bd6a" title="Convenience wrapper around xcb_create_window which takes care of depth, generating...">create_window</a>(conn, helprect, XCB_WINDOW_CLASS_INPUT_OUTPUT,
<a name="l00133"></a>00133                                              (orientation == <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048adf2421ce8287797fba766ef7785fd15f">O_VERTICAL</a> ?
<a name="l00134"></a>00134                                               <a class="code" href="a00054.html#a4e44cdac03bdc4337b8cf1e91fa35370">XCB_CURSOR_SB_H_DOUBLE_ARROW</a> :
<a name="l00135"></a>00135                                               <a class="code" href="a00054.html#abecce64970049f96b6bfaecface172e6">XCB_CURSOR_SB_V_DOUBLE_ARROW</a>), <span class="keyword">true</span>, mask, values);
<a name="l00136"></a>00136 
<a name="l00137"></a>00137         xcb_circulate_window(conn, XCB_CIRCULATE_RAISE_LOWEST, helpwin);
<a name="l00138"></a>00138 
<a name="l00139"></a>00139         xcb_flush(conn);
<a name="l00140"></a>00140 
<a name="l00141"></a>00141         <span class="keyword">struct </span><a class="code" href="a00005.html">callback_params</a> params = { orientation, screen, helpwin, &amp;new_position };
<a name="l00142"></a>00142 
<a name="l00143"></a>00143         <a class="code" href="a00066.html#a74161272ece36a35ab930bf32fb5027e" title="This function grabs your pointer and lets you drag stuff around (borders).">drag_pointer</a>(conn, NULL, event, grabwin, <a class="code" href="a00039.html#aacfe70f93afb3b5a074ff4d6f726769aa74fabb36cb5f0a09955bb37ced6fd0da">BORDER_TOP</a>, resize_callback, &amp;params);
<a name="l00144"></a>00144 
<a name="l00145"></a>00145         xcb_destroy_window(conn, helpwin);
<a name="l00146"></a>00146         xcb_destroy_window(conn, grabwin);
<a name="l00147"></a>00147         xcb_flush(conn);
<a name="l00148"></a>00148 
<a name="l00149"></a>00149         <span class="keywordtype">int</span> pixels;
<a name="l00150"></a>00150         <span class="keywordflow">if</span> (orientation == <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048adf2421ce8287797fba766ef7785fd15f">O_VERTICAL</a>)
<a name="l00151"></a>00151                 pixels = (new_position - <span class="keyword">event</span>-&gt;root_x);
<a name="l00152"></a>00152         <span class="keywordflow">else</span> pixels = (new_position - <span class="keyword">event</span>-&gt;root_y);
<a name="l00153"></a>00153         <a class="code" href="a00074.html#aa9b01c3afa38f9471b7a99ea145066f0" title="Resizes a column/row by the given amount of pixels.">resize_container</a>(conn, ws, first, second, orientation, pixels);
<a name="l00154"></a>00154 
<a name="l00155"></a>00155         <span class="keywordflow">return</span> 1;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 <span class="comment">/*</span>
<a name="l00159"></a>00159 <span class="comment"> * Resizes a column/row by the given amount of pixels. Called by</span>
<a name="l00160"></a>00160 <span class="comment"> * resize_graphical_handler (the user clicked) or parse_resize_command (the</span>
<a name="l00161"></a>00161 <span class="comment"> * user issued the command)</span>
<a name="l00162"></a>00162 <span class="comment"> *</span>
<a name="l00163"></a>00163 <span class="comment"> */</span>
<a name="l00164"></a><a class="code" href="a00049.html#aa9b01c3afa38f9471b7a99ea145066f0">00164</a> <span class="keywordtype">void</span> <a class="code" href="a00074.html#aa9b01c3afa38f9471b7a99ea145066f0" title="Resizes a column/row by the given amount of pixels.">resize_container</a>(xcb_connection_t *conn, <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *ws, <span class="keywordtype">int</span> first, <span class="keywordtype">int</span> second,
<a name="l00165"></a>00165                       <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048">resize_orientation_t</a> <a class="code" href="a00005.html#ab90688c79550c1ebbd085c7fcc227aa8">orientation</a>, <span class="keywordtype">int</span> pixels) {
<a name="l00166"></a>00166 
<a name="l00167"></a>00167         <span class="comment">/* TODO: refactor this, both blocks are very identical */</span>
<a name="l00168"></a>00168         <span class="keywordflow">if</span> (orientation == <a class="code" href="a00049.html#a71bd35b8b1c20409e895e1d16db16048adf2421ce8287797fba766ef7785fd15f">O_VERTICAL</a>) {
<a name="l00169"></a>00169                 <span class="keywordtype">int</span> default_width = ws-&gt;<a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> / ws-&gt;<a class="code" href="a00025.html#a1d295f430fa92fc0b91c7f85a4b499b2" title="table dimensions">cols</a>;
<a name="l00170"></a>00170                 <span class="keywordtype">int</span> old_unoccupied_x = <a class="code" href="a00069.html#a58500d1d5e56285ceb2bd514dbee8a2f" title="Gets the unoccupied space (= space which is available for windows which were resized...">get_unoccupied_x</a>(ws);
<a name="l00171"></a>00171 
<a name="l00172"></a>00172                 <span class="comment">/* We pre-calculate the unoccupied space to see if we need to adapt sizes before</span>
<a name="l00173"></a>00173 <span class="comment">                 * doing the resize */</span>
<a name="l00174"></a>00174                 <span class="keywordtype">int</span> new_unoccupied_x = old_unoccupied_x;
<a name="l00175"></a>00175 
<a name="l00176"></a>00176                 <span class="keywordflow">if</span> (old_unoccupied_x == 0)
<a name="l00177"></a>00177                         old_unoccupied_x = ws-&gt;<a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a>;
<a name="l00178"></a>00178 
<a name="l00179"></a>00179                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first] == 0)
<a name="l00180"></a>00180                         new_unoccupied_x += default_width;
<a name="l00181"></a>00181 
<a name="l00182"></a>00182                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second] == 0)
<a name="l00183"></a>00183                         new_unoccupied_x += default_width;
<a name="l00184"></a>00184 
<a name="l00185"></a>00185                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;\n\n\n&quot;</span>);
<a name="l00186"></a>00186                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;old = %d, new = %d\n&quot;</span>, old_unoccupied_x, new_unoccupied_x);
<a name="l00187"></a>00187 
<a name="l00188"></a>00188                 <span class="keywordtype">int</span> cols_without_wf = 0;
<a name="l00189"></a>00189                 <span class="keywordtype">int</span> old_width, old_second_width;
<a name="l00190"></a>00190                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> col = 0; col &lt; ws-&gt;<a class="code" href="a00025.html#a1d295f430fa92fc0b91c7f85a4b499b2" title="table dimensions">cols</a>; col++)
<a name="l00191"></a>00191                         <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[col] == 0)
<a name="l00192"></a>00192                                 cols_without_wf++;
<a name="l00193"></a>00193 
<a name="l00194"></a>00194                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;old_unoccupied_x = %d\n&quot;</span>, old_unoccupied_x);
<a name="l00195"></a>00195 
<a name="l00196"></a>00196                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating first (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first]);
<a name="l00197"></a>00197                 <span class="comment">/* Convert 0 (for default width_factor) to actual numbers */</span>
<a name="l00198"></a>00198                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first] == 0)
<a name="l00199"></a>00199                         old_width = (old_unoccupied_x / <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(cols_without_wf, 1));
<a name="l00200"></a>00200                 <span class="keywordflow">else</span> old_width = ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first] * old_unoccupied_x;
<a name="l00201"></a>00201 
<a name="l00202"></a>00202                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;second (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second]);
<a name="l00203"></a>00203                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second] == 0)
<a name="l00204"></a>00204                         old_second_width = (old_unoccupied_x / <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(cols_without_wf, 1));
<a name="l00205"></a>00205                 <span class="keywordflow">else</span> old_second_width = ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second] * old_unoccupied_x;
<a name="l00206"></a>00206 
<a name="l00207"></a>00207                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;middle = %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first]);
<a name="l00208"></a>00208 
<a name="l00209"></a>00209                 <span class="comment">/* If the space used for customly resized columns has changed we need to adapt the</span>
<a name="l00210"></a>00210 <span class="comment">                 * other customly resized columns, if any */</span>
<a name="l00211"></a>00211                 <span class="keywordflow">if</span> (new_unoccupied_x != old_unoccupied_x)
<a name="l00212"></a>00212                         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> col = 0; col &lt; ws-&gt;<a class="code" href="a00025.html#a1d295f430fa92fc0b91c7f85a4b499b2" title="table dimensions">cols</a>; col++) {
<a name="l00213"></a>00213                                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[col] == 0)
<a name="l00214"></a>00214                                         <span class="keywordflow">continue</span>;
<a name="l00215"></a>00215 
<a name="l00216"></a>00216                                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating other column (%d) (current width_factor = %f)\n&quot;</span>, col, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[col]);
<a name="l00217"></a>00217                                 ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[col] = (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[col] * old_unoccupied_x) / new_unoccupied_x;
<a name="l00218"></a>00218                                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;to %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[col]);
<a name="l00219"></a>00219                         }
<a name="l00220"></a>00220 
<a name="l00221"></a>00221                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating first (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first]);
<a name="l00222"></a>00222                 <span class="comment">/* Convert 0 (for default width_factor) to actual numbers */</span>
<a name="l00223"></a>00223                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first] == 0)
<a name="l00224"></a>00224                         ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first] = ((float)ws-&gt;<a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> / ws-&gt;<a class="code" href="a00025.html#a1d295f430fa92fc0b91c7f85a4b499b2" title="table dimensions">cols</a>) / new_unoccupied_x;
<a name="l00225"></a>00225 
<a name="l00226"></a>00226                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;first-&gt;width = %d, pixels = %d\n&quot;</span>, old_width, pixels);
<a name="l00227"></a>00227                 ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first] *= (float)(old_width + pixels) / old_width;
<a name="l00228"></a>00228                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;-&gt; %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[first]);
<a name="l00229"></a>00229 
<a name="l00230"></a>00230 
<a name="l00231"></a>00231                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating second (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second]);
<a name="l00232"></a>00232                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second] == 0)
<a name="l00233"></a>00233                         ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second] = ((float)ws-&gt;<a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> / ws-&gt;<a class="code" href="a00025.html#a1d295f430fa92fc0b91c7f85a4b499b2" title="table dimensions">cols</a>) / new_unoccupied_x;
<a name="l00234"></a>00234 
<a name="l00235"></a>00235                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;middle = %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second]);
<a name="l00236"></a>00236                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;second-&gt;width = %d, pixels = %d\n&quot;</span>, old_second_width, pixels);
<a name="l00237"></a>00237                 ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second] *= (float)(old_second_width - pixels) / old_second_width;
<a name="l00238"></a>00238                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;-&gt; %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a9821dccf3f7541515549feb57527dcb6" title="width_factor and height_factor contain the amount of space (percentage) a column/row...">width_factor</a>[second]);
<a name="l00239"></a>00239 
<a name="l00240"></a>00240                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;new unoccupied_x = %d\n&quot;</span>, <a class="code" href="a00069.html#a58500d1d5e56285ceb2bd514dbee8a2f" title="Gets the unoccupied space (= space which is available for windows which were resized...">get_unoccupied_x</a>(ws));
<a name="l00241"></a>00241 
<a name="l00242"></a>00242                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;\n\n\n&quot;</span>);
<a name="l00243"></a>00243         } <span class="keywordflow">else</span> {
<a name="l00244"></a>00244                 <span class="keywordtype">int</span> ws_height = <a class="code" href="a00078.html#af55407f9bc846ec57cf289c87a47dbce">workspace_height</a>(ws);
<a name="l00245"></a>00245                 <span class="keywordtype">int</span> default_height = ws_height / ws-&gt;<a class="code" href="a00025.html#ae4fee0126eb1ae8484bf7281709c3fdb" title="table dimensions">rows</a>;
<a name="l00246"></a>00246                 <span class="keywordtype">int</span> old_unoccupied_y = <a class="code" href="a00069.html#a9ca57ef4162045e82bf24e326ec8a936" title="See get_unoccupied_x.">get_unoccupied_y</a>(ws);
<a name="l00247"></a>00247 
<a name="l00248"></a>00248                 <span class="comment">/* We pre-calculate the unoccupied space to see if we need to adapt sizes before</span>
<a name="l00249"></a>00249 <span class="comment">                 * doing the resize */</span>
<a name="l00250"></a>00250                 <span class="keywordtype">int</span> new_unoccupied_y = old_unoccupied_y;
<a name="l00251"></a>00251 
<a name="l00252"></a>00252                 <span class="keywordflow">if</span> (old_unoccupied_y == 0)
<a name="l00253"></a>00253                         old_unoccupied_y = ws_height;
<a name="l00254"></a>00254 
<a name="l00255"></a>00255                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first] == 0)
<a name="l00256"></a>00256                         new_unoccupied_y += default_height;
<a name="l00257"></a>00257 
<a name="l00258"></a>00258                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second] == 0)
<a name="l00259"></a>00259                         new_unoccupied_y += default_height;
<a name="l00260"></a>00260 
<a name="l00261"></a>00261                 <span class="keywordtype">int</span> cols_without_hf = 0;
<a name="l00262"></a>00262                 <span class="keywordtype">int</span> old_height, old_second_height;
<a name="l00263"></a>00263                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> row = 0; row &lt; ws-&gt;<a class="code" href="a00025.html#ae4fee0126eb1ae8484bf7281709c3fdb" title="table dimensions">rows</a>; row++)
<a name="l00264"></a>00264                         <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[row] == 0)
<a name="l00265"></a>00265                                 cols_without_hf++;
<a name="l00266"></a>00266 
<a name="l00267"></a>00267                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;old_unoccupied_y = %d\n&quot;</span>, old_unoccupied_y);
<a name="l00268"></a>00268 
<a name="l00269"></a>00269                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating first (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first]);
<a name="l00270"></a>00270 
<a name="l00271"></a>00271                 <span class="comment">/* Convert 0 (for default width_factor) to actual numbers */</span>
<a name="l00272"></a>00272                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first] == 0)
<a name="l00273"></a>00273                         old_height = (old_unoccupied_y / <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(cols_without_hf, 1));
<a name="l00274"></a>00274                 <span class="keywordflow">else</span> old_height = ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first] * old_unoccupied_y;
<a name="l00275"></a>00275 
<a name="l00276"></a>00276                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;second (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second]);
<a name="l00277"></a>00277                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second] == 0)
<a name="l00278"></a>00278                         old_second_height = (old_unoccupied_y / <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(cols_without_hf, 1));
<a name="l00279"></a>00279                 <span class="keywordflow">else</span> old_second_height = ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second] * old_unoccupied_y;
<a name="l00280"></a>00280 
<a name="l00281"></a>00281                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;middle = %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first]);
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 
<a name="l00284"></a>00284                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;\n\n\n&quot;</span>);
<a name="l00285"></a>00285                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;old = %d, new = %d\n&quot;</span>, old_unoccupied_y, new_unoccupied_y);
<a name="l00286"></a>00286 
<a name="l00287"></a>00287                 <span class="comment">/* If the space used for customly resized columns has changed we need to adapt the</span>
<a name="l00288"></a>00288 <span class="comment">                 * other customly resized columns, if any */</span>
<a name="l00289"></a>00289                 <span class="keywordflow">if</span> (new_unoccupied_y != old_unoccupied_y)
<a name="l00290"></a>00290                         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> row = 0; row &lt; ws-&gt;<a class="code" href="a00025.html#ae4fee0126eb1ae8484bf7281709c3fdb" title="table dimensions">rows</a>; row++) {
<a name="l00291"></a>00291                                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[row] == 0)
<a name="l00292"></a>00292                                         <span class="keywordflow">continue</span>;
<a name="l00293"></a>00293 
<a name="l00294"></a>00294                                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating other column (%d) (current width_factor = %f)\n&quot;</span>, row, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[row]);
<a name="l00295"></a>00295                                 ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[row] = (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[row] * old_unoccupied_y) / new_unoccupied_y;
<a name="l00296"></a>00296                                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;to %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[row]);
<a name="l00297"></a>00297                         }
<a name="l00298"></a>00298 
<a name="l00299"></a>00299 
<a name="l00300"></a>00300                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating first (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first]);
<a name="l00301"></a>00301                 <span class="comment">/* Convert 0 (for default width_factor) to actual numbers */</span>
<a name="l00302"></a>00302                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first] == 0)
<a name="l00303"></a>00303                         ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first] = ((float)ws_height / ws-&gt;<a class="code" href="a00025.html#ae4fee0126eb1ae8484bf7281709c3fdb" title="table dimensions">rows</a>) / new_unoccupied_y;
<a name="l00304"></a>00304 
<a name="l00305"></a>00305                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;first-&gt;width = %d, pixels = %d\n&quot;</span>, old_height, pixels);
<a name="l00306"></a>00306                 ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first] *= (float)(old_height + pixels) / old_height;
<a name="l00307"></a>00307                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;-&gt; %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[first]);
<a name="l00308"></a>00308 
<a name="l00309"></a>00309 
<a name="l00310"></a>00310                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Updating second (before = %f)\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second]);
<a name="l00311"></a>00311                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second] == 0)
<a name="l00312"></a>00312                         ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second] = ((float)ws_height / ws-&gt;<a class="code" href="a00025.html#ae4fee0126eb1ae8484bf7281709c3fdb" title="table dimensions">rows</a>) / new_unoccupied_y;
<a name="l00313"></a>00313                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;middle = %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second]);
<a name="l00314"></a>00314                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;second-&gt;width = %d, pixels = %d\n&quot;</span>, old_second_height, pixels);
<a name="l00315"></a>00315                 ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second] *= (float)(old_second_height - pixels) / old_second_height;
<a name="l00316"></a>00316                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;-&gt; %f\n&quot;</span>, ws-&gt;<a class="code" href="a00025.html#a88f474bf999c23126a00922de6102822">height_factor</a>[second]);
<a name="l00317"></a>00317 
<a name="l00318"></a>00318                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;new unoccupied_y = %d\n&quot;</span>, <a class="code" href="a00069.html#a9ca57ef4162045e82bf24e326ec8a936" title="See get_unoccupied_x.">get_unoccupied_y</a>(ws));
<a name="l00319"></a>00319 
<a name="l00320"></a>00320                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;\n\n\n&quot;</span>);
<a name="l00321"></a>00321         }
<a name="l00322"></a>00322 
<a name="l00323"></a>00323         <a class="code" href="a00069.html#a47ffef7db851301198762179187ac997" title="Renders the whole layout, that is: Go through each screen, each workspace, each container...">render_layout</a>(conn);
<a name="l00324"></a>00324 }
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>