unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: [ELISP] Detect focus on emacs.
Date: Tue, 03 May 2005 19:24:11 -0400	[thread overview]
Message-ID: <87br7rq4le.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.1224.1115069322.2819.help-gnu-emacs@gnu.org

>>> 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

      parent reply	other threads:[~2005-05-03 23:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-25 22:47 [ELISP] Detect focus on emacs Micha
2005-04-27 10:10 ` Micha
2005-04-27 12:10   ` Peter Dyballa
     [not found]   ` <mailman.3175.1114604433.2895.help-gnu-emacs@gnu.org>
2005-04-27 17:41     ` Mathias Dahl
2005-04-27 19:08       ` Micha
2005-05-02 13:50         ` rgb
2005-05-03 13:15           ` Mathias Dahl
2005-05-03 16:57             ` rgb
2005-05-02  0:38 ` [ELISP] " Stefan Monnier
2005-05-02 21:21   ` Michael Cadilhac
2005-05-03  3:09     ` Joe Corneli
2005-05-03 19:33       ` Peter Dyballa
2005-05-04 20:29         ` Drew Adams
2005-05-04 21:15           ` Peter Dyballa
2005-05-04 21:31             ` Drew Adams
2005-05-04 22:28               ` Peter Dyballa
     [not found]           ` <mailman.3325.1115241750.2819.help-gnu-emacs@gnu.org>
2005-05-04 21:44             ` Michael Cadilhac
     [not found]       ` <mailman.3162.1115148898.2819.help-gnu-emacs@gnu.org>
2005-05-04 19:57         ` Michael Cadilhac
2005-05-04 20:03           ` Michael Cadilhac
2005-05-05  2:53           ` Joe Corneli
     [not found]           ` <mailman.3390.1115261851.2819.help-gnu-emacs@gnu.org>
2005-05-05  5:30             ` David Kastrup
     [not found]   ` <mailman.1224.1115069322.2819.help-gnu-emacs@gnu.org>
2005-05-03  8:56     ` Tim X
2005-05-04  3:46       ` Joe Corneli
2005-05-04 15:56       ` Kevin Rodgers
2005-05-04 20:13       ` Michael Cadilhac
2005-05-03 23:24     ` Stefan Monnier [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87br7rq4le.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    /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).