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 /src | |
| 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'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 44 |
1 files changed, 44 insertions, 0 deletions
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); |