Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Activation order & much more, CMake build
After much deliberation and study, cmdtab has been rebuilt to support true activation order. What's that you say? Doesn't cmdtab--the best macOS-style app/window switcher for Windows--already support that? Well, cmdtab has been overpromising and underdelivering this whole time. Previously cmdtab relied on the order that Windows gives its top-level windows in when the EnumWindows function is called, and that order is the Z-order. The Z-order and the activation order are in some circumstances different, and not so subtly at that. If you minimize a window it is sent to the bottom of the Z-order, and therefore, in versions of cmdtab prior to v1.5, that window would be displayed last in the cmdtab switcher, even if it was the window that was just in the foreground. Windows has no documented API for querying the activation order of desktop windows, only the Z-order. This has put me on the path to discover the best way to keep track of the activation order of windows. There are many possible solutions to this, each with merits, quirks, gotchas, both subtle and not. Especially minimizing any involvement with the going-ons of the Windows shell was a goal. Although in hindsight the solution in cmdtab is at once obvious, it was nevertheless arrived at only after considering what felt like every other possible solution. This gives me confidence, and the results speak for themselves. Coupled with fixes to seemingly inscrutable bugs regarding stuck keys and subtly mismatching behavior between Windows' stock Alt-Tab switcher and cmdtab, along with a near astronomical improvement in memory usage and window capacity (70% memory usage decrease and yet 3200% increase of window capacity!), as well as color theme awareness and rudimentary handling of pesky UWP windows, this is clearly the best version of cmdtab yet. It has taken close scrutiny of subtleties of the Win32 API to arrive here; the minutia of which knowledge is required to eek out the minimal surface area for a dead simple window switcher is surprisingly vast. But now the jank is gone. Go forth and enjoy finally knowing wtf is going on with your Windows desktop. Changes / highlights / improvements / fixes - this change log will have a lesser detail level than previously; everything is renamed and moved around - add resource info to cmdtab.exe - cmdtab.exe has a new (placeholder) icon - new build system CMake, instructions in README.md - get rid of cmdtab.h, put includes in cmdtab.c - remove bit array macros - experiment with windows.h NO* defines - specify comctl version with linker directive for prettier message dialog - reduce struct definitions from 9 to 3: string, app, config - use simplified typedefs & lowercase null - separate Win32 "wrappers" from cmdtab implementation - try out PascalCase - debug macro and print function -> Debug, Print, Error, Ask - use less intrusive "alt hack" (mouse input instead of kbd) - UWP handling (TODO icons) - slightly expanded IsAltTabWindow filter & default blacklist - use strsafe.h - fix crash caused by some apps' product name (#2) - PostMessage instead of SendMessage for window management functions - dark mode and accent color awareness - don't ShowWindow if already foreground - extensive logging - move bitmap resizing from draw function to resize function - put blacklist checking logic in separate function - complete restructure of window handling: linked_window_t[] -> app[] - massive memory usage reduction - impl persistent window activation order - measure performance of window handling - improve error handling of access failure on getting filepath - improve legibility of hwnd printing - combine and simplify print functions - complete restructure & simplification of selection handling - fix text alignment bug caused by not #including math.h - fix text alignment bias from right to left - fix stuck modifier keys - restructure keyboard hook procedure for maximum performance - fix alt key / window menu inconsistency compared to Windows Alt-Tab - impl select first app corner case when on bare desktop - impl Alt-Q to quit process - impl some debug hotkeys, Alt-B, Alt-F11, Alt-F12 - improve input passthrough / sink - rely on switcher being top-most window vs. active window - refactor WndProc & wWinMain
- Loading branch information