Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when pressing Esc from Home screen #1

Closed
jaybirdjuju opened this issue Mar 4, 2024 · 1 comment
Closed

Bug when pressing Esc from Home screen #1

jaybirdjuju opened this issue Mar 4, 2024 · 1 comment

Comments

@jaybirdjuju
Copy link

jaybirdjuju commented Mar 4, 2024

Hi there!

I loove this app and your work!!

The one issue I'm having is when I open cmdtab from Home screen and press Esc it jumps to one of my open windows/apps instead of closing down. This does not happen when I click outside the app to cancel. Only seems to happen from Home screen.

Also, some of your commit messages are hilarious :D cee0f50 27dd7cb and more...
Regards,
Your #1 Fangirl
(Full disclosure, I'm his gf <3)

@stianhoiland
Copy link
Owner

stianhoiland commented Mar 17, 2024

Okay, fixed it now. Thanks for the feedback and appreciating my whimsy😘 (Remember to download the updated version when it comes online!)

stianhoiland added a commit that referenced this issue Mar 17, 2024
The Highlights

- Fix hanging Alt key (woohoo!)
- Fix window restoring bug reported in issue #1
- Fix initial white flash when showing GUI
- Improvements to stability and snappiness: snappiness is happiness!
- No GUI delay by default:
   After extended use, I have determined that the lesser visual impact of a
   narrow strip of icons vs. a possibly full-screen montage of window previews
   is enough to prevent the distraction for which GUI delay was introduced. Now
   I much prefer the snappiness of no delay. Nevertheless, the functionality of
   GUI delay will remain in cmdtab, but will be disabled by default.
- Allow fast switching for both app- and window-switching (was only allowed for
  subwindow-switching)
- Allow showing GUI switcher for both app- and window-switching (was only
  allowed for app-switching)
- Dodge & weave between apps & windows by mixing & matching Alt-Tab & Alt-`
- Long app names are now aligned to fit the switcher
- Use Alt-W and Alt-Delete to close selected window (requires some testing)
- Use Alt-M to minimize window (requires some testing)
- Cmdtab will now (re)ask if you want to enable autorun *before* refusing to
  start if it's already running
- Fixed a bug that caused cmdtab to no longer ask about autorun

The Sausage Making

cleanup: minor code style changes
cleanup: temporarily commented-out several debug prints
refactor: relocate 'struct style' definition
refactor: rename style_t members
refactor: rename selection_t member 'window' -> 'current'
feature: track whether the selected window has been shown. This is so that
         the next subwindow hotkey selects the top window after having
         Alt-Tab'ed, but otherwise selects the next subwindow.
feature: allow fast switching for both app- and window-switching (was only
         allowed for window-switching). 'Fast switching' means instantly showing
         the selected window (not waiting for Alt keyup or Enter).
feature: allow showing switcher gui for both app- and window-switching (was only
         allowed for app-switching)
refactor: remove global variables hMutexHandle, hMainInstance & hKeyboardHook
refactor: remove once() function. This was used to improve first-use impression
          by skipping gui show delay on the very first show, but I have opted to
          disable gui show delay by default (see below).
bugfix: fix hanging Alt key (hurrah!)
feature: no longer default to using gui show delay. After extended use, I have
         determined that the lesser visual impact of a narrow row of icons vs. a
         possibly full-screen montage of window previews is enough to prevent
         the distraction for which gui delay was introduced. Now I much prefer
         the snappiness of no delay. Nevertheless, the functionality of gui
         delay will remain in cmdtab, but will be disabled by default.
feature: tweaked the size of the gui a little, vertically more compact,
         horizontally more roomy
refactor: use show_hwnd() from show_gui() instead of near-duplicate logic
          (mostly to dogfeed the ALTHACK)
bugfix: return false from error branch in filter()
refactor: prettify some logic in filter()
refactor: new function print_hwnd() that can print any hwnd and doesn't reuse
          linked_window_t members. Also now prints class name in details.
refactor: refactor print_window() to use print_hwnd(), but short-circuit with a
          simple linked_window_t member print
refactor: remove find_hwnd(). This function was only used to find the
          linked_window_t that corresponded with the GetForegroundWindow().
          See notes below for select_foreground().
refactor: in select_foreground() remove implicit condition that the actual
          foreground window (as returned by GetForegroundWindow()) must also be
          a linked_window_t managed by us.
          Now, instead we simply pick windows.array[0], which is more consistent
          with the way we internal represent state, but is also potentially
          inconsistent with the actual foreground window since it may have been
          filtered out. (Commit 4ade8ea moved to a generic representation of the
          foreground window to support restoring to filtered-out windows.)
cleanup: minor style change, and simplify some debug printing in select_next()
refactor: rename select_done() -> select_show()
refactor: redraw() function renamed -> draw_gui() and drawing logic completely
          overhauled (yummy code!) and improved
feature: draw_gui() now aligns long app names to fit the switcher
refactor: in LLKeyboardProc():
          - properly separate selection activation from navigation
feature: in LLKeyboardProc():
         - (as mentioned above) make the select next subwindow hotkey select the
           next top window (i.e. app) after having Alt-Tab'ed, but otherwise
           select the next subwindow
         - (as mentioned above) allow fast switching and showing gui switcher
           for both apps and subwindows
         - use Alt-W and Alt-Delete to close selected window
         - use Alt-M to minimize window
feature: cmdtab will now (re)ask if you want to enable autorun *before* refusing
         to start if it's already running
bugfix: fix regression causing cmdtab to no longer ask about autorun
feature: remove all window decoration, except rounded corners
         - this seems to have fixed initial white flash when showing GUI
           (huzzah!) [either that, or the new drawing code did that...]
bugfix: add a '> 0' check in message loop for total correctness
bugfix: add a possibly unneccesary CloseHandle() call

The following changes were extracted from the otherwise sequential listing of
changes above to group together pieces of a larger refactor:

refactor: change all switcher gui functions to take hwnd parameter. This simple
          change had a radical effect on my understanding of an important,
          implicit dependency between window swithing state and GUI visibility.
          See comments in cancel() function. (Global vars can be evil!)
refactor: remove hide_gui(), functionality moved to new function cancel()
refactor: remove select_null(), functionality moved to new function cancel()
refactor: move 'restore' functionality from select_done() -> new fn cancel()
refactor: new function cancel():
          cmdtab strives to keep window selection state independent of GUI state
          (such that window switching can occur entirely without GUI), but
          cancelling selection upon window deactivation, and vice versa, is a
          desired feature, and this necessitates an irredicuble state
          dependency. This dependence escaped notice through the use of a global
          variable (hMainWindow), but is now encapsulated in the cancel()
          function and illustrated by the cancel() function taking both a
          selection_t parameter and a hwnd parameter.
          The cancel() function also absorbs the functionality of hide_gui(),
          select_null(), as well as the window restoring functionality
          previously in the select_done() [renamed select_show()] function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants