MouseUnSnag / MouseUnSnag

On a Windows system with multiple monitors, allow the mouse to move freely and not get stuck on corners or edges.
MIT License
147 stars 28 forks source link

"Exit" tray icon option doesn't actual terminate MouseUnsnag.exe #5

Closed patricknelson closed 2 years ago

patricknelson commented 2 years ago

I noticed that MouseUnsnag.exe didn't actually close when clicking the Exit option in the system tray icon menu. I'm not 100% sure what I'm doing here since I don't typically build windows GUI apps, so my initial fix was to just swap out Application.Exit() with Environment.Exit(0) which probably just unceremoniously kills the application.

My guess (being a noob in C#) is that Application.Exit() should have allowed the process to exit gracefully on its own, but since maybe it's hooking into something (maybe via MouseHookHandler), it stays running until those handlers are closed, maybe? Not sure. I'm guessing this fix works since it's probably taking a sledge hammer to everything. But again... I'm dumb and I don't really know for sure yet 😬

cc @drewnoakes since you were the original author of this option here (back in 2018). Do you know if issue existed back then in your version as well?

EDIT: Never mind, I just found that this was caused by some odd undocumented functionality associated with a separate thread being created to watch the caps lock key, will address in #6 and in a separate PR.

patricknelson commented 2 years ago

Just setting the v2.2 milestone since the Exit capability currently in master is broken, so ideally either this or #7 should be merged prior to the next release.

patricknelson commented 2 years ago

Closing this in lieu of the approach taken in #7.