On April 7, 2021 8:47 PM Achim Gratz wrote:
>L A Walsh writes:
>> If I move the windows cursor to another editor window in X11,
>> the blinking cursor moves to the new window, but if I move
>> it to a native window, the blinking doesn't stop.
>>
>> Has this always been this way?
>
>Windows never had "focus follows mouse" in any version I can remember.
>

It has had it since Windows95 or so and it is my default setting on 
any PC I use. Attached is a little program I wrote a long time ago that 
turns the feature on or off. Compile with `gcc xmouse.c` or mingw.

Something like this was included in the Windows PowerToys as xmouse.exe.

Michael
#define WINVER 0x0500
#include <windows.h>
#include <stdio.h>
 
/* gcc -mno-cygwin -mwindows  ... */
 
void ErrorExit(LPTSTR lpszFunction, DWORD dw) 
{ 
    LPVOID lpMsgBuf;
    LPVOID lpDisplayBuf;
    //DWORD dw = GetLastError(); 
 
    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        dw,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR) &lpMsgBuf,
        0, NULL );
 
    lpDisplayBuf = LocalAlloc(LMEM_ZEROINIT, 
        strlen(lpMsgBuf)+strlen(lpszFunction)+40); 
    wsprintf(lpDisplayBuf, 
        "%s failed with error %d: %s", 
        lpszFunction, dw, lpMsgBuf); 
    MessageBox(NULL, lpDisplayBuf, "Error", MB_OK); 
 
    LocalFree(lpMsgBuf);
    LocalFree(lpDisplayBuf);
    ExitProcess(dw); 
}
 
 
 
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) {
//int main (void) {
 
   BOOL xmouse = FALSE;
 
   DWORD status;
 
   if( !(status=SystemParametersInfo( SPI_GETACTIVEWINDOWTRACKING,
                                      0,
                                      &xmouse,
                                      0
                                     )) ) {
      ErrorExit("Get mouse status",status);
   }

   if( !(status=SystemParametersInfo( SPI_SETACTIVEWNDTRKZORDER,
                                      0,
                                      (PVOID)FALSE,
                                      SPIF_UPDATEINIFILE || 
SPIF_SENDWININICHANGE
                                    )) ) {
      ErrorExit("Set mouse status",status);
   }

   if( !(status=SystemParametersInfo( SPI_SETACTIVEWNDTRKTIMEOUT,
                                      0,
                                      (PVOID)100,
                                      SPIF_UPDATEINIFILE || 
SPIF_SENDWININICHANGE
                                    )) ) {
      ErrorExit("Set mouse status",status);
   }

   xmouse = !xmouse;
   if( !(status=SystemParametersInfo( SPI_SETACTIVEWINDOWTRACKING,
                                      0,
                                      (PVOID)xmouse,
                                      SPIF_UPDATEINIFILE || 
SPIF_SENDWININICHANGE
                                    )) ) {
      ErrorExit("Set mouse status",status);
   }
   printf( "X mouse is now %s.\n", xmouse ? "on" : "off" );
 
   return 0;
}
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to