Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
UnderPL1
19 discussion posts
Although the windows are restored, for windows that are not maximized (for example put on the left with WIN+LEFT) in my second monitor, are restored with a slightly different height, making them appear behing the taskbar (windows taskbar not DF)
• Attachment [protected]: JeKbKIIzWg.png [19,540 bytes]
Oct 4, 2024 (modified Oct 4, 2024)  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Could you send me a copy of your troubleshooting info? Here are the steps:

  • Open the DisplayFusion Settings > Troubleshooting tab
  • Click the "Export Info to File" button
  • Reply with the file attached
Oct 4, 2024  • #2
User Image
UnderPL1
19 discussion posts
attached
• Attachment [protected]: DisplayFusionDebugInfo.zip [97,097 bytes]
Dec 17, 2024 (modified Dec 17, 2024)  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Thanks for sending that over. It looks like you have Start11 installed as well, do you have "Enhance the taskbar" enabled?

Thanks!
Dec 17, 2024  • #4
User Image
UnderPL1
19 discussion posts
I'm using Start10, I don't think the option you mentionned exist in my version. Here is what I have in regard to taskbar related options.
• Attachment: Start10Config_9hO03bWd9J.png [6,837 bytes]
Start10Config_9hO03bWd9J.png
Start10Config_9hO03bWd9J.png
• Attachment: Start10Config_FtnMhVHuOD.png [30,766 bytes]
Start10Config_FtnMhVHuOD.png
Start10Config_FtnMhVHuOD.png
Dec 17, 2024  • #5
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Ah yeah you won't have that setting then. When this happens, if you open a new window and maximize it on that monitor, does it go past the taskbar as well, or does it respect the taskbar work area?
Dec 18, 2024  • #6
User Image
UnderPL1
19 discussion posts
Quote:
Ah yeah you won't have that setting then. When this happens, if you open a new window and maximize it on that monitor, does it go past the taskbar as well, or does it respect the taskbar work area?


Windows maximize correctly, and their positions are restored accurately when I close and reopen them, whether they're maximized or positioned on the left side (using Win+Left).

I conducted additional tests to verify if the windows retain the correct height on my primary monitor and to check if the issue only occurs in the Win+Left area. The results are consistent. Even if I move the window from the corner and put it in the middle of my screen, it'll happen.

I also discovered another issue: when I set the layout as shown in one of the screenshots, windows positioned in the corners (using Win+Left/Right followed by Win+Up/Down) have their height resized. Additionally, they also extend behind the taskbar.
• Attachment: i_view64_qKwigI7DRB.png [69,323 bytes]
i_view64_qKwigI7DRB.png
i_view64_qKwigI7DRB.png
Dec 18, 2024  • #7
User Image
UnderPL1
19 discussion posts
While testing, after unlocking my PC, I noticed that the taskbar sometimes get "loaded', by that I mean it's not present for maybe 1 sec after the unlocking and then I see it appear. The other times, I see it "flash", it's there when I unlock but I do see it dissapear for a few miliseconds and reappear.

Could it be related to this?
Dec 18, 2024  • #8
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Yeah the taskbars will take a bit to reset the work area after unlocking. If you wait around 30 seconds and then load the function, does it still appear behind the taskbar?
Dec 19, 2024  • #9
User Image
UnderPL1
19 discussion posts
Increasing it from 3000 to 5000 30000 didn't help,
Dec 20, 2024 (modified Dec 21, 2024)  • #10
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
If you attach a hotkey to the restore function and run it manually rather then through the trigger, does the same issue happen?
Dec 20, 2024  • #11
User Image
UnderPL1
19 discussion posts
In my last message, I meant increasing it from 3000ms to 30000ms (not 5k) didn't work.

A small clarification, for the second bug, when windows are on a corner (win+left/right + win+up/down), I mentionned that they are restored to full height. It seem to be a windows bug and NOT displayfusion, they will be restored to full height even when DisplayFusion is not running.

