diff options
| author | Martin Rudalics | 2025-03-19 09:36:42 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2025-03-19 09:36:42 +0100 |
| commit | fa1cfcada0939e33d69696df6448b75b33ab656d (patch) | |
| tree | 1efb3005a665ec9ca545d14f50ecd08d6ae9f8e7 | |
| parent | ec9290eb80253cc97990788aab588a15cb35b664 (diff) | |
| download | emacs-fa1cfcada0939e33d69696df6448b75b33ab656d.tar.gz emacs-fa1cfcada0939e33d69696df6448b75b33ab656d.zip | |
On tty frames restrict number of menu bar lines (Bug#77015)
* src/frame.c (set_menu_bar_lines): Make sure tty frames get
only 0 or 1 menu bar line (Bug#77015).
| -rw-r--r-- | src/frame.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/frame.c b/src/frame.c index e5177afa059..3d181312c10 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -210,22 +210,34 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 210 | int olines = FRAME_MENU_BAR_LINES (f); | 210 | int olines = FRAME_MENU_BAR_LINES (f); |
| 211 | int nlines = TYPE_RANGED_FIXNUMP (int, value) ? XFIXNUM (value) : 0; | 211 | int nlines = TYPE_RANGED_FIXNUMP (int, value) ? XFIXNUM (value) : 0; |
| 212 | 212 | ||
| 213 | /* Menu bars on child frames don't work on all platforms, which is | 213 | if (is_tty_frame (f)) |
| 214 | the reason why prepare_menu_bar does not update_menu_bar for | ||
| 215 | child frames (info from Martin Rudalics). This could be | ||
| 216 | implemented in ttys, but it's probably not worth it. */ | ||
| 217 | if (is_tty_child_frame (f)) | ||
| 218 | { | 214 | { |
| 219 | FRAME_MENU_BAR_LINES (f) = 0; | 215 | /* Menu bars on child frames don't work on all platforms, which is |
| 220 | FRAME_MENU_BAR_HEIGHT (f) = 0; | 216 | the reason why prepare_menu_bar does not update_menu_bar for |
| 221 | return; | 217 | child frames (info from Martin Rudalics). This could be |
| 222 | } | 218 | implemented in ttys, but it's probably not worth it. */ |
| 219 | if (FRAME_PARENT_FRAME (f)) | ||
| 220 | FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) = 0; | ||
| 221 | else | ||
| 222 | { | ||
| 223 | /* Make only 0 or 1 menu bar line (Bug#77015). */ | ||
| 224 | FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) | ||
| 225 | = nlines > 0 ? 1 : 0; | ||
| 223 | 226 | ||
| 227 | if (FRAME_MENU_BAR_LINES (f) != olines) | ||
| 228 | { | ||
| 229 | windows_or_buffers_changed = 14; | ||
| 230 | change_frame_size | ||
| 231 | (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), | ||
| 232 | false, true, false); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | } | ||
| 224 | /* Right now, menu bars don't work properly in minibuf-only frames; | 236 | /* Right now, menu bars don't work properly in minibuf-only frames; |
| 225 | most of the commands try to apply themselves to the minibuffer | 237 | most of the commands try to apply themselves to the minibuffer |
| 226 | frame itself, and get an error because you can't switch buffers | 238 | frame itself, and get an error because you can't switch buffers |
| 227 | in or split the minibuffer window. */ | 239 | in or split the minibuffer window. */ |
| 228 | if (!FRAME_MINIBUF_ONLY_P (f) && nlines != olines) | 240 | else if (!FRAME_MINIBUF_ONLY_P (f) && nlines != olines) |
| 229 | { | 241 | { |
| 230 | windows_or_buffers_changed = 14; | 242 | windows_or_buffers_changed = 14; |
| 231 | FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) = nlines; | 243 | FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) = nlines; |