Index: kdeui/windowmanagement/kwindowsystem_win.cpp
===================================================================
--- kdeui/windowmanagement/kwindowsystem_win.cpp	(revision 781317)
+++ kdeui/windowmanagement/kwindowsystem_win.cpp	(working copy)
@@ -193,14 +193,99 @@
 
 void KWindowSystem::setState( WId win, unsigned long state )
 {
-   //TODO
-   kDebug() << "KWindowSystem::setState( WId win, unsigned long state ) isn't yet implemented!";
+    if (state & NET::Modal) {
+        // TODO
+    }
+    if (state & NET::Sticky) {
+        // unsupported
+    }
+
+    if (state & NET::Max) {
+        ShowWindow( win, SW_SHOWMAXIMIZED );
+    }
+    else if (state & NET::MaxVert) {
+        // TODO
+    }
+    else if (state & NET::MaxHoriz) {
+        // TODO
+    }
+
+    if (state & NET::Shaded) {
+        // unsupported
+    }
+    if (state & NET::SkipTaskbar) {
+        // TODO, see "Managing Taskbar Buttons" at http://msdn2.microsoft.com/en-us/library/bb776822(VS.85).aspx
+    }
+    if (state & NET::KeepAbove /* same as StaysOnTop */) {
+        SetWindowPos( win, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE );
+    }
+    if (state & NET::SkipPager) {
+        // unsupported
+    }
+    if (state & NET::Hidden) {
+        SetWindowPos( win, 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
+    }
+    if (state & NET::FullScreen) {
+        UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
+        if (IsWindowVisible( win ))
+            style |= WS_VISIBLE;
+        SetWindowLongA( win, GWL_STYLE, style );
+        QRect r( s_deskWidget->screenGeometry() ); // FIXME use geometry of widget's screen, not the primary one
+        SetWindowPos( win, HWND_TOP, r.left(), r.top(), r.width(), r.height(), SWP_FRAMECHANGED );
+    }
+    if (state & NET::KeepBelow) {
+        KWindowSystem::lowerWindow( win );
+    }
+    if (state & NET::DemandsAttention) {
+        KWindowSystem::demandAttention( win, true );
+    }
+    //TODO ?
 }
 
 void KWindowSystem::clearState( WId win, unsigned long state )
 {
-    //TODO
-    kDebug() << "KWindowSystem::clearState( WId win, unsigned long state ) isn't yet implemented!";
+    if (state & NET::Modal) {
+        // TODO
+    }
+    if (state & NET::Sticky) {
+        // unsupported
+    }
+
+    if (state & NET::Max) {
+        ShowWindow( win, SW_SHOWNORMAL);
+    }
+    else if (state & NET::MaxVert) {
+        // TODO
+    }
+    else if (state & NET::MaxHoriz) {
+        // TODO
+    }
+
+    if (state & NET::Shaded) {
+        // unsupported
+    }
+    if (state & NET::SkipTaskbar) {
+        // TODO, see "Managing Taskbar Buttons" at http://msdn2.microsoft.com/en-us/library/bb776822(VS.85).aspx
+    }
+    if (state & NET::KeepAbove /* same as NET::StaysOnTop */) {
+        SetWindowPos( win, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // ??
+    }
+    if (state & NET::SkipPager) {
+        // unsupported
+    }
+    if (state & NET::Hidden) {
+        SetWindowPos( win, 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
+    }
+    if (state & NET::FullScreen) {
+        // TODO
+    }
+    if (state & NET::KeepBelow) {
+        KWindowSystem::raiseWindow( win ); //??
+    }
+    if (state & NET::DemandsAttention) {
+        KWindowSystem::demandAttention( win, false );
+    }
+    //TODO ?
 }
 
 void KWindowSystem::minimizeWindow( WId win, bool animation)
