Mouse-mouse-focus conflicts with Resharper navigation

In Windows 7, you can focus on a window simply by hovering your mouse over it. This feature is not enabled by default, but you can enable it in the control panel. (Here's the way:

[Ease of Access Center → Ease of Mouse Use → check the box "Activate the window by hovering over it"]).

I like this feature a lot, but sometimes it annoys me when I try to open a C # class in Visual Studio using Resharper. I'll press CTRL + N and type in the name of the class I want to see (for example, "MyWpfClass"). Resharper will then show a dropdown list of suggestions with "MyWpfClass" at the top. I hit return and Resharper now opens a dropdown menu that lets me choose between "MyWpfClass.xaml" and "MyWpfClass.xaml.cs". However, if the mouse cursor is in the wrong place, the dropdown will close within a second and I will return to the square. Is there a way to fix this without disabling the focus-follow-mouse feature?

+3


source to share


1 answer


I had the same problem with MS Outlook: the list of automatic suggestions for contacts will close automatically because Windows viewed it as a window and not part of the New Message window.

You can use NiftyWindows, which has the same "Focus Follows Mouse" option available through its context menu.



Alternatively, since it's written in Autohotkey, you can use extract and run your "XWN_FocusHandler" subroutine in a stand-alone script:

#Persistent 
#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn All, OutputDebug ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTimer, XWN_FocusHandler, 100
return

XWN_FocusHandler:
    CoordMode, Mouse, Screen
    MouseGetPos, XWN_MouseX, XWN_MouseY, XWN_WinID
    If ( !XWN_WinID )
        Return

    If ( (XWN_MouseX != XWN_MouseOldX) or (XWN_MouseY != XWN_MouseOldY) )
    {
        IfWinNotActive, ahk_id %XWN_WinID%
            XWN_FocusRequest = 1
        Else
            XWN_FocusRequest = 0

        XWN_MouseOldX := XWN_MouseX
        XWN_MouseOldY := XWN_MouseY
        XWN_MouseMovedTickCount := A_TickCount
    }
    Else
        If ( XWN_FocusRequest and (A_TickCount - XWN_MouseMovedTickCount > 500) )
        {
            WinGetClass, XWN_WinClass, ahk_id %XWN_WinID%
            If ( XWN_WinClass = "Progman" )
                Return

            ; checks wheter the selected window is a popup menu
            ; (WS_POPUP) and !(WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME)
            WinGet, XWN_WinStyle, Style, ahk_id %XWN_WinID%
            If ( (XWN_WinStyle & 0x80000000) and !(XWN_WinStyle & 0x4C0000) )
                Return

            IfWinNotActive, ahk_id %XWN_WinID%
                WinActivate, ahk_id %XWN_WinID%

            XWN_FocusRequest = 0
        }
Return

      

+1


source







All Articles