help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting notified on focus events.


From: rgb
Subject: Re: Getting notified on focus events.
Date: 25 Oct 2006 11:16:42 -0700
User-agent: G2/1.0

martin.blais@gmail.com wrote:
> Hi
>
> New gig, new environment, and I inherited two glorious 30-inch LCD
> monitors and a 24-in sidekick.  Nice setup one would think, but my
> emacs windows are so unscrupulously large now that it takes me about 10
> seconds to find where my cursor is, even with blinking on.  To
> alleviate the problem, I wrote an Emacs package that will briefly flash
> an overlay around the cursor when I switch frames.
> http://furius.ca/pubcode/pub/conf/common/elisp/blais/highwin.el
>
> While this is working well when switching between frames, I also need
> to flash my cursor when I switch between window manager windows (e.g.
> non-Emacs windows, the X-windows of other applications).  That is, I
> need to be notified for enter-focus and leave-focus X events, somehow.
>
> I tried adding an advice on handle-switch-frame and make-frame-visible
> and a few other functions, and I cannot get it to work.  There are no
> hooks I could find.
>
> Any idea?  Can this be done?

I suppose you know about this...?

Most X window managers are set up so that just moving the mouse into a
window is enough to set the focus there. Emacs appears to do this,
because it changes the cursor to solid in the new frame. However, there
is no need for the Lisp program to know about the focus change until
some other kind of input arrives. So Emacs generates a focus event only
when the user actually types a keyboard key or presses a mouse button
in the new frame; just moving the mouse between frames does not
generate a focus event.

A focus event in the middle of a key sequence would garble the
sequence. So Emacs never generates a focus event in the middle of a key
sequence. If the user changes focus in the middle of a key
sequence-that is, after a prefix key-then Emacs reorders the events
so that the focus event comes either before or after the multi-event
key sequence, and not within it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]