<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>kwin Library: manage.cpp Source File (kwin Library)</title> <link href="../../common/doxygen.css" rel="stylesheet" type="text/css"> </head> <div class="header"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td rowspan="2" width="92"> <a href="../../index.html" title="The API documentation main page"><img src="../../common/docheadergears.png" style="border:0px;" alt=""></a> </td> <td width="95%"> <h1>kwin Library API Documentation</h1> </td> </tr> <tr> <td valign="bottom"> <table class="links" border=0 cellspacing=0> <tr> <td><a href="index.html">Overview</a></td> <td><a href="hierarchy.html" title="Inheritance list, sorted roughly alphabetically">Class Hierarchy</a></td> <td><a href="classes.html" title="Alphabetical list of classes">Classes</a></td> <td><a href="annotated.html" title="Classes, structs, unions and interfaces with brief descriptions">Classes (annotated)</a></td> <td><a href="functions.html" title="Documented class members with links to the classes they belong to">Members</a></td> <td><a href="namespaces.html" title="All documented namespaces with brief descriptions">Namespaces</a></td> <td><a href="files.html" title="A list of all documented files with brief descriptions">Source Files</a></td> </tr> </table> </td></tr></table> </div> <div id="hgrad"></div> <div class="text"> <!-- Generated by Doxygen 1.4.4 --> <h1>manage.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> KWin - the KDE window manager</span> <a name="l00003"></a>00003 <span class="comment"> This file is part of the KDE project.</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org></span> <a name="l00006"></a>00006 <span class="comment">Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org></span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment">You can Freely distribute this program under the GNU General Public</span> <a name="l00009"></a>00009 <span class="comment">License. See the file "COPYING" for the exact licensing terms.</span> <a name="l00010"></a>00010 <span class="comment">******************************************************************/</span> <a name="l00011"></a>00011 <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="comment"> This file contains things relevant to handling incoming events.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment">*/</span> <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="preprocessor">#include "client.h"</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#include <kstartupinfo.h></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <kglobal.h></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <X11/extensions/shape.h></span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="preprocessor">#include "notifications.h"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "rules.h"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">extern</span> Time qt_x_time; <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keyword">namespace </span>KWinInternal <a name="l00030"></a>00030 { <a name="l00031"></a>00031 <a name="l00037"></a><a class="code" href="classKWinInternal_1_1Client.html#a35">00037</a> <span class="keywordtype">bool</span> <a class="code" href="classKWinInternal_1_1Client.html#a35">Client::manage</a>( Window w, <span class="keywordtype">bool</span> isMapped ) <a name="l00038"></a>00038 { <a name="l00039"></a>00039 XWindowAttributes attr; <a name="l00040"></a>00040 <span class="keywordflow">if</span>( !XGetWindowAttributes(qt_xdisplay(), w, &attr)) <a name="l00041"></a>00041 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00042"></a>00042 <a name="l00043"></a>00043 <a class="code" href="namespaceKWinInternal.html#a105">grabXServer</a>(); <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="comment">// from this place on, manage() mustn't return false</span> <a name="l00046"></a>00046 postpone_geometry_updates = 1; <a name="l00047"></a>00047 pending_geometry_update = <span class="keyword">true</span>; <span class="comment">// force update when finishing with geometry changes</span> <a name="l00048"></a>00048 <a name="l00049"></a>00049 embedClient( w, attr ); <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="comment">// SELI order all these things in some sane manner</span> <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="keywordtype">bool</span> init_minimize = <span class="keyword">false</span>; <a name="l00054"></a>00054 XWMHints * hints = XGetWMHints(qt_xdisplay(), w ); <a name="l00055"></a>00055 <span class="keywordflow">if</span> (hints && (hints->flags & StateHint) && hints->initial_state == IconicState) <a name="l00056"></a>00056 init_minimize = <span class="keyword">true</span>; <a name="l00057"></a>00057 <span class="keywordflow">if</span> (hints) <a name="l00058"></a>00058 XFree(hints); <a name="l00059"></a>00059 <span class="keywordflow">if</span>( isMapped ) <a name="l00060"></a>00060 init_minimize = <span class="keyword">false</span>; <span class="comment">// if it's already mapped, ignore hint</span> <a name="l00061"></a>00061 <a name="l00062"></a>00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> properties[ 2 ]; <a name="l00063"></a>00063 properties[ WinInfo::PROTOCOLS ] = <a name="l00064"></a>00064 NET::WMDesktop | <a name="l00065"></a>00065 NET::WMState | <a name="l00066"></a>00066 NET::WMWindowType | <a name="l00067"></a>00067 NET::WMStrut | <a name="l00068"></a>00068 NET::WMName | <a name="l00069"></a>00069 NET::WMIconGeometry | <a name="l00070"></a>00070 NET::WMIcon | <a name="l00071"></a>00071 NET::WMPid | <a name="l00072"></a>00072 NET::WMIconName | <a name="l00073"></a>00073 0; <a name="l00074"></a>00074 properties[ WinInfo::PROTOCOLS2 ] = <a name="l00075"></a>00075 NET::WM2UserTime | <a name="l00076"></a>00076 NET::WM2StartupId | <a name="l00077"></a>00077 NET::WM2ExtendedStrut | <a name="l00078"></a>00078 0; <a name="l00079"></a>00079 <a name="l00080"></a>00080 info = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1WinInfo.html">WinInfo</a>( <span class="keyword">this</span>, qt_xdisplay(), client, qt_xrootwin(), properties, 2 ); <a name="l00081"></a>00081 <a name="l00082"></a>00082 cmap = attr.colormap; <a name="l00083"></a>00083 <a name="l00084"></a>00084 XClassHint classHint; <a name="l00085"></a>00085 <span class="keywordflow">if</span> ( XGetClassHint( qt_xdisplay(), client, &classHint ) ) <a name="l00086"></a>00086 { <a name="l00087"></a>00087 <span class="comment">// Qt3.2 and older had this all lowercase, Qt3.3 capitalized resource class</span> <a name="l00088"></a>00088 <span class="comment">// force lowercase, so that workarounds listing resource classes still work</span> <a name="l00089"></a>00089 resource_name = QCString( classHint.res_name ).lower(); <a name="l00090"></a>00090 resource_class = QCString( classHint.res_class ).lower(); <a name="l00091"></a>00091 XFree( classHint.res_name ); <a name="l00092"></a>00092 XFree( classHint.res_class ); <a name="l00093"></a>00093 } <a name="l00094"></a>00094 ignore_focus_stealing = <a class="code" href="namespaceKWinInternal.html#a13">options</a>-><a class="code" href="classKWinInternal_1_1Options.html#a4">checkIgnoreFocusStealing</a>( <span class="keyword">this</span> ); <span class="comment">// TODO change to rules</span> <a name="l00095"></a>00095 <a name="l00096"></a>00096 window_role = <a class="code" href="classKWinInternal_1_1Client.html#e0">staticWindowRole</a>( w ); <a name="l00097"></a>00097 getWmClientLeader(); <a name="l00098"></a>00098 getWmClientMachine(); <a name="l00099"></a>00099 <span class="comment">// first only read the caption text, so that setupWindowRules() can use it for matching,</span> <a name="l00100"></a>00100 <span class="comment">// and only then really set the caption using setCaption(), which checks for duplicates etc.</span> <a name="l00101"></a>00101 <span class="comment">// and also relies on rules already existing</span> <a name="l00102"></a>00102 cap_normal = readName(); <a name="l00103"></a>00103 setupWindowRules( <span class="keyword">false</span> ); <a name="l00104"></a>00104 setCaption( cap_normal, <span class="keyword">true</span> ); <a name="l00105"></a>00105 <a name="l00106"></a>00106 detectNoBorder(); <a name="l00107"></a>00107 fetchIconicName(); <a name="l00108"></a>00108 getWMHints(); <span class="comment">// needs to be done before readTransient() because of reading the group</span> <a name="l00109"></a>00109 modal = ( info->state() & NET::Modal ) != 0; <span class="comment">// needs to be valid before handling groups</span> <a name="l00110"></a>00110 readTransient(); <a name="l00111"></a>00111 getIcons(); <a name="l00112"></a>00112 getWindowProtocols(); <a name="l00113"></a>00113 getWmNormalHints(); <span class="comment">// get xSizeHint</span> <a name="l00114"></a>00114 getMotifHints(); <a name="l00115"></a>00115 <a name="l00116"></a>00116 <span class="comment">// TODO try to obey all state information from info->state()</span> <a name="l00117"></a>00117 <a name="l00118"></a>00118 original_skip_taskbar = skip_taskbar = ( info->state() & NET::SkipTaskbar) != 0; <a name="l00119"></a>00119 skip_pager = ( info->state() & NET::SkipPager) != 0; <a name="l00120"></a>00120 <a name="l00121"></a>00121 KStartupInfoId asn_id; <a name="l00122"></a>00122 KStartupInfoData asn_data; <a name="l00123"></a>00123 <span class="keywordtype">bool</span> asn_valid = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a96">checkStartupNotification</a>( <a class="code" href="classKWinInternal_1_1Client.html#a1">window</a>(), asn_id, asn_data ); <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a39">updateClientLayer</a>( <span class="keyword">this</span> ); <a name="l00126"></a>00126 <a name="l00127"></a>00127 <a class="code" href="structKWinInternal_1_1SessionInfo.html">SessionInfo</a>* session = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a70">takeSessionInfo</a>( <span class="keyword">this</span> ); <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keywordflow">if</span> ( session ) <a name="l00130"></a>00130 { <a name="l00131"></a>00131 <span class="keywordflow">if</span> ( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o12">minimized</a> ) <a name="l00132"></a>00132 init_minimize = <span class="keyword">true</span>; <a name="l00133"></a>00133 <span class="keywordflow">if</span>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o19">userNoBorder</a> ) <a name="l00134"></a>00134 <a class="code" href="classKWinInternal_1_1Client.html#a67">setUserNoBorder</a>( <span class="keyword">true</span> ); <a name="l00135"></a>00135 } <a name="l00136"></a>00136 <a name="l00137"></a>00137 <a class="code" href="classKWinInternal_1_1Client.html#a122">setShortcut</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkShortcut( session ? session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o21">shortcut</a> : QString::null, <span class="keyword">true</span> )); <a name="l00138"></a>00138 <a name="l00139"></a>00139 init_minimize = <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()-><a class="code" href="classKWinInternal_1_1WindowRules.html#a16">checkMinimize</a>( init_minimize, !isMapped ); <a name="l00140"></a>00140 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()-><a class="code" href="classKWinInternal_1_1WindowRules.html#a23">checkNoBorder</a>( <span class="keyword">false</span>, !isMapped )) <a name="l00141"></a>00141 <a class="code" href="classKWinInternal_1_1Client.html#a67">setUserNoBorder</a>( <span class="keyword">true</span> ); <a name="l00142"></a>00142 <a name="l00143"></a>00143 <a class="code" href="classKWinInternal_1_1Client.html#a169">checkAndSetInitialRuledOpacity</a>(); <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="comment">// initial desktop placement</span> <a name="l00146"></a>00146 <span class="keywordflow">if</span> ( session ) <a name="l00147"></a>00147 { <a name="l00148"></a>00148 desk = session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o11">desktop</a>; <a name="l00149"></a>00149 <span class="keywordflow">if</span>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o13">onAllDesktops</a> ) <a name="l00150"></a>00150 desk = NET::OnAllDesktops; <a name="l00151"></a>00151 } <a name="l00152"></a>00152 <span class="keywordflow">else</span> <a name="l00153"></a>00153 { <a name="l00154"></a>00154 <span class="comment">// if this window is transient, ensure that it is opened on the</span> <a name="l00155"></a>00155 <span class="comment">// same window as its parent. this is necessary when an application</span> <a name="l00156"></a>00156 <span class="comment">// starts up on a different desktop than is currently displayed</span> <a name="l00157"></a>00157 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a8">isTransient</a>()) <a name="l00158"></a>00158 { <a name="l00159"></a>00159 <a class="code" href="namespaceKWinInternal.html#a24">ClientList</a> mainclients = <a class="code" href="classKWinInternal_1_1Client.html#a11">mainClients</a>(); <a name="l00160"></a>00160 <span class="keywordtype">bool</span> on_current = <span class="keyword">false</span>; <a name="l00161"></a>00161 <a class="code" href="classKWinInternal_1_1Client.html">Client</a>* maincl = NULL; <a name="l00162"></a>00162 <span class="comment">// this is slightly duplicated from Placement::placeOnMainWindow()</span> <a name="l00163"></a>00163 <span class="keywordflow">for</span>( ClientList::ConstIterator it = mainclients.begin(); <a name="l00164"></a>00164 it != mainclients.end(); <a name="l00165"></a>00165 ++it ) <a name="l00166"></a>00166 { <a name="l00167"></a>00167 <span class="keywordflow">if</span>( (*it)->isSpecialWindow() && !(*it)->isOverride()) <a name="l00168"></a>00168 <span class="keywordflow">continue</span>; <span class="comment">// don't consider toolbars etc when placing</span> <a name="l00169"></a>00169 maincl = *it; <a name="l00170"></a>00170 <span class="keywordflow">if</span>( (*it)->isOnCurrentDesktop()) <a name="l00171"></a>00171 on_current = <span class="keyword">true</span>; <a name="l00172"></a>00172 } <a name="l00173"></a>00173 <span class="keywordflow">if</span>( on_current ) <a name="l00174"></a>00174 desk = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a45">currentDesktop</a>(); <a name="l00175"></a>00175 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( maincl != NULL ) <a name="l00176"></a>00176 desk = maincl-><a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>(); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <span class="keywordflow">if</span> ( info->desktop() ) <a name="l00179"></a>00179 desk = info->desktop(); <span class="comment">// window had the initial desktop property, force it</span> <a name="l00180"></a>00180 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>() == 0 && asn_valid && asn_data.desktop() != 0 ) <a name="l00181"></a>00181 desk = asn_data.desktop(); <a name="l00182"></a>00182 } <a name="l00183"></a>00183 <span class="keywordflow">if</span> ( desk == 0 ) <span class="comment">// assume window wants to be visible on the current desktop</span> <a name="l00184"></a>00184 desk = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a45">currentDesktop</a>(); <a name="l00185"></a>00185 desk = <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()-><a class="code" href="classKWinInternal_1_1WindowRules.html#a13">checkDesktop</a>( desk, !isMapped ); <a name="l00186"></a>00186 <span class="keywordflow">if</span>( desk != NET::OnAllDesktops ) <span class="comment">// do range check</span> <a name="l00187"></a>00187 desk = KMAX( 1, KMIN( <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()->numberOfDesktops(), desk )); <a name="l00188"></a>00188 info->setDesktop( desk ); <a name="l00189"></a>00189 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a66">updateOnAllDesktopsOfTransients</a>( <span class="keyword">this</span> ); <span class="comment">// SELI</span> <a name="l00190"></a>00190 <span class="comment">// onAllDesktopsChange(); decoration doesn't exist here yet</span> <a name="l00191"></a>00191 <a name="l00192"></a>00192 QRect geom( attr.x, attr.y, attr.width, attr.height ); <a name="l00193"></a>00193 <span class="keywordtype">bool</span> placementDone = FALSE; <a name="l00194"></a>00194 <a name="l00195"></a>00195 <span class="keywordflow">if</span> ( session ) <a name="l00196"></a>00196 geom = session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o6">geometry</a>; <a name="l00197"></a>00197 <a name="l00198"></a>00198 QRect area; <a name="l00199"></a>00199 <span class="keywordtype">bool</span> partial_keep_in_area = isMapped || session; <a name="l00200"></a>00200 <span class="keywordflow">if</span>( isMapped || session ) <a name="l00201"></a>00201 area = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( FullArea, geom.center(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00202"></a>00202 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="namespaceKWinInternal.html#a13">options</a>-><a class="code" href="classKWinInternal_1_1Options.html#o10">xineramaPlacementEnabled</a> ) <a name="l00203"></a>00203 area = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( PlacementArea, QCursor::pos(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00204"></a>00204 <span class="keywordflow">else</span> <a name="l00205"></a>00205 area = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( PlacementArea, geom.center(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="keywordflow">if</span>( checkFullScreenHack( geom )) <a name="l00208"></a>00208 { <a name="l00209"></a>00209 fullscreen_mode = FullScreenHack; <a name="l00210"></a>00210 geom = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( FullScreenArea, geom.center(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00211"></a>00211 placementDone = <span class="keyword">true</span>; <a name="l00212"></a>00212 } <a name="l00213"></a>00213 <a name="l00214"></a>00214 <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a87">isDesktop</a>() ) <a name="l00215"></a>00215 { <a name="l00216"></a>00216 <span class="comment">// desktops are treated slightly special</span> <a name="l00217"></a>00217 geom = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( FullArea, geom.center(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00218"></a>00218 placementDone = <span class="keyword">true</span>; <a name="l00219"></a>00219 } <a name="l00220"></a>00220 <a name="l00221"></a>00221 <span class="keywordtype">bool</span> usePosition = <span class="keyword">false</span>; <a name="l00222"></a>00222 <span class="keywordflow">if</span> ( isMapped || session || placementDone ) <a name="l00223"></a>00223 placementDone = <span class="keyword">true</span>; <span class="comment">// use geometry</span> <a name="l00224"></a>00224 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a8">isTransient</a>() && !<a class="code" href="classKWinInternal_1_1Client.html#a95">isUtility</a>() && !<a class="code" href="classKWinInternal_1_1Client.html#a93">isDialog</a>() && !<a class="code" href="classKWinInternal_1_1Client.html#a94">isSplash</a>()) <a name="l00225"></a>00225 usePosition = <span class="keyword">true</span>; <a name="l00226"></a>00226 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a8">isTransient</a>() && !<a class="code" href="classKWinInternal_1_1Client.html#a85">hasNETSupport</a>()) <a name="l00227"></a>00227 usePosition = <span class="keyword">true</span>; <a name="l00228"></a>00228 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a93">isDialog</a>() && <a class="code" href="classKWinInternal_1_1Client.html#a85">hasNETSupport</a>()) <a name="l00229"></a>00229 <span class="comment">// if the dialog is actually non-NETWM transient window, don't try to apply placement to it,</span> <a name="l00230"></a>00230 <span class="comment">// it breaks with too many things (xmms, display)</span> <a name="l00231"></a>00231 { <a name="l00232"></a>00232 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a11">mainClients</a>().count() >= 1 ) <a name="l00233"></a>00233 { <a name="l00234"></a>00234 <span class="preprocessor">#if 1</span> <a name="l00235"></a>00235 <span class="preprocessor"></span> <span class="comment">// TODO #78082 - Ok, it seems there are after all some cases when an application has a good</span> <a name="l00236"></a>00236 <span class="comment">// reason to specify a position for its dialog. Too bad other WMs have never bothered</span> <a name="l00237"></a>00237 <span class="comment">// with placement for dialogs, so apps always specify positions for their dialogs,</span> <a name="l00238"></a>00238 <span class="comment">// including such silly positions like always centered on the screen or under mouse.</span> <a name="l00239"></a>00239 <span class="comment">// Using ignoring requested position in window-specific settings helps, but at least</span> <a name="l00240"></a>00240 <span class="comment">// for Qt apps this should work better.</span> <a name="l00241"></a>00241 usePosition = <span class="keyword">true</span>; <a name="l00242"></a>00242 <span class="preprocessor">#else</span> <a name="l00243"></a>00243 <span class="preprocessor"></span> ; <span class="comment">// force using placement policy</span> <a name="l00244"></a>00244 <span class="preprocessor">#endif</span> <a name="l00245"></a>00245 <span class="preprocessor"></span> } <a name="l00246"></a>00246 <span class="keywordflow">else</span> <a name="l00247"></a>00247 usePosition = <span class="keyword">true</span>; <a name="l00248"></a>00248 } <a name="l00249"></a>00249 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a94">isSplash</a>()) <a name="l00250"></a>00250 ; <span class="comment">// force using placement policy</span> <a name="l00251"></a>00251 <span class="keywordflow">else</span> <a name="l00252"></a>00252 usePosition = <span class="keyword">true</span>; <a name="l00253"></a>00253 <span class="keywordflow">if</span>( !<a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()-><a class="code" href="classKWinInternal_1_1WindowRules.html#a12">checkIgnorePosition</a>( !usePosition )) <a name="l00254"></a>00254 { <a name="l00255"></a>00255 <span class="keywordtype">bool</span> ignorePPosition = ( <a class="code" href="namespaceKWinInternal.html#a13">options</a>-><a class="code" href="classKWinInternal_1_1Options.html#o25">ignorePositionClasses</a>.contains(QString::fromLatin1(<a class="code" href="classKWinInternal_1_1Client.html#a127">resourceClass</a>()))); <a name="l00256"></a>00256 <a name="l00257"></a>00257 <span class="keywordflow">if</span> ( ( (xSizeHint.flags & PPosition) && !ignorePPosition ) || <a name="l00258"></a>00258 (xSizeHint.flags & USPosition) ) <a name="l00259"></a>00259 { <a name="l00260"></a>00260 placementDone = TRUE; <a name="l00261"></a>00261 <span class="comment">// disobey xinerama placement option for now (#70943)</span> <a name="l00262"></a>00262 area = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( PlacementArea, geom.center(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00263"></a>00263 } <a name="l00264"></a>00264 } <a name="l00265"></a>00265 <span class="keywordflow">if</span>( true ) <span class="comment">// size is always obeyed for now, only with constraints applied</span> <a name="l00266"></a>00266 <span class="keywordflow">if</span> ( (xSizeHint.flags & USSize) || (xSizeHint.flags & PSize) ) <a name="l00267"></a>00267 { <a name="l00268"></a>00268 <span class="comment">// keep in mind that we now actually have a size :-)</span> <a name="l00269"></a>00269 } <a name="l00270"></a>00270 <a name="l00271"></a>00271 <span class="keywordflow">if</span> (xSizeHint.flags & PMaxSize) <a name="l00272"></a>00272 geom.setSize( geom.size().boundedTo( <a name="l00273"></a>00273 <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkMaxSize( QSize(xSizeHint.max_width, xSizeHint.max_height ) ) ) ); <a name="l00274"></a>00274 <span class="keywordflow">if</span> (xSizeHint.flags & PMinSize) <a name="l00275"></a>00275 geom.setSize( geom.size().expandedTo( <a name="l00276"></a>00276 <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkMinSize( QSize(xSizeHint.min_width, xSizeHint.min_height ) ) ) ); <a name="l00277"></a>00277 <a name="l00278"></a>00278 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a86">isMovable</a>()) <a name="l00279"></a>00279 { <a name="l00280"></a>00280 <span class="keywordflow">if</span>( geom.x() > area.right() || geom.y() > area.bottom()) <a name="l00281"></a>00281 placementDone = FALSE; <span class="comment">// weird, do not trust.</span> <a name="l00282"></a>00282 } <a name="l00283"></a>00283 <a name="l00284"></a>00284 <span class="keywordflow">if</span> ( placementDone ) <a name="l00285"></a>00285 <a class="code" href="classKWinInternal_1_1Client.html#a111">move</a>( geom.x(), geom.y() ); <span class="comment">// before gravitating</span> <a name="l00286"></a>00286 <a name="l00287"></a>00287 <a class="code" href="classKWinInternal_1_1Client.html#a105">updateDecoration</a>( <span class="keyword">false</span> ); <span class="comment">// also gravitates</span> <a name="l00288"></a>00288 <span class="comment">// TODO is CentralGravity right here, when resizing is done after gravitating?</span> <a name="l00289"></a>00289 <a class="code" href="classKWinInternal_1_1Client.html#a113">plainResize</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkSize( sizeForClientSize( geom.size()), !isMapped )); <a name="l00290"></a>00290 <a name="l00291"></a>00291 QPoint forced_pos = <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()-><a class="code" href="classKWinInternal_1_1WindowRules.html#a6">checkPosition</a>( invalidPoint, !isMapped ); <a name="l00292"></a>00292 <span class="keywordflow">if</span>( forced_pos != invalidPoint ) <a name="l00293"></a>00293 { <a name="l00294"></a>00294 <a class="code" href="classKWinInternal_1_1Client.html#a111">move</a>( forced_pos ); <a name="l00295"></a>00295 placementDone = <span class="keyword">true</span>; <a name="l00296"></a>00296 <span class="comment">// don't keep inside workarea if the window has specially configured position</span> <a name="l00297"></a>00297 partial_keep_in_area = <span class="keyword">true</span>; <a name="l00298"></a>00298 area = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a8">clientArea</a>( FullArea, geom.center(), <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00299"></a>00299 } <a name="l00300"></a>00300 <span class="keywordflow">if</span>( !placementDone ) <a name="l00301"></a>00301 { <span class="comment">// placement needs to be after setting size</span> <a name="l00302"></a>00302 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a30">place</a>( <span class="keyword">this</span>, area ); <a name="l00303"></a>00303 placementDone = TRUE; <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <a name="l00306"></a>00306 <span class="keywordflow">if</span>(( !<a class="code" href="classKWinInternal_1_1Client.html#a97">isSpecialWindow</a>() || <a class="code" href="classKWinInternal_1_1Client.html#a89">isToolbar</a>()) && <a class="code" href="classKWinInternal_1_1Client.html#a86">isMovable</a>()) <a name="l00307"></a>00307 <a class="code" href="classKWinInternal_1_1Client.html#a115">keepInArea</a>( area, partial_keep_in_area ); <a name="l00308"></a>00308 <a name="l00309"></a>00309 XShapeSelectInput( qt_xdisplay(), <a class="code" href="classKWinInternal_1_1Client.html#a1">window</a>(), ShapeNotifyMask ); <a name="l00310"></a>00310 <span class="keywordflow">if</span> ( (is_shape = <a class="code" href="classKWinInternal_1_1Shape.html#e1">Shape::hasShape</a>( <a class="code" href="classKWinInternal_1_1Client.html#a1">window</a>())) ) <a name="l00311"></a>00311 { <a name="l00312"></a>00312 <a class="code" href="classKWinInternal_1_1Client.html#a108">updateShape</a>(); <a name="l00313"></a>00313 } <a name="l00314"></a>00314 <span class="comment">// else</span> <a name="l00315"></a>00315 <span class="comment">// setShapable(FALSE);</span> <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="comment">//CT extra check for stupid jdk 1.3.1. But should make sense in general</span> <a name="l00318"></a>00318 <span class="comment">// if client has initial state set to Iconic and is transient with a parent</span> <a name="l00319"></a>00319 <span class="comment">// window that is not Iconic, set init_state to Normal</span> <a name="l00320"></a>00320 <span class="keywordflow">if</span>( init_minimize && <a class="code" href="classKWinInternal_1_1Client.html#a8">isTransient</a>()) <a name="l00321"></a>00321 { <a name="l00322"></a>00322 <a class="code" href="namespaceKWinInternal.html#a24">ClientList</a> mainclients = <a class="code" href="classKWinInternal_1_1Client.html#a11">mainClients</a>(); <a name="l00323"></a>00323 <span class="keywordflow">for</span>( ClientList::ConstIterator it = mainclients.begin(); <a name="l00324"></a>00324 it != mainclients.end(); <a name="l00325"></a>00325 ++it ) <a name="l00326"></a>00326 <span class="keywordflow">if</span>( (*it)->isShown( <span class="keyword">true</span> )) <a name="l00327"></a>00327 init_minimize = <span class="keyword">false</span>; <span class="comment">// SELI even e.g. for NET::Utility?</span> <a name="l00328"></a>00328 } <a name="l00329"></a>00329 <a name="l00330"></a>00330 <span class="keywordflow">if</span>( init_minimize ) <a name="l00331"></a>00331 <a class="code" href="classKWinInternal_1_1Client.html#a151">minimize</a>( <span class="keyword">true</span> ); <span class="comment">// no animation</span> <a name="l00332"></a>00332 <a name="l00333"></a>00333 <span class="comment">// SELI this seems to be mainly for kstart and ksystraycmd</span> <a name="l00334"></a>00334 <span class="comment">// probably should be replaced by something better</span> <a name="l00335"></a>00335 <span class="keywordtype">bool</span> doNotShow = <span class="keyword">false</span>; <a name="l00336"></a>00336 <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()->isNotManaged( <a class="code" href="classKWinInternal_1_1Client.html#a136">caption</a>() ) ) <a name="l00337"></a>00337 doNotShow = TRUE; <a name="l00338"></a>00338 <a name="l00339"></a>00339 <span class="comment">// other settings from the previous session</span> <a name="l00340"></a>00340 <span class="keywordflow">if</span> ( session ) <a name="l00341"></a>00341 { <a name="l00342"></a>00342 <span class="comment">// session restored windows are not considered to be new windows WRT rules,</span> <a name="l00343"></a>00343 <span class="comment">// i.e. obey only forcing rules</span> <a name="l00344"></a>00344 <a class="code" href="classKWinInternal_1_1Client.html#a75">setKeepAbove</a>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o15">keepAbove</a> ); <a name="l00345"></a>00345 <a class="code" href="classKWinInternal_1_1Client.html#a77">setKeepBelow</a>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o16">keepBelow</a> ); <a name="l00346"></a>00346 <a class="code" href="classKWinInternal_1_1Client.html#a71">setSkipTaskbar</a>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o17">skipTaskbar</a>, <span class="keyword">true</span> ); <a name="l00347"></a>00347 <a class="code" href="classKWinInternal_1_1Client.html#a73">setSkipPager</a>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o18">skipPager</a> ); <a name="l00348"></a>00348 <a class="code" href="classKWinInternal_1_1Client.html#a52">setShade</a>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o14">shaded</a> ? ShadeNormal : ShadeNone ); <a name="l00349"></a>00349 <span class="keywordflow">if</span>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o9">maximized</a> != <a class="code" href="classKDecorationDefines.html#w71w9">MaximizeRestore</a> ) <a name="l00350"></a>00350 { <a name="l00351"></a>00351 <a class="code" href="classKWinInternal_1_1Client.html#a155">maximize</a>( (<a class="code" href="classKDecorationDefines.html#w71">MaximizeMode</a>) session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o9">maximized</a> ); <a name="l00352"></a>00352 geom_restore = session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o7">restore</a>; <a name="l00353"></a>00353 } <a name="l00354"></a>00354 <span class="keywordflow">if</span>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o10">fullscreen</a> == FullScreenHack ) <a name="l00355"></a>00355 ; <span class="comment">// nothing, this should be already set again above</span> <a name="l00356"></a>00356 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o10">fullscreen</a> != FullScreenNone ) <a name="l00357"></a>00357 { <a name="l00358"></a>00358 <a class="code" href="classKWinInternal_1_1Client.html#a60">setFullScreen</a>( <span class="keyword">true</span>, <span class="keyword">false</span> ); <a name="l00359"></a>00359 geom_fs_restore = session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o8">fsrestore</a>; <a name="l00360"></a>00360 } <a name="l00361"></a>00361 } <a name="l00362"></a>00362 <span class="keywordflow">else</span> <a name="l00363"></a>00363 { <a name="l00364"></a>00364 geom_restore = <a class="code" href="classKWinInternal_1_1Client.html#a21">geometry</a>(); <span class="comment">// remember restore geometry</span> <a name="l00365"></a>00365 <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a55">isMaximizable</a>() <a name="l00366"></a>00366 && ( <a class="code" href="classKWinInternal_1_1Client.html#a29">width</a>() >= area.width() || <a class="code" href="classKWinInternal_1_1Client.html#a30">height</a>() >= area.height() ) ) <a name="l00367"></a>00367 { <a name="l00368"></a>00368 <span class="comment">// window is too large for the screen, maximize in the</span> <a name="l00369"></a>00369 <span class="comment">// directions necessary</span> <a name="l00370"></a>00370 <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a29">width</a>() >= area.width() && <a class="code" href="classKWinInternal_1_1Client.html#a30">height</a>() >= area.height() ) <a name="l00371"></a>00371 { <a name="l00372"></a>00372 <a class="code" href="classKWinInternal_1_1Client.html#a155">maximize</a>( <a class="code" href="classKDecorationDefines.html#w71w12">Client::MaximizeFull</a> ); <a name="l00373"></a>00373 geom_restore = QRect(); <span class="comment">// use placement when unmaximizing</span> <a name="l00374"></a>00374 } <a name="l00375"></a>00375 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a29">width</a>() >= area.width() ) <a name="l00376"></a>00376 { <a name="l00377"></a>00377 <a class="code" href="classKWinInternal_1_1Client.html#a155">maximize</a>( <a class="code" href="classKDecorationDefines.html#w71w11">Client::MaximizeHorizontal</a> ); <a name="l00378"></a>00378 geom_restore = QRect(); <span class="comment">// use placement when unmaximizing</span> <a name="l00379"></a>00379 geom_restore.setY( <a class="code" href="classKWinInternal_1_1Client.html#a28">y</a>()); <span class="comment">// but only for horizontal direction</span> <a name="l00380"></a>00380 geom_restore.setHeight( <a class="code" href="classKWinInternal_1_1Client.html#a30">height</a>()); <a name="l00381"></a>00381 } <a name="l00382"></a>00382 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a30">height</a>() >= area.height() ) <a name="l00383"></a>00383 { <a name="l00384"></a>00384 <a class="code" href="classKWinInternal_1_1Client.html#a155">maximize</a>( <a class="code" href="classKDecorationDefines.html#w71w10">Client::MaximizeVertical</a> ); <a name="l00385"></a>00385 geom_restore = QRect(); <span class="comment">// use placement when unmaximizing</span> <a name="l00386"></a>00386 geom_restore.setX( <a class="code" href="classKWinInternal_1_1Client.html#a27">x</a>()); <span class="comment">// but only for vertical direction</span> <a name="l00387"></a>00387 geom_restore.setWidth( <a class="code" href="classKWinInternal_1_1Client.html#a29">width</a>()); <a name="l00388"></a>00388 } <a name="l00389"></a>00389 } <a name="l00390"></a>00390 <span class="comment">// window may want to be maximized</span> <a name="l00391"></a>00391 <span class="comment">// done after checking that the window isn't larger than the workarea, so that</span> <a name="l00392"></a>00392 <span class="comment">// the restore geometry from the checks above takes precedence, and window</span> <a name="l00393"></a>00393 <span class="comment">// isn't restored larger than the workarea</span> <a name="l00394"></a>00394 <a class="code" href="classKDecorationDefines.html#w71">MaximizeMode</a> maxmode = static_cast< MaximizeMode > <a name="l00395"></a>00395 ((( info->state() & NET::MaxVert ) ? <a class="code" href="classKDecorationDefines.html#w71w10">MaximizeVertical</a> : 0 ) <a name="l00396"></a>00396 | (( info->state() & NET::MaxHoriz ) ? <a class="code" href="classKDecorationDefines.html#w71w11">MaximizeHorizontal</a> : 0 )); <a name="l00397"></a>00397 <a class="code" href="classKDecorationDefines.html#w71">MaximizeMode</a> forced_maxmode = <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()-><a class="code" href="classKWinInternal_1_1WindowRules.html#a15">checkMaximize</a>( maxmode, !isMapped ); <a name="l00398"></a>00398 <span class="comment">// either hints were set to maximize, or is forced to maximize,</span> <a name="l00399"></a>00399 <span class="comment">// or is forced to non-maximize and hints were set to maximize</span> <a name="l00400"></a>00400 <span class="keywordflow">if</span>( forced_maxmode != <a class="code" href="classKDecorationDefines.html#w71w9">MaximizeRestore</a> || maxmode != <a class="code" href="classKDecorationDefines.html#w71w9">MaximizeRestore</a> ) <a name="l00401"></a>00401 <a class="code" href="classKWinInternal_1_1Client.html#a155">maximize</a>( forced_maxmode ); <a name="l00402"></a>00402 <a name="l00403"></a>00403 <span class="comment">// read other initial states</span> <a name="l00404"></a>00404 <a class="code" href="classKWinInternal_1_1Client.html#a52">setShade</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkShade( info->state() & NET::Shaded ? ShadeNormal : ShadeNone, !isMapped )); <a name="l00405"></a>00405 <a class="code" href="classKWinInternal_1_1Client.html#a75">setKeepAbove</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkKeepAbove( info->state() & NET::KeepAbove, !isMapped )); <a name="l00406"></a>00406 <a class="code" href="classKWinInternal_1_1Client.html#a77">setKeepBelow</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkKeepBelow( info->state() & NET::KeepBelow, !isMapped )); <a name="l00407"></a>00407 <a class="code" href="classKWinInternal_1_1Client.html#a71">setSkipTaskbar</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkSkipTaskbar( info->state() & NET::SkipTaskbar, !isMapped ), true ); <a name="l00408"></a>00408 <a class="code" href="classKWinInternal_1_1Client.html#a73">setSkipPager</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkSkipPager( info->state() & NET::SkipPager, !isMapped )); <a name="l00409"></a>00409 <span class="keywordflow">if</span>( info->state() & NET::DemandsAttention ) <a name="l00410"></a>00410 <a class="code" href="classKWinInternal_1_1Client.html#a102">demandAttention</a>(); <a name="l00411"></a>00411 <span class="keywordflow">if</span>( info->state() & NET::Modal ) <a name="l00412"></a>00412 <a class="code" href="classKWinInternal_1_1Client.html#a81">setModal</a>( <span class="keyword">true</span> ); <a name="l00413"></a>00413 <span class="keywordflow">if</span>( fullscreen_mode != FullScreenHack && <a class="code" href="classKWinInternal_1_1Client.html#a62">isFullScreenable</a>()) <a name="l00414"></a>00414 <a class="code" href="classKWinInternal_1_1Client.html#a60">setFullScreen</a>( <a class="code" href="classKWinInternal_1_1Client.html#a20">rules</a>()->checkFullScreen( info->state() & NET::FullScreen, !isMapped ), false ); <a name="l00415"></a>00415 } <a name="l00416"></a>00416 <a name="l00417"></a>00417 updateAllowedActions( <span class="keyword">true</span> ); <a name="l00418"></a>00418 <a name="l00419"></a>00419 <span class="comment">// TODO this should avoid flicker, because real restacking is done</span> <a name="l00420"></a>00420 <span class="comment">// only after manage() finishes, but the window is shown sooner</span> <a name="l00421"></a>00421 <span class="comment">// - keep it?</span> <a name="l00422"></a>00422 XLowerWindow( qt_xdisplay(), <a class="code" href="classKWinInternal_1_1Client.html#a2">frameId</a>()); <a name="l00423"></a>00423 <a name="l00424"></a>00424 user_time = readUserTimeMapTimestamp( asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session ); <a name="l00425"></a>00425 <a name="l00426"></a>00426 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a90">isTopMenu</a>()) <span class="comment">// they're shown in Workspace::addClient() if their mainwindow</span> <a name="l00427"></a>00427 <a class="code" href="classKWinInternal_1_1Client.html#a134">hideClient</a>( <span class="keyword">true</span> ); <span class="comment">// is the active one</span> <a name="l00428"></a>00428 <a name="l00429"></a>00429 <span class="keywordflow">if</span> ( <a class="code" href="classKWinInternal_1_1Client.html#a49">isShown</a>( <span class="keyword">true</span> ) && !doNotShow ) <a name="l00430"></a>00430 { <a name="l00431"></a>00431 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a93">isDialog</a>()) <a name="l00432"></a>00432 <a class="code" href="classKWinInternal_1_1Notify.html#e0">Notify::raise</a>( Notify::TransNew ); <a name="l00433"></a>00433 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a92">isNormalWindow</a>()) <a name="l00434"></a>00434 <a class="code" href="classKWinInternal_1_1Notify.html#e0">Notify::raise</a>( Notify::New ); <a name="l00435"></a>00435 <a name="l00436"></a>00436 <span class="keywordtype">bool</span> allow; <a name="l00437"></a>00437 <span class="keywordflow">if</span>( session ) <a name="l00438"></a>00438 allow = session-><a class="code" href="structKWinInternal_1_1SessionInfo.html#o22">active</a> && !<a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a104">wasUserInteraction</a>(); <a name="l00439"></a>00439 <span class="keywordflow">else</span> <a name="l00440"></a>00440 allow = <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a20">allowClientActivation</a>( <span class="keyword">this</span>, <a class="code" href="classKWinInternal_1_1Client.html#a148">userTime</a>(), <span class="keyword">false</span> ); <a name="l00441"></a>00441 <a name="l00442"></a>00442 <span class="comment">// if session saving, force showing new windows (i.e. "save file?" dialogs etc.)</span> <a name="l00443"></a>00443 <span class="comment">// also force if activation is allowed</span> <a name="l00444"></a>00444 <span class="keywordflow">if</span>( !<a class="code" href="classKWinInternal_1_1Client.html#a46">isOnCurrentDesktop</a>() && !isMapped && !session && ( allow || <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a105">sessionSaving</a>())) <a name="l00445"></a>00445 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a76">setCurrentDesktop</a>( <a class="code" href="classKWinInternal_1_1Client.html#a43">desktop</a>()); <a name="l00446"></a>00446 <a name="l00447"></a>00447 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1Client.html#a46">isOnCurrentDesktop</a>()) <a name="l00448"></a>00448 { <a name="l00449"></a>00449 setMappingState( NormalState ); <a name="l00450"></a>00450 <a name="l00451"></a>00451 <span class="keywordflow">if</span>( isMapped ) <a name="l00452"></a>00452 { <a name="l00453"></a>00453 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a34">raiseClient</a>( <span class="keyword">this</span> ); <a name="l00454"></a>00454 rawShow(); <a name="l00455"></a>00455 } <a name="l00456"></a>00456 <span class="keywordflow">else</span> <a name="l00457"></a>00457 { <a name="l00458"></a>00458 <span class="keywordflow">if</span>( allow ) <a name="l00459"></a>00459 { <a name="l00460"></a>00460 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a34">raiseClient</a>( <span class="keyword">this</span> ); <a name="l00461"></a>00461 rawShow(); <a name="l00462"></a>00462 <span class="keywordflow">if</span>( !<a class="code" href="classKWinInternal_1_1Client.html#a97">isSpecialWindow</a>() || <a class="code" href="classKWinInternal_1_1Client.html#a96">isOverride</a>()) <a name="l00463"></a>00463 <span class="keywordflow">if</span> ( <a class="code" href="namespaceKWinInternal.html#a13">options</a>-><a class="code" href="classKWinInternal_1_1Options.html#a3">focusPolicyIsReasonable</a>() && <a class="code" href="classKWinInternal_1_1Client.html#a83">wantsTabFocus</a>() ) <a name="l00464"></a>00464 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a17">requestFocus</a>( <span class="keyword">this</span> ); <a name="l00465"></a>00465 } <a name="l00466"></a>00466 <span class="keywordflow">else</span> <a name="l00467"></a>00467 { <a name="l00468"></a>00468 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a38">restackClientUnderActive</a>( <span class="keyword">this</span> ); <a name="l00469"></a>00469 rawShow(); <a name="l00470"></a>00470 <span class="keywordflow">if</span>( !session && ( !<a class="code" href="classKWinInternal_1_1Client.html#a97">isSpecialWindow</a>() || <a class="code" href="classKWinInternal_1_1Client.html#a96">isOverride</a>())) <a name="l00471"></a>00471 <a class="code" href="classKWinInternal_1_1Client.html#a102">demandAttention</a>(); <a name="l00472"></a>00472 } <a name="l00473"></a>00473 } <a name="l00474"></a>00474 } <a name="l00475"></a>00475 <span class="keywordflow">else</span> <a name="l00476"></a>00476 { <a name="l00477"></a>00477 <a class="code" href="classKWinInternal_1_1Client.html#a135">virtualDesktopChange</a>(); <a name="l00478"></a>00478 <a class="code" href="classKWinInternal_1_1Client.html#a5">workspace</a>()-><a class="code" href="classKWinInternal_1_1Workspace.html#a34">raiseClient</a>( <span class="keyword">this</span> ); <a name="l00479"></a>00479 <span class="keywordflow">if</span>( !session && !isMapped ) <a name="l00480"></a>00480 <a class="code" href="classKWinInternal_1_1Client.html#a102">demandAttention</a>(); <a name="l00481"></a>00481 } <a name="l00482"></a>00482 } <a name="l00483"></a>00483 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( !doNotShow ) <span class="comment">// !isShown()</span> <a name="l00484"></a>00484 { <a name="l00485"></a>00485 rawHide(); <a name="l00486"></a>00486 setMappingState( IconicState ); <a name="l00487"></a>00487 } <a name="l00488"></a>00488 <span class="keywordflow">else</span> <span class="comment">// doNotShow</span> <a name="l00489"></a>00489 { <span class="comment">// SELI HACK !!!</span> <a name="l00490"></a>00490 <a class="code" href="classKWinInternal_1_1Client.html#a134">hideClient</a>( <span class="keyword">true</span> ); <a name="l00491"></a>00491 setMappingState( IconicState ); <a name="l00492"></a>00492 } <a name="l00493"></a>00493 assert( mappingState() != WithdrawnState ); <a name="l00494"></a>00494 <a name="l00495"></a>00495 <span class="keywordflow">if</span>( user_time == CurrentTime || user_time == -1U ) <span class="comment">// no known user time, set something old</span> <a name="l00496"></a>00496 { <a name="l00497"></a>00497 user_time = qt_x_time - 1000000; <a name="l00498"></a>00498 <span class="keywordflow">if</span>( user_time == CurrentTime || user_time == -1U ) <span class="comment">// let's be paranoid</span> <a name="l00499"></a>00499 user_time = qt_x_time - 1000000 + 10; <a name="l00500"></a>00500 } <a name="l00501"></a>00501 <a name="l00502"></a>00502 updateWorkareaDiffs(); <a name="l00503"></a>00503 <a name="l00504"></a>00504 <span class="comment">// sendSyntheticConfigureNotify(); done when setting mapping state</span> <a name="l00505"></a>00505 <a name="l00506"></a>00506 <span class="keyword">delete</span> session; <a name="l00507"></a>00507 <a name="l00508"></a>00508 <a class="code" href="namespaceKWinInternal.html#a106">ungrabXServer</a>(); <a name="l00509"></a>00509 <a name="l00510"></a>00510 client_rules.<a class="code" href="classKWinInternal_1_1WindowRules.html#a3">discardTemporary</a>(); <a name="l00511"></a>00511 updateWindowRules(); <span class="comment">// was blocked while !isManaged()</span> <a name="l00512"></a>00512 <a name="l00513"></a>00513 <span class="comment">// TODO there's a small problem here - isManaged() depends on the mapping state,</span> <a name="l00514"></a>00514 <span class="comment">// but this client is not yet in Workspace's client list at this point, will</span> <a name="l00515"></a>00515 <span class="comment">// be only done in addClient()</span> <a name="l00516"></a>00516 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00517"></a>00517 } <a name="l00518"></a>00518 <a name="l00519"></a>00519 <span class="comment">// called only from manage()</span> <a name="l00520"></a>00520 <span class="keywordtype">void</span> Client::embedClient( Window w, <span class="keyword">const</span> XWindowAttributes &attr ) <a name="l00521"></a>00521 { <a name="l00522"></a>00522 assert( client == None ); <a name="l00523"></a>00523 assert( frame == None ); <a name="l00524"></a>00524 assert( wrapper == None ); <a name="l00525"></a>00525 client = w; <a name="l00526"></a>00526 <span class="comment">// we don't want the window to be destroyed when we are destroyed</span> <a name="l00527"></a>00527 XAddToSaveSet( qt_xdisplay(), client ); <a name="l00528"></a>00528 XSelectInput( qt_xdisplay(), client, NoEventMask ); <a name="l00529"></a>00529 XUnmapWindow( qt_xdisplay(), client ); <a name="l00530"></a>00530 XWindowChanges wc; <span class="comment">// set the border width to 0</span> <a name="l00531"></a>00531 wc.border_width = 0; <span class="comment">// TODO possibly save this, and also use it for initial configuring of the window</span> <a name="l00532"></a>00532 XConfigureWindow( qt_xdisplay(), client, CWBorderWidth, &wc ); <a name="l00533"></a>00533 <a name="l00534"></a>00534 XSetWindowAttributes swa; <a name="l00535"></a>00535 swa.colormap = attr.colormap; <a name="l00536"></a>00536 swa.background_pixmap = None; <a name="l00537"></a>00537 swa.border_pixel = 0; <a name="l00538"></a>00538 <a name="l00539"></a>00539 frame = XCreateWindow( qt_xdisplay(), qt_xrootwin(), 0, 0, 1, 1, 0, <a name="l00540"></a>00540 attr.depth, InputOutput, attr.visual, <a name="l00541"></a>00541 CWColormap | CWBackPixmap | CWBorderPixel, &swa ); <a name="l00542"></a>00542 wrapper = XCreateWindow( qt_xdisplay(), frame, 0, 0, 1, 1, 0, <a name="l00543"></a>00543 attr.depth, InputOutput, attr.visual, <a name="l00544"></a>00544 CWColormap | CWBackPixmap | CWBorderPixel, &swa ); <a name="l00545"></a>00545 <a name="l00546"></a>00546 XDefineCursor( qt_xdisplay(), frame, arrowCursor.handle()); <a name="l00547"></a>00547 <span class="comment">// some apps are stupid and don't define their own cursor - set the arrow one for them</span> <a name="l00548"></a>00548 XDefineCursor( qt_xdisplay(), wrapper, arrowCursor.handle()); <a name="l00549"></a>00549 XReparentWindow( qt_xdisplay(), client, wrapper, 0, 0 ); <a name="l00550"></a>00550 XSelectInput( qt_xdisplay(), frame, <a name="l00551"></a>00551 KeyPressMask | KeyReleaseMask | <a name="l00552"></a>00552 ButtonPressMask | ButtonReleaseMask | <a name="l00553"></a>00553 KeymapStateMask | <a name="l00554"></a>00554 ButtonMotionMask | <a name="l00555"></a>00555 PointerMotionMask | <a name="l00556"></a>00556 EnterWindowMask | LeaveWindowMask | <a name="l00557"></a>00557 FocusChangeMask | <a name="l00558"></a>00558 ExposureMask | <a name="l00559"></a>00559 PropertyChangeMask | <a name="l00560"></a>00560 StructureNotifyMask | SubstructureRedirectMask | <a name="l00561"></a>00561 VisibilityChangeMask ); <a name="l00562"></a>00562 XSelectInput( qt_xdisplay(), wrapper, <a class="code" href="namespaceKWinInternal.html#a23">ClientWinMask</a> | SubstructureNotifyMask ); <a name="l00563"></a>00563 XSelectInput( qt_xdisplay(), client, <a name="l00564"></a>00564 FocusChangeMask | <a name="l00565"></a>00565 PropertyChangeMask | <a name="l00566"></a>00566 ColormapChangeMask | <a name="l00567"></a>00567 EnterWindowMask | LeaveWindowMask | <a name="l00568"></a>00568 KeyPressMask | KeyReleaseMask <a name="l00569"></a>00569 ); <a name="l00570"></a>00570 <a class="code" href="classKWinInternal_1_1Client.html#a139">updateMouseGrab</a>(); <a name="l00571"></a>00571 } <a name="l00572"></a>00572 <a name="l00573"></a>00573 } <span class="comment">// namespace</span> </pre></div></div> <div id="bottom-nav"> <img src="../../common/bottom2.png" align="right" height="59" width="227" alt="KDE Logo"> </div> <div class="bottom"> This file is part of the documentation for kwin Library Version 3.4.2. </div> <div class="bottom" style="color:#cccccc"> Documentation copyright © 1996-2004 the KDE developers.<br> Generated on Wed Jun 14 19:06:09 2006 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.4.4 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2003 </div> </body> </html>