unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16761: 24.3.50; focus-in-hook not running accurately when frame switches to terminal
@ 2014-02-15 12:14 Steven Edwards
  2014-02-15 14:31 ` Eli Zaretskii
  2021-12-04  3:27 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Steven Edwards @ 2014-02-15 12:14 UTC (permalink / raw)
  To: 16761

Starting from emacs -Q:

---
(server-start)
(defun rand/on-focus ()
  (message (concat (prin1-to-string window-system) (prin1-to-string
  (selected-frame)) (format-time-string "%H:%M:%S.%N"))))
(add-hook 'focus-in-hook 'rand/on-focus)
---

Open another graphical frame with C-x 5 2; switch it to *Messages* buffer.

Next open a non-graphical frame with emacsclient -nw.

You should now have three frames open.

Switch frames from one to the next.  (I'm using the awesome window
manager, so Super-J.)

You'll notice that when switching from one graphical frame to the next,
two messages appear, e.g.:

---
x#<frame *unsent mail to bug-gnu-emacs@gnu.org* 0xe88e40>06:40:47.325463985
x#<frame *Messages* 0x1123978>06:40:47.384926969
---

...but when cycling from a graphical frame to a terminal frame, nothing new
appears in *Messages*--until you switch to a graphical frame:

---
x#<frame *Messages* 0x1123978>06:44:37.889809270
x#<frame *Messages* 0x1123978>06:44:37.922339020
x#<frame *unsent mail to bug-gnu-emacs@gnu.org* 0xe88e40>06:44:37.922801690
---

If you perform any actions on the terminal frame after switching switch
from a graphical frame, *Messages* will receive one message--as if
focus-in-hooks are being called from focus-out-hooks:

---
x#<frame emacs@Rand.launchmodem.com 0x352e880>06:56:51.097246751
---

Switching to a raphical frame after performing an action on the terminal
frame will finally send a message containing the terminal frame object,
but only after it loses focus:

---
nil#<frame F2 0x11e90c8>06:56:53.533491550
x#<frame emacs@Rand.launchmodem.com 0x352e880>06:56:53.533998714
---

Possibly related, C-x 5 o skips over any terminal frames and C-x 5 1
won't delete terminal frames.

The use case for this is that I'd like to use different themes for X
frames and terminal frames.

I know the use of window-system is deprecated; (framep (selected-frame))
does not work either.

I hope this report helps.

Best,

Steven




In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
 of 2014-01-25 on Rand
Windowing system distributor `The X.Org Foundation', version 11.0.11004000
System Description:	Debian GNU/Linux 6.0.8 (squeeze)

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f . e m a c s <return> C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-b C-x
C-e C-x b C-g C-x C-f . e m a c s . d / l i TAB c u
s TAB g l TAB <return> C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-b C-x C-e C-n C-n C-n C-n
C-n C-n C-a C-b C-x C-e C-x 5 2 <switch-frame> M-x
i d o - m o d e <return> <switch-frame> C-x b m e <return>
<switch-frame> <switch-frame> <switch-frame> <switch-frame>
ESC [ > 1 ; 2 4 0 3 ; 0 c <switch-frame> <switch-frame>
<switch-frame> <switch-frame> <switch-frame> <switch-frame>
M-x r e p o r t - e m SPC SPC <return>

Recent messages:
x#<frame custom-global.el 0xe88e40>06:28:40.401223846
x#<frame *Messages* 0x1123978>06:28:40.435829590
x#<frame *Messages* 0x1123978>06:28:58.428023215
x#<frame *Messages* 0x1123978>06:28:58.482460360
x#<frame custom-global.el 0xe88e40>06:28:58.482890190
x#<frame custom-global.el 0xe88e40>06:29:07.640302435
x#<frame *Messages* 0x1123978>06:29:07.675357806
x#<frame *Messages* 0x1123978>06:29:20.079938338
x#<frame *Messages* 0x1123978>06:29:20.136675311
x#<frame custom-global.el 0xe88e40>06:29:20.137121846

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 xterm ido server 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 font-render-setting move-toolbar
gtk x-toolkit x multi-tty emacs)





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

end of thread, other threads:[~2021-12-04  3:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-15 12:14 bug#16761: 24.3.50; focus-in-hook not running accurately when frame switches to terminal Steven Edwards
2014-02-15 14:31 ` Eli Zaretskii
2014-02-15 17:04   ` Steven Edwards
2014-02-15 17:14     ` Eli Zaretskii
2014-02-15 17:23       ` Steven Edwards
2014-02-15 20:39         ` Eli Zaretskii
2021-12-04  3:27 ` Lars Ingebrigtsen

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