diff --git a/icewm/src/icetray.cc b/icewm/src/icetray.cc
index 65e1f33..afd47fd 100644
--- a/icewm/src/icetray.cc
+++ b/icewm/src/icetray.cc
@@ -36,14 +36,11 @@ public:
     bool checkMessageEvent(const XClientMessageEvent &message);
     void requestDock();
 
-    void handleUnmap(const XUnmapEvent &ev) {
-        YWindow::handleUnmap(ev);
-        MSG(("hide1"));
-//        if (visible() && ev.window == handle()) {
-            MSG(("hide2"));
+    void handleUnmap(const XUnmapEvent &) {
+        MSG(("hide"));
+        if (visible())
+
             hide();
-            fManaged = false;
-//        }
     }
 
     void trayChanged();
@@ -51,7 +48,6 @@ private:
     Atom icewm_internal_tray;
     Atom _NET_SYSTEM_TRAY_OPCODE;
     YXTray *fTray2;
-    bool fManaged;
 };
 
 class SysTrayApp: public YXApplication {
@@ -187,7 +183,6 @@ SysTray::SysTray(): YWindow(0) {
     setSize(fTray2->width(),
             fTray2->height());
     fTray2->show();
-    fManaged = false;
     requestDock();
 }
     
@@ -195,15 +190,10 @@ void SysTray::trayChanged() {
     fTray2->backgroundChanged();
     setSize(fTray2->width(),
             fTray2->height());
-    if (fTray2->visible()) {
-        if (!fManaged)
-            requestDock();
-        else
-            show();
-    } else {
-        fManaged = false;
+    if (fTray2->visible())
+        show();
+    else 
         hide();
-    }
 }
 
 void SysTray::requestDock() {
@@ -223,19 +213,12 @@ void SysTray::requestDock() {
 
         XSendEvent(xapp->display(), w, False, StructureNotifyMask, (XEvent *) &xev);
     }
-    fManaged = true;
 }
 
 bool SysTray::checkMessageEvent(const XClientMessageEvent &message) {
     if (message.message_type == icewm_internal_tray) {
-        MSG(("requestDock %lX", (long)handle()));
-        setSize(fTray2->width(),
-                fTray2->height());
-        MSG(("requestDock2 %d %d", width(), height()));
-        if (fTray2->visible())
-            requestDock();
-        else
-            fManaged = false;
+        MSG(("requestDock"));
+        requestDock();
     }
     return true;
 }
