<!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/container.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 Page</span></a></li> <li><a href="annotated.html"><span>Data 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 List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <h1>src/container.c</h1><a href="a00063.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 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"> */</span> <a name="l00011"></a>00011 <a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="a00036.html">data.h</a>"</span> <a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="a00044.html">log.h</a>"</span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="comment">/*</span> <a name="l00016"></a>00016 <span class="comment"> * Returns the mode of the given container (or MODE_DEFAULT if a NULL pointer</span> <a name="l00017"></a>00017 <span class="comment"> * was passed in order to save a few explicit checks in other places). If</span> <a name="l00018"></a>00018 <span class="comment"> * for_frame was set to true, the special case of having exactly one client</span> <a name="l00019"></a>00019 <span class="comment"> * in a container is handled so that MODE_DEFAULT is returned. For some parts</span> <a name="l00020"></a>00020 <span class="comment"> * of the rendering, this is interesting, other parts need the real mode.</span> <a name="l00021"></a>00021 <span class="comment"> *</span> <a name="l00022"></a>00022 <span class="comment"> */</span> <a name="l00023"></a><a class="code" href="a00035.html#a613f019bb3d6960b1ff386eca5316158">00023</a> <span class="keywordtype">int</span> <a class="code" href="a00063.html#a613f019bb3d6960b1ff386eca5316158" title="Returns the mode of the given container (or MODE_DEFAULT if a NULL pointer was passed...">container_mode</a>(<a class="code" href="a00013.html" title="A container is either in default, stacking or tabbed mode.">Container</a> *con, <span class="keywordtype">bool</span> for_frame) { <a name="l00024"></a>00024 <span class="keywordtype">int</span> num_clients = 0; <a name="l00025"></a>00025 <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client; <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keywordflow">if</span> (con == NULL || con-><a class="code" href="a00013.html#ac094306ab77e360742aba04d7cbd0fe6">mode</a> == MODE_DEFAULT) <a name="l00028"></a>00028 <span class="keywordflow">return</span> MODE_DEFAULT; <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="keywordflow">if</span> (!for_frame) <a name="l00031"></a>00031 <span class="keywordflow">return</span> con-><a class="code" href="a00013.html#ac094306ab77e360742aba04d7cbd0fe6">mode</a>; <a name="l00032"></a>00032 <a name="l00033"></a>00033 <a class="code" href="a00047.html#ae97f4eb5724477c63699fafea4614b46">CIRCLEQ_FOREACH</a>(client, &(con->clients), clients) <a name="l00034"></a>00034 num_clients++; <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="comment">/* If the container contains only one client, mode is irrelevant */</span> <a name="l00037"></a>00037 <span class="keywordflow">if</span> (num_clients == 1) { <a name="l00038"></a>00038 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"mode to default\n"</span>); <a name="l00039"></a>00039 <span class="keywordflow">return</span> MODE_DEFAULT; <a name="l00040"></a>00040 } <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="keywordflow">return</span> con-><a class="code" href="a00013.html#ac094306ab77e360742aba04d7cbd0fe6">mode</a>; <a name="l00043"></a>00043 } </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <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>