none
xmouse SPI_SETACTIVEWINDOWTRACKING flag lost on logout (or login)

    Question

  • In Windows XP and earlier, I used the powertoys to get "focus follows mouse" behavior, which mimicks the X windows behavior (known as XMouse in the old PowerToys application).

    In Windows Vista, I wrote a Python script to set the "focus follows mouse" flag. The Python script uses the Windows API function: SystemParametersInfoW using the parameter SPI_SETACTIVEWINDOWTRACKING.

    Beginning with Windows 7, the API still works, but the behavior is lost on logout or login. That is, I can enable xmouse and it works just as it did with Windows 6, but when I log out and log back in, the setting is lost.

    Is this by design, or is this a bug?  If it's by design, is the recommended solution to run a process on login to call the API function?
    Friday, October 09, 2009 3:23 PM

All replies

  • Here's something interesting. On the two machines that I upgraded from Windows Vista (instead of performing a clean install), the XMouse behavior appears to be persistent. That is, without making any calls to SystemParametersInfoW, the "focus follows mouse" behavior continues as before the upgrade.
    Thursday, October 29, 2009 1:51 PM
  • I'm still interested in knowing if this is a bug or intended behavior, and if there's a way to make the SPI_SETACTIVEWINDOWTRACKING flag persistent.
    • Edited by Jason R. Coombs Saturday, November 07, 2009 11:32 PM elaborated my inquiry
    Saturday, November 07, 2009 11:31 PM
  • I've additionally observed that the "focus follows mouse" flag is also reset even without a logout event. On those machines that received a clean install of Windows, the focus follows mouse behavior will be reset on a logout or periodically in an active session. I do not know what triggers the resetting of the flag. I would estimate it happens approximately once a week. On the Windows 7 machine that was upgraded from Windows Vista, however, the flag persists without any intervention.

    I would still like to know if there's a way to keep this flag from being reset.
    Friday, January 29, 2010 1:56 PM
  • I've found that establishing a remote desktop connection to the clean-installed Windows 7 machine will reliably clear the SPI_SETACTIVEWINDOWTRACKING flag.  Again, this only happens on a clean-installed machine. I remote into a machine that was upgraded from Vista and it retains the flag setting. How can I make the clean-installed machine retain the behavior in the same way that the upgraded machine does?
    Thursday, April 01, 2010 10:10 PM