Hi,
I'm experiencing a window restoration issue in DisplayFusion 12.2 Beta 8, related to injected application hooks, the Shift modifier, and the native Win32 SetWindowPlacement API.
I'm developing a set of C# scripted functions for window management, including minimizing and restoring groups of windows, moving windows between monitors, and preserving their original normal geometry and maximized state.
After extensive diagnostic testing, I was able to isolate the issue to DisplayFusion's injected application hooks.
When restoring a previously maximized->minimized->unminimized window using SetWindowPlacement while Shift is held, the window may end up in an incorrect show state or with corrupted normal window geometry. This does not reproduce when window is only maximized, without minimizing when in maximized state (then restoring from minimzed to maximized).
In some cases, the window briefly becomes maximized, then returns to the normal state with a normal rectangle corresponding approximately to its maximized dimensions.
This also means that the original normal window geometry is lost.
I've reproduced window restoration problems with both Visual Studio Code and Heroes III, so the issue does not appear to be specific to a single application or window framework.
Tested Environment:
- DisplayFusion 12.2 Beta 8
- Multi-monitor configuration
- C# scripted functions using native Win32 APIs
- Visual Studio Code and Heroes III
The restoration implementation uses
and
to preserve the saved normal rectangle and restore the original maximized state. The resulting window state and geometry are verified through native API readback.
Test Results:
- DisplayFusion running, no modifier keys held: PASS
- DisplayFusion running, Ctrl held: PASS
- DisplayFusion running, Shift held: FAIL
- DisplayFusion not running: PASS
- DisplayFusion running, Window Snapping disabled: FAIL
I then tested the two application hook compatibility settings independently for Visual Studio Code:
- Only polling application hooks disabled: FAIL
- Only injected application hooks disabled: PASS
- Both injected and polling application hooks disabled: PASS
The same restoration implementation works correctly when the injected application hooks are disabled for the affected application.
With both application hook types disabled for Visual Studio Code, an initial diagnostic series completed with all successful restores and correct normal-placement samples.
These tests included restoring maximized windows through different shortcut combinations and restoring windows while other scripted window movement operations were active.
Working Workaround:
In DisplayFusion Settings > Compatibility, enable the following option for the affected application:
Disable application hooks (injected, this application only)
Disabling polling application hooks alone does not resolve the issue.
However, disabling injected hooks individually for every affected application is not an ideal long-term solution.
I also considered disabling Global Application Hooks, but disabling Global Application Hooks is not a viable workaround for my setup, as I rely on the DisplayFusion taskbar and its Start button.
Expected Behavior:
Native Win32 window placement operations performed by C# scripted functions should behave consistently regardless of whether Shift is held.
DisplayFusion's injected application hooks should not interfere with an explicit SetWindowPlacement request or cause the original normal window geometry to be lost.
The issue CAN be also reproduced without using scripted functions at all and manually clicking minimize / maximize buttons of application and resting in from minimized state by clicking on taskbard (without key held down).
Questions:
1. Is there any special handling of the Shift modifier in DisplayFusion's injected application hooks that could interfere with native window restoration or maximization?
2. Could the injected hooks be modifying or overriding the normal rectangle or show state requested through SetWindowPlacement?
3. Is there a supported way for a scripted function to temporarily bypass this behavior during explicit window placement operations without disabling injected hooks for the entire application?
4. Could you investigate whether this is an issue in DisplayFusion's injected application hooks?
Thanks!