aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2017-10-01 10:17:17 +0200
committerMartin Rudalics2017-10-01 10:17:17 +0200
commitb03b4f6d79f1736f2455574aced92f89ed032d79 (patch)
treed1c6e321991f13f90b95dd2a90bded0263c7406c
parentba9139c501ed8220980e898f127e293e8f263ea1 (diff)
downloademacs-b03b4f6d79f1736f2455574aced92f89ed032d79.tar.gz
emacs-b03b4f6d79f1736f2455574aced92f89ed032d79.zip
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.
-rw-r--r--doc/lispref/frames.texi30
-rw-r--r--lisp/cus-start.el7
-rw-r--r--src/frame.c42
3 files changed, 73 insertions, 6 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index f66ecee8e8e..07a8b825026 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -3076,15 +3076,14 @@ as long as the parameter is not changed or reset. Technically, this
3076makes the child frame's window-system window a child window of the 3076makes the child frame's window-system window a child window of the
3077parent frame's window-system window. 3077parent frame's window-system window.
3078 3078
3079@cindex top-level frame
3080@cindex reparent frame 3079@cindex reparent frame
3081@cindex nest frame 3080@cindex nest frame
3082 The @code{parent-frame} parameter can be changed at any time. Setting 3081 The @code{parent-frame} parameter can be changed at any time. Setting
3083it to another frame @dfn{reparents} the child frame. Setting it to 3082it to another frame @dfn{reparents} the child frame. Setting it to
3084another child frame makes the frame a @dfn{nested} child frame. Setting 3083another child frame makes the frame a @dfn{nested} child frame. Setting
3085it to @code{nil} restores the frame's status as a @dfn{top-level 3084it to @code{nil} restores the frame's status as a top-level frame---a
3086frame}---a frame whose window-system window is a child of its display's 3085frame whose window-system window is a child of its display's root
3087root window. 3086window.
3088 3087
3089 Since child frames can be arbitrarily nested, a frame can be both a 3088 Since child frames can be arbitrarily nested, a frame can be both a
3090child and a parent frame. Also, the relative roles of child and parent 3089child and a parent frame. Also, the relative roles of child and parent
@@ -3203,7 +3202,11 @@ a number of other ways as well. Here we sketch a few of them:
3203@item 3202@item
3204The semantics of maximizing and iconifying child frames is highly 3203The semantics of maximizing and iconifying child frames is highly
3205window-system dependent. As a rule, applications should never invoke 3204window-system dependent. As a rule, applications should never invoke
3206these operations for child frames. 3205these operations for on frames. By default, invoking
3206@code{iconify-frame} on a child frame will try to iconify the top-level
3207frame corresponding to that child frame instead. To obtain a different
3208behavior, users may customize the option @code{iconify-child-frame}
3209described below.
3207 3210
3208@item 3211@item
3209Raising, lowering and restacking child frames (@pxref{Raising and 3212Raising, lowering and restacking child frames (@pxref{Raising and
@@ -3259,6 +3262,23 @@ frame in the largest empty area of an existing window. This can be
3259useful to avoid that a child frame obscures any text shown in that 3262useful to avoid that a child frame obscures any text shown in that
3260window. 3263window.
3261 3264
3265Customizing the following option can be useful to tweak the behavior of
3266@code{iconify-frame} for child frames.
3267
3268@defvar iconify-child-frame
3269This option tells Emacs how to proceed when it is asked to iconify a
3270child frame. If it is @code{nil}, @code{iconify-frame} will do nothing
3271when invoked on a child frame. If it is @code{iconify-top-level}, Emacs
3272will try to iconify the top-level frame that is the ancestor of this
3273child frame instead. If it is @code{make-invisible}, Emacs will try to
3274make this child frame invisible instead of iconifying it.
3275
3276Any other value means to try iconifying the child frame. Since such an
3277attempt may not be honored by all window managers and can even lead to
3278making the child frame unresponsive to user actions, the default is to
3279iconify the top level frame instead.
3280@end defvar
3281
3262 3282
3263@node Mouse Tracking 3283@node Mouse Tracking
3264@section Mouse Tracking 3284@section Mouse Tracking
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index b197f2f1de5..fd015b70ca3 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -319,6 +319,13 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
319 (const :tag "Always" t) 319 (const :tag "Always" t)
320 (repeat (symbol :tag "Parameter"))) 320 (repeat (symbol :tag "Parameter")))
321 "25.1") 321 "25.1")
322 (iconify-child-frame frames
323 (choice
324 (const :tag "Do nothing" nil)
325 (const :tag "Iconify top level frame instead" iconify-top-level)
326 (const :tag "Make frame invisible instead" make-invisible)
327 (const :tag "Iconify" t))
328 "26.1")
322 (tooltip-reuse-hidden-frame tooltip boolean "26.1") 329 (tooltip-reuse-hidden-frame tooltip boolean "26.1")
323 ;; fringe.c 330 ;; fringe.c
324 (overflow-newline-into-fringe fringe boolean) 331 (overflow-newline-into-fringe fringe boolean)
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. */)
2535DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, 2535DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
2536 0, 1, "", 2536 0, 1, "",
2537 doc: /* Make the frame FRAME into an icon. 2537 doc: /* Make the frame FRAME into an icon.
2538If omitted, FRAME defaults to the currently selected frame. */) 2538If omitted, FRAME defaults to the currently selected frame.
2539
2540If FRAME is a child frame, consult the variable `iconify-child-frame'
2541for how to proceed. */)
2539 (Lisp_Object frame) 2542 (Lisp_Object frame)
2540{ 2543{
2541 struct frame *f = decode_live_frame (frame); 2544 struct frame *f = decode_live_frame (frame);
2545 Lisp_Object parent = f->parent_frame;
2546
2547 if (!NILP (parent))
2548 {
2549 if (NILP (iconify_child_frame))
2550 /* Do nothing. */
2551 return Qnil;
2552 else if (EQ (iconify_child_frame, Qiconify_top_level))
2553 {
2554 /* Iconify top level frame instead (the default). */
2555 Ficonify_frame (parent);
2556 return Qnil;
2557 }
2558 else if (EQ (iconify_child_frame, Qmake_invisible))
2559 {
2560 /* Make frame invisible instead. */
2561 Fmake_frame_invisible (frame, Qnil);
2562 return Qnil;
2563 }
2564 }
2542 2565
2543 /* Don't allow minibuf_window to remain on an iconified frame. */ 2566 /* Don't allow minibuf_window to remain on an iconified frame. */
2544 check_minibuf_window (frame, EQ (minibuf_window, selected_window)); 2567 check_minibuf_window (frame, EQ (minibuf_window, selected_window));
@@ -5713,6 +5736,8 @@ syms_of_frame (void)
5713 DEFSYM (Qheight_only, "height-only"); 5736 DEFSYM (Qheight_only, "height-only");
5714 DEFSYM (Qleft_only, "left-only"); 5737 DEFSYM (Qleft_only, "left-only");
5715 DEFSYM (Qtop_only, "top-only"); 5738 DEFSYM (Qtop_only, "top-only");
5739 DEFSYM (Qiconify_top_level, "iconify-top-level");
5740 DEFSYM (Qmake_invisible, "make-invisible");
5716 5741
5717 { 5742 {
5718 int i; 5743 int i;
@@ -6016,6 +6041,21 @@ This variable is effective only with the X toolkit (and there only when
6016Gtk+ tooltips are not used) and on Windows. */); 6041Gtk+ tooltips are not used) and on Windows. */);
6017 tooltip_reuse_hidden_frame = false; 6042 tooltip_reuse_hidden_frame = false;
6018 6043
6044 DEFVAR_LISP ("iconify-child-frame", iconify_child_frame,
6045 doc: /* How to handle iconification of child frames.
6046This variable tells Emacs how to proceed when it is asked to iconify a
6047child frame. If it is nil, `iconify-frame' will do nothing when invoked
6048on a child frame. If it is `iconify-top-level', Emacs will try to
6049iconify the top level frame associated with this child frame instead.
6050If it is `make-invisible', Emacs will try to make this child frame
6051invisible instead.
6052
6053Any other value means to try iconifying the child frame. Since such an
6054attempt is not honored by all window managers and may even lead to
6055making the child frame unresponsive to user actions, the default is to
6056iconify the top level frame instead. */);
6057 iconify_child_frame = Qiconify_top_level;
6058
6019 staticpro (&Vframe_list); 6059 staticpro (&Vframe_list);
6020 6060
6021 defsubr (&Sframep); 6061 defsubr (&Sframep);