ecere/gui/drivers/Win32Interface: Hacks for Pimiento StickyNotes
authorJerome St-Louis <jerome@ecere.com>
Mon, 2 Feb 2015 06:05:41 +0000 (01:05 -0500)
committerJerome St-Louis <jerome@ecere.com>
Thu, 15 Oct 2015 00:19:29 +0000 (20:19 -0400)
- Changed taskBar rules regarding thin border
- Allows not showing in taskbar for StickyNotes (must now set showInTaskBar = true if set to thin border to show)
- Getting minimize all / restore to behave

ecere/src/gui/Window.ec
ecere/src/gui/drivers/Win32Interface.ec

index a65d1e8..6572e81 100644 (file)
@@ -25,6 +25,10 @@ import "EditBox"
 import "DataBox"
 import "ToolTip"
 
+#if defined(__WIN32__)
+import "Win32Interface"
+#endif
+
 #if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
 import "Desktop3D"
 #endif
@@ -5854,35 +5858,38 @@ private:
                break;
             case minimized:
             {
-               int maxIcons = parent.clientSize.w / MINIMIZED_WIDTH;
-               Window child;
-               int size = 256;
-               byte * idBuffer = new0 byte[size];
-               int c;
-               for(child = parent.children.first; child; child = child.next)
+               if(hasMinimize)
                {
-                  if(child != this && child.state == minimized)
+                  int maxIcons = parent.clientSize.w / MINIMIZED_WIDTH;
+                  Window child;
+                  int size = 256;
+                  byte * idBuffer = new0 byte[size];
+                  int c;
+                  for(child = parent.children.first; child; child = child.next)
                   {
-                     if(child.iconID > size - 2)
+                     if(child != this && child.state == minimized)
                      {
-                        idBuffer = renew0 idBuffer byte[size*2];
-                        memset(idBuffer + size, 0, size);
-                        size *= 2;
+                        if(child.iconID > size - 2)
+                        {
+                           idBuffer = renew0 idBuffer byte[size*2];
+                           memset(idBuffer + size, 0, size);
+                           size *= 2;
+                        }
+                        idBuffer[child.iconID] = (byte)bool::true;
                      }
-                     idBuffer[child.iconID] = (byte)bool::true;
                   }
-               }
-               for(c = 0; c<size; c++)
-                  if(!idBuffer[c])
-                     break;
-               iconID = c;
-               delete idBuffer;
-               if(style.isActiveClient && !style.hidden)
-                  parent.numIcons++;
+                  for(c = 0; c<size; c++)
+                     if(!idBuffer[c])
+                        break;
+                  iconID = c;
+                  delete idBuffer;
+                  if(style.isActiveClient && !style.hidden)
+                     parent.numIcons++;
 
-               stateAnchor = Anchor { left = (iconID % maxIcons) * MINIMIZED_WIDTH, bottom = (iconID / maxIcons) * (guiApp.textMode ? 16 : 24) };
-               stateSizeAnchor = SizeAnchor { size.w = MINIMIZED_WIDTH };
-               break;
+                  stateAnchor = Anchor { left = (iconID % maxIcons) * MINIMIZED_WIDTH, bottom = (iconID / maxIcons) * (guiApp.textMode ? 16 : 24) };
+                  stateSizeAnchor = SizeAnchor { size.w = MINIMIZED_WIDTH };
+                  break;
+               }
             }
          }
          // TOCHECK: Why was this here?
@@ -5890,13 +5897,15 @@ private:
          //position.y = (ty > 0) ? ty & 0xFFFFF : ty;
          ComputeAnchors(stateAnchor, stateSizeAnchor, &x, &y, &w, &h);
 
-         Position(x, y, w, h, true, true, true, true, false, true);
+         if(state != minimized || hasMinimize)
+            Position(x, y, w, h, true, true, true, true, false, true);
 
          if(!style.inactive && !style.interim && parent && this == parent.activeClient)
             parent.UpdateActiveDocument(null);
       }
 
