Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-updates > by-pkgid > 7a18965e2ffd92515e6886f479af5961 > files > 182

kdebase-devel-doc-3.5.9-37.2mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!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" lang="en_US" xml:lang="en_US">

<head>
  <title>kwin: manage.cpp Source File (kwin)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta http-equiv="Content-Style-Type" content="text/css" />

  <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org"  r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org"  r (n 0 s 0 v 0 l 0))' />

  <meta name="trademark" content="KDE e.V." />
  <meta name="description" content="K Desktop Environment Homepage, KDE.org" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta name="robots" content="all" />

  <link rel="shortcut icon" href="../../favicon.ico" />

<link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" />



</head>

<body>

<div id="nav_header_top" align="right">
  <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a>

  <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a>
  <span class="doNotDisplay">::</span>

  <div id="nav_header_title" align="left">KDE API Reference</div>


</div>

<div id="nav_header_bottom" align="right">
  <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span>
  <div id="nav_header_bottom_right" style="text-align: left;">
/ <a href="../..">API Reference</a>
 / <a href=".">kwin</a>
  </div>
</div>


<table id="main" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
      <td valign="top" class="menuheader" height="0"></td>

  <td id="contentcolumn" valign="top" rowspan="2" >
    <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;">
    <a name="content"></a>


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


      </td>
  </tr>
  <tr>
    <td valign="top" id="leftmenu" width="25%">
      <a name="navigation"></a>
      <div class="menu_box"><h2>kwin</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li></ul>
<!--
<h2>Class Picker</h2>
<div style="text-align: center;">
<form name="guideform">
<select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
<option value="annotated.html">-- Choose --</option>
  <option value="classKWinInternal_1_1Client.html">kwininternal::client</option>,
</select>
</form>
</div>
-->
</div></div>
<div class="menu_box"><h2>API Dox</h2>
<div class="nav_list">
<ul>
<li><a href="../../kate/html/index.html">kate</a></li><li><a href="../../kwin/html/index.html">kwin</a></li><li>&nbsp;&nbsp;<a href="../../kwin/lib/html/index.html">lib</a></li><li><a href="../../libkonq/html/index.html">libkonq</a></li>
</ul></div></div>


        </td>
</tr>
</table>

<span class="doNotDisplay">
  <a href="http://www.kde.org/" accesskey="8">KDE Home</a> |
  <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> |
  <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a>
</span>


<div style="height: 8px"></div>

<div id="footer">
  <div id="footer_left">
    Maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">Allen Winter</a>.
<br/>
    KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
    <a href="http://www.kde.org/contact/impressum.php">Legal</a>
  </div>
  <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div>
</div>

<!--
WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL
BE BLOCKED INSTANTLY AND PERMANENTLY!
<a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a>
WARNING END
-->

</body>
</html>