all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* switch-to-buffer-other-frame changes focus/mouse to that other frame
@ 2010-10-15  9:14 Zidek, Herbert
  0 siblings, 0 replies; 3+ messages in thread
From: Zidek, Herbert @ 2010-10-15  9:14 UTC (permalink / raw
  To: help-gnu-emacs

 Hello!

Situation:

  A "switch-to-buffer-other-frame" switches to a (newly created)
  frame, but keeps the focus (and the mouse) on it's current
  location in

    GNU Emacs 22.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.12.0)
    of 2008-05-16 on willimas

  as a "switch-to-buffer-other-window" (with pop-up-frames==f) does.


  However, the same "switch-to-buffer-other-frame" in

    GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.6)
    of 2010-04-01 on build17

  gives the focus to (and places the mouse in) the (newly created)
  frame.


  I don't want to focus on the other-frame in this situation.
How can I avoid this behavior of Emacs 23.1.1?

  A subsequent "set-mouse-pixel-position frame_orig x_orig y_orig"
with according saved original values would help, but the delay
between the switching forth and back is too long in order to ignore
it.

Any idea or help would be appreciated.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: switch-to-buffer-other-frame changes focus/mouse to that other frame
@ 2010-10-16  7:56 martin rudalics
  0 siblings, 0 replies; 3+ messages in thread
From: martin rudalics @ 2010-10-16  7:56 UTC (permalink / raw
  To: Herbert.Zidek, help-gnu-emacs

 >   A "switch-to-buffer-other-frame" switches to a (newly created)
 >   frame, but keeps the focus (and the mouse) on it's current
 >   location in
 >
 >     GNU Emacs 22.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.12.0)
 >     of 2008-05-16 on willimas
 >
 >   as a "switch-to-buffer-other-window" (with pop-up-frames==f) does.
 >
 >
 >   However, the same "switch-to-buffer-other-frame" in
 >
 >     GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.6)
 >     of 2010-04-01 on build17
 >
 >   gives the focus to (and places the mouse in) the (newly created)
 >   frame.
 >
 >
 >   I don't want to focus on the other-frame in this situation.
 > How can I avoid this behavior of Emacs 23.1.1?

You can't, due to possible race conditions with the window manager :-(

Note that `switch-to-buffer-other-frame' is not a good example in this
context.  By design, this function permanently selects the window it
uses for showing the buffer and, implicitly, that window's frame.  Hence
it's only natural that it does also focus that frame.

But the problem you describe already occurs with `display-buffer' which,
by design, should _not_ select the window where it displays the buffer.
If, however, `display-buffer' shows the buffer in a new frame, it also
transfers focus to that frame and raises it.  Emacs 23 transfers focus
even when it _reuses_ an existing frame - there was a longer discussion
on this somehwere around 2007 or 2008 but I don't recall the title of
the thread any more.

It's probably most instructive to look at the rather ill-fated function
`display-buffer-other-frame' in files.el.  If we can fix this, we could
try to make the do-not-transfer-focus behavior optional at least on all
those systems that support it reliably.

martin



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: switch-to-buffer-other-frame changes focus/mouse to that other frame
       [not found] ` <jwv8w1x516w.fsf-monnier+gnu.emacs.help@gnu.org>
@ 2010-10-16 21:17   ` Miles Bader
  0 siblings, 0 replies; 3+ messages in thread
From: Miles Bader @ 2010-10-16 21:17 UTC (permalink / raw
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:
> As for moving the mouse, it does seem undesirable, tho it would be
> expected&normal if you've set focus-follows-mouse to a non-nil value.

I think that focus-switching-without-mouse-moving-in-focus-follows-
mouse-mode has always been a bit flaky and unreliable[*], although
convenient.  If moving the mouse-pointer too helps somewhat, it's
probably the best thing.

[*] though it "mostly works," because FFM mode in X is "edge triggered"
-- it doesn't actually do anything until the mouse enters a window

-Miles

-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-16 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-16  7:56 switch-to-buffer-other-frame changes focus/mouse to that other frame martin rudalics
     [not found] <mailman.8.1287167122.4625.help-gnu-emacs@gnu.org>
     [not found] ` <jwv8w1x516w.fsf-monnier+gnu.emacs.help@gnu.org>
2010-10-16 21:17   ` Miles Bader
  -- strict thread matches above, loose matches on Subject: below --
2010-10-15  9:14 Zidek, Herbert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.