ecere/gui/3D Desktop; samples/orbitWithMouse: Fixes to run in window with native...
[sdk] / ecere / src / gui / Window.ec
index 74f22d9..5fa4cf2 100644 (file)
@@ -698,6 +698,8 @@ private:
          tempExtents[3].Free(null);
          delete tempExtents;
       }
+
+      delete controller;
    }
 
 //#if !defined(ECERE_VANILLA)
@@ -765,13 +767,21 @@ private:
 
             if(rootWindow.is3D)
             {
-               x += rootWindow.parent.clientStart.x;
-               y += rootWindow.parent.clientStart.y;
+               int dx = rootWindow.parent.parent.clientStart.x;
+               int dy = rootWindow.parent.parent.clientStart.y;
+               if(!rootWindow.parent.nativeDecorations)
+               {
+                  dx += rootWindow.parent.clientStart.x;
+                  dy += rootWindow.parent.clientStart.y;
+               }
+               x += dx;
+               y += dy;
+
                /*
-               mox.left += rootWindow.parent.clientStart.x;
-               mox.top += rootWindow.parent.clientStart.y;
-               mox.right += rootWindow.parent.clientStart.x;
-               mox.bottom += rootWindow.parent.clientStart.y;
+               mox.left += dx;
+               mox.top += dy;
+               mox.right += dx;
+               mox.bottom += dy;
                */
             }
          }
@@ -812,13 +822,21 @@ private:
             y -= rootWindow.absPosition.y;
             if(rootWindow.is3D)
             {
-               x += rootWindow.parent.clientStart.x;
-               y += rootWindow.parent.clientStart.y;
+               int dx = rootWindow.parent.parent.clientStart.x;
+               int dy = rootWindow.parent.parent.clientStart.y;
+               if(!rootWindow.parent.nativeDecorations)
+               {
+                  dx += rootWindow.parent.clientStart.x;
+                  dy += rootWindow.parent.clientStart.y;
+               }
+               x += dx;
+               y += dy;
+
                /*
-               mox.left += rootWindow.parent.clientStart.x;
-               mox.top += rootWindow.parent.clientStart.y;
-               mox.right += rootWindow.parent.clientStart.x;
-               mox.bottom += rootWindow.parent.clientStart.y;
+               mox.left += dx;
+               mox.top += dy;
+               mox.right += dx;
+               mox.bottom += dy;
                */
             }
          }
@@ -5212,7 +5230,7 @@ private:
          LogErrorCode(graphicsLoadingFailed, _class.name);
 
       // Do this here to avoid problems on Windows
-      if(stateBackup == maximized)
+      if(rootWindow == this && parent && stateBackup == maximized)
          property::state = maximized;
       return result;
    }
@@ -6363,7 +6381,8 @@ public:
                         else if(creationActivation == activate || creationActivation == flash)
                         {
                            MakeActive();
-                           Flash();
+                           if(this == rootWindow)
+                              Flash();
                         }
                      }
 
@@ -6866,7 +6885,8 @@ public:
       else if(!active)
       {
          MakeActive();
-         Flash();
+         if(this == rootWindow)
+            Flash();
       }
    }
 
@@ -8107,15 +8127,14 @@ public:
                firewatchers font;
 
 
-               if(value.rootWindow && value.rootWindow.display && rootWindow)
+               if(value.rootWindow && value.rootWindow.display && rootWindow && created)
                {
                   bool reloadGraphics = (oldParent.rootWindow == oldParent && value.rootWindow) || (!value.rootWindow && rootWindow == this) ||
                         (value.rootWindow.display && value.rootWindow.display.displaySystem != rootWindow.display.displaySystem);
 
                   if(reloadGraphics)
                      UnloadGraphics(false);
-                  if(created)
-                     SetupDisplay();
+                  SetupDisplay();
                   if(reloadGraphics)
                      LoadGraphics(false, false);
 
@@ -9136,7 +9155,8 @@ public:
                else if((creationActivation == activate || creationActivation == flash) && !object)
                {
                   MakeActive();
-                  Flash();
+                  if(this == rootWindow)
+                     Flash();
                }
 
                //SetVisibility(!parent.style.hidden && (style.hidden ? false : true));