Patch for ALT Key Handling

Posted by Pink Olifaunt on Thu 19 Jul 2007 11:45 PM — 5 posts, 22,470 views.

#0
Hello everyone,

I like to use ALT for macros because it's the only modifier I can press without moving my fingers from the home row. Unfortunately ALT+[x] also opens menus, and releasing ALT focuses the menu bar, which tends to lead to accidental menu openings. For example, it's pretty frustrating to type "fl" to flee, only to be presented with the "Log Game" dialog because you've accidentally focused the menu bar :)

This isn't something that MUSHClient specifically does, rather the behaviour is common to any application that uses standard Windows menus. The same thing happens in ZMud and MM2K.

Since Nick has very kindly open-sourced MUSHClient, I've written a small patch against the 4.12 source which adds an option to the general prefs dialog that allows the user to suppress the standard processing of ALT. Specifically, when the option is turned on, ALT+[x] combinations no longer open menus, and releasing ALT or F10 no longer focuses the menu bar.

The implementation is to selectively throw away WM_SYSCOMMAND messages before they are passed to DefWindowProc. See the comments in the source if you're interested.

The patch is actually two patches, one against the 4.12 source and the other against the 4.11 resources project. The process for using them is something like this:
  1. 'cd' to the mushclient source directory and do "patch < mushclient_patch".
  2. 'cd' to the mushclient_resources directory and do "patch < mushclient_resources_patch".
  3. Build mushclient_resources to get a new 'en.dll'. You'll also need to copy 'resource.h' into the mushclient source directory, replacing the existing one.
  4. Build mushclient.

Naturally you'll need the GNU patch utility.

The patch is here:

http://pink.olifaunt.googlepages.com/altkey_patch.zip

and there's a binary here:

http://pink.olifaunt.googlepages.com/altkey_patch_binaries.zip

if you want to see it in "action".

I've been using the patched binary for a couple of days and haven't seen any problems, but if anyone actually uses this and finds one, feel free to PM me and I'll fix it.
Amended on Thu 19 Jul 2007 11:57 PM by Pink Olifaunt
USA #1
I'd love to see an option to disable the alt key by itself focusing on the menu bar. I use the alt key a lot to switch between desktops, and I frequently wind up in a menu option I didn't want.

Perhaps this patch could be added to the official MUSHclient program source, especially for those of us who can't compile due to a lack of MFC libraries.
#2
Quote:
I'd love to see an option to disable the alt key by itself focusing on the menu bar.


This patch does that too.
Australia Forum Administrator #3
Thank you for releasing that. You have the honour of being the first to post a suggested amendment to the source code.

I'll look at incorporating that into the next release.
#4
That's great, thanks!