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

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

Re: [ELISP] Detect focus on emacs.


From: Stefan Monnier
Subject: Re: [ELISP] Detect focus on emacs.
Date: Tue, 03 May 2005 19:24:11 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>> I need to know if emacs has the global input focus, that's to say,
>>> if emacs' window is the selected one in the wm.
>> 
>> I don't think you can do that from elisp as of Emacs-22.
>> Patches are welcome to add the functionality, of course,

>     A   function   like  `window-focus-p',   that   will  check   with
>   XGetInputFocus(3x)/GetForegroundWindow(w32)  if  the current  window
>   has the input focus ?

BTW, you might want to use other info than focus.  E.g. you might just want
to check whether one of Emacs's frames is currently visible (rather than
obscured by another window).
Of course it depends on the actual application you have in mind.

In any case, whatever you use will be fragile, since you might lose focus
between the moment you ask whether you have focus and the moment you act
on it.

>     So I'll  have a try. BTW,  is there guidelines  for emacs patches,
>   some must-know coding style or whatever like that somewhere ?

Try to mimick the rest of the code ;-)


        Stefan


reply via email to

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