summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-10-01 23:15:03 +0300
committerJuri Linkov <juri@linkov.net>2019-10-01 23:15:03 +0300
commit2698d3dba2e9858b026ed127d4de3f86810a5ef3 (patch)
tree8e9b8f194cfcad8af83a4174a0105bbc691f06d6 /lisp/frame.el
parent25f45d710e91a7c1049f056ff27bc3e6968f5624 (diff)
parent3f981a0a89bca47a207fb362485f07e7322bb145 (diff)
downloademacs-2698d3dba2e9858b026ed127d4de3f86810a5ef3.tar.gz
Merge branch 'feature/tabs'
Diffstat (limited to 'lisp/frame.el')
-rw-r--r--lisp/frame.el42
1 files changed, 42 insertions, 0 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index e9d4b2ebe4c..0c68fc378b9 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -363,6 +363,47 @@ there (in decreasing order of priority)."
;; If the initial frame is still around, apply initial-frame-alist
;; and default-frame-alist to it.
(when (frame-live-p frame-initial-frame)
+ ;; When tab-bar has been switched off, correct the frame size
+ ;; by the lines added in x-create-frame for the tab-bar and
+ ;; switch `tab-bar-mode' off.
+ (when (display-graphic-p)
+ (let* ((init-lines
+ (assq 'tab-bar-lines initial-frame-alist))
+ (other-lines
+ (or (assq 'tab-bar-lines window-system-frame-alist)
+ (assq 'tab-bar-lines default-frame-alist)))
+ (lines (or init-lines other-lines))
+ (height (tab-bar-height frame-initial-frame t)))
+ ;; Adjust frame top if either zero (nil) tab bar lines have
+ ;; been requested in the most relevant of the frame's alists
+ ;; or tab bar mode has been explicitly turned off in the
+ ;; user's init file.
+ (when (and (> height 0)
+ (or (and lines
+ (or (null (cdr lines))
+ (eq 0 (cdr lines))))
+ (not tab-bar-mode)))
+ (let* ((initial-top
+ (cdr (assq 'top frame-initial-geometry-arguments)))
+ (top (frame-parameter frame-initial-frame 'top)))
+ (when (and (consp initial-top) (eq '- (car initial-top)))
+ (let ((adjusted-top
+ (cond
+ ((and (consp top) (eq '+ (car top)))
+ (list '+ (+ (cadr top) height)))
+ ((and (consp top) (eq '- (car top)))
+ (list '- (- (cadr top) height)))
+ (t (+ top height)))))
+ (modify-frame-parameters
+ frame-initial-frame `((top . ,adjusted-top))))))
+ ;; Reset `tab-bar-mode' when zero tab bar lines have been
+ ;; requested for the window-system or default frame alists.
+ (when (and tab-bar-mode
+ (and other-lines
+ (or (null (cdr other-lines))
+ (eq 0 (cdr other-lines)))))
+ (tab-bar-mode -1)))))
+
;; When tool-bar has been switched off, correct the frame size
;; by the lines added in x-create-frame for the tool-bar and
;; switch `tool-bar-mode' off.
@@ -1593,6 +1634,7 @@ and width values are in pixels.
'(tool-bar-external . nil)
'(tool-bar-position . nil)
'(tool-bar-size 0 . 0)
+ '(tab-bar-size 0 . 0)
(cons 'internal-border-width
(frame-parameter frame 'internal-border-width)))))))