public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Lemke, Michael  SF/HZA-ZIC2" <lemkemch@schaeffler.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: X11 blinking cursor in text window like 'gvim' - only halts if moved-over another X11-win
Date: Thu, 8 Apr 2021 09:52:47 +0000	[thread overview]
Message-ID: <VI1PR03MB6446117C1CA60C30C43CD948BE749@VI1PR03MB6446.eurprd03.prod.outlook.com> (raw)
In-Reply-To: <87k0pec4pp.fsf@Rainer.invalid>

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]

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

[-- Attachment #2: xmouse.c --]
[-- Type: text/plain, Size: 2413 bytes --]

#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;
}

  parent reply	other threads:[~2021-04-08  9:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  0:27 L A Walsh
2021-04-07 18:46 ` Achim Gratz
2021-04-08  8:52   ` L A Walsh
2021-04-08  9:52   ` Lemke, Michael  SF/HZA-ZIC2 [this message]
2021-04-08 11:19   ` Andrey Repin
2021-04-15 19:10     ` Achim Gratz
2021-06-16 17:41     ` L A Walsh
2021-04-09 14:41 ` Jon Turney
2021-04-09 15:12   ` Thomas Wolff
2021-04-10 21:40     ` L A Walsh
2021-04-11 14:14     ` Jon Turney
2021-04-10 19:14   ` L A Walsh
2021-04-10 21:37     ` L A Walsh
2021-04-11 14:33       ` Jon Turney
2021-04-11 14:53         ` L A Walsh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR03MB6446117C1CA60C30C43CD948BE749@VI1PR03MB6446.eurprd03.prod.outlook.com \
    --to=lemkemch@schaeffler.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).