---

As for binding the function to a hotkey, it also didn't help. Are you not able to replicate my issue? I've uploaded a screenshot of my windows 10 taskbar settings, just in case. Closing 7+ Taskbar Tweaker which you might have noticed from my log also doesn't help btw.
• Attachment: ApplicationFrameHost_GLaCy39beF.png [41,234 bytes]
ApplicationFrameHost_GLaCy39beF.png
ApplicationFrameHost_GLaCy39beF.png
Dec 21, 2024 (modified Dec 21, 2024)  • #12
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
From your screenshot it looks like you're using Windows taskbars on your secondary monitors? So you're just using DisplayFusion to restore the windows, not using the DisplayFusion taskbars?
Dec 30, 2024  • #13
User Image
UnderPL1
19 discussion posts
Yes, I'm using windows taskbar.
Jan 1, 2025  • #14
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Can you send me a screenshot of the "Edit" window from your profile?
Jan 6, 2025  • #15
User Image
UnderPL1
19 discussion posts
attached
• Attachment: DisplayFusion_hsCkFcrZ5f.png [187,577 bytes]
DisplayFusion_hsCkFcrZ5f.png
DisplayFusion_hsCkFcrZ5f.png
• Attachment: DisplayFusion_UMUfRhTsy8.png [190,809 bytes]
DisplayFusion_UMUfRhTsy8.png
DisplayFusion_UMUfRhTsy8.png
Jan 7, 2025  • #16
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Thanks for sending that over, still no luck reproducing it here. Can you try running without Start10 and see if the issue persists?
Jan 10, 2025  • #17
User Image
UnderPL1
19 discussion posts
I've tested this after unloading Start10 and disabling its service. I also closed 7+ Taskbar Inspector, but the issue still persists.

As mentioned earlier, the problem occurs on both monitors. It happens when I position windows at the edge of the screen using either WIN+Left/Right or by dragging a window to the edge of one of my monitors (to make it occupy half the width of the screen). Placing a window in a corner using WIN+Arrow keys or the mouse also triggers this bug.

Interestingly, if I programmatically set the windows to the same location and dimensions (height/width), the bug does not occur. In the screenshot, I opened the same image in IrfanView twice for comparison.

