<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -151,6 +151,17 @@ version 1.2
 ? 7.7.
 + 7. (rest of the section)
 
+
++ _NET_WM_FULLSCREEN_MONITORS	Status: Done.
+        +----------------------------------------------------------------+
+	| The Window Manager MUST keep this list updated to reflect the  |
+	| current state of the window. The application window sends this |
+	| in a ClientMessage to the root window. KWin persists this info |
+	| both internally as well as against the application window.     |
+	| This data is used to spread the fullscreen application window  |
+	| across the requested topology, if valid.                       |
+	+----------------------------------------------------------------+
+
 ICCCM spec compliance (whole document):
 version 2.0
 ======================</diff>
      <filename>COMPLIANCE</filename>
    </modified>
    <modified>
      <diff>@@ -86,6 +86,7 @@ class Client
         void setupWindowRules( bool ignore_temporary );
         void applyWindowRules();
         void updateWindowRules();
+        void updateFullscreenMonitors( NETFullscreenMonitors topology );
 
     // returns true for &quot;special&quot; windows and false for windows which are &quot;normal&quot;
     // (normal=window which has a border, can be moved by the user, can be closed, etc.)
@@ -349,6 +350,7 @@ class Client
         bool isManaged() const; // returns false if this client is not yet managed
         void updateAllowedActions( bool force = false );
         QSize sizeForClientSize( const QSize&amp;, Sizemode mode = SizemodeAny, bool noframe = false ) const;
+        QRect fullscreenMonitorsArea( NETFullscreenMonitors topology ) const;
         void changeMaximize( bool horizontal, bool vertical, bool adjust );
         void checkMaximizeGeometry();
         int checkFullScreenHack( const QRect&amp; geom ) const; // 0 - none, 1 - one xinerama screen, 2 - full area
@@ -547,7 +549,7 @@ class GeometryUpdatesBlocker
 
 
 // NET WM Protocol handler class
-class WinInfo : public NETWinInfo
+class WinInfo : public NETWinInfo2
     {
     private:
         typedef KWin::Client Client; // because of NET::Client
@@ -555,6 +557,7 @@ class WinInfo : public NETWinInfo
         WinInfo( Client* c, Display * display, Window window,
                 Window rwin, const unsigned long pr[], int pr_size );
         virtual void changeDesktop(int desktop);
+        virtual void changeFullscreenMonitors(NETFullscreenMonitors topology);
         virtual void changeState( unsigned long state, unsigned long mask );
         void disable();
     private:</diff>
      <filename>client.h</filename>
    </modified>
    <modified>
      <diff>@@ -254,7 +254,7 @@ void Workspace::finishCompositing()
         { // forward all opacity values to the frame in case there'll be other CM running
         if( (*it)-&gt;opacity() != 1.0 )
             {
-            NETWinInfo i( display(), (*it)-&gt;frameId(), rootWindow(), 0 );
+            NETWinInfo2 i( display(), (*it)-&gt;frameId(), rootWindow(), 0 );
             i.setOpacity( static_cast&lt; unsigned long &gt;((*it)-&gt;opacity() * 0xffffffff ));
             }
         }</diff>
      <filename>composite.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -59,7 +59,7 @@ namespace KWin
 
 WinInfo::WinInfo( Client * c, Display * display, Window window,
     Window rwin, const unsigned long pr[], int pr_size )
-    : NETWinInfo( display, window, rwin, pr, pr_size, NET::WindowManager ), m_client( c )
+    : NETWinInfo2( display, window, rwin, pr, pr_size, NET::WindowManager ), m_client( c )
     {
     }
 
@@ -68,6 +68,11 @@ void WinInfo::changeDesktop(int desktop)
     m_client-&gt;workspace()-&gt;sendClientToDesktop( m_client, desktop, true );
     }
 
+void WinInfo::changeFullscreenMonitors( NETFullscreenMonitors topology )
+    {
+    m_client-&gt;updateFullscreenMonitors( topology );
+    }
+
 void WinInfo::changeState( unsigned long state, unsigned long mask )
     {
     mask &amp;= ~NET::Sticky; // KWin doesn't support large desktops, ignore
@@ -622,7 +627,7 @@ bool Client::windowEvent( XEvent* e )
                 }
             else
                 { // forward to the frame if there's possibly another compositing manager running
-                NETWinInfo i( display(), frameId(), rootWindow(), 0 );
+                NETWinInfo2 i( display(), frameId(), rootWindow(), 0 );
                 i.setOpacity( info-&gt;opacity());
                 }
             }</diff>
      <filename>events.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -2305,7 +2305,10 @@ void Client::setFullScreen( bool set, bool user )
     info-&gt;setState( isFullScreen() ? NET::FullScreen : 0, NET::FullScreen );
     updateDecoration( false, false );
     if( isFullScreen())
-        setGeometry( workspace()-&gt;clientArea( FullScreenArea, this ));
+        if( info-&gt;fullscreenMonitors().isSet())
+            setGeometry( fullscreenMonitorsArea( info-&gt;fullscreenMonitors()));
+        else
+            setGeometry( workspace()-&gt;clientArea( FullScreenArea, this ));
     else
         {
         if( !geom_fs_restore.isNull())
@@ -2320,6 +2323,51 @@ void Client::setFullScreen( bool set, bool user )
     workspace()-&gt;checkUnredirect();
     }
 
