Sophie

Sophie

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

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/client.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/client.c</h1><a href="a00060.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"> * client.c: holds all client-specific functions</span>
<a name="l00011"></a>00011 <span class="comment"> *</span>
<a name="l00012"></a>00012 <span class="comment"> */</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;assert.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;limits.h&gt;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;xcb/xcb.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;xcb/xcb_icccm.h&gt;</span>
<a name="l00020"></a>00020 
<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="a00041.html">i3.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="a00054.html">xcb.h</a>&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="a00052.html">util.h</a>&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="a00047.html">queue.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="a00032.html">client.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="a00051.html">table.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;<a class="code" href="a00053.html">workspace.h</a>&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="a00034.html">config.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"> * Removes the given client from the container, either because it will be inserted into another</span>
<a name="l00035"></a>00035 <span class="comment"> * one or because it was unmapped</span>
<a name="l00036"></a>00036 <span class="comment"> *</span>
<a name="l00037"></a>00037 <span class="comment"> */</span>
<a name="l00038"></a><a class="code" href="a00032.html#a795be4a8912ac14d7657257953a91cd1">00038</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a795be4a8912ac14d7657257953a91cd1" title="Removes the given client from the container, either because it will be inserted into...">client_remove_from_container</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, <a class="code" href="a00013.html" title="A container is either in default, stacking or tabbed mode.">Container</a> *<a class="code" href="a00023.html#ad5f9402c2db288b0762e3a6467257dc8" title="Backpointer to the container this stack window is in.">container</a>, <span class="keywordtype">bool</span> remove_from_focusstack) {
<a name="l00039"></a>00039         <a class="code" href="a00047.html#ae1b066e803ee2f2a3ead6e4c632b7e49">CIRCLEQ_REMOVE</a>(&amp;(container-&gt;clients), client, clients);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041         <span class="keywordflow">if</span> (remove_from_focusstack)
<a name="l00042"></a>00042                 <a class="code" href="a00047.html#a9c7950d61593ab9198524fca81b17ab0">SLIST_REMOVE</a>(&amp;(container-&gt;<a class="code" href="a00013.html#a98ed501e1088ccf2e7c75399ab7e6031">workspace</a>-&gt;focus_stack), client, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a>, focus_clients);
<a name="l00043"></a>00043 
<a name="l00044"></a>00044         <span class="comment">/* If the container will be empty now and is in stacking mode, we need to</span>
<a name="l00045"></a>00045 <span class="comment">           unmap the stack_win */</span>
<a name="l00046"></a>00046         <span class="keywordflow">if</span> (<a class="code" href="a00047.html#a5612649227a37a22f0b8b6420d5f2c92">CIRCLEQ_EMPTY</a>(&amp;(container-&gt;clients)) &amp;&amp;
<a name="l00047"></a>00047             (container-&gt;<a class="code" href="a00013.html#ac094306ab77e360742aba04d7cbd0fe6">mode</a> == MODE_STACK ||
<a name="l00048"></a>00048              container-&gt;<a class="code" href="a00013.html#ac094306ab77e360742aba04d7cbd0fe6">mode</a> == MODE_TABBED)) {
<a name="l00049"></a>00049                 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Unmapping stack window\n&quot;</span>);
<a name="l00050"></a>00050                 <span class="keyword">struct </span><a class="code" href="a00023.html" title="Contains data for the windows needed to draw the titlebars on in stacking mode.">Stack_Window</a> *stack_win = &amp;(container-&gt;<a class="code" href="a00013.html#ad3c94b066b8ddd9a56f33e8bd9f200b2">stack_win</a>);
<a name="l00051"></a>00051                 stack_win-&gt;<a class="code" href="a00023.html#ac42bcee20d4f77f4ecbdec1dbb616a4f">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> = 0;
<a name="l00052"></a>00052                 xcb_unmap_window(conn, stack_win-&gt;<a class="code" href="a00023.html#aa10861a9e5d4859d70275b462acfcd24">window</a>);
<a name="l00053"></a>00053                 xcb_flush(conn);
<a name="l00054"></a>00054         }
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="comment">/*</span>
<a name="l00058"></a>00058 <span class="comment"> * Warps the pointer into the given client (in the middle of it, to be specific), therefore</span>
<a name="l00059"></a>00059 <span class="comment"> * selecting it</span>
<a name="l00060"></a>00060 <span class="comment"> *</span>
<a name="l00061"></a>00061 <span class="comment"> */</span>
<a name="l00062"></a><a class="code" href="a00032.html#a4f8920c26884a6afe27211af25500135">00062</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a4f8920c26884a6afe27211af25500135" title="Warps the pointer into the given client (in the middle of it, to be specific), therefore...">client_warp_pointer_into</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00063"></a>00063         <span class="keywordtype">int</span> mid_x = client-&gt;<a class="code" href="a00007.html#aea76187592ae1a87eb8bb1af77af62d4" title="x, y, width, height of the frame">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> / 2,
<a name="l00064"></a>00064             mid_y = client-&gt;<a class="code" href="a00007.html#aea76187592ae1a87eb8bb1af77af62d4" title="x, y, width, height of the frame">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> / 2;
<a name="l00065"></a>00065         xcb_warp_pointer(conn, XCB_NONE, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, 0, 0, 0, 0, mid_x, mid_y);
<a name="l00066"></a>00066 }
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="comment">/*</span>
<a name="l00069"></a>00069 <span class="comment"> * Returns true if the client supports the given protocol atom (like WM_DELETE_WINDOW)</span>
<a name="l00070"></a>00070 <span class="comment"> *</span>
<a name="l00071"></a>00071 <span class="comment"> */</span>
<a name="l00072"></a><a class="code" href="a00060.html#a5dabfa9e20f5a31def4882c507b25e72">00072</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="a00060.html#a5dabfa9e20f5a31def4882c507b25e72">client_supports_protocol</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, xcb_atom_t atom) {
<a name="l00073"></a>00073         xcb_get_property_cookie_t cookie;
<a name="l00074"></a>00074         xcb_get_wm_protocols_reply_t protocols;
<a name="l00075"></a>00075         <span class="keywordtype">bool</span> result = <span class="keyword">false</span>;
<a name="l00076"></a>00076 
<a name="l00077"></a>00077         cookie = xcb_get_wm_protocols_unchecked(conn, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a5d7366da3deea67253099a5c730d4297">WM_PROTOCOLS</a>]);
<a name="l00078"></a>00078         <span class="keywordflow">if</span> (xcb_get_wm_protocols_reply(conn, cookie, &amp;protocols, NULL) != 1)
<a name="l00079"></a>00079                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00080"></a>00080 
<a name="l00081"></a>00081         <span class="comment">/* Check if the client’s protocols have the requested atom set */</span>
<a name="l00082"></a>00082         <span class="keywordflow">for</span> (uint32_t i = 0; i &lt; protocols.atoms_len; i++)
<a name="l00083"></a>00083                 <span class="keywordflow">if</span> (protocols.atoms[i] == atom)
<a name="l00084"></a>00084                         result = <span class="keyword">true</span>;
<a name="l00085"></a>00085 
<a name="l00086"></a>00086         xcb_get_wm_protocols_reply_wipe(&amp;protocols);
<a name="l00087"></a>00087 
<a name="l00088"></a>00088         <span class="keywordflow">return</span> result;
<a name="l00089"></a>00089 }
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 <span class="comment">/*</span>
<a name="l00092"></a>00092 <span class="comment"> * Kills the given window using WM_DELETE_WINDOW or xcb_kill_window</span>
<a name="l00093"></a>00093 <span class="comment"> *</span>
<a name="l00094"></a>00094 <span class="comment"> */</span>
<a name="l00095"></a><a class="code" href="a00032.html#aa244b3de7ad8ce3dddcca51abbc7fda9">00095</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#aa244b3de7ad8ce3dddcca51abbc7fda9" title="Kills the given window using WM_DELETE_WINDOW or xcb_kill_window.">client_kill</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *<a class="code" href="a00023.html#aa10861a9e5d4859d70275b462acfcd24">window</a>) {
<a name="l00096"></a>00096         <span class="comment">/* If the client does not support WM_DELETE_WINDOW, we kill it the hard way */</span>
<a name="l00097"></a>00097         <span class="keywordflow">if</span> (!<a class="code" href="a00060.html#a5dabfa9e20f5a31def4882c507b25e72">client_supports_protocol</a>(conn, window, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a72e98f8036033fc3b9db52933dd749d0">WM_DELETE_WINDOW</a>])) {
<a name="l00098"></a>00098                 <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Killing window the hard way\n&quot;</span>);
<a name="l00099"></a>00099                 xcb_kill_client(conn, window-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>);
<a name="l00100"></a>00100                 <span class="keywordflow">return</span>;
<a name="l00101"></a>00101         }
<a name="l00102"></a>00102 
<a name="l00103"></a>00103         xcb_client_message_event_t ev;
<a name="l00104"></a>00104 
<a name="l00105"></a>00105         memset(&amp;ev, 0, <span class="keyword">sizeof</span>(xcb_client_message_event_t));
<a name="l00106"></a>00106 
<a name="l00107"></a>00107         ev.response_type = XCB_CLIENT_MESSAGE;
<a name="l00108"></a>00108         ev.window = window-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>;
<a name="l00109"></a>00109         ev.type = <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a5d7366da3deea67253099a5c730d4297">WM_PROTOCOLS</a>];
<a name="l00110"></a>00110         ev.format = 32;
<a name="l00111"></a>00111         ev.data.data32[0] = <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[WM_DELETE_WINDOW];
<a name="l00112"></a>00112         ev.data.data32[1] = XCB_CURRENT_TIME;
<a name="l00113"></a>00113 
<a name="l00114"></a>00114         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Sending WM_DELETE to the client\n&quot;</span>);
<a name="l00115"></a>00115         xcb_send_event(conn, <span class="keyword">false</span>, window-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, XCB_EVENT_MASK_NO_EVENT, (<span class="keywordtype">char</span>*)&amp;ev);
<a name="l00116"></a>00116         xcb_flush(conn);
<a name="l00117"></a>00117 }
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 <span class="comment">/*</span>
<a name="l00120"></a>00120 <span class="comment"> * Checks if the given window class and title match the given client</span>
<a name="l00121"></a>00121 <span class="comment"> * Window title is passed as &quot;normal&quot; string and as UCS-2 converted string for</span>
<a name="l00122"></a>00122 <span class="comment"> * matching _NET_WM_NAME capable clients as well as those using legacy hints.</span>
<a name="l00123"></a>00123 <span class="comment"> *</span>
<a name="l00124"></a>00124 <span class="comment"> */</span>
<a name="l00125"></a><a class="code" href="a00032.html#ace28c5dcca4e3a62a20429038d3bed50">00125</a> <span class="keywordtype">bool</span> <a class="code" href="a00060.html#ace28c5dcca4e3a62a20429038d3bed50" title="Checks if the given window class and title match the given client Window title is...">client_matches_class_name</a>(<a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, <span class="keywordtype">char</span> *to_class, <span class="keywordtype">char</span> *to_title,
<a name="l00126"></a>00126                                <span class="keywordtype">char</span> *to_title_ucs, <span class="keywordtype">int</span> to_title_ucs_len) {
<a name="l00127"></a>00127         <span class="comment">/* Check if the given class is part of the window class */</span>
<a name="l00128"></a>00128         <span class="keywordflow">if</span> ((client-&gt;<a class="code" href="a00007.html#ac39c70e8b92f752b81f2c5cca3522399" title="Holds the WM_CLASS (which consists of two strings, the instance and the class), useful...">window_class_instance</a> == NULL ||
<a name="l00129"></a>00129              strcasestr(client-&gt;<a class="code" href="a00007.html#ac39c70e8b92f752b81f2c5cca3522399" title="Holds the WM_CLASS (which consists of two strings, the instance and the class), useful...">window_class_instance</a>, to_class) == NULL) &amp;&amp;
<a name="l00130"></a>00130             (client-&gt;<a class="code" href="a00007.html#a1c231d29bfbf4213354bb5ac43bacfa4">window_class_class</a> == NULL ||
<a name="l00131"></a>00131              strcasestr(client-&gt;<a class="code" href="a00007.html#a1c231d29bfbf4213354bb5ac43bacfa4">window_class_class</a>, to_class) == NULL))
<a name="l00132"></a>00132                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134         <span class="comment">/* If no title was given, we’re done */</span>
<a name="l00135"></a>00135         <span class="keywordflow">if</span> (to_title == NULL)
<a name="l00136"></a>00136                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00137"></a>00137 
<a name="l00138"></a>00138         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#aa6a6f0505f2d751ea862bc97343dd6df" title="name_len stores the real string length (glyphs) of the window title if the client...">name_len</a> &gt; -1) {
<a name="l00139"></a>00139                 <span class="comment">/* UCS-2 converted window titles */</span>
<a name="l00140"></a>00140                 <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a14c9eb7f57edfd939ed2fada25e83916" title="Name (= window title).">name</a> == NULL || memmem(client-&gt;<a class="code" href="a00007.html#a14c9eb7f57edfd939ed2fada25e83916" title="Name (= window title).">name</a>, (client-&gt;<a class="code" href="a00007.html#aa6a6f0505f2d751ea862bc97343dd6df" title="name_len stores the real string length (glyphs) of the window title if the client...">name_len</a> * 2), to_title_ucs, (to_title_ucs_len * 2)) == NULL)
<a name="l00141"></a>00141                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00142"></a>00142         } <span class="keywordflow">else</span> {
<a name="l00143"></a>00143                 <span class="comment">/* Legacy hints */</span>
<a name="l00144"></a>00144                 <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a14c9eb7f57edfd939ed2fada25e83916" title="Name (= window title).">name</a> == NULL || strcasestr(client-&gt;<a class="code" href="a00007.html#a14c9eb7f57edfd939ed2fada25e83916" title="Name (= window title).">name</a>, to_title) == NULL)
<a name="l00145"></a>00145                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00146"></a>00146         }
<a name="l00147"></a>00147 
<a name="l00148"></a>00148         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 
<a name="l00151"></a>00151 <span class="comment">/*</span>
<a name="l00152"></a>00152 <span class="comment"> * Enters fullscreen mode for the given client. This is called by toggle_fullscreen</span>
<a name="l00153"></a>00153 <span class="comment"> * and when moving a fullscreen client to another screen.</span>
<a name="l00154"></a>00154 <span class="comment"> *</span>
<a name="l00155"></a>00155 <span class="comment"> */</span>
<a name="l00156"></a><a class="code" href="a00032.html#a9ec4f35452bd2af99fbc1e8cbf0917f4">00156</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a9ec4f35452bd2af99fbc1e8cbf0917f4" title="Enters fullscreen mode for the given client.">client_enter_fullscreen</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, <span class="keywordtype">bool</span> global) {
<a name="l00157"></a>00157         <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *workspace;
<a name="l00158"></a>00158         <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *output;
<a name="l00159"></a>00159         <a class="code" href="a00020.html" title="Stores a rectangle, for example the size of a window, the child window etc.">Rect</a> r;
<a name="l00160"></a>00160 
<a name="l00161"></a>00161         <span class="keywordflow">if</span> (global) {
<a name="l00162"></a>00162                 <a class="code" href="a00047.html#a16e5fc168e7f3494d4b1df54447d871e">TAILQ_FOREACH</a>(output, &amp;<a class="code" href="a00073.html#a9fecba0738529e3d9ff0d4fa7c31ffa9">outputs</a>, <a class="code" href="a00073.html#a9fecba0738529e3d9ff0d4fa7c31ffa9">outputs</a>) {
<a name="l00163"></a>00163                         <span class="keywordflow">if</span> (!output-&gt;<a class="code" href="a00026.html#a7c56e7415ebe0aa040614d1244e2da6b" title="Whether the output is currently active (has a CRTC attached with a valid mode).">active</a>)
<a name="l00164"></a>00164                                 <span class="keywordflow">continue</span>;
<a name="l00165"></a>00165 
<a name="l00166"></a>00166                         <span class="keywordflow">if</span> (output-&gt;<a class="code" href="a00026.html#a9bcf702b65d8f47f98eafbefff529ffe" title="Current workspace selected on this virtual screen.">current_workspace</a>-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> == NULL)
<a name="l00167"></a>00167                                 <span class="keywordflow">continue</span>;
<a name="l00168"></a>00168 
<a name="l00169"></a>00169                         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Not entering global fullscreen mode, there already &quot;</span>
<a name="l00170"></a>00170                             <span class="stringliteral">&quot;is a fullscreen client on output %s.\n&quot;</span>, output-&gt;<a class="code" href="a00026.html#a4c8b185b15cf45e3ca300cb54b2d4650" title="Name of the output.">name</a>);
<a name="l00171"></a>00171                         <span class="keywordflow">return</span>;
<a name="l00172"></a>00172                 }
<a name="l00173"></a>00173 
<a name="l00174"></a>00174                 r = (<a class="code" href="a00020.html" title="Stores a rectangle, for example the size of a window, the child window etc.">Rect</a>) { UINT_MAX, UINT_MAX, 0,0 };
<a name="l00175"></a>00175                 <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *output;
<a name="l00176"></a>00176 
<a name="l00177"></a>00177                 <span class="comment">/* Set fullscreen_client for each active workspace.</span>
<a name="l00178"></a>00178 <span class="comment">                 * Expand the rectangle to contain all outputs. */</span>
<a name="l00179"></a>00179                 <a class="code" href="a00047.html#a16e5fc168e7f3494d4b1df54447d871e">TAILQ_FOREACH</a>(output, &amp;<a class="code" href="a00073.html#a9fecba0738529e3d9ff0d4fa7c31ffa9">outputs</a>, <a class="code" href="a00073.html#a9fecba0738529e3d9ff0d4fa7c31ffa9">outputs</a>) {
<a name="l00180"></a>00180                         <span class="keywordflow">if</span> (!output-&gt;<a class="code" href="a00026.html#a7c56e7415ebe0aa040614d1244e2da6b" title="Whether the output is currently active (has a CRTC attached with a valid mode).">active</a>)
<a name="l00181"></a>00181                                 <span class="keywordflow">continue</span>;
<a name="l00182"></a>00182 
<a name="l00183"></a>00183                         output-&gt;<a class="code" href="a00026.html#a9bcf702b65d8f47f98eafbefff529ffe" title="Current workspace selected on this virtual screen.">current_workspace</a>-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> = client;
<a name="l00184"></a>00184 
<a name="l00185"></a>00185                         <span class="comment">/* Temporarily abuse width/heigth as coordinates of the lower right corner */</span>
<a name="l00186"></a>00186                         <span class="keywordflow">if</span> (r.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> &gt; output-&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="l00187"></a>00187                                 r.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> = output-&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="l00188"></a>00188                         <span class="keywordflow">if</span> (r.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> &gt; output-&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="l00189"></a>00189                                 r.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> = output-&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="l00190"></a>00190                         <span class="keywordflow">if</span> (r.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + r.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> &lt; output-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + output-&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="l00191"></a>00191                                 r.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> = output-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + output-&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="l00192"></a>00192                         <span class="keywordflow">if</span> (r.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + r.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> &lt; output-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + output-&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="l00193"></a>00193                                 r.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> = output-&gt;<a class="code" href="a00026.html#aedbb714bf5d5ef9a28b5ff048321ed99" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + output-&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="l00194"></a>00194                 }
<a name="l00195"></a>00195 
<a name="l00196"></a>00196                 <span class="comment">/* Putting them back to their original meaning */</span>
<a name="l00197"></a>00197                 r.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> -= r.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a>;
<a name="l00198"></a>00198                 r.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> -= r.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a>;
<a name="l00199"></a>00199 
<a name="l00200"></a>00200                 <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Entering global fullscreen mode...\n&quot;</span>);
<a name="l00201"></a>00201         } <span class="keywordflow">else</span> {
<a name="l00202"></a>00202                 workspace = client-&gt;<a class="code" href="a00007.html#ab9573ba898dbd1932f5200be5eb2a990" title="Because dock clients don’t have a container, we have this workspace-backpointer...">workspace</a>;
<a name="l00203"></a>00203                 <span class="keywordflow">if</span> (workspace-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> != NULL &amp;&amp; workspace-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> != client) {
<a name="l00204"></a>00204                         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Not entering fullscreen mode, there already is a fullscreen client.\n&quot;</span>);
<a name="l00205"></a>00205                         <span class="keywordflow">return</span>;
<a name="l00206"></a>00206                 }
<a name="l00207"></a>00207 
<a name="l00208"></a>00208                 workspace-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> = client;
<a name="l00209"></a>00209                 r = workspace-&gt;<a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211                 <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Entering fullscreen mode...\n&quot;</span>);
<a name="l00212"></a>00212         }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214         client-&gt;<a class="code" href="a00007.html#a9eeeb880b93223456c2eae445beccf94" title="fullscreen is pretty obvious">fullscreen</a> = <span class="keyword">true</span>;
<a name="l00215"></a>00215 
<a name="l00216"></a>00216         <span class="comment">/* We just entered fullscreen mode, let’s configure the window */</span>
<a name="l00217"></a>00217         <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;child itself will be at %dx%d with size %dx%d\n&quot;</span>,
<a name="l00218"></a>00218                         r.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a>, r.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a>, r.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a>, r.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a>);
<a name="l00219"></a>00219 
<a name="l00220"></a>00220         <a class="code" href="a00079.html#a7bbb53cdd77036e67c997f0c93e67cef" title="Configures the given window to have the size/position specified by given rect.">xcb_set_window_rect</a>(conn, client-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>, r);
<a name="l00221"></a>00221 
<a name="l00222"></a>00222         <span class="comment">/* Child’s coordinates are relative to the parent (=frame) */</span>
<a name="l00223"></a>00223         r.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> = 0;
<a name="l00224"></a>00224         r.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> = 0;
<a name="l00225"></a>00225         <a class="code" href="a00079.html#a7bbb53cdd77036e67c997f0c93e67cef" title="Configures the given window to have the size/position specified by given rect.">xcb_set_window_rect</a>(conn, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, r);
<a name="l00226"></a>00226 
<a name="l00227"></a>00227         <span class="comment">/* Raise the window */</span>
<a name="l00228"></a>00228         uint32_t values[] = { XCB_STACK_MODE_ABOVE };
<a name="l00229"></a>00229         xcb_configure_window(conn, client-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>, XCB_CONFIG_WINDOW_STACK_MODE, values);
<a name="l00230"></a>00230 
<a name="l00231"></a>00231         <span class="comment">/* Update _NET_WM_STATE */</span>
<a name="l00232"></a>00232         values[0] = <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635accdb5c5ee0d74dfffda6f4324a9abff5">_NET_WM_STATE_FULLSCREEN</a>];
<a name="l00233"></a>00233         xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a555588bf6061a168cd7526a49dc4b0fa">_NET_WM_STATE</a>], ATOM, 32, 1, values);
<a name="l00234"></a>00234 
<a name="l00235"></a>00235         <a class="code" href="a00079.html#a164801596691fe72d4e2e2f1b8b3cee1" title="Generates a configure_notify event and sends it to the given window Applications...">fake_configure_notify</a>(conn, r, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>);
<a name="l00236"></a>00236 
<a name="l00237"></a>00237         xcb_flush(conn);
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239 
<a name="l00240"></a>00240 <span class="comment">/*</span>
<a name="l00241"></a>00241 <span class="comment"> * Leaves fullscreen mode for the current client. This is called by toggle_fullscreen.</span>
<a name="l00242"></a>00242 <span class="comment"> *</span>
<a name="l00243"></a>00243 <span class="comment"> */</span>
<a name="l00244"></a><a class="code" href="a00032.html#ab8050b96085f7672609cc67eec3d839d">00244</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#ab8050b96085f7672609cc67eec3d839d" title="Leaves fullscreen mode for the current client.">client_leave_fullscreen</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00245"></a>00245         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;leaving fullscreen mode\n&quot;</span>);
<a name="l00246"></a>00246         client-&gt;<a class="code" href="a00007.html#a9eeeb880b93223456c2eae445beccf94" title="fullscreen is pretty obvious">fullscreen</a> = <span class="keyword">false</span>;
<a name="l00247"></a>00247         <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *ws;
<a name="l00248"></a>00248         <a class="code" href="a00047.html#a16e5fc168e7f3494d4b1df54447d871e">TAILQ_FOREACH</a>(ws, <a class="code" href="a00076.html#afb45f3a3a9c66c3e3a5e4d372ae24da7">workspaces</a>, <a class="code" href="a00076.html#afb45f3a3a9c66c3e3a5e4d372ae24da7">workspaces</a>)
<a name="l00249"></a>00249                 <span class="keywordflow">if</span> (ws-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> == client)
<a name="l00250"></a>00250                         ws-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> = NULL;
<a name="l00251"></a>00251 
<a name="l00252"></a>00252         <span class="keywordflow">if</span> (<a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(client)) {
<a name="l00253"></a>00253                 <span class="comment">/* For floating clients it’s enough if we just reconfigure that window (in fact,</span>
<a name="l00254"></a>00254 <span class="comment">                 * re-rendering the layout will not update the client.) */</span>
<a name="l00255"></a>00255                 <a class="code" href="a00069.html#a1d68fface3cf11ff882c23a5bfa586ab" title="Pushes the client’s x and y coordinates to X11.">reposition_client</a>(conn, client);
<a name="l00256"></a>00256                 <a class="code" href="a00069.html#a83463931ef26f7c3261dc1b804282299" title="Pushes the client’s width/height to X11 and resizes the child window.">resize_client</a>(conn, client);
<a name="l00257"></a>00257                 <span class="comment">/* redecorate_window flushes */</span>
<a name="l00258"></a>00258                 <a class="code" href="a00069.html#ac78b8a4b371d2c4c2800c765f46e5df3" title="Redecorates the given client correctly by checking if it’s in a stacking container...">redecorate_window</a>(conn, client);
<a name="l00259"></a>00259         } <span class="keywordflow">else</span> {
<a name="l00260"></a>00260                 <a class="code" href="a00060.html#a20c5492b1cd5c30793e9fae4b7902686" title="Sets the position of the given client in the X stack to the highest (tiling layer...">client_set_below_floating</a>(conn, client);
<a name="l00261"></a>00261 
<a name="l00262"></a>00262                 <span class="comment">/* Because the coordinates of the window haven’t changed, it would not be</span>
<a name="l00263"></a>00263 <span class="comment">                   re-configured if we don’t set the following flag */</span>
<a name="l00264"></a>00264                 client-&gt;<a class="code" href="a00007.html#a873c62703ab51afe96b38df2b30ffa66">force_reconfigure</a> = <span class="keyword">true</span>;
<a name="l00265"></a>00265                 <span class="comment">/* We left fullscreen mode, redraw the whole layout to ensure enternotify events are disabled */</span>
<a name="l00266"></a>00266                 <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="l00267"></a>00267         }
<a name="l00268"></a>00268 
<a name="l00269"></a>00269         <span class="comment">/* Update _NET_WM_STATE */</span>
<a name="l00270"></a>00270         xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a555588bf6061a168cd7526a49dc4b0fa">_NET_WM_STATE</a>], ATOM, 32, 0, NULL);
<a name="l00271"></a>00271 
<a name="l00272"></a>00272         xcb_flush(conn);
<a name="l00273"></a>00273 }
<a name="l00274"></a>00274 
<a name="l00275"></a>00275 <span class="comment">/*</span>
<a name="l00276"></a>00276 <span class="comment"> * Toggles fullscreen mode for the given client. It updates the data structures and</span>
<a name="l00277"></a>00277 <span class="comment"> * reconfigures (= resizes/moves) the client and its frame to the full size of the</span>
<a name="l00278"></a>00278 <span class="comment"> * screen. When leaving fullscreen, re-rendering the layout is forced.</span>
<a name="l00279"></a>00279 <span class="comment"> *</span>
<a name="l00280"></a>00280 <span class="comment"> */</span>
<a name="l00281"></a><a class="code" href="a00032.html#a6eaa454820104be1fe5a9c9f99ca46e9">00281</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a6eaa454820104be1fe5a9c9f99ca46e9" title="Toggles fullscreen mode for the given client.">client_toggle_fullscreen</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00282"></a>00282         <span class="comment">/* dock clients cannot enter fullscreen mode */</span>
<a name="l00283"></a>00283         assert(!client-&gt;<a class="code" href="a00007.html#a994b0c5a9eb35e42f04a0b845a3166ef" title="If a client is set as a dock, it is placed at the very bottom of the screen and its...">dock</a>);
<a name="l00284"></a>00284 
<a name="l00285"></a>00285         <span class="keywordflow">if</span> (!client-&gt;<a class="code" href="a00007.html#a9eeeb880b93223456c2eae445beccf94" title="fullscreen is pretty obvious">fullscreen</a>) {
<a name="l00286"></a>00286                 <a class="code" href="a00060.html#a9ec4f35452bd2af99fbc1e8cbf0917f4" title="Enters fullscreen mode for the given client.">client_enter_fullscreen</a>(conn, client, <span class="keyword">false</span>);
<a name="l00287"></a>00287         } <span class="keywordflow">else</span> {
<a name="l00288"></a>00288                 <a class="code" href="a00060.html#ab8050b96085f7672609cc67eec3d839d" title="Leaves fullscreen mode for the current client.">client_leave_fullscreen</a>(conn, client);
<a name="l00289"></a>00289         }
<a name="l00290"></a>00290 }
<a name="l00291"></a>00291 
<a name="l00292"></a>00292 <span class="comment">/*</span>
<a name="l00293"></a>00293 <span class="comment"> * Like client_toggle_fullscreen(), but putting it in global fullscreen-mode.</span>
<a name="l00294"></a>00294 <span class="comment"> *</span>
<a name="l00295"></a>00295 <span class="comment"> */</span>
<a name="l00296"></a><a class="code" href="a00032.html#a24b4c1c08112c968a1732a43a2794d8e">00296</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a24b4c1c08112c968a1732a43a2794d8e" title="Like client_toggle_fullscreen(), but putting it in global fullscreen-mode.">client_toggle_fullscreen_global</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00297"></a>00297         <span class="comment">/* dock clients cannot enter fullscreen mode */</span>
<a name="l00298"></a>00298         assert(!client-&gt;<a class="code" href="a00007.html#a994b0c5a9eb35e42f04a0b845a3166ef" title="If a client is set as a dock, it is placed at the very bottom of the screen and its...">dock</a>);
<a name="l00299"></a>00299 
<a name="l00300"></a>00300         <span class="keywordflow">if</span> (!client-&gt;<a class="code" href="a00007.html#a9eeeb880b93223456c2eae445beccf94" title="fullscreen is pretty obvious">fullscreen</a>) {
<a name="l00301"></a>00301                 <a class="code" href="a00060.html#a9ec4f35452bd2af99fbc1e8cbf0917f4" title="Enters fullscreen mode for the given client.">client_enter_fullscreen</a>(conn, client, <span class="keyword">true</span>);
<a name="l00302"></a>00302         } <span class="keywordflow">else</span> {
<a name="l00303"></a>00303                 <a class="code" href="a00060.html#ab8050b96085f7672609cc67eec3d839d" title="Leaves fullscreen mode for the current client.">client_leave_fullscreen</a>(conn, client);
<a name="l00304"></a>00304         }
<a name="l00305"></a>00305 }
<a name="l00306"></a>00306 
<a name="l00307"></a>00307 <span class="comment">/*</span>
<a name="l00308"></a>00308 <span class="comment"> * Sets the position of the given client in the X stack to the highest (tiling layer is always</span>
<a name="l00309"></a>00309 <span class="comment"> * on the same position, so this doesn’t matter) below the first floating client, so that</span>
<a name="l00310"></a>00310 <span class="comment"> * floating windows are always on top.</span>
<a name="l00311"></a>00311 <span class="comment"> *</span>
<a name="l00312"></a>00312 <span class="comment"> */</span>
<a name="l00313"></a><a class="code" href="a00032.html#a20c5492b1cd5c30793e9fae4b7902686">00313</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a20c5492b1cd5c30793e9fae4b7902686" title="Sets the position of the given client in the X stack to the highest (tiling layer...">client_set_below_floating</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00314"></a>00314         <span class="comment">/* Ensure that it is below all floating clients */</span>
<a name="l00315"></a>00315         <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *ws = client-&gt;<a class="code" href="a00007.html#ab9573ba898dbd1932f5200be5eb2a990" title="Because dock clients don’t have a container, we have this workspace-backpointer...">workspace</a>;
<a name="l00316"></a>00316         <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *first_floating = <a class="code" href="a00047.html#a7d6894360bd1c41e0e6f6d84998c1362">TAILQ_FIRST</a>(&amp;(ws-&gt;floating_clients));
<a name="l00317"></a>00317         <span class="keywordflow">if</span> (first_floating == <a class="code" href="a00047.html#a4322b8461a6ab7632435ff4f57bb3a2e">TAILQ_END</a>(&amp;(ws-&gt;floating_clients)))
<a name="l00318"></a>00318                 <span class="keywordflow">return</span>;
<a name="l00319"></a>00319 
<a name="l00320"></a>00320         <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;Setting below floating\n&quot;</span>);
<a name="l00321"></a>00321         uint32_t values[] = { first_floating-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>, XCB_STACK_MODE_BELOW };
<a name="l00322"></a>00322         xcb_configure_window(conn, client-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
<a name="l00323"></a>00323 
<a name="l00324"></a>00324         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#ab9573ba898dbd1932f5200be5eb2a990" title="Because dock clients don’t have a container, we have this workspace-backpointer...">workspace</a>-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a> == NULL)
<a name="l00325"></a>00325                 <span class="keywordflow">return</span>;
<a name="l00326"></a>00326 
<a name="l00327"></a>00327         <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">&quot;(and below fullscreen)\n&quot;</span>);
<a name="l00328"></a>00328         <span class="comment">/* Ensure that the window is still below the fullscreen window */</span>
<a name="l00329"></a>00329         values[0] = client-&gt;<a class="code" href="a00007.html#ab9573ba898dbd1932f5200be5eb2a990" title="Because dock clients don’t have a container, we have this workspace-backpointer...">workspace</a>-&gt;<a class="code" href="a00025.html#a918ace3a3d2f03c58ec8fa05ac97275e" title="the client who is started in fullscreen mode on this workspace, NULL if there is...">fullscreen_client</a>-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>;
<a name="l00330"></a>00330         xcb_configure_window(conn, client-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 
<a name="l00333"></a>00333 <span class="comment">/*</span>
<a name="l00334"></a>00334 <span class="comment"> * Returns true if the client is floating. Makes the code more beatiful, as floating</span>
<a name="l00335"></a>00335 <span class="comment"> * is not simply a boolean, but also saves whether the user selected the current state</span>
<a name="l00336"></a>00336 <span class="comment"> * or whether it was automatically set.</span>
<a name="l00337"></a>00337 <span class="comment"> *</span>
<a name="l00338"></a>00338 <span class="comment"> */</span>
<a name="l00339"></a><a class="code" href="a00032.html#a56065826f75013837bc8e125c8dc66c7">00339</a> <span class="keywordtype">bool</span> <a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(<a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00340"></a>00340         <span class="keywordflow">return</span> (client-&gt;<a class="code" href="a00007.html#ad5e886955e668cc51fbb17acb2871cea" title="floating? (= not in tiling layout) This cannot be simply a bool because we want to...">floating</a> &gt;= FLOATING_AUTO_ON);
<a name="l00341"></a>00341 }
<a name="l00342"></a>00342 
<a name="l00343"></a>00343 <span class="comment">/*</span>
<a name="l00344"></a>00344 <span class="comment"> * Change the border type for the given client to normal (n), 1px border (p) or</span>
<a name="l00345"></a>00345 <span class="comment"> * completely borderless (b) without actually re-rendering the layout. Useful</span>
<a name="l00346"></a>00346 <span class="comment"> * for calling it when initializing a new client.</span>
<a name="l00347"></a>00347 <span class="comment"> *</span>
<a name="l00348"></a>00348 <span class="comment"> */</span>
<a name="l00349"></a><a class="code" href="a00032.html#a1858104634b1bcafb34644f0a525c443">00349</a> <span class="keywordtype">bool</span> <a class="code" href="a00060.html#a1858104634b1bcafb34644f0a525c443" title="Change the border type for the given client to normal (n), 1px border (p) or completely...">client_init_border</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, <span class="keywordtype">char</span> border_type) {
<a name="l00350"></a>00350         <span class="keywordflow">switch</span> (border_type) {
<a name="l00351"></a>00351                 <span class="keywordflow">case</span> <span class="charliteral">&#39;n&#39;</span>:
<a name="l00352"></a>00352                         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Changing to normal border\n&quot;</span>);
<a name="l00353"></a>00353                         client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> = TITLEBAR_TOP;
<a name="l00354"></a>00354                         client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a> = <span class="keyword">false</span>;
<a name="l00355"></a>00355                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00356"></a>00356                 <span class="keywordflow">case</span> <span class="charliteral">&#39;p&#39;</span>:
<a name="l00357"></a>00357                         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Changing to 1px border\n&quot;</span>);
<a name="l00358"></a>00358                         client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> = TITLEBAR_OFF;
<a name="l00359"></a>00359                         client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a> = <span class="keyword">false</span>;
<a name="l00360"></a>00360                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00361"></a>00361                 <span class="keywordflow">case</span> <span class="charliteral">&#39;b&#39;</span>:
<a name="l00362"></a>00362                         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Changing to borderless\n&quot;</span>);
<a name="l00363"></a>00363                         client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> = TITLEBAR_OFF;
<a name="l00364"></a>00364                         client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a> = <span class="keyword">true</span>;
<a name="l00365"></a>00365                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00366"></a>00366                 <span class="keywordflow">default</span>:
<a name="l00367"></a>00367                         <a class="code" href="a00044.html#a388edf12256bf73c3a8ee9734c3bd841" title="#__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is, delete...">LOG</a>(<span class="stringliteral">&quot;Unknown border mode\n&quot;</span>);
<a name="l00368"></a>00368                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00369"></a>00369         }
<a name="l00370"></a>00370 }
<a name="l00371"></a>00371 
<a name="l00372"></a>00372 <span class="comment">/*</span>
<a name="l00373"></a>00373 <span class="comment"> * Change the border type for the given client to normal (n), 1px border (p) or</span>
<a name="l00374"></a>00374 <span class="comment"> * completely borderless (b).</span>
<a name="l00375"></a>00375 <span class="comment"> *</span>
<a name="l00376"></a>00376 <span class="comment"> */</span>
<a name="l00377"></a><a class="code" href="a00032.html#a10218faab5f6cc4fe90b439e278dec49">00377</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a10218faab5f6cc4fe90b439e278dec49" title="Change the border type for the given client to normal (n), 1px border (p) or completely...">client_change_border</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, <span class="keywordtype">char</span> border_type) {
<a name="l00378"></a>00378         <span class="keywordflow">if</span> (!<a class="code" href="a00060.html#a1858104634b1bcafb34644f0a525c443" title="Change the border type for the given client to normal (n), 1px border (p) or completely...">client_init_border</a>(conn, client, border_type))
<a name="l00379"></a>00379                 <span class="keywordflow">return</span>;
<a name="l00380"></a>00380 
<a name="l00381"></a>00381         <span class="comment">/* Ensure that the child’s position inside our window gets updated */</span>
<a name="l00382"></a>00382         client-&gt;<a class="code" href="a00007.html#a873c62703ab51afe96b38df2b30ffa66">force_reconfigure</a> = <span class="keyword">true</span>;
<a name="l00383"></a>00383 
<a name="l00384"></a>00384         <span class="comment">/* For clients inside a container, we can simply render the container */</span>
<a name="l00385"></a>00385         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a> != NULL)
<a name="l00386"></a>00386                 <a class="code" href="a00069.html#a2a1fee0aebdaf2497fb52ea57a1033a4" title="Renders the given container.">render_container</a>(conn, client-&gt;<a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a>);
<a name="l00387"></a>00387         <span class="keywordflow">else</span> {
<a name="l00388"></a>00388                 <span class="comment">/* If the client is floating, directly push its size */</span>
<a name="l00389"></a>00389                 <span class="keywordflow">if</span> (<a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(client))
<a name="l00390"></a>00390                         <a class="code" href="a00069.html#a83463931ef26f7c3261dc1b804282299" title="Pushes the client’s width/height to X11 and resizes the child window.">resize_client</a>(conn, client);
<a name="l00391"></a>00391                 <span class="comment">/* Otherwise, it may be a dock client, thus render the whole layout */</span>
<a name="l00392"></a>00392                 <span class="keywordflow">else</span> <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="l00393"></a>00393         }
<a name="l00394"></a>00394 
<a name="l00395"></a>00395         <a class="code" href="a00069.html#ac78b8a4b371d2c4c2800c765f46e5df3" title="Redecorates the given client correctly by checking if it’s in a stacking container...">redecorate_window</a>(conn, client);
<a name="l00396"></a>00396 }
<a name="l00397"></a>00397 
<a name="l00398"></a>00398 <span class="comment">/*</span>
<a name="l00399"></a>00399 <span class="comment"> * Unmap the client, correctly setting any state which is needed.</span>
<a name="l00400"></a>00400 <span class="comment"> *</span>
<a name="l00401"></a>00401 <span class="comment"> */</span>
<a name="l00402"></a><a class="code" href="a00032.html#afe96e905cd2fcc23acf096304000f793">00402</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#afe96e905cd2fcc23acf096304000f793" title="Unmap the client, correctly setting any state which is needed.">client_unmap</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00403"></a>00403         <span class="comment">/* Set WM_STATE_WITHDRAWN, it seems like Java apps need it */</span>
<a name="l00404"></a>00404         <span class="keywordtype">long</span> data[] = { XCB_WM_STATE_WITHDRAWN, XCB_NONE };
<a name="l00405"></a>00405         xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a5ce0f911fd3494577cce5417d7b7eea4">WM_STATE</a>], <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[WM_STATE], 32, 2, data);
<a name="l00406"></a>00406 
<a name="l00407"></a>00407         xcb_unmap_window(conn, client-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>);
<a name="l00408"></a>00408 }
<a name="l00409"></a>00409 
<a name="l00410"></a>00410 <span class="comment">/*</span>
<a name="l00411"></a>00411 <span class="comment"> * Map the client, correctly restoring any state needed.</span>
<a name="l00412"></a>00412 <span class="comment"> *</span>
<a name="l00413"></a>00413 <span class="comment"> */</span>
<a name="l00414"></a><a class="code" href="a00032.html#a7f3612a4061bd46213d5e28f0c4d00ee">00414</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#a7f3612a4061bd46213d5e28f0c4d00ee" title="Map the client, correctly restoring any state needed.">client_map</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00415"></a>00415         <span class="comment">/* Set WM_STATE_NORMAL because GTK applications don’t want to drag &amp; drop if we don’t.</span>
<a name="l00416"></a>00416 <span class="comment">         * Also, xprop(1) needs that to work. */</span>
<a name="l00417"></a>00417         <span class="keywordtype">long</span> data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
<a name="l00418"></a>00418         xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client-&gt;<a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a5ce0f911fd3494577cce5417d7b7eea4">WM_STATE</a>], <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[WM_STATE], 32, 2, data);
<a name="l00419"></a>00419 
<a name="l00420"></a>00420         xcb_map_window(conn, client-&gt;<a class="code" href="a00007.html#ae6bb442465a95e5794ed34936fa67bac" title="Our window: The frame around the client.">frame</a>);
<a name="l00421"></a>00421 }
<a name="l00422"></a>00422 
<a name="l00423"></a>00423 <span class="comment">/*</span>
<a name="l00424"></a>00424 <span class="comment"> * Set the given mark for this client. Used for jumping to the client</span>
<a name="l00425"></a>00425 <span class="comment"> * afterwards (like m&lt;mark&gt; and &#39;&lt;mark&gt; in vim).</span>
<a name="l00426"></a>00426 <span class="comment"> *</span>
<a name="l00427"></a>00427 <span class="comment"> */</span>
<a name="l00428"></a><a class="code" href="a00032.html#af960751e35e4e181bc7c9e8b362babc3">00428</a> <span class="keywordtype">void</span> <a class="code" href="a00060.html#af960751e35e4e181bc7c9e8b362babc3" title="Set the given mark for this client.">client_mark</a>(xcb_connection_t *conn, <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client, <span class="keyword">const</span> <span class="keywordtype">char</span> *mark) {
<a name="l00429"></a>00429         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a> != NULL)
<a name="l00430"></a>00430                 free(client-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a>);
<a name="l00431"></a>00431         client-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a> = <a class="code" href="a00077.html#a11822d1f4b182be3fa03d2a5af536e1a" title="Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there...">sstrdup</a>(mark);
<a name="l00432"></a>00432 
<a name="l00433"></a>00433         <span class="comment">/* Make sure no other client has this mark set */</span>
<a name="l00434"></a>00434         <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *current;
<a name="l00435"></a>00435         <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *ws;
<a name="l00436"></a>00436         <a class="code" href="a00047.html#a16e5fc168e7f3494d4b1df54447d871e">TAILQ_FOREACH</a>(ws, <a class="code" href="a00076.html#afb45f3a3a9c66c3e3a5e4d372ae24da7">workspaces</a>, <a class="code" href="a00076.html#afb45f3a3a9c66c3e3a5e4d372ae24da7">workspaces</a>)
<a name="l00437"></a>00437                 <a class="code" href="a00047.html#a05db87878125c27e3060dd641aa3b0f4">SLIST_FOREACH</a>(current, &amp;(ws-&gt;focus_stack), focus_clients) {
<a name="l00438"></a>00438                         <span class="keywordflow">if</span> (current == client ||
<a name="l00439"></a>00439                             current-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a> == NULL ||
<a name="l00440"></a>00440                             strcmp(current-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a>, mark) != 0)
<a name="l00441"></a>00441                                 <span class="keywordflow">continue</span>;
<a name="l00442"></a>00442 
<a name="l00443"></a>00443                         free(current-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a>);
<a name="l00444"></a>00444                         current-&gt;<a class="code" href="a00007.html#a08f4887a64c4ea1812e5a27efe641d18" title="Holds the client’s mark, for vim-like jumping.">mark</a> = NULL;
<a name="l00445"></a>00445                         <span class="comment">/* We can break here since there can only be one other</span>
<a name="l00446"></a>00446 <span class="comment">                         * client with this mark. */</span>
<a name="l00447"></a>00447                         <span class="keywordflow">break</span>;
<a name="l00448"></a>00448                 }
<a name="l00449"></a>00449 }
<a name="l00450"></a>00450 
<a name="l00451"></a>00451 <span class="comment">/*</span>
<a name="l00452"></a>00452 <span class="comment"> * Returns the minimum height of a specific window. The height is calculated</span>
<a name="l00453"></a>00453 <span class="comment"> * by using 2 pixels (for the client window itself), possibly padding this to</span>
<a name="l00454"></a>00454 <span class="comment"> * comply with the client’s base_height and then adding the decoration height.</span>
<a name="l00455"></a>00455 <span class="comment"> *</span>
<a name="l00456"></a>00456 <span class="comment"> */</span>
<a name="l00457"></a><a class="code" href="a00032.html#a0c35ae37d3b41c85a9a0797b7578a018">00457</a> uint32_t <a class="code" href="a00060.html#a0c35ae37d3b41c85a9a0797b7578a018" title="Returns the minimum height of a specific window.">client_min_height</a>(<a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00458"></a>00458         uint32_t height = <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(2, client-&gt;<a class="code" href="a00007.html#a92916a2b042c07b01eb6e3a4269413cc">base_height</a>);
<a name="l00459"></a>00459         <a class="code" href="a00015.html" title="Data structure for cached font information:font id in X11 (load it once)font height...">i3Font</a> *font = <a class="code" href="a00054.html#a50c1fc0de5343536d542c8349ab7ab0d" title="Loads a font for usage, getting its height.">load_font</a>(<a class="code" href="a00071.html#ada13c42121d64521629e06e7a5e1db16">global_conn</a>, <a class="code" href="a00062.html#a4a8dd3a2de125b72d4fe6251a0a271b5">config</a>.<a class="code" href="a00010.html#aff568f0d5ca7a51971f4c3006a842019">font</a>);
<a name="l00460"></a>00460 
<a name="l00461"></a>00461         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> == TITLEBAR_OFF &amp;&amp; client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a>)
<a name="l00462"></a>00462                 <span class="keywordflow">return</span> height;
<a name="l00463"></a>00463 
<a name="l00464"></a>00464         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> == TITLEBAR_OFF &amp;&amp; !client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a>)
<a name="l00465"></a>00465                 <span class="keywordflow">return</span> height + 2;
<a name="l00466"></a>00466 
<a name="l00467"></a>00467         <span class="keywordflow">return</span> height + font-&gt;<a class="code" href="a00015.html#a89ceb86bb4ad2694315d846e69893399" title="The height of the font, built from font_ascent + font_descent.">height</a> + 2 + 2;
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 
<a name="l00470"></a>00470 <span class="comment">/*</span>
<a name="l00471"></a>00471 <span class="comment"> * See client_min_height.</span>
<a name="l00472"></a>00472 <span class="comment"> *</span>
<a name="l00473"></a>00473 <span class="comment"> */</span>
<a name="l00474"></a><a class="code" href="a00032.html#a5e28f5d4823929a52611f745e41ec3e3">00474</a> uint32_t <a class="code" href="a00060.html#a5e28f5d4823929a52611f745e41ec3e3" title="See client_min_height.">client_min_width</a>(<a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client) {
<a name="l00475"></a>00475         uint32_t width = <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(2, client-&gt;<a class="code" href="a00007.html#a51ffa9095f0fba59737c1252cf0031cb">base_width</a>);
<a name="l00476"></a>00476 
<a name="l00477"></a>00477         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> == TITLEBAR_OFF &amp;&amp; client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a>)
<a name="l00478"></a>00478                 <span class="keywordflow">return</span> width;
<a name="l00479"></a>00479 
<a name="l00480"></a>00480         <span class="keywordflow">if</span> (client-&gt;<a class="code" href="a00007.html#a990cfbc44d87127fd05d8f6a5293d2fd" title="Ensure TITLEBAR_TOP maps to 0 because we use calloc for initialization later.">titlebar_position</a> == TITLEBAR_OFF &amp;&amp; !client-&gt;<a class="code" href="a00007.html#a5a1078f3b194418aa54c1837ff82351c" title="Contains a bool specifying whether this window should not be drawn with the usual...">borderless</a>)
<a name="l00481"></a>00481                 <span class="keywordflow">return</span> width + 2;
<a name="l00482"></a>00482 
<a name="l00483"></a>00483         <span class="keywordflow">return</span> width + 2 + 2;
<a name="l00484"></a>00484 }
</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>