summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-08-31 23:40:07 +0300
committerJuri Linkov <juri@linkov.net>2019-08-31 23:40:07 +0300
commit3e0ad29a607c8c085de3b74c7505e417ad7f9062 (patch)
treefeff537233e67c705d67b280023c623192c3d95b /lisp/frame.el
parent7791005544836f93542e8277ad5897f8f5920f05 (diff)
downloademacs-3e0ad29a607c8c085de3b74c7505e417ad7f9062.tar.gz
Frame-local tab-bar and window-local tab-line.
* etc/NEWS: Add 'tab-bar-mode' and 'global-tab-line-mode'. * etc/TODO: Remove tab-related items. * lisp/cus-start.el: Add tab-bar-mode, tab-bar-max-label-size. * lisp/frame.el (frame-notice-user-settings): handle tab-bar-lines. * lisp/loadup.el: Load "tab-bar". * lisp/menu-bar.el (menu-bar-options-save): Add tab-bar-mode. (menu-bar-showhide-menu): Define showhide-tab-bar. * lisp/startup.el (tab-bar-images-pixel-height): New defconst. (command-line): Reset tab-bar-mode. (x-apply-session-resources): Add "tabBar", "TabBar". * lisp/subr.el (read-key): Add tab-bar. * lisp/tab-bar.el: New file. * lisp/tab-line.el: New file. * lisp/window.el (window--dump-frame): Add tab-bar-height. * src/dispextern.h (enum window_part): Add ON_TAB_LINE. (struct glyph_matrix): Add tab_line_p. (struct glyph_row): Add tab_line_p. (MATRIX_TAB_LINE_ROW): New macro. (MATRIX_FIRST_TEXT_ROW): Handle more mode lines. (MR_PARTIALLY_VISIBLE_AT_TOP): Add WINDOW_TAB_LINE_HEIGHT. (MATRIX_TAB_LINE_HEIGHT, CURRENT_TAB_LINE_HEIGHT) (DESIRED_TAB_LINE_HEIGHT): New macros. (enum face_id): Add TAB_BAR_FACE_ID and TAB_LINE_FACE_ID. (struct it): Add tab_line_p. (tab_bar_item_idx, tab_bar_item_image): New enums. (DEFAULT_TAB_BAR_LABEL_SIZE, DEFAULT_TAB_BAR_BUTTON_MARGIN) (DEFAULT_TAB_BAR_BUTTON_RELIEF, DEFAULT_TAB_BAR_IMAGE_HEIGHT): New constants. * src/dispnew.c (adjust_glyph_matrix): Use window_wants_tab_line. (shift_glyph_matrix): Add WINDOW_TAB_LINE_HEIGHT. (clear_current_matrices, clear_desired_matrices): Call clear_glyph_matrix on tab_bar_window. (blank_row): Add WINDOW_TAB_LINE_HEIGHT. (required_matrix_height): Change 2 to 3. (fake_current_matrices): Reset tab_line_p. (adjust_frame_glyphs_for_window_redisplay): Handle tab_bar_window. Add FRAME_TAB_BAR_HEIGHT and FRAME_TAB_BAR_LINES. (free_glyphs): Handle tab_bar_window. (update_frame): Handle tab_bar_window. (update_window): Handle row->tab_line_p. (scrolling_window): Change arg type from bool to int. Change header_line_p to tab_line_p. (buffer_posn_from_coords): Add window_wants_tab_line. (mode_line_string): Use MATRIX_TAB_LINE_ROW for part ON_TAB_LINE. * src/frame.c (frame_default_tab_bar_height): New internal variable. (adjust_frame_size): Handle tab_bar_window. (make_frame): Reset tab_bar_redisplayed, tab_bar_resized and last_tab_bar_item. (Ftab_bar_pixel_width): New function. (frame_parms): Add tab-bar-lines. (gui_figure_window_size): Add new arg tabbar_p. (syms_of_frame): Add Qtab_bar_size, Qupdate_frame_tab_bar, Qfree_frame_tab_bar, Qtab_bar_lines, Stab_bar_pixel_width. Add Qtab_bar_lines to frame_inhibit_implied_resize. (tab-bar-mode): New variable. * src/frame.h (GCALIGNED_STRUCT): Add tab_bar_window, desired_tab_bar_string, current_tab_bar_string. (GCALIGNED_STRUCT): Add tab_bar_items, last_tab_bar_item, minimize_tab_bar_window_p, tab_bar_redisplayed, tab_bar_resized, tab_bar_lines, tab_bar_height, n_tab_bar_rows, n_tab_bar_items. (fset_tab_bar_items, fset_tab_bar_window) (fset_current_tab_bar_string, fset_desired_tab_bar_string): New inlines. (FRAME_TAB_BAR_LINES, FRAME_TAB_BAR_HEIGHT): New macros. (FRAME_TOP_MARGIN, FRAME_TOP_MARGIN_HEIGHT): Use FRAME_TAB_BAR_LINES. * src/fringe.c (draw_fringe_bitmap_1, update_window_fringes): Add WINDOW_TAB_LINE_HEIGHT. * src/gtkutil.c (xg_frame_set_char_size): Add FRAME_TABBAR_WIDTH. (x_wm_set_size_hint): Add FRAME_TABBAR_WIDTH. * src/keyboard.c (read_char): Handle Qtab_bar. (kbd_buffer_get_event): Handle TAB_BAR_EVENT. (make_lispy_position): Add WINDOW_TAB_LINE_HEIGHT. Handle TAB_BAR_EVENT. (tab_bar_items_vector, tab_bar_item_properties, ntab_bar_items): New internal variables. (tab_bar_items, process_tab_bar_item, set_prop_tab_bar) (parse_tab_bar_item, init_tab_bar_items, append_tab_bar_item): New functions. (read_char_x_menu_prompt, read_key_sequence): Handle Qtab_bar. (tab-bar-separator-image-expression): New variable. * src/keymap.c (syms_of_keymap): Add Qtab_bar and Qtab_line. * src/menu.c (x_popup_menu_1, Fx_popup_dialog): Handle Qtab_bar. * src/termhooks.h (enum event_kind): Add TAB_BAR_EVENT. (GCALIGNED_STRUCT): Add change_tab_bar_height_hook. * src/w32fns.c (w32_frame_parm_handlers): Add w32_set_tab_bar_lines. * src/w32term.c (w32_draw_window_cursor): Add WINDOW_TAB_LINE_HEIGHT. * src/window.c (window_body_height): Add WINDOW_TAB_LINE_HEIGHT. (Fwindow_tab_line_height): New function. (coordinates_in_window): Use window_wants_tab_line with CURRENT_TAB_LINE_HEIGHT. (window_relative_x_coord): Add ON_TAB_LINE. (Fcoordinates_in_window_p): Add ON_TAB_LINE. (window_from_coordinates): Add new arg tab_bar_p. (Fwindow_line_height): Use window_wants_tab_line with WINDOW_TAB_LINE_HEIGHT. (Fwindow_lines_pixel_dimensions): Add WINDOW_TAB_LINE_HEIGHT. (make_window): Set tab_line_height to -1. (window_wants_tab_line): New function. (window_internal_height): Use window_wants_tab_line. (window_scroll_pixel_based): Add WINDOW_TAB_LINE_HEIGHT. (Frecenter): Set minimize_tab_bar_window_p to 1. (GCALIGNED_STRUCT): Add frame_tab_bar_lines and frame_tab_bar_height. (Fcurrent_window_configuration): Set frame_tab_bar_lines and frame_tab_bar_height. (set_window_scroll_bars): Add WINDOW_TAB_LINE_HEIGHT. (syms_of_window): Add Qtab_line_format and Swindow_tab_line_height. * src/window.h (GCALIGNED_STRUCT): Add tab_line_height. (WINDOW_TAB_BAR_P, WINDOW_TAB_LINE_HEIGHT, WINDOW_TAB_LINE_LINES): New macros. (WINDOW_TOP_EDGE_Y, WINDOW_BOTTOM_EDGE_Y, WINDOW_TAB_LINE_HEIGHT): Add WINDOW_TAB_BAR_P. * src/xdisp.c (window_box_height): Add window_wants_tab_line with MATRIX_TAB_LINE_ROW and CURRENT_TAB_LINE_HEIGHT. (pos_visible_p): Use window_wants_tab_line. Add WINDOW_TAB_LINE_HEIGHT. (get_glyph_string_clip_rects): Add WINDOW_TAB_LINE_HEIGHT. (get_phys_cursor_geometry): Add WINDOW_TAB_LINE_HEIGHT. (remember_mouse_glyph): Use MATRIX_TAB_LINE_ROW for part ON_TAB_LINE. (init_iterator): Use MATRIX_TAB_LINE_ROW for TAB_LINE_FACE_ID. Add WINDOW_TAB_LINE_HEIGHT. Add window_wants_tab_line. (Fwindow_text_pixel_size): Add WINDOW_TAB_LINE_HEIGHT. (prepare_menu_bars): Call update_tab_bar. (update_tab_bar, build_desired_tab_bar_string) (display_tab_bar_line, tab_bar_height, Ftab_bar_height) (redisplay_tab_bar, tab_bar_item_info, get_tab_bar_item) (handle_tab_bar_click, note_tab_bar_highlight): New functions. (compute_window_start_on_continuation_line): Use window_wants_tab_line. (try_cursor_movement): Use window_wants_tab_line with CURRENT_TAB_LINE_HEIGHT. (redisplay_window): Use window_wants_tab_line with CURRENT_TAB_LINE_HEIGHT. (try_window_reusing_current_matrix): Use window_wants_tab_line with WINDOW_TAB_LINE_HEIGHT. (Fdump_tab_bar_row): New function. (compute_line_metrics): Add WINDOW_TAB_LINE_HEIGHT. (display_line): Use window_wants_tab_line. (display_mode_line): Set tab_line_p to true if face_id is TAB_LINE_FACE_ID. (Fformat_mode_line): Handle Qtab_line and Qtab_bar. (gui_clear_end_of_line): Add WINDOW_TAB_LINE_HEIGHT. (erase_phys_cursor): Use WINDOW_TAB_LINE_HEIGHT. (show_mouse_face): Use tab_bar_window. (note_mode_line_or_margin_highlight): Use MATRIX_TAB_LINE_ROW for area ON_TAB_LINE. (note_mouse_highlight): Call note_tab_bar_highlight, (expose_frame): Handle tab_bar_window. (syms_of_xdisp): Add Sdump_tab_bar_row and Stab_bar_height. (auto-resize-tab-bars, auto-raise-tab-bar-buttons) (tab-bar-border, tab-bar-button-margin, tab-bar-button-relief) (tab-bar-max-label-size): New variables. * src/xfaces.c (lookup_basic_face): Add TAB_LINE_FACE_ID and TAB_BAR_FACE_ID. (syms_of_xfaces): Define Qtab_bar and Qtab_line. * src/xfns.c (x_set_tab_bar_lines, x_change_tab_bar_height): New functions. (xic_set_statusarea): Add FRAME_TABBAR_TOP_HEIGHT. (frame_geometry): Add FRAME_TAB_BAR_HEIGHT and Qtab_bar_size. * src/xterm.c (x_draw_image_relief): Use tab_bar_button_relief. (x_draw_image_relief): Use TAB_BAR_FACE_ID. (handle_one_xevent): Handle tab_bar_window. (x_set_window_size_1): Add FRAME_TABBAR_WIDTH. (x_create_terminal): Set change_tab_bar_height_hook. * src/xterm.h (struct x_output): Add tabbar_top_height, tabbar_bottom_height, tabbar_left_width, tabbar_right_width tabbar_widget, tabbar_in_hbox, tabbar_is_packed. (FRAME_TABBAR_TOP_HEIGHT): Add FRAME_TABBAR_TOP_HEIGHT, FRAME_TABBAR_BOTTOM_HEIGHT, FRAME_TABBAR_HEIGHT, FRAME_TABBAR_LEFT_WIDTH, FRAME_TABBAR_RIGHT_WIDTH, FRAME_TABBAR_WIDTH.
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 fd7e872fb6d..374c92f9e7d 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)))))))