+
+void Client::updateFullscreenMonitors( NETFullscreenMonitors topology )
+    {
+    int nscreens = Kephal::ScreenUtils::numScreens();
+
+//    kDebug( 1212 ) &lt;&lt; &quot;incoming request with top: &quot; &lt;&lt; topology.top &lt;&lt; &quot; bottom: &quot; &lt;&lt; topology.bottom
+//                   &lt;&lt; &quot; left: &quot; &lt;&lt; topology.left &lt;&lt; &quot; right: &quot; &lt;&lt; topology.right
+//                   &lt;&lt; &quot;, we have: &quot; &lt;&lt; nscreens &lt;&lt; &quot; screens.&quot;;
+
+    if( topology.top &gt;= nscreens ||
+        topology.bottom &gt;= nscreens ||
+        topology.left &gt;= nscreens ||
+        topology.right &gt;= nscreens )
+        {
+            kWarning( 1212 ) &lt;&lt; &quot;fullscreenMonitors update failed. request higher than number of screens.&quot;;
+            return;
+        }
+
+    info-&gt;setFullscreenMonitors( topology );
+    if( isFullScreen())
+        setGeometry( fullscreenMonitorsArea( topology ));
+    }
+
+
+/*!
+  Calculates the bounding rectangle defined by the 4 monitor indices indicating the
+  top, bottom, left, and right edges of the window when the fullscreen state is enabled.
+ */
+QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const
+    {
+    QRect top, bottom, left, right, total;
+
+    top = Kephal::ScreenUtils::screenGeometry( requestedTopology.top );
+    bottom = Kephal::ScreenUtils::screenGeometry(requestedTopology.bottom );
+    left = Kephal::ScreenUtils::screenGeometry(requestedTopology.left );
+    right = Kephal::ScreenUtils::screenGeometry(requestedTopology.right );
+    total = top.united( bottom.united( left.united( right ) ) );
+
+//    kDebug( 1212 ) &lt;&lt; &quot;top: &quot; &lt;&lt; top &lt;&lt; &quot; bottom: &quot; &lt;&lt; bottom
+//                   &lt;&lt; &quot; left: &quot; &lt;&lt; left &lt;&lt; &quot; right: &quot; &lt;&lt; right;
+//    kDebug( 1212 ) &lt;&lt; &quot;returning rect: &quot; &lt;&lt; total;
+    return total;
+    }
+
+
 int Client::checkFullScreenHack( const QRect&amp; geom ) const
     {
     // if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack</diff>
      <filename>geometry.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -221,7 +221,7 @@ Group::Group( Window leader_P, Workspace* workspace_P )
         {
         leader_client = workspace_P-&gt;findClient( WindowMatchPredicate( leader_P ));
         unsigned long properties[ 2 ] = { 0, NET::WM2StartupId };
-        leader_info = new NETWinInfo( display(), leader_P, rootWindow(),
+        leader_info = new NETWinInfo2( display(), leader_P, rootWindow(),
             properties, 2 );
         }
     effect_group = new EffectWindowGroupImpl( this );</diff>
      <filename>group.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -62,7 +62,7 @@ class Group
         Client* leader_client;
         Window leader_wid;
         Workspace* _workspace;
-        NETWinInfo* leader_info;
+        NETWinInfo2* leader_info;
         Time user_time;
         int refcount;
         EffectWindowGroupImpl* effect_group;</diff>
      <filename>group.h</filename>
    </modified>
    <modified>
      <diff>@@ -94,6 +94,7 @@ bool Client::manage( Window w, bool isMapped )
         NET::WM2StartupId |
         NET::WM2ExtendedStrut |
         NET::WM2Opacity |
+        NET::WM2FullscreenMonitors |
         0;
 
     info = new WinInfo( this, display(), client, rootWindow(), properties, 2 );</diff>
      <filename>manage.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 #include &lt;X11/extensions/Xdamage.h&gt;
 #endif
 
-class NETWinInfo;
+class NETWinInfo2;
 
 namespace KWin
 {
@@ -151,7 +151,7 @@ class Toplevel
         QRect geom;
         Visual* vis;
         int bit_depth;
-        NETWinInfo* info;
+        NETWinInfo2* info;
         bool ready_for_painting;
     private:
         static QByteArray staticWindowRole(WId);</diff>
      <filename>toplevel.h</filename>
    </modified>
    <modified>
      <diff>@@ -65,7 +65,7 @@ bool Unmanaged::track( Window w )
     properties[ NETWinInfo::PROTOCOLS2 ] =
         NET::WM2Opacity |
         0;
-    info = new NETWinInfo( display(), w, rootWindow(), properties, 2 );
+    info = new NETWinInfo2( display(), w, rootWindow(), properties, 2 );
     getResourceClass();
     getWindowRole();
     getWmClientLeader();</diff>
      <filename>unmanaged.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d87c3193a8e5fcaf94ddcb0b3f76b06b6f6590c9</id>
    </parent>
  </parents>
  <author>
    <name>Jason vanRijn Kasper</name>
    <email>vR@movingparts.net</email>
  </author>
  <url>http://github.com/Zarin/kwin/commit/769c1028e9b5a3caa54ab1888eb1995c3f9297c5</url>
  <id>769c1028e9b5a3caa54ab1888eb1995c3f9297c5</id>
  <committed-date>2008-11-17T00:03:39-08:00</committed-date>
  <authored-date>2008-11-17T00:03:39-08:00</authored-date>
  <message>This change allows KWin to use the new NETWinInfo2 class (binary
compatibility class) and subsequently properly handle the
_NET_WM_FULLSCREEN_MONITORS EWMH spec hint.


git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/KDE/kdebase/workspace/kwin@885362 283d02a7-25f6-0310-bc7c-ecb5cbfe19da</message>
  <tree>9ded0a3edf2685129972841f507576e82c649c89</tree>
  <committer>
    <name>Jason vanRijn Kasper</name>
    <email>vR@movingparts.net</email>
  </committer>
</commit>