In the image, the left window was positioned using Python, while the right window was placed using WIN+Right. The issue seems to be related to windows moved or resized using Snap Assist (https://support.microsoft.com/en-us/windows/snap-your-windows-885a9b1e-a983-a3b1-16cd-c531795e6241).

Can you try to replicate the issue while making sure that you've used SnapAssist to move the window?
• Attachment: G7mspmxUL3.png [118,295 bytes]
G7mspmxUL3.png
G7mspmxUL3.png
29 days ago  • #18
User Image
UnderPL1
19 discussion posts
Ok, I played around with the scripted functions (which I’m guessing are used) Restore Window Positions and Z-Order and Save Window Positions and Z-Order, and I’ve figured out what’s happening.

The issue occurs when the Save Window Positions function runs in a trigger with the event "Desktop Locked" and some windows were moved with Snap Assist.

An output from my test script:

An output from my test script:
Restoring window: IrfanView
Saved Bounds: {X=0,Y=0,Width=1280,Height=1440}
Current Bounds: {X=0,Y=0,Width=1280,Height=1400


The saved bounds are incorrect. Notice the extra 40 pixels (the taskbar)?

This issue can be reproduced if you set up the trigger as shown in my screenshot.

What happens:

Place an IrfanView window on the left using WIN+LEFT.
Lock the PC; the window's location and size are saved.
Unlock the PC (note that the window is still in its correct location).
My test script prints the saved bounds (Height=1440) and the current bounds, which are correct (Height=1400).

When the script is executed while the desktop is locked, the height simply return the height height of the monitor, the max height (1440p in my case). This also happens if you place a window in the corner with snap assist.

You'll see a similar output (set the trigger as I did) with the following restore script:

Code

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;

public static class DisplayFusionFunction
{
    [DllImport("user32.dll", SetLastError = true)]
    private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
    
    [DllImport("user32.dll", SetLastError = true)]
    private static extern bool SetWindowPos(
        IntPtr hWnd,
        IntPtr hWndInsertAfter,
        int X,
        int Y,
        int cx,
        int cy,
        uint uFlags);
    
    //some constants
    const uint GW_HWNDNEXT = 2;
    private const int SWP_NOSIZE = 0x0001;
    private const int SWP_NOMOVE = 0x0002;
    private const int SWP_NOACTIVATE = 0x0010;
    private const int SWP_NOSENDCHANGING = 0x0400;
    
    public static void Run(IntPtr windowHandle)
    {   
        // Get the saved window info
        Dictionary<IntPtr, WindowInfo> savedWindowInfo = new Dictionary<IntPtr, WindowInfo>();
        foreach (WindowInfo info in System.Text.Json.JsonSerializer.Deserialize<List<WindowInfo>>(BFS.ScriptSettings.ReadValue("WindowInfoList")))
        {
            if (savedWindowInfo.ContainsKey(info.HandleAsPtr()))
                continue;
            
            savedWindowInfo.Add(info.HandleAsPtr(), info);
        }
        
        // A list to store the windows
        List<IntPtr> windows = new List<IntPtr>();
        
        // Enumerate through the monitors, starting with the focused window, and moving down
        for (IntPtr window = BFS.Window.GetFocusedWindow(); ; window = GetWindow(window, GW_HWNDNEXT))
        {
            // Check to see if there are any windows left
            if (window == IntPtr.Zero)
                break;
            
            // we don't care about windows we have no info about
            if (!savedWindowInfo.ContainsKey(window))
                continue;
            
            // Store the window with its info
            windows.Add(window);
        }
        
        // Bubble sort!
        bool swapped;
        for (int i = 0; i < windows.Count - 1; i++)
        {
            swapped = false;
            for (int j = 0; j < windows.Count - i - 1; j++)
            {
                WindowInfo a = savedWindowInfo[windows[j]];
                WindowInfo b = savedWindowInfo[windows[j + 1]];
                if (a.ZOrder <= b.ZOrder)
                    continue;
                
                swapped = true;
                SwapWindowZOrder(a.HandleAsPtr(), b.HandleAsPtr());
                windows[j] = b.HandleAsPtr();
                windows[j + 1] = a.HandleAsPtr();
            }
            
            if (!swapped)
                break;
        }
        
        // Restore state and positions
        foreach (IntPtr window in windows)
        {
            WindowInfo saved = savedWindowInfo[window];
            WindowInfo current = new WindowInfo(window, 0); // we don't care about the z-order here
            
            // Debugging for IrfanView
            string title = BFS.Window.GetText(window) ?? string.Empty;
            if (title == "IrfanView")
            {
                BFS.Dialog.ShowMessageInfo($"Restoring window: IrfanView\nSaved Bounds: {saved.Bounds}\nCurrent Bounds: {current.Bounds}");
            }

            if (saved.State != current.State)
            {
                if (saved.State == FormWindowState.Normal)
                    BFS.Window.Restore(window);
                if (saved.State == FormWindowState.Minimized)
                    BFS.Window.Minimize(window);
                if (saved.State == FormWindowState.Maximized)
                    BFS.Window.Maximize(window);
            }
            
            if (saved.Bounds != current.Bounds)
            {
                BFS.Window.SetSizeAndLocation(window, saved.Bounds.X, saved.Bounds.Y, saved.Bounds.Width, saved.Bounds.Height);

                // Debugging after restoring position and size
                if (title == "IrfanView")
                {
                    Rectangle newBounds = BFS.Window.GetBounds(window);
                    BFS.Dialog.ShowMessageInfo($"Restored window: IrfanView\nNew Bounds: {newBounds}");
                }
            }
        }
    }
    
    // A method to swap two window z orders
    private static void SwapWindowZOrder(IntPtr a, IntPtr b)
    {
        SetWindowPos(a, b, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
        SetWindowPos(b, a, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
    }
    
    private static bool IsDisplayFusionWindowOrHiddenExplorerWindow(IntPtr window)
    {
        // Ignore any DisplayFusion windows (title bar buttons, etc.)
        // Ignore pesky hidden explorer.exe windows
        string windowClass = BFS.Window.GetClass(window);
        if ((windowClass.StartsWith("DF", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("EdgeUiInputTopWndClass", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("EdgeUiInputWndClass", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("NativeHWNDHost", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("ModeInputWnd", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("MetroGhostWindow", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("ImmersiveLauncher", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("ApplicationManager_ImmersiveShellWindow", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("Shell_TrayWnd", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("WorkerW", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("Progman", StringComparison.OrdinalIgnoreCase)) ||
            (windowClass.Equals("SearchPane", StringComparison.OrdinalIgnoreCase)))
        {
            return true;
        }
        
        return false;
    }
    
    public class WindowInfo
    {        
        public long Handle { get; set; }
        public FormWindowState State { get; set; }
        public Rectangle Bounds { get; set; }
        public int ZOrder { get; set; }
        
        // for JSON deserialization
        public WindowInfo() {}
        
        public WindowInfo(IntPtr handle, int zOrder)
        {
            this.Handle = handle.ToInt64();
            if (BFS.Window.IsMinimized(handle))
                this.State = FormWindowState.Minimized;            
            else if (BFS.Window.IsMaximized(handle))
                this.State = FormWindowState.Maximized;
            else
                this.State = FormWindowState.Normal;
            
            this.Bounds = BFS.Window.GetBounds(handle);
            this.ZOrder = zOrder;
        }
        
        public IntPtr HandleAsPtr()
        {
            return new IntPtr(this.Handle);
        }
    }
}


TLDR: Save windows position/size function on windows moved with SnapAssist return monitor height instead of window height when it's run and the desktop is locked (trigger)
• Attachment: DisplayFusion_cHfM6Imjdg.png [32,470 bytes]
DisplayFusion_cHfM6Imjdg.png
DisplayFusion_cHfM6Imjdg.png
• Attachment: DisplayFusion_QMsXMykoLY.png [32,659 bytes]
DisplayFusion_QMsXMykoLY.png
DisplayFusion_QMsXMykoLY.png
29 days ago (modified 29 days ago)  • #19
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Oh yeah this is expected, the function needs to be run before the desktop is locked to get the correct bounds including the taskbar.

If you're looking to have the positions saved automatically before your screensaver kicks in, you can use a trigger that runs on a "System Idle" timer with it set to save right before the screensaver starts (this guide explains further: https://www.displayfusion.com/HelpGuide/AutomaticallySaveAndRestoreWindowPositionsOnSleepResume/)

If you're looking to have the positions saved right before you manually lock the desktop, you'll have to run the function manually as well.

Thanks!
25 days ago  • #20
User Image
UnderPL1
19 discussion posts
Quote:
Oh yeah this is expected, the function needs to be run before the desktop is locked to get the correct bounds including the taskbar.

If you're looking to have the positions saved automatically before your screensaver kicks in, you can use a trigger that runs on a "System Idle" timer with it set to save right before the screensaver starts (this guide explains further: https://www.displayfusion.com/HelpGuide/AutomaticallySaveAndRestoreWindowPositionsOnSleepResume/)

If you're looking to have the positions saved right before you manually lock the desktop, you'll have to run the function manually as well.

Thanks!


They actually get the correct bound, just not when a windows was placed with SnapAssist. Neverthless, I modified the function subtract the 40px of the taskbar, this will be good enough and will fit my needs.

Thanks.
24 days ago (modified 24 days ago)  • #21
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)