summaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2017-10-01 10:17:17 +0200
committerMartin Rudalics <rudalics@gmx.at>2017-10-01 10:17:17 +0200
commitb03b4f6d79f1736f2455574aced92f89ed032d79 (patch)
treed1c6e321991f13f90b95dd2a90bded0263c7406c /src/frame.c
parentba9139c501ed8220980e898f127e293e8f263ea1 (diff)
downloademacs-b03b4f6d79f1736f2455574aced92f89ed032d79.tar.gz
Improve handling of iconification of child frames (Bug#28611)
* src/frame.c (Ficonify_frame): Handle `iconify-child-frame' option. (syms_of_frame): New symbols Qiconify_top_level and Qmake_invisible. (iconify_child_frame): New option. * lisp/cus-start.el (iconify-child-frame): Add customization properties. * doc/lispref/frames.texi (Child Frames): Describe new option `iconify-child-frame'. Don't index "top-level frame" twice.
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/frame.c b/src/frame.c
index 39e5cc9c854..4ec54fa3473 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2535,10 +2535,33 @@ displayed in the terminal. */)
DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
0, 1, "",
doc: /* Make the frame FRAME into an icon.
-If omitted, FRAME defaults to the currently selected frame. */)
+If omitted, FRAME defaults to the currently selected frame.
+
+If FRAME is a child frame, consult the variable `iconify-child-frame'
+for how to proceed. */)
(Lisp_Object frame)
{
struct frame *f = decode_live_frame (frame);
+ Lisp_Object parent = f->parent_frame;
+
+ if (!NILP (parent))
+ {
+ if (NILP (iconify_child_frame))
+ /* Do nothing. */
+ return Qnil;
+ else if (EQ (iconify_child_frame, Qiconify_top_level))
+ {
+ /* Iconify top level frame instead (the default). */
+ Ficonify_frame (parent);
+ return Qnil;
+ }
+ else if (EQ (iconify_child_frame, Qmake_invisible))
+ {
+ /* Make frame invisible instead. */
+ Fmake_frame_invisible (frame, Qnil);
+ return Qnil;
+ }
+ }
/* Don't allow minibuf_window to remain on an iconified frame. */
check_minibuf_window (frame, EQ (minibuf_window, selected_window));
@@ -5713,6 +5736,8 @@ syms_of_frame (void)
DEFSYM (Qheight_only, "height-only");
DEFSYM (Qleft_only, "left-only");
DEFSYM (Qtop_only, "top-only");
+ DEFSYM (Qiconify_top_level, "iconify-top-level");
+ DEFSYM (Qmake_invisible, "make-invisible");
{
int i;
@@ -6016,6 +6041,21 @@ This variable is effective only with the X toolkit (and there only when
Gtk+ tooltips are not used) and on Windows. */);
tooltip_reuse_hidden_frame = false;
+ DEFVAR_LISP ("iconify-child-frame", iconify_child_frame,
+ doc: /* How to handle iconification of child frames.
+This variable tells Emacs how to proceed when it is asked to iconify a
+child frame. If it is nil, `iconify-frame' will do nothing when invoked
+on a child frame. If it is `iconify-top-level', Emacs will try to
+iconify the top level frame associated with this child frame instead.
+If it is `make-invisible', Emacs will try to make this child frame
+invisible instead.
+
+Any other value means to try iconifying the child frame. Since such an
+attempt is not honored by all window managers and may even lead to
+making the child frame unresponsive to user actions, the default is to
+iconify the top level frame instead. */);
+ iconify_child_frame = Qiconify_top_level;
+
staticpro (&Vframe_list);
defsubr (&Sframep);