Thursday, July 30, 2009

X-Mouse in Windows Vista

This is really just for my own records, in case I need to do the same thing again at some point in the future, I probably won't remember all the details by then, and the resources I found with the information may no longer be around.

So I've been using Windows Vista for a while, and have gotten used to most of its functions. One of the things I missed the most from the previous version was the Power Toys/TweakUI. More specifically, an X-Mouse feature which made it possible for you to "switch" your "active window" from one to the other by simply moving your mouse cursor over to the window you want, without having to click on that other window.

Why is this useful, you ask?

Well, sometimes I might need to copy information from one window to another, and for whatever reason, copy & paste might not be an option. That means I need both windows visible to me, and I might not need to see the full window to which I'm copying the info...

Every once in a while, I would search for TweakUI and Vista, hoping that they've finally released a version for it. Today I realized that the only thing I really want from it was the X-Mouse function, so I searched for that specifically, and found my solution.

It turns out, Vista already has a version of it built-in. Unfortunately for me, it wasn't the exact version I wanted...

There are two different possible behaviors in X-Mouse:
  1. Follow the mouse cursor to set the active window, and bring the active window to the front.
  2. Follow the mouse cursor to set the active window, and leave the active window where it is (be it in the foreground, the background, or somewhere in between).
In Windows Vista, if you go to the Control Panel > Ease of Access Center > Make the mouse easier to use, you'll find a checkbox for "Activate a window by hovering over it with the mouse"; checking the box will get you the first behavior--Move your mouse over to a window in the background, and (500 milliseconds later) that background window will be in the foreground.

Me, I want the second kind of behavior. But there's no setting to get that behavior. No graphical setting, anyway. Nope, to get that behavior, we'll have to edit the Windows registry.


So, fire up regedit, and get yourself to [HKEY_CURRENT_USER\Control Panel\Desktop]; but first, make sure that checkbox mentioned above is not checked--it makes what we're about to do easier.

Look for the REG_BINARY key of "UserPreferencesMask," and make note of its data values (Mine was "9e 3e 07 80 12 00 00 00").

To make Windows follow your mouse cursor, but not bring the window to the front, add 1(hex) to the first hexadecimal number (which in my case makes it "9f 3e 07 80 12 00 00 00"); to bring the active window to the foreground, on the other hand, requires that you add 41(hex) to the first hex number--for the curious, you can confirm this by using the setting in your Control Panel, then refreshing the display in the registry editor, and making the calculations for yourself.

Next, see if the REG_DWORD key of "ActiveWndTrkTimeout" exists. The value here is for "how long should windows wait before changing focus, in milliseconds." If it exists, the default value is probably "1f4" in Hex, or "500" milliseconds in the decimal system. You can edit this to be whatever value you want. If it doesn't exist, create it, and set it to the value you want.

That's it! Log off your current Windows user, then log back in, and it will take effect.



Oh, and the reason I said not checking the box would make it easier? Well, if the box was checked, then you'd have to subtract 40(hex) from the first hex number, instead of just adding 1(hex). I can add 1(hex) in my head, but subtracting by 40(hex)? I'd either need a piece of paper to work out the math, or a scientific calculator.

0 comments: