<!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/manage.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/manage.c</h1><a href="a00072.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"> * src/manage.c: Contains all functions for initially managing new windows</span> <a name="l00011"></a>00011 <span class="comment"> * (or existing ones on restart).</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 <stdlib.h></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <string.h></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <assert.h></span> <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="preprocessor">#include <xcb/xcb.h></span> <a name="l00019"></a>00019 <span class="preprocessor">#include <xcb/xcb_icccm.h></span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="a00054.html">xcb.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="a00036.html">data.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="a00052.html">util.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="a00041.html">i3.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="a00051.html">table.h</a>"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="a00034.html">config.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="a00040.html">handlers.h</a>"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="a00043.html">layout.h</a>"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="a00046.html">manage.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="a00039.html">floating.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="a00032.html">client.h</a>"</span> <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="a00053.html">workspace.h</a>"</span> <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="a00044.html">log.h</a>"</span> <a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="a00038.html">ewmh.h</a>"</span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="comment">/*</span> <a name="l00037"></a>00037 <span class="comment"> * Go through all existing windows (if the window manager is restarted) and manage them</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="a00046.html#a525375308e06d233e560f4e739e02ca6">00040</a> <span class="keywordtype">void</span> <a class="code" href="a00072.html#a525375308e06d233e560f4e739e02ca6" title="Go through all existing windows (if the window manager is restarted) and manage them...">manage_existing_windows</a>(xcb_connection_t *conn, xcb_property_handlers_t *prophs, xcb_window_t <a class="code" href="a00071.html#a768f07da9e11ab88732a5c550ff49257">root</a>) { <a name="l00041"></a>00041 xcb_query_tree_reply_t *reply; <a name="l00042"></a>00042 <span class="keywordtype">int</span> i, len; <a name="l00043"></a>00043 xcb_window_t *children; <a name="l00044"></a>00044 xcb_get_window_attributes_cookie_t *cookies; <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="comment">/* Get the tree of windows whose parent is the root window (= all) */</span> <a name="l00047"></a>00047 <span class="keywordflow">if</span> ((reply = xcb_query_tree_reply(conn, xcb_query_tree(conn, root), 0)) == NULL) <a name="l00048"></a>00048 <span class="keywordflow">return</span>; <a name="l00049"></a>00049 <a name="l00050"></a>00050 len = xcb_query_tree_children_length(reply); <a name="l00051"></a>00051 cookies = <a class="code" href="a00077.html#a46c23cb2833f4b674f5cfc977f16b990" title="Safe-wrapper around malloc which exits if malloc returns NULL (meaning that there...">smalloc</a>(len * <span class="keyword">sizeof</span>(*cookies)); <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="comment">/* Request the window attributes for every window */</span> <a name="l00054"></a>00054 children = xcb_query_tree_children(reply); <a name="l00055"></a>00055 <span class="keywordflow">for</span> (i = 0; i < len; ++i) <a name="l00056"></a>00056 cookies[i] = xcb_get_window_attributes(conn, children[i]); <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="comment">/* Call manage_window with the attributes for every window */</span> <a name="l00059"></a>00059 <span class="keywordflow">for</span> (i = 0; i < len; ++i) <a name="l00060"></a>00060 <a class="code" href="a00072.html#a4a34e4e6e27dfe96206b43297c001f9c" title="Do some sanity checks and then reparent the window.">manage_window</a>(prophs, conn, children[i], cookies[i], <span class="keyword">true</span>); <a name="l00061"></a>00061 <a name="l00062"></a>00062 free(reply); <a name="l00063"></a>00063 free(cookies); <a name="l00064"></a>00064 } <a name="l00065"></a>00065 <a name="l00066"></a>00066 <span class="comment">/*</span> <a name="l00067"></a>00067 <span class="comment"> * Restores the geometry of each window by reparenting it to the root window</span> <a name="l00068"></a>00068 <span class="comment"> * at the position of its frame.</span> <a name="l00069"></a>00069 <span class="comment"> *</span> <a name="l00070"></a>00070 <span class="comment"> * This is to be called *only* before exiting/restarting i3 because of evil</span> <a name="l00071"></a>00071 <span class="comment"> * side-effects which are to be expected when continuing to run i3.</span> <a name="l00072"></a>00072 <span class="comment"> *</span> <a name="l00073"></a>00073 <span class="comment"> */</span> <a name="l00074"></a><a class="code" href="a00046.html#a7a5eac8069bf76ea873503dd80100544">00074</a> <span class="keywordtype">void</span> <a class="code" href="a00072.html#a7a5eac8069bf76ea873503dd80100544" title="Restores the geometry of each window by reparenting it to the root window at the...">restore_geometry</a>(xcb_connection_t *conn) { <a name="l00075"></a>00075 <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *ws; <a name="l00076"></a>00076 <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *client; <a name="l00077"></a>00077 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Restoring geometry\n"</span>); <a name="l00078"></a>00078 <a name="l00079"></a>00079 <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="l00080"></a>00080 <a class="code" href="a00047.html#a05db87878125c27e3060dd641aa3b0f4">SLIST_FOREACH</a>(client, &(ws->focus_stack), focus_clients) <a name="l00081"></a>00081 xcb_reparent_window(conn, client-><a class="code" href="a00007.html#afba312b946fa74727ce619a33f8f28aa" title="The client’s window.">child</a>, <a class="code" href="a00071.html#a768f07da9e11ab88732a5c550ff49257">root</a>, <a name="l00082"></a>00082 client-><a class="code" href="a00007.html#aea76187592ae1a87eb8bb1af77af62d4" title="x, y, width, height of the frame">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a>, client-><a class="code" href="a00007.html#aea76187592ae1a87eb8bb1af77af62d4" title="x, y, width, height of the frame">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a>); <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="comment">/* Make sure our changes reach the X server, we restart/exit now */</span> <a name="l00085"></a>00085 xcb_flush(conn); <a name="l00086"></a>00086 } <a name="l00087"></a>00087 <a name="l00088"></a>00088 <span class="comment">/*</span> <a name="l00089"></a>00089 <span class="comment"> * Do some sanity checks and then reparent the window.</span> <a name="l00090"></a>00090 <span class="comment"> *</span> <a name="l00091"></a>00091 <span class="comment"> */</span> <a name="l00092"></a><a class="code" href="a00046.html#a4a34e4e6e27dfe96206b43297c001f9c">00092</a> <span class="keywordtype">void</span> <a class="code" href="a00072.html#a4a34e4e6e27dfe96206b43297c001f9c" title="Do some sanity checks and then reparent the window.">manage_window</a>(xcb_property_handlers_t *prophs, xcb_connection_t *conn, <a name="l00093"></a>00093 xcb_window_t window, xcb_get_window_attributes_cookie_t cookie, <a name="l00094"></a>00094 <span class="keywordtype">bool</span> needs_to_be_mapped) { <a name="l00095"></a>00095 xcb_drawable_t d = { window }; <a name="l00096"></a>00096 xcb_get_geometry_cookie_t geomc; <a name="l00097"></a>00097 xcb_get_geometry_reply_t *geom; <a name="l00098"></a>00098 xcb_get_window_attributes_reply_t *attr = 0; <a name="l00099"></a>00099 <a name="l00100"></a>00100 geomc = xcb_get_geometry(conn, d); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="comment">/* Check if the window is mapped (it could be not mapped when intializing and</span> <a name="l00103"></a>00103 <span class="comment"> calling manage_window() for every window) */</span> <a name="l00104"></a>00104 <span class="keywordflow">if</span> ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) { <a name="l00105"></a>00105 <a class="code" href="a00044.html#a6828c68e0feb4b7fdfe0fc3ba9f3038b">ELOG</a>(<span class="stringliteral">"Could not get attributes\n"</span>); <a name="l00106"></a>00106 <span class="keywordflow">return</span>; <a name="l00107"></a>00107 } <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="keywordflow">if</span> (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) <a name="l00110"></a>00110 <span class="keywordflow">goto</span> out; <a name="l00111"></a>00111 <a name="l00112"></a>00112 <span class="comment">/* Don’t manage clients with the override_redirect flag */</span> <a name="l00113"></a>00113 <span class="keywordflow">if</span> (attr->override_redirect) <a name="l00114"></a>00114 <span class="keywordflow">goto</span> out; <a name="l00115"></a>00115 <a name="l00116"></a>00116 <span class="comment">/* Check if the window is already managed */</span> <a name="l00117"></a>00117 <span class="keywordflow">if</span> (<a class="code" href="a00077.html#ae1529a1d81e2457f9a2402eda35735d7" title="Returns the value of the element of the given keyvalue-table with the given key.">table_get</a>(&<a class="code" href="a00077.html#aadfb9c6f265623f83355191df37c86c8">by_child</a>, window)) <a name="l00118"></a>00118 <span class="keywordflow">goto</span> out; <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="comment">/* Get the initial geometry (position, size, …) */</span> <a name="l00121"></a>00121 <span class="keywordflow">if</span> ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL) <a name="l00122"></a>00122 <span class="keywordflow">goto</span> out; <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="comment">/* Reparent the window and add it to our list of managed windows */</span> <a name="l00125"></a>00125 <a class="code" href="a00072.html#a3231348efe9bf4a5f43fe491b1fbfbc8" title="reparent_window() gets called when a new window was opened and becomes a child of...">reparent_window</a>(conn, window, attr->visual, geom->root, geom->depth, <a name="l00126"></a>00126 geom->x, geom->y, geom->width, geom->height, <a name="l00127"></a>00127 geom->border_width); <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="comment">/* Generate callback events for every property we watch */</span> <a name="l00130"></a>00130 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_CLASS); <a name="l00131"></a>00131 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_NAME); <a name="l00132"></a>00132 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_NORMAL_HINTS); <a name="l00133"></a>00133 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_HINTS); <a name="l00134"></a>00134 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_TRANSIENT_FOR); <a name="l00135"></a>00135 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a13d4dbc6987347bcc7c535570b4e6c2b">WM_CLIENT_LEADER</a>]); <a name="l00136"></a>00136 xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a1dedae1b3288478b95e08984bac0e951">_NET_WM_NAME</a>]); <a name="l00137"></a>00137 <a name="l00138"></a>00138 free(geom); <a name="l00139"></a>00139 out: <a name="l00140"></a>00140 free(attr); <a name="l00141"></a>00141 <span class="keywordflow">return</span>; <a name="l00142"></a>00142 } <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="comment">/*</span> <a name="l00145"></a>00145 <span class="comment"> * reparent_window() gets called when a new window was opened and becomes a child of the root</span> <a name="l00146"></a>00146 <span class="comment"> * window, or it gets called by us when we manage the already existing windows at startup.</span> <a name="l00147"></a>00147 <span class="comment"> *</span> <a name="l00148"></a>00148 <span class="comment"> * Essentially, this is the point where we take over control.</span> <a name="l00149"></a>00149 <span class="comment"> *</span> <a name="l00150"></a>00150 <span class="comment"> */</span> <a name="l00151"></a><a class="code" href="a00046.html#a3231348efe9bf4a5f43fe491b1fbfbc8">00151</a> <span class="keywordtype">void</span> <a class="code" href="a00072.html#a3231348efe9bf4a5f43fe491b1fbfbc8" title="reparent_window() gets called when a new window was opened and becomes a child of...">reparent_window</a>(xcb_connection_t *conn, xcb_window_t child, <a name="l00152"></a>00152 xcb_visualid_t visual, xcb_window_t <a class="code" href="a00071.html#a768f07da9e11ab88732a5c550ff49257">root</a>, uint8_t depth, <a name="l00153"></a>00153 int16_t x, int16_t <a class="code" href="a00068.html#a16e56e533e1eb98fda15e06fdec03da6">y</a>, uint16_t width, uint16_t height, <a name="l00154"></a>00154 uint32_t border_width) { <a name="l00155"></a>00155 <a name="l00156"></a>00156 xcb_get_property_cookie_t wm_type_cookie, strut_cookie, state_cookie, <a name="l00157"></a>00157 utf8_title_cookie, title_cookie, <a name="l00158"></a>00158 class_cookie, leader_cookie; <a name="l00159"></a>00159 uint32_t mask = 0; <a name="l00160"></a>00160 uint32_t values[3]; <a name="l00161"></a>00161 uint16_t original_height = height; <a name="l00162"></a>00162 <span class="keywordtype">bool</span> map_frame = <span class="keyword">true</span>; <a name="l00163"></a>00163 <a name="l00164"></a>00164 <span class="comment">/* We are interested in property changes */</span> <a name="l00165"></a>00165 mask = XCB_CW_EVENT_MASK; <a name="l00166"></a>00166 values[0] = <a class="code" href="a00054.html#a943b53f85455fd0587d1b010cd9e4114" title="The XCB_CW_EVENT_MASK for the child (= real window).">CHILD_EVENT_MASK</a>; <a name="l00167"></a>00167 xcb_change_window_attributes(conn, child, mask, values); <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="comment">/* Place requests for properties ASAP */</span> <a name="l00170"></a>00170 wm_type_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635ad2b0847e09761bd2ad2b6482c51b07ca">_NET_WM_WINDOW_TYPE</a>], <a class="code" href="a00058.html#ab5eb23180f7cc12b7d6c04a8ec067fdd">UINT32_MAX</a>); <a name="l00171"></a>00171 strut_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a5171f3918252a26530d02d6a1716ca45">_NET_WM_STRUT_PARTIAL</a>], <a class="code" href="a00058.html#ab5eb23180f7cc12b7d6c04a8ec067fdd">UINT32_MAX</a>); <a name="l00172"></a>00172 state_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a555588bf6061a168cd7526a49dc4b0fa">_NET_WM_STATE</a>], <a class="code" href="a00058.html#ab5eb23180f7cc12b7d6c04a8ec067fdd">UINT32_MAX</a>); <a name="l00173"></a>00173 utf8_title_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a1dedae1b3288478b95e08984bac0e951">_NET_WM_NAME</a>], 128); <a name="l00174"></a>00174 leader_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a13d4dbc6987347bcc7c535570b4e6c2b">WM_CLIENT_LEADER</a>], <a class="code" href="a00058.html#ab5eb23180f7cc12b7d6c04a8ec067fdd">UINT32_MAX</a>); <a name="l00175"></a>00175 title_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, WM_NAME, 128); <a name="l00176"></a>00176 class_cookie = xcb_get_any_property_unchecked(conn, <span class="keyword">false</span>, child, WM_CLASS, 128); <a name="l00177"></a>00177 <a name="l00178"></a>00178 <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *<span class="keyword">new</span> = <a class="code" href="a00077.html#ae1529a1d81e2457f9a2402eda35735d7" title="Returns the value of the element of the given keyvalue-table with the given key.">table_get</a>(&<a class="code" href="a00077.html#aadfb9c6f265623f83355191df37c86c8">by_child</a>, child); <a name="l00179"></a>00179 <a name="l00180"></a>00180 <span class="comment">/* Events for already managed windows should already be filtered in manage_window() */</span> <a name="l00181"></a>00181 assert(<span class="keyword">new</span> == NULL); <a name="l00182"></a>00182 <a name="l00183"></a>00183 <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">"Managing window 0x%08x\n"</span>, child); <a name="l00184"></a>00184 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"x = %d, y = %d, width = %d, height = %d\n"</span>, x, y, width, height); <a name="l00185"></a>00185 <span class="keyword">new</span> = <a class="code" href="a00077.html#ad475e1b898d9da9b2a8b92e3da51b3dd" title="Safe-wrapper around calloc which exits if malloc returns NULL (meaning that there...">scalloc</a>(<span class="keyword">sizeof</span>(<a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a>)); <a name="l00186"></a>00186 <span class="keyword">new</span>->force_reconfigure = <span class="keyword">true</span>; <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="comment">/* Update the data structures */</span> <a name="l00189"></a>00189 <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *old_focused = <a class="code" href="a00051.html#ac120dc3752e8ac2853ddd65d7737a2fd">CUR_CELL</a>->currently_focused; <a name="l00190"></a>00190 <a name="l00191"></a>00191 <span class="keyword">new</span>->container = <a class="code" href="a00051.html#ac120dc3752e8ac2853ddd65d7737a2fd">CUR_CELL</a>; <a name="l00192"></a>00192 <span class="keyword">new</span>->workspace = <span class="keyword">new</span>->container->workspace; <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="comment">/* Minimum useful size for managed windows is 75x50 (primarily affects floating) */</span> <a name="l00195"></a>00195 width = <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(width, 75); <a name="l00196"></a>00196 height = <a class="code" href="a00077.html#af082905f7eac6d03e92015146bbc1925">max</a>(height, 50); <a name="l00197"></a>00197 <a name="l00198"></a>00198 <span class="keyword">new</span>->frame = xcb_generate_id(conn); <a name="l00199"></a>00199 <span class="keyword">new</span>->child = child; <a name="l00200"></a>00200 <span class="keyword">new</span>->rect.width = width; <a name="l00201"></a>00201 <span class="keyword">new</span>->rect.height = height; <a name="l00202"></a>00202 <span class="keyword">new</span>->width_increment = 1; <a name="l00203"></a>00203 <span class="keyword">new</span>->height_increment = 1; <a name="l00204"></a>00204 <span class="keyword">new</span>->border_width = border_width; <a name="l00205"></a>00205 <span class="comment">/* Pre-initialize the values for floating */</span> <a name="l00206"></a>00206 <span class="keyword">new</span>->floating_rect.x = -1; <a name="l00207"></a>00207 <span class="keyword">new</span>->floating_rect.width = width; <a name="l00208"></a>00208 <span class="keyword">new</span>->floating_rect.height = height; <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="keywordflow">if</span> (<a class="code" href="a00062.html#a4a8dd3a2de125b72d4fe6251a0a271b5">config</a>.<a class="code" href="a00010.html#a8ae68d7d3e33840388191d2ca725c48c">default_border</a> != NULL) <a name="l00211"></a>00211 <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, <span class="keyword">new</span>, <a class="code" href="a00062.html#a4a8dd3a2de125b72d4fe6251a0a271b5">config</a>.<a class="code" href="a00010.html#a8ae68d7d3e33840388191d2ca725c48c">default_border</a>[1]); <a name="l00212"></a>00212 <a name="l00213"></a>00213 mask = 0; <a name="l00214"></a>00214 <a name="l00215"></a>00215 <span class="comment">/* Don’t generate events for our new window, it should *not* be managed */</span> <a name="l00216"></a>00216 mask |= XCB_CW_OVERRIDE_REDIRECT; <a name="l00217"></a>00217 values[0] = 1; <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="comment">/* We want to know when… */</span> <a name="l00220"></a>00220 mask |= XCB_CW_EVENT_MASK; <a name="l00221"></a>00221 values[1] = <a class="code" href="a00054.html#aed223c0ebc389529a1b1e74c6f4d2df8" title="The XCB_CW_EVENT_MASK for its frame.">FRAME_EVENT_MASK</a>; <a name="l00222"></a>00222 <a name="l00223"></a>00223 <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>(conn, <a class="code" href="a00062.html#a4a8dd3a2de125b72d4fe6251a0a271b5">config</a>.<a class="code" href="a00010.html#aff568f0d5ca7a51971f4c3006a842019">font</a>); <a name="l00224"></a>00224 width = <a class="code" href="a00077.html#abd8bbcfabb3ddef2ccaafb9928a37b95">min</a>(width, <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><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="l00225"></a>00225 height = <a class="code" href="a00077.html#abd8bbcfabb3ddef2ccaafb9928a37b95">min</a>(height, <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a>); <a name="l00226"></a>00226 <a name="l00227"></a>00227 <a class="code" href="a00020.html" title="Stores a rectangle, for example the size of a window, the child window etc.">Rect</a> framerect = {x, y, <a name="l00228"></a>00228 width + 2 + 2, <span class="comment">/* 2 px border at each side */</span> <a name="l00229"></a>00229 height + 2 + 2 + font-><a class="code" href="a00015.html#a89ceb86bb4ad2694315d846e69893399" title="The height of the font, built from font_ascent + font_descent.">height</a>}; <span class="comment">/* 2 px border plus font’s height */</span> <a name="l00230"></a>00230 <a name="l00231"></a>00231 <span class="comment">/* Yo dawg, I heard you like windows, so I create a window around your window… */</span> <a name="l00232"></a>00232 <span class="keyword">new</span>->frame = <a class="code" href="a00079.html#a1c6bb71a9f8e0501e2228dd3dca3bd6a" title="Convenience wrapper around xcb_create_window which takes care of depth, generating...">create_window</a>(conn, framerect, XCB_WINDOW_CLASS_INPUT_OUTPUT, <a class="code" href="a00054.html#ada5e89d9bddd5e5feff900639db2e208" title="This is the equivalent of XC_left_ptr.">XCB_CURSOR_LEFT_PTR</a>, <span class="keyword">false</span>, mask, values); <a name="l00233"></a>00233 <a name="l00234"></a>00234 <span class="comment">/* Put the client inside the save set. Upon termination (whether killed or normal exit</span> <a name="l00235"></a>00235 <span class="comment"> does not matter) of the window manager, these clients will be correctly reparented</span> <a name="l00236"></a>00236 <span class="comment"> to their most closest living ancestor (= cleanup) */</span> <a name="l00237"></a>00237 xcb_change_save_set(conn, XCB_SET_MODE_INSERT, child); <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="comment">/* Generate a graphics context for the titlebar */</span> <a name="l00240"></a>00240 <span class="keyword">new</span>->titlegc = xcb_generate_id(conn); <a name="l00241"></a>00241 xcb_create_gc(conn, new->titlegc, new->frame, 0, 0); <a name="l00242"></a>00242 <a name="l00243"></a>00243 <span class="comment">/* Moves the original window into the new frame we've created for it */</span> <a name="l00244"></a>00244 <span class="keyword">new</span>->awaiting_useless_unmap = <span class="keyword">true</span>; <a name="l00245"></a>00245 xcb_void_cookie_t cookie = xcb_reparent_window_checked(conn, child, new->frame, 0, font-><a class="code" href="a00015.html#a89ceb86bb4ad2694315d846e69893399" title="The height of the font, built from font_ascent + font_descent.">height</a>); <a name="l00246"></a>00246 <span class="keywordflow">if</span> (xcb_request_check(conn, cookie) != NULL) { <a name="l00247"></a>00247 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Could not reparent the window, aborting\n"</span>); <a name="l00248"></a>00248 xcb_destroy_window(conn, new->frame); <a name="l00249"></a>00249 free(<span class="keyword">new</span>); <a name="l00250"></a>00250 <span class="keywordflow">return</span>; <a name="l00251"></a>00251 } <a name="l00252"></a>00252 <a name="l00253"></a>00253 <span class="comment">/* Put our data structure (Client) into the table */</span> <a name="l00254"></a>00254 <a class="code" href="a00077.html#a387447a095debe780790788f18e88d6e" title="Inserts an element into the given keyvalue-table using the given key.">table_put</a>(&<a class="code" href="a00077.html#a38dffc58d761d720f7c63d35f2efd71d">by_parent</a>, new->frame, <span class="keyword">new</span>); <a name="l00255"></a>00255 <a class="code" href="a00077.html#a387447a095debe780790788f18e88d6e" title="Inserts an element into the given keyvalue-table using the given key.">table_put</a>(&<a class="code" href="a00077.html#aadfb9c6f265623f83355191df37c86c8">by_child</a>, child, <span class="keyword">new</span>); <a name="l00256"></a>00256 <a name="l00257"></a>00257 <span class="comment">/* We need to grab the mouse buttons for click to focus */</span> <a name="l00258"></a>00258 xcb_grab_button(conn, <span class="keyword">false</span>, child, XCB_EVENT_MASK_BUTTON_PRESS, <a name="l00259"></a>00259 XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE, <a name="l00260"></a>00260 1 <span class="comment">/* left mouse button */</span>, <a name="l00261"></a>00261 XCB_BUTTON_MASK_ANY <span class="comment">/* don’t filter for any modifiers */</span>); <a name="l00262"></a>00262 <a name="l00263"></a>00263 xcb_grab_button(conn, <span class="keyword">false</span>, child, XCB_EVENT_MASK_BUTTON_PRESS, <a name="l00264"></a>00264 XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE, <a name="l00265"></a>00265 3 <span class="comment">/* right mouse button */</span>, <a name="l00266"></a>00266 XCB_BUTTON_MASK_ANY <span class="comment">/* don’t filter for any modifiers */</span>); <a name="l00267"></a>00267 <a name="l00268"></a>00268 <span class="comment">/* Get _NET_WM_WINDOW_TYPE (to see if it’s a dock) */</span> <a name="l00269"></a>00269 xcb_atom_t *atom; <a name="l00270"></a>00270 xcb_get_property_reply_t *preply = xcb_get_property_reply(conn, wm_type_cookie, NULL); <a name="l00271"></a>00271 <span class="keywordflow">if</span> (preply != NULL && preply->value_len > 0 && (atom = xcb_get_property_value(preply))) { <a name="l00272"></a>00272 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < xcb_get_property_value_length(preply); i++) <a name="l00273"></a>00273 <span class="keywordflow">if</span> (atom[i] == <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a2d1c4f653feb0746c9d55bddfa1f8946">_NET_WM_WINDOW_TYPE_DOCK</a>]) { <a name="l00274"></a>00274 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Window is a dock.\n"</span>); <a name="l00275"></a>00275 <a class="code" href="a00026.html" title="An Output is a physical output on your graphics driver.">Output</a> *t_out = <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>(x, y); <a name="l00276"></a>00276 <span class="keywordflow">if</span> (t_out != <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#aeee203e013dae84555d28f8247a7e375" title="Backpointer to the output this workspace is on.">output</a>) { <a name="l00277"></a>00277 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Dock client requested to be on output %s by geometry (%d, %d)\n"</span>, <a name="l00278"></a>00278 t_out-><a class="code" href="a00026.html#a4c8b185b15cf45e3ca300cb54b2d4650" title="Name of the output.">name</a>, x, y); <a name="l00279"></a>00279 <span class="keyword">new</span>->workspace = t_out-><a class="code" href="a00026.html#a9bcf702b65d8f47f98eafbefff529ffe" title="Current workspace selected on this virtual screen.">current_workspace</a>; <a name="l00280"></a>00280 } <a name="l00281"></a>00281 <span class="keyword">new</span>->dock = <span class="keyword">true</span>; <a name="l00282"></a>00282 <span class="keyword">new</span>->borderless = <span class="keyword">true</span>; <a name="l00283"></a>00283 <span class="keyword">new</span>->titlebar_position = TITLEBAR_OFF; <a name="l00284"></a>00284 <span class="keyword">new</span>->force_reconfigure = <span class="keyword">true</span>; <a name="l00285"></a>00285 <span class="keyword">new</span>->container = NULL; <a name="l00286"></a>00286 <a class="code" href="a00047.html#a48df7439e09a419afabdd1f2f8551e73">SLIST_INSERT_HEAD</a>(&(t_out->dock_clients), <span class="keyword">new</span>, dock_clients); <a name="l00287"></a>00287 <span class="comment">/* If it’s a dock we can’t make it float, so we break */</span> <a name="l00288"></a>00288 <span class="keyword">new</span>->floating = FLOATING_AUTO_OFF; <a name="l00289"></a>00289 <span class="keywordflow">break</span>; <a name="l00290"></a>00290 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (atom[i] == <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635afc6c49b0d04427d54227a147e230fa6c">_NET_WM_WINDOW_TYPE_DIALOG</a>] || <a name="l00291"></a>00291 atom[i] == <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a2e553ea4ae93c2324801a40f52d7a70a">_NET_WM_WINDOW_TYPE_UTILITY</a>] || <a name="l00292"></a>00292 atom[i] == <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635adc360a29b4d20ba8cd1c999f6077a843">_NET_WM_WINDOW_TYPE_TOOLBAR</a>] || <a name="l00293"></a>00293 atom[i] == <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635a49555c0ebb81f76501d672c92857704a">_NET_WM_WINDOW_TYPE_SPLASH</a>]) { <a name="l00294"></a>00294 <span class="comment">/* Set the dialog window to automatically floating, will be used below */</span> <a name="l00295"></a>00295 <span class="keyword">new</span>->floating = FLOATING_AUTO_ON; <a name="l00296"></a>00296 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"dialog/utility/toolbar/splash window, automatically floating\n"</span>); <a name="l00297"></a>00297 } <a name="l00298"></a>00298 } <a name="l00299"></a>00299 <a name="l00300"></a>00300 <span class="comment">/* All clients which have a leader should be floating */</span> <a name="l00301"></a>00301 <span class="keywordflow">if</span> (!new->dock && !<a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(<span class="keyword">new</span>) && new->leader != 0) { <a name="l00302"></a>00302 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Client has WM_CLIENT_LEADER hint set, setting floating\n"</span>); <a name="l00303"></a>00303 <span class="keyword">new</span>->floating = FLOATING_AUTO_ON; <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <a name="l00306"></a>00306 <span class="keywordflow">if</span> (new->workspace->auto_float) { <a name="l00307"></a>00307 <span class="keyword">new</span>->floating = FLOATING_AUTO_ON; <a name="l00308"></a>00308 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"workspace is in autofloat mode, setting floating\n"</span>); <a name="l00309"></a>00309 } <a name="l00310"></a>00310 <a name="l00311"></a>00311 <span class="keywordflow">if</span> (new->dock) { <a name="l00312"></a>00312 <span class="comment">/* Get _NET_WM_STRUT_PARTIAL to determine the client’s requested height */</span> <a name="l00313"></a>00313 uint32_t *strut; <a name="l00314"></a>00314 preply = xcb_get_property_reply(conn, strut_cookie, NULL); <a name="l00315"></a>00315 <span class="keywordflow">if</span> (preply != NULL && preply->value_len > 0 && (strut = xcb_get_property_value(preply))) { <a name="l00316"></a>00316 <span class="comment">/* We only use a subset of the provided values, namely the reserved space at the top/bottom</span> <a name="l00317"></a>00317 <span class="comment"> of the screen. This is because the only possibility for bars is at to be at the top/bottom</span> <a name="l00318"></a>00318 <span class="comment"> with maximum horizontal size.</span> <a name="l00319"></a>00319 <span class="comment"> TODO: bars at the top */</span> <a name="l00320"></a>00320 <span class="keyword">new</span>->desired_height = strut[3]; <a name="l00321"></a>00321 <span class="keywordflow">if</span> (new->desired_height == 0) { <a name="l00322"></a>00322 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Client wanted to be 0 pixels high, using the window's height (%d)\n"</span>, original_height); <a name="l00323"></a>00323 <span class="keyword">new</span>->desired_height = original_height; <a name="l00324"></a>00324 } <a name="l00325"></a>00325 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"the client wants to be %d pixels high\n"</span>, new->desired_height); <a name="l00326"></a>00326 } <span class="keywordflow">else</span> { <a name="l00327"></a>00327 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"The client didn't specify space to reserve at the screen edge, using its height (%d)\n"</span>, original_height); <a name="l00328"></a>00328 <span class="keyword">new</span>->desired_height = original_height; <a name="l00329"></a>00329 } <a name="l00330"></a>00330 } <span class="keywordflow">else</span> { <a name="l00331"></a>00331 <span class="comment">/* If it’s not a dock, we can check on which workspace we should put it. */</span> <a name="l00332"></a>00332 <a name="l00333"></a>00333 <span class="comment">/* Firstly, we need to get the window’s class / title. We asked for the properties at the</span> <a name="l00334"></a>00334 <span class="comment"> * top of this function, get them now and pass them to our callback function for window class / title</span> <a name="l00335"></a>00335 <span class="comment"> * changes. It is important that the client was already inserted into the by_child table,</span> <a name="l00336"></a>00336 <span class="comment"> * because the callbacks won’t work otherwise. */</span> <a name="l00337"></a>00337 preply = xcb_get_property_reply(conn, utf8_title_cookie, NULL); <a name="l00338"></a>00338 <a class="code" href="a00067.html#a763f921cc825269f3034ac3237f911f2" title="Called when a window changes its title.">handle_windowname_change</a>(NULL, conn, 0, new->child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[_NET_WM_NAME], preply); <a name="l00339"></a>00339 <a name="l00340"></a>00340 preply = xcb_get_property_reply(conn, title_cookie, NULL); <a name="l00341"></a>00341 <a class="code" href="a00067.html#ac3e59ebb6684722fada02f66582a1787" title="We handle legacy window names (titles) which are in COMPOUND_TEXT encoding.">handle_windowname_change_legacy</a>(NULL, conn, 0, new->child, WM_NAME, preply); <a name="l00342"></a>00342 <a name="l00343"></a>00343 preply = xcb_get_property_reply(conn, class_cookie, NULL); <a name="l00344"></a>00344 <a class="code" href="a00067.html#a3fdeb5f8c0fbef80784d1d62e4653ed9" title="Store the window classes for jumping to them later.">handle_windowclass_change</a>(NULL, conn, 0, new->child, WM_CLASS, preply); <a name="l00345"></a>00345 <a name="l00346"></a>00346 preply = xcb_get_property_reply(conn, leader_cookie, NULL); <a name="l00347"></a>00347 <a class="code" href="a00067.html#a3651e94bba743f088fd461a90892ff2f" title="Handles changes of the WM_CLIENT_LEADER atom which specifies if this is a toolwindow...">handle_clientleader_change</a>(NULL, conn, 0, new->child, <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[WM_CLIENT_LEADER], preply); <a name="l00348"></a>00348 <a name="l00349"></a>00349 <span class="comment">/* if WM_CLIENT_LEADER is set, we put the new window on the</span> <a name="l00350"></a>00350 <span class="comment"> * same window as its leader. This might be overwritten by</span> <a name="l00351"></a>00351 <span class="comment"> * assignments afterwards. */</span> <a name="l00352"></a>00352 <span class="keywordflow">if</span> (new->leader != XCB_NONE) { <a name="l00353"></a>00353 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"client->leader is set (to 0x%08x)\n"</span>, new->leader); <a name="l00354"></a>00354 <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *parent = <a class="code" href="a00077.html#ae1529a1d81e2457f9a2402eda35735d7" title="Returns the value of the element of the given keyvalue-table with the given key.">table_get</a>(&<a class="code" href="a00077.html#aadfb9c6f265623f83355191df37c86c8">by_child</a>, new->leader); <a name="l00355"></a>00355 <span class="keywordflow">if</span> (parent != NULL && parent-><a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a> != NULL) { <a name="l00356"></a>00356 <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *t_ws = parent-><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="l00357"></a>00357 <span class="keyword">new</span>->container = t_ws-><a class="code" href="a00025.html#a26cf35518dcf31aa97deda261548e719" title="This is a two-dimensional dynamic array of Container-pointers.">table</a>[parent-><a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a>-><a class="code" href="a00013.html#ad20f57a89cdcc15b1e656c67d7b4861a">col</a>][parent-><a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a>-><a class="code" href="a00013.html#a4fefa5b1b97f096cbee9cd24cc3d6c34">row</a>]; <a name="l00358"></a>00358 <span class="keyword">new</span>-><a class="code" href="a00013.html#a98ed501e1088ccf2e7c75399ab7e6031">workspace</a> = t_ws; <a name="l00359"></a>00359 old_focused = <span class="keyword">new</span>-><a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a>-><a class="code" href="a00013.html#a82d910506b0d788a92ebeeb1d82da75b">currently_focused</a>; <a name="l00360"></a>00360 map_frame = <a class="code" href="a00078.html#a7a4e9d7994d904776ead4c8fc1b22091" title="Returns true if the workspace is currently visible.">workspace_is_visible</a>(t_ws); <a name="l00361"></a>00361 <span class="keyword">new</span>->urgent = <span class="keyword">true</span>; <a name="l00362"></a>00362 <span class="comment">/* This is a little tricky: we cannot use</span> <a name="l00363"></a>00363 <span class="comment"> * workspace_update_urgent_flag() because the</span> <a name="l00364"></a>00364 <span class="comment"> * new window was not yet inserted into the</span> <a name="l00365"></a>00365 <span class="comment"> * focus stack on t_ws. */</span> <a name="l00366"></a>00366 t_ws-><a class="code" href="a00025.html#ae43262c5fb60e7d7a93da1041835eeb2" title="True if any client on this workspace has its urgent flag set.">urgent</a> = <span class="keyword">true</span>; <a name="l00367"></a>00367 } <span class="keywordflow">else</span> { <a name="l00368"></a>00368 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"parent is not usable\n"</span>); <a name="l00369"></a>00369 } <a name="l00370"></a>00370 } <a name="l00371"></a>00371 <a name="l00372"></a>00372 <span class="keyword">struct </span><a class="code" href="a00001.html" title="Holds an assignment for a given window class/title to a specific workspace (see src/config...">Assignment</a> *assign; <a name="l00373"></a>00373 <a class="code" href="a00047.html#a16e5fc168e7f3494d4b1df54447d871e">TAILQ_FOREACH</a>(assign, &<a class="code" href="a00071.html#af36d2f2cbc5487cf0e9e2d60165b3e89">assignments</a>, <a class="code" href="a00071.html#af36d2f2cbc5487cf0e9e2d60165b3e89">assignments</a>) { <a name="l00374"></a>00374 <span class="keywordflow">if</span> (<a class="code" href="a00077.html#ad77b9ae748e9583f072306af098dafed" title="Gets the first matching client for the given window class/window title.">get_matching_client</a>(conn, assign-><a class="code" href="a00001.html#aaf25640d8abe3c02c613fdc54d77878d">windowclass_title</a>, <span class="keyword">new</span>) == NULL) <a name="l00375"></a>00375 <span class="keywordflow">continue</span>; <a name="l00376"></a>00376 <a name="l00377"></a>00377 <span class="keywordflow">if</span> (assign-><a class="code" href="a00001.html#a7706b3c433fc9199bc55ebf9e56ffbe6" title="floating is true if this was an assignment to the special workspace &quot;~&quot;...">floating</a> == <a class="code" href="a00001.html#a87b683c78c6543b24f9bc77a9c03f33ba5506be147c7de5e1df1ffb6c82e27810">ASSIGN_FLOATING_ONLY</a> || <a name="l00378"></a>00378 assign-><a class="code" href="a00001.html#a7706b3c433fc9199bc55ebf9e56ffbe6" title="floating is true if this was an assignment to the special workspace &quot;~&quot;...">floating</a> == <a class="code" href="a00001.html#a87b683c78c6543b24f9bc77a9c03f33ba0b8ce3450fb62cb9f0da744140875b5b">ASSIGN_FLOATING</a>) { <a name="l00379"></a>00379 <span class="keyword">new</span>->floating = FLOATING_AUTO_ON; <a name="l00380"></a>00380 <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">"Assignment matches, putting client into floating mode\n"</span>); <a name="l00381"></a>00381 <span class="keywordflow">if</span> (assign-><a class="code" href="a00001.html#a7706b3c433fc9199bc55ebf9e56ffbe6" title="floating is true if this was an assignment to the special workspace &quot;~&quot;...">floating</a> == <a class="code" href="a00001.html#a87b683c78c6543b24f9bc77a9c03f33ba5506be147c7de5e1df1ffb6c82e27810">ASSIGN_FLOATING_ONLY</a>) <a name="l00382"></a>00382 <span class="keywordflow">break</span>; <a name="l00383"></a>00383 } <a name="l00384"></a>00384 <a name="l00385"></a>00385 <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">"Assignment \"%s\" matches, so putting it on workspace %d\n"</span>, <a name="l00386"></a>00386 assign-><a class="code" href="a00001.html#aaf25640d8abe3c02c613fdc54d77878d">windowclass_title</a>, assign-><a class="code" href="a00001.html#ad7a79f7c0d2f2801359c9e4458685566" title="The number of the workspace to assign to.">workspace</a>); <a name="l00387"></a>00387 <a name="l00388"></a>00388 <span class="keywordflow">if</span> (<a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#aeee203e013dae84555d28f8247a7e375" title="Backpointer to the output this workspace is on.">output</a>-><a class="code" href="a00026.html#a9bcf702b65d8f47f98eafbefff529ffe" title="Current workspace selected on this virtual screen.">current_workspace</a>-><a class="code" href="a00025.html#a7dfb9b375b2740db75bb82eb0b2be41d" title="Number of this workspace, starting from 0.">num</a> == (assign-><a class="code" href="a00001.html#ad7a79f7c0d2f2801359c9e4458685566" title="The number of the workspace to assign to.">workspace</a>-1)) { <a name="l00389"></a>00389 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"We are already there, no need to do anything\n"</span>); <a name="l00390"></a>00390 <span class="keywordflow">break</span>; <a name="l00391"></a>00391 } <a name="l00392"></a>00392 <a name="l00393"></a>00393 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Changing container/workspace and unmapping the client\n"</span>); <a name="l00394"></a>00394 <a class="code" href="a00025.html" title="The concept of Workspaces is known from various other window managers.">Workspace</a> *t_ws = <a class="code" href="a00078.html#a73833335a85bfc97bdff285b151ab1c5" title="Returns a pointer to the workspace with the given number (starting at 0), creating...">workspace_get</a>(assign-><a class="code" href="a00001.html#ad7a79f7c0d2f2801359c9e4458685566" title="The number of the workspace to assign to.">workspace</a>-1); <a name="l00395"></a>00395 <a class="code" href="a00078.html#a8339966acb1a826e826e9b20bfb754f6" title="Initializes the given workspace if it is not already initialized.">workspace_initialize</a>(t_ws, <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#aeee203e013dae84555d28f8247a7e375" title="Backpointer to the output this workspace is on.">output</a>, <span class="keyword">false</span>); <a name="l00396"></a>00396 <a name="l00397"></a>00397 <span class="keyword">new</span>->container = t_ws-><a class="code" href="a00025.html#a26cf35518dcf31aa97deda261548e719" title="This is a two-dimensional dynamic array of Container-pointers.">table</a>[t_ws-><a class="code" href="a00025.html#ab683091dfe46963b2dd0761e8e5f9e16" title="These are stored here only while this workspace is _not_ shown (see show_workspace())...">current_col</a>][t_ws-><a class="code" href="a00025.html#a86fefbdc838f2b5593ea2521378e4ddd" title="These are stored here only while this workspace is _not_ shown (see show_workspace())...">current_row</a>]; <a name="l00398"></a>00398 <span class="keyword">new</span>-><a class="code" href="a00013.html#a98ed501e1088ccf2e7c75399ab7e6031">workspace</a> = t_ws; <a name="l00399"></a>00399 old_focused = <span class="keyword">new</span>-><a class="code" href="a00007.html#a022927d41b4140a623f72fa360c46a17" title="Backpointer.">container</a>-><a class="code" href="a00013.html#a82d910506b0d788a92ebeeb1d82da75b">currently_focused</a>; <a name="l00400"></a>00400 <a name="l00401"></a>00401 map_frame = <a class="code" href="a00078.html#a7a4e9d7994d904776ead4c8fc1b22091" title="Returns true if the workspace is currently visible.">workspace_is_visible</a>(t_ws); <a name="l00402"></a>00402 <span class="keywordflow">break</span>; <a name="l00403"></a>00403 } <a name="l00404"></a>00404 } <a name="l00405"></a>00405 <a name="l00406"></a>00406 <span class="keywordflow">if</span> (new->workspace->fullscreen_client != NULL) { <a name="l00407"></a>00407 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Setting below fullscreen window\n"</span>); <a name="l00408"></a>00408 <a name="l00409"></a>00409 <span class="comment">/* If we are in fullscreen, we should place the window below</span> <a name="l00410"></a>00410 <span class="comment"> * the fullscreen window to not be annoying */</span> <a name="l00411"></a>00411 uint32_t values[] = { <a name="l00412"></a>00412 <span class="keyword">new</span>->workspace->fullscreen_client->frame, <a name="l00413"></a>00413 XCB_STACK_MODE_BELOW <a name="l00414"></a>00414 }; <a name="l00415"></a>00415 xcb_configure_window(conn, new->frame, <a name="l00416"></a>00416 XCB_CONFIG_WINDOW_SIBLING | <a name="l00417"></a>00417 XCB_CONFIG_WINDOW_STACK_MODE, values); <a name="l00418"></a>00418 } <a name="l00419"></a>00419 <a name="l00420"></a>00420 <span class="comment">/* Insert into the currently active container, if it’s not a dock window */</span> <a name="l00421"></a>00421 <span class="keywordflow">if</span> (!new->dock && !<a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(<span class="keyword">new</span>)) { <a name="l00422"></a>00422 <span class="comment">/* Insert after the old active client, if existing. If it does not exist, the</span> <a name="l00423"></a>00423 <span class="comment"> container is empty and it does not matter, where we insert it */</span> <a name="l00424"></a>00424 <span class="keywordflow">if</span> (old_focused != NULL && !old_focused-><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="l00425"></a>00425 <a class="code" href="a00047.html#a108b36ff00cbf59efbbf185baac770b4">CIRCLEQ_INSERT_AFTER</a>(&(new->container->clients), old_focused, <span class="keyword">new</span>, clients); <a name="l00426"></a>00426 <span class="keywordflow">else</span> <a class="code" href="a00047.html#aa2b767125267fa26ca10e21fa358008c">CIRCLEQ_INSERT_TAIL</a>(&(new->container->clients), <span class="keyword">new</span>, clients); <a name="l00427"></a>00427 <a name="l00428"></a>00428 <span class="keywordflow">if</span> (new->container->workspace->fullscreen_client != NULL) <a name="l00429"></a>00429 <a class="code" href="a00047.html#af1d994d9652ccbc41a60b747dfc15ea5">SLIST_INSERT_AFTER</a>(new->container->workspace->fullscreen_client, <span class="keyword">new</span>, focus_clients); <a name="l00430"></a>00430 <span class="keywordflow">else</span> <a class="code" href="a00047.html#a48df7439e09a419afabdd1f2f8551e73">SLIST_INSERT_HEAD</a>(&(new->container->workspace->focus_stack), <span class="keyword">new</span>, focus_clients); <a name="l00431"></a>00431 <a name="l00432"></a>00432 <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, <span class="keyword">new</span>); <a name="l00433"></a>00433 } <a name="l00434"></a>00434 <a name="l00435"></a>00435 <span class="keywordflow">if</span> (<a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(<span class="keyword">new</span>)) { <a name="l00436"></a>00436 <a class="code" href="a00047.html#a48df7439e09a419afabdd1f2f8551e73">SLIST_INSERT_HEAD</a>(&(new->workspace->focus_stack), <span class="keyword">new</span>, focus_clients); <a name="l00437"></a>00437 <a name="l00438"></a>00438 <span class="comment">/* Add the client to the list of floating clients for its workspace */</span> <a name="l00439"></a>00439 <a class="code" href="a00047.html#a512bee16b46f601078c96c776d2648c3">TAILQ_INSERT_TAIL</a>(&(new->workspace->floating_clients), <span class="keyword">new</span>, floating_clients); <a name="l00440"></a>00440 <a name="l00441"></a>00441 <span class="keyword">new</span>->container = NULL; <a name="l00442"></a>00442 <a name="l00443"></a>00443 <span class="keyword">new</span>->rect.width = <span class="keyword">new</span>->floating_rect.width + 2 + 2; <a name="l00444"></a>00444 <span class="keyword">new</span>->rect.height = <span class="keyword">new</span>->floating_rect.height + (font-><a class="code" href="a00015.html#a89ceb86bb4ad2694315d846e69893399" title="The height of the font, built from font_ascent + font_descent.">height</a> + 2 + 2) + 2; <a name="l00445"></a>00445 <a name="l00446"></a>00446 <span class="comment">/* Some clients (like GIMP’s color picker window) get mapped</span> <a name="l00447"></a>00447 <span class="comment"> * to (0, 0), so we push them to a reasonable position</span> <a name="l00448"></a>00448 <span class="comment"> * (centered over their leader) */</span> <a name="l00449"></a>00449 <span class="keywordflow">if</span> (new->leader != 0 && x == 0 && y == 0) { <a name="l00450"></a>00450 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"Floating client wants to (0x0), moving it over its leader instead\n"</span>); <a name="l00451"></a>00451 <a class="code" href="a00007.html" title="A client is X11-speak for a window.">Client</a> *leader = <a class="code" href="a00077.html#ae1529a1d81e2457f9a2402eda35735d7" title="Returns the value of the element of the given keyvalue-table with the given key.">table_get</a>(&<a class="code" href="a00077.html#aadfb9c6f265623f83355191df37c86c8">by_child</a>, new->leader); <a name="l00452"></a>00452 <span class="keywordflow">if</span> (leader == NULL) { <a name="l00453"></a>00453 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"leader is NULL, centering it over current workspace\n"</span>); <a name="l00454"></a>00454 <a name="l00455"></a>00455 x = <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + (<a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#adb31dc42e48628c3e513c60296779ef8">width</a> / 2) - (new->rect.width / 2); <a name="l00456"></a>00456 y = <a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + (<a class="code" href="a00076.html#a6dc99dff7063221c1096561951c0386b">c_ws</a>-><a class="code" href="a00025.html#ac11bedb880b568b9c540fc9a376607ad" title="x, y, width, height">rect</a>.<a class="code" href="a00020.html#a0a074c07d144c9647e3eb60ef54f88c3">height</a> / 2) - (new->rect.height / 2); <a name="l00457"></a>00457 } <span class="keywordflow">else</span> { <a name="l00458"></a>00458 x = leader-><a class="code" href="a00007.html#aea76187592ae1a87eb8bb1af77af62d4" title="x, y, width, height of the frame">rect</a>.<a class="code" href="a00020.html#a6f5ab43ec9da45a9c3ddbc45d9aa3bbc">x</a> + (leader-><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) - (new->rect.width / 2); <a name="l00459"></a>00459 y = leader-><a class="code" href="a00007.html#aea76187592ae1a87eb8bb1af77af62d4" title="x, y, width, height of the frame">rect</a>.<a class="code" href="a00020.html#ac77eddc4cc31fe7881da4a23cdca0ea5">y</a> + (leader-><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) - (new->rect.height / 2); <a name="l00460"></a>00460 } <a name="l00461"></a>00461 } <a name="l00462"></a>00462 <span class="keyword">new</span>->floating_rect.x = <span class="keyword">new</span>->rect.x = x; <a name="l00463"></a>00463 <span class="keyword">new</span>->floating_rect.y = <span class="keyword">new</span>->rect.y = y; <a name="l00464"></a>00464 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"copying floating_rect from tiling (%d, %d) size (%d, %d)\n"</span>, <a name="l00465"></a>00465 new->floating_rect.x, new->floating_rect.y, <a name="l00466"></a>00466 new->floating_rect.width, new->floating_rect.height); <a name="l00467"></a>00467 <a class="code" href="a00044.html#a287e239c800086178591f5e53f5bb82c">DLOG</a>(<span class="stringliteral">"outer rect (%d, %d) size (%d, %d)\n"</span>, <a name="l00468"></a>00468 new->rect.x, new->rect.y, new->rect.width, new->rect.height); <a name="l00469"></a>00469 <a name="l00470"></a>00470 <span class="comment">/* Make sure it is on top of the other windows */</span> <a name="l00471"></a>00471 <a class="code" href="a00079.html#a6ea5ab6082e87ce76340a38034f7b513" title="Raises the given window (typically client-&gt;frame) above all other windows.">xcb_raise_window</a>(conn, new->frame); <a name="l00472"></a>00472 <a class="code" href="a00069.html#a1d68fface3cf11ff882c23a5bfa586ab" title="Pushes the client’s x and y coordinates to X11.">reposition_client</a>(conn, <span class="keyword">new</span>); <a name="l00473"></a>00473 <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, <span class="keyword">new</span>); <a name="l00474"></a>00474 <span class="comment">/* redecorate_window flushes */</span> <a name="l00475"></a>00475 <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, <span class="keyword">new</span>); <a name="l00476"></a>00476 } <a name="l00477"></a>00477 <a name="l00478"></a>00478 <span class="keyword">new</span>->initialized = <span class="keyword">true</span>; <a name="l00479"></a>00479 <a name="l00480"></a>00480 <span class="comment">/* Check if the window already got the fullscreen hint set */</span> <a name="l00481"></a>00481 xcb_atom_t *state; <a name="l00482"></a>00482 <span class="keywordflow">if</span> ((preply = xcb_get_property_reply(conn, state_cookie, NULL)) != NULL && <a name="l00483"></a>00483 (state = xcb_get_property_value(preply)) != NULL) <a name="l00484"></a>00484 <span class="comment">/* Check all set _NET_WM_STATEs */</span> <a name="l00485"></a>00485 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < xcb_get_property_value_length(preply); i++) { <a name="l00486"></a>00486 <span class="keywordflow">if</span> (state[i] != <a class="code" href="a00071.html#a327a6e1e08087496e9cb60b9e6f2a499">atoms</a>[<a class="code" href="a00054.html#a726ca809ffd3d67ab4b8476646f26635accdb5c5ee0d74dfffda6f4324a9abff5">_NET_WM_STATE_FULLSCREEN</a>]) <a name="l00487"></a>00487 <span class="keywordflow">continue</span>; <a name="l00488"></a>00488 <span class="comment">/* If the window got the fullscreen state, we just toggle fullscreen</span> <a name="l00489"></a>00489 <span class="comment"> and don’t event bother to redraw the layout – that would not change</span> <a name="l00490"></a>00490 <span class="comment"> anything anyways */</span> <a name="l00491"></a>00491 <a class="code" href="a00060.html#a6eaa454820104be1fe5a9c9f99ca46e9" title="Toggles fullscreen mode for the given client.">client_toggle_fullscreen</a>(conn, <span class="keyword">new</span>); <a name="l00492"></a>00492 <span class="keywordflow">goto</span> map; <a name="l00493"></a>00493 } <a name="l00494"></a>00494 <a name="l00495"></a>00495 <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="l00496"></a>00496 <a name="l00497"></a>00497 map: <a name="l00498"></a>00498 <span class="comment">/* Map the window first to avoid flickering */</span> <a name="l00499"></a>00499 xcb_map_window(conn, child); <a name="l00500"></a>00500 <span class="keywordflow">if</span> (map_frame) <a name="l00501"></a>00501 <a class="code" href="a00060.html#a7f3612a4061bd46213d5e28f0c4d00ee" title="Map the client, correctly restoring any state needed.">client_map</a>(conn, <span class="keyword">new</span>); <a name="l00502"></a>00502 <a name="l00503"></a>00503 <span class="keywordflow">if</span> ((<a class="code" href="a00051.html#ac120dc3752e8ac2853ddd65d7737a2fd">CUR_CELL</a>->workspace->fullscreen_client == NULL || new->fullscreen) && !new->dock) { <a name="l00504"></a>00504 <span class="comment">/* Focus the new window if we’re not in fullscreen mode and if it is not a dock window */</span> <a name="l00505"></a>00505 <span class="keywordflow">if</span> ((new->workspace->fullscreen_client == NULL) || new->fullscreen) { <a name="l00506"></a>00506 <span class="keywordflow">if</span> (!<a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(<span class="keyword">new</span>)) { <a name="l00507"></a>00507 <span class="keyword">new</span>->container->currently_focused = <span class="keyword">new</span>; <a name="l00508"></a>00508 <span class="keywordflow">if</span> (map_frame) <a name="l00509"></a>00509 <a class="code" href="a00069.html#a2a1fee0aebdaf2497fb52ea57a1033a4" title="Renders the given container.">render_container</a>(conn, new->container); <a name="l00510"></a>00510 } <a name="l00511"></a>00511 <span class="keywordflow">if</span> (new->container == <a class="code" href="a00051.html#ac120dc3752e8ac2853ddd65d7737a2fd">CUR_CELL</a> || <a class="code" href="a00060.html#a56065826f75013837bc8e125c8dc66c7" title="Returns true if the client is floating.">client_is_floating</a>(<span class="keyword">new</span>)) { <a name="l00512"></a>00512 xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, new->child, XCB_CURRENT_TIME); <a name="l00513"></a>00513 <a class="code" href="a00065.html#a07da16d476a61d9ef63f31de1dc84700" title="Updates _NET_ACTIVE_WINDOW with the currently focused window.">ewmh_update_active_window</a>(new->child); <a name="l00514"></a>00514 } <a name="l00515"></a>00515 } <a name="l00516"></a>00516 } <a name="l00517"></a>00517 <a name="l00518"></a>00518 xcb_flush(conn); <a name="l00519"></a>00519 } </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>