diff options
| author | Martin Rudalics | 2017-10-01 10:17:17 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2017-10-01 10:17:17 +0200 |
| commit | b03b4f6d79f1736f2455574aced92f89ed032d79 (patch) | |
| tree | d1c6e321991f13f90b95dd2a90bded0263c7406c | |
| parent | ba9139c501ed8220980e898f127e293e8f263ea1 (diff) | |
| download | emacs-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.texi | 30 | ||||
| -rw-r--r-- | lisp/cus-start.el | 7 | ||||
| -rw-r--r-- | src/frame.c | 42 |
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 | |||
| 3076 | makes the child frame's window-system window a child window of the | 3076 | makes the child frame's window-system window a child window of the |
| 3077 | parent frame's window-system window. | 3077 | parent 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 |
| 3083 | it to another frame @dfn{reparents} the child frame. Setting it to | 3082 | it to another frame @dfn{reparents} the child frame. Setting it to |
| 3084 | another child frame makes the frame a @dfn{nested} child frame. Setting | 3083 | another child frame makes the frame a @dfn{nested} child frame. Setting |
| 3085 | it to @code{nil} restores the frame's status as a @dfn{top-level | 3084 | it to @code{nil} restores the frame's status as a top-level frame---a |
| 3086 | frame}---a frame whose window-system window is a child of its display's | 3085 | frame whose window-system window is a child of its display's root |
| 3087 | root window. | 3086 | window. |
| 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 |
| 3090 | child and a parent frame. Also, the relative roles of child and parent | 3089 | child 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 |
| 3204 | The semantics of maximizing and iconifying child frames is highly | 3203 | The semantics of maximizing and iconifying child frames is highly |
| 3205 | window-system dependent. As a rule, applications should never invoke | 3204 | window-system dependent. As a rule, applications should never invoke |
| 3206 | these operations for child frames. | 3205 | these operations for on frames. By default, invoking |
| 3206 | @code{iconify-frame} on a child frame will try to iconify the top-level | ||
| 3207 | frame corresponding to that child frame instead. To obtain a different | ||
| 3208 | behavior, users may customize the option @code{iconify-child-frame} | ||
| 3209 | described below. | ||
| 3207 | 3210 | ||
| 3208 | @item | 3211 | @item |
| 3209 | Raising, lowering and restacking child frames (@pxref{Raising and | 3212 | Raising, 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 | |||
| 3259 | useful to avoid that a child frame obscures any text shown in that | 3262 | useful to avoid that a child frame obscures any text shown in that |
| 3260 | window. | 3263 | window. |
| 3261 | 3264 | ||
| 3265 | Customizing the following option can be useful to tweak the behavior of | ||
| 3266 | @code{iconify-frame} for child frames. | ||
| 3267 | |||
| 3268 | @defvar iconify-child-frame | ||
| 3269 | This option tells Emacs how to proceed when it is asked to iconify a | ||
| 3270 | child frame. If it is @code{nil}, @code{iconify-frame} will do nothing | ||
| 3271 | when invoked on a child frame. If it is @code{iconify-top-level}, Emacs | ||
| 3272 | will try to iconify the top-level frame that is the ancestor of this | ||
| 3273 | child frame instead. If it is @code{make-invisible}, Emacs will try to | ||
| 3274 | make this child frame invisible instead of iconifying it. | ||
| 3275 | |||
| 3276 | Any other value means to try iconifying the child frame. Since such an | ||
| 3277 | attempt may not be honored by all window managers and can even lead to | ||
| 3278 | making the child frame unresponsive to user actions, the default is to | ||
| 3279 | iconify 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. */) | |||
| 2535 | DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, | 2535 | DEFUN ("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. |
| 2538 | If omitted, FRAME defaults to the currently selected frame. */) | 2538 | If omitted, FRAME defaults to the currently selected frame. |
| 2539 | |||
| 2540 | If FRAME is a child frame, consult the variable `iconify-child-frame' | ||
| 2541 | for 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 | |||
| 6016 | Gtk+ tooltips are not used) and on Windows. */); | 6041 | Gtk+ 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. | ||
| 6046 | This variable tells Emacs how to proceed when it is asked to iconify a | ||
| 6047 | child frame. If it is nil, `iconify-frame' will do nothing when invoked | ||
| 6048 | on a child frame. If it is `iconify-top-level', Emacs will try to | ||
| 6049 | iconify the top level frame associated with this child frame instead. | ||
| 6050 | If it is `make-invisible', Emacs will try to make this child frame | ||
| 6051 | invisible instead. | ||
| 6052 | |||
| 6053 | Any other value means to try iconifying the child frame. Since such an | ||
| 6054 | attempt is not honored by all window managers and may even lead to | ||
| 6055 | making the child frame unresponsive to user actions, the default is to | ||
| 6056 | iconify 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); |