From cb0382bdf9952a85044fbaae8478d60bc7b4704f Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Mon, 2 Feb 2015 01:05:41 -0500 Subject: [PATCH] ecere/gui/drivers/Win32Interface: Hacks for Pimiento StickyNotes - 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 | 67 ++++++++++++++++++++------------- ecere/src/gui/drivers/Win32Interface.ec | 34 ++++++++++++----- 2 files changed, 66 insertions(+), 35 deletions(-) diff --git a/ecere/src/gui/Window.ec b/ecere/src/gui/Window.ec index 826d43c..a2dce1e 100644 --- a/ecere/src/gui/Window.ec +++ b/ecere/src/gui/Window.ec @@ -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 @@ -5837,35 +5841,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 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(); // ------------------------------------------------------ } @@ -9383,7 +9392,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; } }; diff --git a/ecere/src/gui/drivers/Win32Interface.ec b/ecere/src/gui/drivers/Win32Interface.ec index e81f1fc..f02f601 100644 --- a/ecere/src/gui/drivers/Win32Interface.ec +++ b/ecere/src/gui/drivers/Win32Interface.ec @@ -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); @@ -1404,7 +1420,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) @@ -1412,7 +1428,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; -- 1.8.3.1