aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorJuri Linkov2019-09-02 00:32:10 +0300
committerJuri Linkov2019-09-02 00:32:10 +0300
commit5bf45ec48b781a1165e882e7216892bf201d15f4 (patch)
tree2be92e4c40bb078796fa485ff92da43944a79e3e /src/nsfns.m
parent51ac64d9aa6aec969c38a3774310479d1cbb4dc9 (diff)
downloademacs-5bf45ec48b781a1165e882e7216892bf201d15f4.tar.gz
emacs-5bf45ec48b781a1165e882e7216892bf201d15f4.zip
Try to add more tab-bar support on macos
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m86
1 files changed, 85 insertions, 1 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 2470c05c4b5..890da99082b 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -610,6 +610,75 @@ ns_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
610} 610}
611 611
612 612
613/* tabbar support */
614static void
615ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
616{
617 /* Currently, when the tab bar changes state, the frame is resized.
618
619 TODO: It would be better if this didn't occur when 1) the frame
620 is full height or maximized or 2) when specified by
621 `frame-inhibit-implied-resize'. */
622 int nlines;
623
624 NSTRACE ("ns_set_tab_bar_lines");
625
626 if (FRAME_MINIBUF_ONLY_P (f))
627 return;
628
629 if (RANGED_FIXNUMP (0, value, INT_MAX))
630 nlines = XFIXNAT (value);
631 else
632 nlines = 0;
633
634 if (nlines)
635 {
636 FRAME_EXTERNAL_TAB_BAR (f) = 1;
637 update_frame_tab_bar (f);
638 }
639 else
640 {
641 if (FRAME_EXTERNAL_TAB_BAR (f))
642 {
643 free_frame_tab_bar (f);
644 FRAME_EXTERNAL_TAB_BAR (f) = 0;
645
646 {
647 EmacsView *view = FRAME_NS_VIEW (f);
648 int fs_state = [view fullscreenState];
649
650 if (fs_state == FULLSCREEN_MAXIMIZED)
651 {
652 [view setFSValue:FULLSCREEN_WIDTH];
653 }
654 else if (fs_state == FULLSCREEN_HEIGHT)
655 {
656 [view setFSValue:FULLSCREEN_NONE];
657 }
658 }
659 }
660 }
661
662 {
663 int inhibit
664 = ((f->after_make_frame
665 && !f->tab_bar_resized
666 && (EQ (frame_inhibit_implied_resize, Qt)
667 || (CONSP (frame_inhibit_implied_resize)
668 && !NILP (Fmemq (Qtab_bar_lines,
669 frame_inhibit_implied_resize))))
670 && NILP (get_frame_param (f, Qfullscreen)))
671 ? 0
672 : 2);
673
674 NSTRACE_MSG ("inhibit:%d", inhibit);
675
676 frame_size_history_add (f, Qupdate_frame_tab_bar, 0, 0, Qnil);
677 adjust_frame_size (f, -1, -1, inhibit, 0, Qtab_bar_lines);
678 }
679}
680
681
613/* toolbar support */ 682/* toolbar support */
614static void 683static void
615ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) 684ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
@@ -923,6 +992,7 @@ frame_parm_handler ns_frame_parm_handlers[] =
923 gui_set_vertical_scroll_bars, /* generic OK */ 992 gui_set_vertical_scroll_bars, /* generic OK */
924 gui_set_horizontal_scroll_bars, /* generic OK */ 993 gui_set_horizontal_scroll_bars, /* generic OK */
925 gui_set_visibility, /* generic OK */ 994 gui_set_visibility, /* generic OK */
995 ns_set_tab_bar_lines,
926 ns_set_tool_bar_lines, 996 ns_set_tool_bar_lines,
927 0, /* x_set_scroll_bar_foreground, will ignore (not possible on NS) */ 997 0, /* x_set_scroll_bar_foreground, will ignore (not possible on NS) */
928 0, /* x_set_scroll_bar_background, will ignore (not possible on NS) */ 998 0, /* x_set_scroll_bar_background, will ignore (not possible on NS) */
@@ -1286,6 +1356,10 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1286 NILP (Vmenu_bar_mode) 1356 NILP (Vmenu_bar_mode)
1287 ? make_fixnum (0) : make_fixnum (1), 1357 ? make_fixnum (0) : make_fixnum (1),
1288 NULL, NULL, RES_TYPE_NUMBER); 1358 NULL, NULL, RES_TYPE_NUMBER);
1359 gui_default_parameter (f, parms, Qtab_bar_lines,
1360 NILP (Vtab_bar_mode)
1361 ? make_fixnum (0) : make_fixnum (1),
1362 NULL, NULL, RES_TYPE_NUMBER);
1289 gui_default_parameter (f, parms, Qtool_bar_lines, 1363 gui_default_parameter (f, parms, Qtool_bar_lines,
1290 NILP (Vtool_bar_mode) 1364 NILP (Vtool_bar_mode)
1291 ? make_fixnum (0) : make_fixnum (1), 1365 ? make_fixnum (0) : make_fixnum (1),
@@ -2790,6 +2864,10 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
2790 int native_right = f->left_pos + outer_width - border; 2864 int native_right = f->left_pos + outer_width - border;
2791 int native_bottom = f->top_pos + outer_height - border; 2865 int native_bottom = f->top_pos + outer_height - border;
2792 int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f); 2866 int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
2867 int tab_bar_height = FRAME_TABBAR_HEIGHT (f);
2868 int tab_bar_width = (tab_bar_height
2869 ? outer_width - 2 * internal_border_width
2870 : 0);
2793 int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f); 2871 int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
2794 int tool_bar_width = (tool_bar_height 2872 int tool_bar_width = (tool_bar_height
2795 ? outer_width - 2 * internal_border_width 2873 ? outer_width - 2 * internal_border_width
@@ -2805,7 +2883,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
2805 native_right, native_bottom); 2883 native_right, native_bottom);
2806 else if (EQ (attribute, Qinner_edges)) 2884 else if (EQ (attribute, Qinner_edges))
2807 return list4i (native_left + internal_border_width, 2885 return list4i (native_left + internal_border_width,
2808 native_top + tool_bar_height + internal_border_width, 2886 native_top + tab_bar_height + tool_bar_height + internal_border_width,
2809 native_right - internal_border_width, 2887 native_right - internal_border_width,
2810 native_bottom - internal_border_width); 2888 native_bottom - internal_border_width);
2811 else 2889 else
@@ -2824,6 +2902,9 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
2824 Fcons (make_fixnum (0), make_fixnum (title_height))), 2902 Fcons (make_fixnum (0), make_fixnum (title_height))),
2825 Fcons (Qmenu_bar_external, Qnil), 2903 Fcons (Qmenu_bar_external, Qnil),
2826 Fcons (Qmenu_bar_size, Fcons (make_fixnum (0), make_fixnum (0))), 2904 Fcons (Qmenu_bar_size, Fcons (make_fixnum (0), make_fixnum (0))),
2905 Fcons (Qtab_bar_size,
2906 Fcons (make_fixnum (tab_bar_width),
2907 make_fixnum (tab_bar_height))),
2827 Fcons (Qtool_bar_external, 2908 Fcons (Qtool_bar_external,
2828 FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil), 2909 FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
2829 Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)), 2910 Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
@@ -2861,6 +2942,9 @@ and width values are in pixels.
2861`menu-bar-size' is a cons of the width and height of the menu bar of 2942`menu-bar-size' is a cons of the width and height of the menu bar of
2862 FRAME. 2943 FRAME.
2863 2944
2945`tab-bar-size' is a cons of the width and height of the tab bar of
2946 FRAME.
2947
2864`tool-bar-external', if non-nil, means the tool bar is external (never 2948`tool-bar-external', if non-nil, means the tool bar is external (never
2865 included in the inner edges of FRAME). 2949 included in the inner edges of FRAME).
2866 2950