unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: 17439@debbugs.gnu.org
Subject: bug#17439: 24.3.50; run-with-idle-timer runs on focus-out
Date: Sun, 11 May 2014 18:29:19 -0400	[thread overview]
Message-ID: <jwvk39s3qs7.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87r440gfhf.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 12 May 2014 00:31:48 +0300")

>> Huh?  `run-with-idle-timer' is not supposed to generate any event.
> It runs on `focus-out',

It does.  But that doesn't mean that "`run-with-idle-timer' generates
the `focus-out'".  The `focus-out' event is generated by the
window-manager plus Emacs's C code in response to some situation such as
a user action.  And after execution of the command bound to `focus-out',
we run the idle timers.

> (defun test () (message "%S" last-input-event))
> (setq timer (run-with-idle-timer 0.1 t 'test))
> It generates:
> (focus-in #<frame emacs@localhost 0x1121908>)
> (focus-out #<frame emacs@localhost 0x1121908>)

Your code generates some output which mentions `focus-out' but it did
not generate those events.

>>> +			 ;; Some window managers generate the `focus-in' event
>>> +			 ;; when showing the Window List,
>> What means "showing the Window List"?
> It depends on the desktop environment, but usually this is a list of windows
> shown after typing Alt-Tab.

Then I still don't understand: why would Emacs get a focus-in event when
the window-manager shows the "Window List"?  I'd maybe expect
a focus-*out* event, since suddenly the focus might go from Emacs to the
Window List.

Or do you mean that Emacs gets a focus-in event when the user selects
an Emacs frame in the window manager's Window List (maybe even if that
selection is transient while looping through all windows)?

>>> +			 ;;  but `raise-frame' forcibly switches to an Emacs
>>> frame when the Window List is active,

Well, this behavior is a choice of the window-manager.  While I'm very
happy to call raise-frame less often (so I generally agree with the
direction of the patch), you could argue that this might be a bug in the
window-manager.

> This is specific behavior observed at least in one window manager (Gnome 2),
> where typing Alt-Tab shows the Window List and generates the `focus-in' event
> in Emacs at the same time.

OK, I think I understand.  Please make the comment a bit more clear
about the fact that the focus-in event might come even *while* (rather
than *when*) the "Window List thingy to select a window" is active.

> But maybe it should be handled like `focus-in', i.e. also
> to not ignore it in `mouse-avoidance-ignore-p' and to move
> the mouse pointer after switching between Emacs frames.

I don't have a strong opinion either way, but it seems like they
generally should be handled in the same way, since they occur in similar
circumstances (one being when you focus-in from another frame of the
same Emacs session, while the other is when you focus-in from some
other process).


        Stefan





  reply	other threads:[~2014-05-11 22:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 20:45 bug#17439: 24.3.50; run-with-idle-timer runs on focus-out Juri Linkov
2014-05-09  6:28 ` Eli Zaretskii
2014-05-09 20:35   ` Juri Linkov
2014-05-10  6:16     ` Eli Zaretskii
2014-05-10 20:38       ` Juri Linkov
2014-05-11 20:19       ` Juri Linkov
2014-05-11 21:06         ` Stefan Monnier
2014-05-11 21:31           ` Juri Linkov
2014-05-11 22:29             ` Stefan Monnier [this message]
2014-05-12 20:39               ` Juri Linkov
2014-05-13 19:33                 ` Stefan Monnier
2014-05-20 21:14                   ` Juri Linkov
2014-05-20 22:12                     ` Juri Linkov

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=jwvk39s3qs7.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=17439@debbugs.gnu.org \
    --cc=juri@jurta.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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