diff options
| author | Martin Rudalics | 2025-11-02 09:24:05 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2025-11-02 09:24:05 +0100 |
| commit | 2c4e7a99cc161ed4ee246a698792feeff26d7b91 (patch) | |
| tree | 802468fc5cbdcad795cd54f48d78a6ad8a1b6931 | |
| parent | fae5ced1acaff0dcf8a2206272d7762612ea7289 (diff) | |
| download | emacs-2c4e7a99cc161ed4ee246a698792feeff26d7b91.tar.gz emacs-2c4e7a99cc161ed4ee246a698792feeff26d7b91.zip | |
Handle resizing of fullscreen frames more consistently (Bug#79704)
* src/frame.c (adjust_frame_size): Honor new option
'alter-fullscreen-frames'.
(syms_of_frame) <alter-fullscreen-frames>: New option to
maintain consistent state when attempting to resize fullscreen
frames. Default to 'inhibit' for NS builds because these
resized the frame while leaving the 'fullscreen' parameter alone
(Bug#79704).
(syms_of_frame) <Qinhibit>: Define symbol.
* lisp/cus-start.el (standard): Add customization options for
'alter-fullscreen-frames'
* doc/lispref/frames.texi (Frame Size): Describe new option
'alter-fullscreen-frames'.
* etc/NEWS: Call out new option 'alter-fullscreen-frames'.
| -rw-r--r-- | doc/lispref/frames.texi | 31 | ||||
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lisp/cus-start.el | 6 | ||||
| -rw-r--r-- | src/frame.c | 44 |
4 files changed, 91 insertions, 0 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 740ea43a90f..c053d8c5543 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -1234,6 +1234,37 @@ bottom corner of the frame. The parameters @code{min-width} and | |||
| 1234 | @code{min-height} (@pxref{Size Parameters}) can be used to obtain a | 1234 | @code{min-height} (@pxref{Size Parameters}) can be used to obtain a |
| 1235 | similar behavior when changing the frame size from within Emacs. | 1235 | similar behavior when changing the frame size from within Emacs. |
| 1236 | 1236 | ||
| 1237 | When a frame is in a fullscreen state (@pxref{Size Parameters}), | ||
| 1238 | requests to change the frame size via one of these functions may be | ||
| 1239 | supported or refused either by Emacs itself or by the window manager. | ||
| 1240 | The following variable provides more control of the resulting behavior. | ||
| 1241 | |||
| 1242 | @cindex altering the size of fullscreen frames | ||
| 1243 | @cindex resizing fullscreen frames | ||
| 1244 | @defopt alter-fullscreen-frames | ||
| 1245 | This options controls how to handle requests to alter fullscreen frames. | ||
| 1246 | Emacs consults it when asked to resize a fullscreen frame via functions | ||
| 1247 | like @code{set-frame-size} or when setting the @code{width} or | ||
| 1248 | @code{height} parameter of a frame. The following values are provided: | ||
| 1249 | |||
| 1250 | @table @code | ||
| 1251 | @item nil | ||
| 1252 | This will forward the resize request to the window manager and leave it | ||
| 1253 | to the latter how to proceed. | ||
| 1254 | |||
| 1255 | @item t | ||
| 1256 | This will first reset the fullscreen status and then forward the resize | ||
| 1257 | request on to the window manager. | ||
| 1258 | |||
| 1259 | @item inhibit | ||
| 1260 | This will reject the resize request and leave the fullscreen status | ||
| 1261 | unchanged. | ||
| 1262 | @end table | ||
| 1263 | |||
| 1264 | The default is @code{inhibit} on NS builds and @code{nil} everywhere | ||
| 1265 | else. | ||
| 1266 | @end defopt | ||
| 1267 | |||
| 1237 | @cindex tracking frame size changes | 1268 | @cindex tracking frame size changes |
| 1238 | The abnormal hook @code{window-size-change-functions} (@pxref{Window | 1269 | The abnormal hook @code{window-size-change-functions} (@pxref{Window |
| 1239 | Hooks}) tracks all changes of the inner size of a frame including those | 1270 | Hooks}) tracks all changes of the inner size of a frame including those |
| @@ -444,6 +444,16 @@ This will inhibit implied resizing while a new frame is made and can be | |||
| 444 | useful on tiling window managers where the initial frame size should be | 444 | useful on tiling window managers where the initial frame size should be |
| 445 | specified by external means. | 445 | specified by external means. |
| 446 | 446 | ||
| 447 | +++ | ||
| 448 | *** New option 'alter-fullscreen-frames'. | ||
| 449 | This option is useful to maintain a consistent state when attempting to | ||
| 450 | resize fullscreen frames. It defaults to 'inhibit' on NS builds which | ||
| 451 | means that a fullscreen frame would not change size. It defaults to nil | ||
| 452 | everywhere else which means that the window manager is supposed to | ||
| 453 | either resize the frame and change the fullscreen status accordingly or | ||
| 454 | keep the frame size unchanged. The value t means to first reset the | ||
| 455 | fullscreen status and then resize the frame. | ||
| 456 | |||
| 447 | --- | 457 | --- |
| 448 | *** Frames can now be renamed to F<number> on text terminals. | 458 | *** Frames can now be renamed to F<number> on text terminals. |
| 449 | Unlike with other frame names, an attempt to rename to F<number> throws | 459 | Unlike with other frame names, an attempt to rename to F<number> throws |
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index e49d1552c08..c4ab23bec61 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -347,6 +347,12 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 347 | ;; :initialize custom-initialize-default | 347 | ;; :initialize custom-initialize-default |
| 348 | :set custom-set-minor-mode) | 348 | :set custom-set-minor-mode) |
| 349 | (frame-resize-pixelwise frames boolean "24.4") | 349 | (frame-resize-pixelwise frames boolean "24.4") |
| 350 | (alter-fullscreen-frames frames | ||
| 351 | (choice | ||
| 352 | (const :tag "Forward request to window manager" nil) | ||
| 353 | (const :tag "Reset fullscreen status first" t) | ||
| 354 | (const :tag "Inhibit altering fullscreen frames" inhibit)) | ||
| 355 | "31.1") | ||
| 350 | (frame-inhibit-implied-resize frames | 356 | (frame-inhibit-implied-resize frames |
| 351 | (choice | 357 | (choice |
| 352 | (const :tag "Never" nil) | 358 | (const :tag "Never" nil) |
diff --git a/src/frame.c b/src/frame.c index 01e21d323ae..d426fa6f1da 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -786,6 +786,26 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height, | |||
| 786 | min_inner_height | 786 | min_inner_height |
| 787 | = frame_windows_min_size (frame, Qnil, (inhibit == 5) ? Qsafe : Qnil, Qt); | 787 | = frame_windows_min_size (frame, Qnil, (inhibit == 5) ? Qsafe : Qnil, Qt); |
| 788 | 788 | ||
| 789 | if (inhibit == 1 && !NILP (alter_fullscreen_frames)) | ||
| 790 | { | ||
| 791 | Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); | ||
| 792 | |||
| 793 | if ((new_text_width != old_text_width | ||
| 794 | && !NILP (fullscreen) && !EQ (fullscreen, Qfullheight)) | ||
| 795 | || (new_text_height != old_text_height | ||
| 796 | && !NILP (fullscreen) && !EQ (fullscreen, Qfullwidth))) | ||
| 797 | |||
| 798 | { | ||
| 799 | if (EQ (alter_fullscreen_frames, Qt)) | ||
| 800 | /* Reset fullscreen status and proceed. */ | ||
| 801 | Fmodify_frame_parameters | ||
| 802 | (frame, Fcons (Fcons (Qfullscreen, Qnil), Qnil)); | ||
| 803 | else if (EQ (alter_fullscreen_frames, Qinhibit)) | ||
| 804 | /* Do nothing and return. */ | ||
| 805 | return; | ||
| 806 | } | ||
| 807 | } | ||
| 808 | |||
| 789 | if (inhibit >= 2 && inhibit <= 4) | 809 | if (inhibit >= 2 && inhibit <= 4) |
| 790 | /* When INHIBIT is in [2..4] inhibit if the "old" window sizes stay | 810 | /* When INHIBIT is in [2..4] inhibit if the "old" window sizes stay |
| 791 | within the limits and either resizing is inhibited or INHIBIT | 811 | within the limits and either resizing is inhibited or INHIBIT |
| @@ -7102,6 +7122,7 @@ syms_of_frame (void) | |||
| 7102 | DEFSYM (Quse_frame_synchronization, "use-frame-synchronization"); | 7122 | DEFSYM (Quse_frame_synchronization, "use-frame-synchronization"); |
| 7103 | DEFSYM (Qfont_parameter, "font-parameter"); | 7123 | DEFSYM (Qfont_parameter, "font-parameter"); |
| 7104 | DEFSYM (Qforce, "force"); | 7124 | DEFSYM (Qforce, "force"); |
| 7125 | DEFSYM (Qinhibit, "inhibit"); | ||
| 7105 | 7126 | ||
| 7106 | for (int i = 0; i < ARRAYELTS (frame_parms); i++) | 7127 | for (int i = 0; i < ARRAYELTS (frame_parms); i++) |
| 7107 | { | 7128 | { |
| @@ -7487,6 +7508,29 @@ allow `make-frame' to show the current buffer even if its hidden. */); | |||
| 7487 | frame_internal_parameters = list3 (Qname, Qparent_id, Qwindow_id); | 7508 | frame_internal_parameters = list3 (Qname, Qparent_id, Qwindow_id); |
| 7488 | #endif | 7509 | #endif |
| 7489 | 7510 | ||
| 7511 | DEFVAR_LISP ("alter-fullscreen-frames", alter_fullscreen_frames, | ||
| 7512 | doc: /* How to handle requests to alter fullscreen frames. | ||
| 7513 | Emacs consults this option when asked to resize a fullscreen frame via | ||
| 7514 | functions like 'set-frame-size' or when setting the 'width' or 'height' | ||
| 7515 | parameter of a frame. The following values are provided: | ||
| 7516 | |||
| 7517 | - nil means to forward the resize request to the window manager and | ||
| 7518 | leave it to the latter how to proceed. | ||
| 7519 | |||
| 7520 | - t means to first reset the fullscreen status and then forward the | ||
| 7521 | request to the window manager. | ||
| 7522 | |||
| 7523 | - 'inhibit' means to reject the resize request and leave the fullscreen | ||
| 7524 | status unchanged. | ||
| 7525 | |||
| 7526 | The default is 'inhibit' on NS builds and nil everywhere else. */); | ||
| 7527 | |||
| 7528 | #if defined (NS_IMPL_COCOA) | ||
| 7529 | alter_fullscreen_frames = Qinhibit; | ||
| 7530 | #else | ||
| 7531 | alter_fullscreen_frames = Qnil; | ||
| 7532 | #endif | ||
| 7533 | |||
| 7490 | defsubr (&Sframep); | 7534 | defsubr (&Sframep); |
| 7491 | defsubr (&Sframe_live_p); | 7535 | defsubr (&Sframe_live_p); |
| 7492 | defsubr (&Swindow_system); | 7536 | defsubr (&Swindow_system); |