ecere/gui/Window: (#1083) Fixed stuck tooltips, stuck/crashing IDE
authorJerome St-Louis <jerome@ecere.com>
Sun, 15 Jun 2014 03:50:00 +0000 (23:50 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 15 Jun 2014 03:50:59 +0000 (23:50 -0400)
- Problem was introduced with ab4dde3bdaf6541408ad30b6252c63ca4af5fa80, not calling OnMouseLeave while still over child windows
- Now keeping a list of ancestors to call OnMouseLeave for

ecere/src/gui/GuiApplication.ec
ecere/src/gui/Window.ec

index 626a7de..87fe462 100644 (file)
@@ -82,6 +82,7 @@ import "XInterface"
 #endif
 
 import "Window"
+import "List"
 
 /*static */bool guiApplicationInitialized = false;
 GuiApplication guiApp;
@@ -123,7 +124,8 @@ public class GuiApplication : Application
    OldList windowTimers;
 
    // Mouse events
-   Window prevWindow;     // Used for OnMouseLeave
+   Window prevWindow;            // Used for OnMouseLeave
+   List<Window> overWindows { }; // Used for OnMouseLeave
    Window windowCaptured;
 
    // Mouse based moving & resizing
index 56a1d25..b269296 100644 (file)
@@ -4269,14 +4269,37 @@ private:
          if(guiApp.windowCaptured || trueWindow)
          {
             Window prevWindow = guiApp.prevWindow;
-            if(guiApp.prevWindow && trueWindow != guiApp.prevWindow)
+            List<Window> overWindows = guiApp.overWindows;
+            Iterator<Window> it { overWindows };
+
+            while(it.Next())
+            {
+               Window w = it.data;
+               if(trueWindow != w && !trueWindow.IsDescendantOf(w))
+               {
+                  it.pointer = null;
+                  result = w.OnMouseLeave(*mods);
+                  if(!result) break;
+                  overWindows.TakeOut(w);
+               }
+            }
+
+            if(result && guiApp.prevWindow && trueWindow != guiApp.prevWindow)
             {
                guiApp.prevWindow.mouseInside = false;
                guiApp.prevWindow = null;
 
-               // Eventually fix this not to include captured?
-               if(!trueWindow.IsDescendantOf(prevWindow) && !prevWindow.OnMouseLeave(*mods))
-                  result = false;
+               if(result)
+               {
+                  if(trueWindow.IsDescendantOf(prevWindow))
+                  {
+                     if(!overWindows.Find(prevWindow))
+                        overWindows.Add(prevWindow);
+                  }
+                  // Eventually fix this not to include captured?
+                  else if(!prevWindow.OnMouseLeave(*mods))
+                     result = false;
+               }
             }
             if(result && trueWindow && !trueWindow.destroyed/* && trueWindow == window*/)
             {