Implement onshow onhide events for window object.
authorRui Guo <firemeteor.guo@gmail.com>
Mon, 22 Jun 2009 08:08:28 +0000 (22 16:08 +0800)
committerRui Guo <firemeteor.guo@gmail.com>
Mon, 22 Jun 2009 08:08:28 +0000 (22 16:08 +0800)
src/process.c

index 6bd76fc..8903314 100644 (file)
@@ -5160,6 +5160,22 @@ struct win *wi;
           trigger_sevent(&fore->w_sev.onleave, display, fore);
 #endif
        }
+#ifdef SCRIPT
+      if (p)
+        {
+          int hide = 1;
+          /* Trigger window hide event if the last view on this display is
+           * removed */
+          for (cvp = l->l_cvlist; cvp; cvp = cvp->c_lnext)
+            if (cvp->c_display == display)
+              {
+                hide = 0;
+                break;
+              }
+          if (hide)
+            trigger_sevent(&fore->w_sev.onhide, display, fore);
+        }
+#endif
       if (l->l_cvlist == 0 && (p == 0 || l != p->w_savelayer))
        KillLayerChain(l);
     }
@@ -5233,6 +5249,19 @@ struct win *wi;
 #endif
        }
     }
+#ifdef SCRIPT
+  if (wi && Layer2Window(l) == wi)
+    {
+      int show = 0;
+      /* Trigger window show event if the first view on this display is
+       * removed */
+      for (cvp = l->l_cvlist; cvp; cvp = cvp->c_lnext)
+        if (cvp->c_display == display)
+            show++;
+      if (show == 1)
+        trigger_sevent(&fore->w_sev.onshow, display, fore);
+    }
+#endif
 }