-      CreateSystemChildren();
+      if(state != minimized || hasMinimize)
+         CreateSystemChildren();
       // ------------------------------------------------------
    }
 
@@ -9432,7 +9441,13 @@ public:
    property bool showInTaskBar
    {
       property_category $"Window Style"
-      set { style.showInTaskBar = value; }
+      set
+      {
+         style.showInTaskBar = value;
+#if defined(__WIN32__)
+         Win32UpdateStyle(this);
+#endif
+      }
       get { return style.showInTaskBar; }
    };
    property FileDialog saveDialog { set { saveDialog = value; } };
index cd413db..9037578 100644 (file)
@@ -236,12 +236,25 @@ void AeroSnapPosition(Window window, int x, int y, int w, int h)
          }
          w = gw;
          h = gh;
-         guiApp.interfaceDriver.PositionRootWindow(window, x, y, w, h, move, true);
+         if(window.state == minimized && !window.nativeDecorations && !window.hasMinimize)
+            y -= 26000;
+          guiApp.interfaceDriver.PositionRootWindow(window, x, y, w, h, move, true);
       }
    }
    window.ExternalPosition(x, y, w, h);
 }
 
+void Win32UpdateStyle(Window window)
+{
+   DWORD style = GetWindowLong(window.windowHandle, GWL_EXSTYLE);
+   if(window.showInTaskBar)
+      style |= WS_EX_APPWINDOW;
+   else
+      style &= ~WS_EX_APPWINDOW;
+
+   SetWindowLong(window.windowHandle, GWL_EXSTYLE, style);
+}
+
 class Win32Interface : Interface
 {
    class_property(name) = "Win32";
@@ -486,12 +499,15 @@ class Win32Interface : Interface
 
                      HWND modalWindow = modalRoot ? modalRoot.windowHandle : null;
 
-                     FLASHWINFO flashInfo = { 0 };
-                     flashInfo.cbSize = sizeof(FLASHWINFO);
-                     flashInfo.hwnd = window.windowHandle;
-                     flashInfo.uCount = 0;
-                     flashInfo.dwFlags = FLASHW_STOP;
-                     FlashWindowEx((void *)&flashInfo);
+                     if(window.creationActivation == flash || window.hasMinimize || window.borderStyle != sizableThin)
+                     {
+                        FLASHWINFO flashInfo = { 0 };
+                        flashInfo.cbSize = sizeof(FLASHWINFO);
+                        flashInfo.hwnd = window.windowHandle;
+                        flashInfo.uCount = 0;
+                        flashInfo.dwFlags = FLASHW_STOP;
+                        FlashWindowEx((void *)&flashInfo);
+                     }
 
                      if(modalWindow && modalWindow != windowHandle)
                         modalRoot.ExternalActivate(true, true, window, null);
@@ -1394,7 +1410,7 @@ class Win32Interface : Interface
          if(window.style.stayOnTop)
             exStyle |= WS_EX_TOPMOST;
 
-         if(rootWindow && (window._isModal || window.style.interim))
+         if(rootWindow && (window._isModal || window.style.interim || (window.style.thin && !window.style.showInTaskBar)))
             parentWindow = rootWindow.is3D ? rootWindow.parent.windowHandle : rootWindow.windowHandle;
 
          if(window.alphaBlend)
@@ -1402,7 +1418,7 @@ class Win32Interface : Interface
             exStyle |= WS_EX_LAYERED; // | WS_EX_TRANSPARENT;
 
          // Toolwindow will disappear if they don't have AppWindow set
-         if(window.style.showInTaskBar || (!parentWindow && window.style.thin))
+         if(window.style.showInTaskBar) // Took this out as a way to prevent sticky notes from showing in task bar... ( added flag to Communicator ) || (!parentWindow && window.style.thin))
          {
             exStyle |= WS_EX_APPWINDOW;
             parentWindow = null;