all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Selecting tooltip frames considered harmful
@ 2018-02-24  9:52 martin rudalics
  2018-02-24 10:41 ` Eli Zaretskii
  2018-02-25 13:33 ` Stefan Monnier
  0 siblings, 2 replies; 15+ messages in thread
From: martin rudalics @ 2018-02-24  9:52 UTC (permalink / raw)
  To: emacs-devel

Emacs tooltip frames are not "first-class" frames.  They don't have
minibuffer windows which means that calling 'message' when a tooltip
frame is selected will crash Emacs.  For example, with emacs -Q run
the following function and move the mouse cursor over the mode line
until a tooltip pops up:

(defun foo ()
   (interactive)
   (track-mouse
     (while (progn
              (setq event (read-key))
              (or (mouse-movement-p event)
                  (memq (car event) '(select-window switch-frame))))
       (dolist (frame (visible-frame-list))
	(when (frame-parameter frame 'tooltip)
	  (select-frame frame)
	  (message "..."))))))

Note also the following excerpt from choose_minibuf_frame

       /* I don't think that any frames may validly have a null minibuffer
	 window anymore.  */
       if (NILP (sf->minibuffer_window))
	emacs_abort ();

so the following function will crash us in a similar way:

(defun bar ()
   (interactive)
   (track-mouse
     (while (progn
              (setq event (read-key))
              (or (mouse-movement-p event)
                  (memq (car event) '(select-window switch-frame))))
       (dolist (frame (visible-frame-list))
	(when (frame-parameter frame 'tooltip)
	  (select-frame frame)
	  (read-from-minibuffer "..."))))))

You won't observe these crashes with GTK+ tooltips since these are not
Emacs frames.  Customize 'x-gtk-use-system-tooltips' to nil in order
to see them with GTK builds.

There seem to be various ways to fix this.  For the 'message' case we
could:

(1) Ignore the message in message3_nolog (the ideal solution but maybe
     too simplistic).

(2) Send the message to stderr instead (confusing for plain messages
     and hardly suited for 'read-from-minibuffer').

(3) Give tooltip frames a minibuffer window of some other frame (with
     the usual consequences when trying to delete that frame).

(4) Try to find a frame with a minibuffer and put the message there
     (it might be tricky to find the most suited minibuffer here).

(5) Avoid that a tooltip frame gets selected (hardly feasible).

A similar solution should be found when reading from the minibuffer.

Suggestions welcome, martin



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

end of thread, other threads:[~2018-02-27  2:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-24  9:52 Selecting tooltip frames considered harmful martin rudalics
2018-02-24 10:41 ` Eli Zaretskii
2018-02-25 19:08   ` martin rudalics
2018-02-25 19:55     ` Eli Zaretskii
2018-02-26  9:05       ` martin rudalics
2018-02-26 15:50         ` Eli Zaretskii
2018-02-26 18:54           ` martin rudalics
2018-02-26 19:31             ` Eli Zaretskii
2018-02-27  2:57               ` Stefan Monnier
2018-02-25 13:33 ` Stefan Monnier
2018-02-25 19:08   ` martin rudalics
2018-02-26  3:02     ` Stefan Monnier
2018-02-26  9:06       ` martin rudalics
2018-02-26 13:21         ` Stefan Monnier
2018-02-26 18:54           ` martin rudalics

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.