Trigger global forechange event on region change.
authorRui Guo <firemeteor.guo@gmail.com>
Mon, 22 Jun 2009 08:12:11 +0000 (22 16:12 +0800)
committerRui Guo <firemeteor.guo@gmail.com>
Mon, 22 Jun 2009 08:12:11 +0000 (22 16:12 +0800)
Also fix a special case of onfocus triggering: when the old canvas has no
window.

src/process.c

index 8d50b27..8f627b4 100644 (file)
@@ -4029,11 +4029,13 @@ int key;
       {
         struct win *oldfore = D_fore;
         fore = D_fore = Layer2Window(D_forecv->c_layer);
-        if (oldfore && oldfore != fore)
+        if (oldfore != fore)
           {
-            trigger_sevent(&oldfore->w_sev.onleave, display, oldfore);
+            if (oldfore)
+              trigger_sevent(&oldfore->w_sev.onleave, display, oldfore);
             if (fore)
               trigger_sevent(&fore->w_sev.onfocus, display, oldfore);
+            trigger_sevent(&globalevents.forechanged, display, display ? D_fore : fore);
           }
       }
 #else