Subject: bug#16540: 24.3.50; emacs started on tty has frame focus problems with frames on X display

From: Noah Friedman <[email-masked]>
Date: Fri, 24 Jan 2014 12:08:49 -0800 (PST)

I'm using focus-follows-mouse in my X window manager.

If I start emacs in an xterm:

	$ ./emacs -nw -Q

And then create an X frame:

	M-x create-frame-on-display RET :0.0 RET

and move the mouse to the new X frame, when I try to type or issue extended
commands with M-x, the text and commands appear in the text frame.

If I hit C-g or click on the window inside the X frame, it will finally
change focus to the new window (but clicking on the window manager
decoration around the frame will not work).

I have similar problems switching between multiple X frames, but ONLY when
emacs was started on a tty.  If the initial frame was an X frame,
focus-follows-mouse works as intended.

This problem started sometime between 2013-07-01 and 2013-08-01, but that's
as far as I've narrowed it down so far.  Since I recently read that the
tree is in feature freeze, I figured I better report this now.

In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2014-01-24 on unexploded-cow.prv.splode.com
Windowing system distributor `Fedora Project', version 11.0.11204000
Configured using:
 `configure --with-x-toolkit=lucid 'CFLAGS=-O3 -march=corei7
 -mtune=corei7 -momit-leaf-frame-pointer -m64 -g2 -pipe' 'LDFLAGS=-O3
 -march=corei7 -mtune=corei7 -momit-leaf-frame-pointer -m64 -g2 -pipe''

Important settings:
  value of $XMODIFIERS: @im=none
  locale-coding-system: nil

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 4 1 ; 2 9 8 ; 0 c ESC x m a k e - f r a m e
- o n - d i s p l TAB RET : 0 . 0 RET C-x b f o o RET
f s d f s f s d f <help-echo> s d f s d f s d f s d
f <help-echo> <help-echo> C-s C-d f s d f s d f <help-echo>
<help-echo> <help-echo> <help-echo> M-x C-g <switch-frame>
C-g <switch-frame> M-x <down-mouse-1> <mouse-1> M-x
<help-echo> C-g C-g M-x C-g <switch-frame> C-g C-g
C-g C-g g f g d f g <down-mouse-1> <mouse-1> <double-down-mouse-1>
<double-mouse-1> f g d f g M-x e m a c s - r e p o
r t <tab> C-a C-k r e p o r t - e m <tab> <return>

Recent messages:
("./emacs")
For information about GNU Emacs and the GNU system, type C-h C-a.
call-interactively: End of buffer
Quit [2 times]
completing-read-default: Command attempted to use minibuffer while in minibuffer
Quit [11 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils misearch multi-isearch xterm
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting x-toolkit x multi-tty emacs)