diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 000000000..cea4d3f4e --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "windows-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..e6ad5a73c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "e:/eProject/windhawk-mods/mods", + "program": "e:/eProject/windhawk-mods/mods/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..bb879da5a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/mods/win-d-per-monitor.wh.cpp b/mods/win-d-per-monitor.wh.cpp index c3b14566b..8f5eda4aa 100644 --- a/mods/win-d-per-monitor.wh.cpp +++ b/mods/win-d-per-monitor.wh.cpp @@ -3,7 +3,7 @@ // @name Win+D per monitor(show desktop) // @description Press Win+D to only manage the windows on the monitor where the mouse is located. // @description:zh-CN 按下Win+D时 只最小化/还原鼠标所在显示器的窗口 -// @version 1.1.20250811 +// @version 1.1.20251123 // @author easyatm // @github https://github.com/easyatm // @include explorer.exe @@ -35,6 +35,13 @@ where the mouse cursor is located. ## Changelog +### 2025-11-23 (v1.1.20251123) +- Fixed window control to use ShowWindow instead of PostMessage for better compatibility with windows that have popups, such as Excel +- 修复窗口控制,使用 ShowWindow 而非 PostMessage,以更好地兼容带有弹出窗口的窗口,如 Excel + +Fixes: +- https://github.com/ramensoftware/windhawk-mods/issues/2709 + ### 2025-08-11 (v1.1.20250811) - Added option to ignore topmost tool windows without title bar during Win+D operation - 新增忽略置顶且无标题栏的工具窗口选项,在Win+D操作时保持这类窗口可见 @@ -78,7 +85,8 @@ using namespace std; #define log(...) Wh_Log(L"%s", ansi_unicode(format(__VA_ARGS__)).c_str()); // 设置变量 -struct { +struct +{ bool ignoreTopmostNoTitleBarWindows; int minWindowSize; } g_settings; @@ -283,9 +291,10 @@ class WindShowDesktop GetWindowTextA(hWndCcc, windowTitle, sizeof(windowTitle)); // 输出窗口信息 - log("Processing window: class='{}', title='{}', size={}x{}, hwnd=0x{:x}, owner=0x{:x}", - wndClass, windowTitle, width, height, (uintptr_t)hWndCcc, (uintptr_t)ownerWnd); + log("Processing2 window: class='{}', title='{}', size={}x{}, hwnd=0x{:x}, owner=0x{:x}", wndClass, windowTitle, width, height, + (uintptr_t)hWndCcc, (uintptr_t)ownerWnd); + log("hWnd:0x{:x}", (uintptr_t)hWndCcc); vec.push_back({ hWndCcc, wndClass, ownerWnd }); } return vec; @@ -315,11 +324,16 @@ class WindShowDesktop continue; if (rc.ownerWnd) + { ShowOwnedPopups(rc.ownerWnd, false); + log("ShowOwnedPopups 0x{:x} false", (uintptr_t)rc.ownerWnd); + } else { - //::ShowWindow(rc.wnd, SW_MINIMIZE); - PostMessage(rc.wnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + log("ShowWindow SC_MINIMIZE 0x{:x}", (uintptr_t)rc.wnd); + + ::ShowWindow(rc.wnd, SW_MINIMIZE); + //PostMessage(rc.wnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); } listWnd.emplace_back(std::move(rc)); @@ -344,8 +358,8 @@ class WindShowDesktop } else { - //::ShowWindow(rc.wnd, SW_SHOWNOACTIVATE); - PostMessage(rc.wnd, WM_SYSCOMMAND, SC_RESTORE, 0); + ::ShowWindow(rc.wnd, SW_SHOWNOACTIVATE); + //PostMessage(rc.wnd, WM_SYSCOMMAND, SC_RESTORE, 0); hLastWnd = rc.wnd; }