aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuri Linkov2019-09-04 22:05:05 +0300
committerJuri Linkov2019-09-04 22:05:05 +0300
commit7970c89c770f475ab67a8de84223e45c5bb23d8c (patch)
tree474cc82c12e36cce942a079569e74c79440c49ae /src
parentd1c14de9a905b2278c3a450963aa8b9498198e25 (diff)
downloademacs-7970c89c770f475ab67a8de84223e45c5bb23d8c.tar.gz
emacs-7970c89c770f475ab67a8de84223e45c5bb23d8c.zip
Text-based nox builds compiled without X window support
Diffstat (limited to 'src')
-rw-r--r--src/window.h2
-rw-r--r--src/xdisp.c238
2 files changed, 130 insertions, 110 deletions
diff --git a/src/window.h b/src/window.h
index 2683c6b1433..21d2f3d3671 100644
--- a/src/window.h
+++ b/src/window.h
@@ -753,6 +753,8 @@ wset_next_buffers (struct window *w, Lisp_Object val)
753#define WINDOW_TAB_BAR_P(W) \ 753#define WINDOW_TAB_BAR_P(W) \
754 (WINDOWP (WINDOW_XFRAME (W)->tab_bar_window) \ 754 (WINDOWP (WINDOW_XFRAME (W)->tab_bar_window) \
755 && (W) == XWINDOW (WINDOW_XFRAME (W)->tab_bar_window)) 755 && (W) == XWINDOW (WINDOW_XFRAME (W)->tab_bar_window))
756#else
757#define WINDOW_TAB_BAR_P(W) false
756#endif 758#endif
757 759
758/* True if W is a tool bar window. */ 760/* True if W is a tool bar window. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 7ad0956d192..eca47d26c38 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -947,6 +947,8 @@ static int store_mode_line_string (const char *, Lisp_Object, bool, int, int,
947 Lisp_Object); 947 Lisp_Object);
948static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *); 948static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *);
949static void display_menu_bar (struct window *); 949static void display_menu_bar (struct window *);
950static void display_tab_bar (struct window *);
951static void update_tab_bar (struct frame *, bool);
950static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t, 952static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t,
951 ptrdiff_t *); 953 ptrdiff_t *);
952static void pint2str (register char *, register int, register ptrdiff_t); 954static void pint2str (register char *, register int, register ptrdiff_t);
@@ -989,8 +991,6 @@ static int underlying_face_id (struct it *);
989 991
990#ifdef HAVE_WINDOW_SYSTEM 992#ifdef HAVE_WINDOW_SYSTEM
991 993
992static void display_tab_bar (struct window *);
993static void update_tab_bar (struct frame *, bool);
994static void update_tool_bar (struct frame *, bool); 994static void update_tool_bar (struct frame *, bool);
995static void gui_draw_bottom_divider (struct window *w); 995static void gui_draw_bottom_divider (struct window *w);
996static void notice_overwritten_cursor (struct window *, 996static void notice_overwritten_cursor (struct window *,
@@ -12392,8 +12392,8 @@ prepare_menu_bars (void)
12392 continue; 12392 continue;
12393 12393
12394 menu_bar_hooks_run = update_menu_bar (f, false, menu_bar_hooks_run); 12394 menu_bar_hooks_run = update_menu_bar (f, false, menu_bar_hooks_run);
12395#ifdef HAVE_WINDOW_SYSTEM
12396 update_tab_bar (f, false); 12395 update_tab_bar (f, false);
12396#ifdef HAVE_WINDOW_SYSTEM
12397 update_tool_bar (f, false); 12397 update_tool_bar (f, false);
12398#endif 12398#endif
12399 } 12399 }
@@ -12404,8 +12404,8 @@ prepare_menu_bars (void)
12404 { 12404 {
12405 struct frame *sf = SELECTED_FRAME (); 12405 struct frame *sf = SELECTED_FRAME ();
12406 update_menu_bar (sf, true, false); 12406 update_menu_bar (sf, true, false);
12407#ifdef HAVE_WINDOW_SYSTEM
12408 update_tab_bar (sf, true); 12407 update_tab_bar (sf, true);
12408#ifdef HAVE_WINDOW_SYSTEM
12409 update_tool_bar (sf, true); 12409 update_tool_bar (sf, true);
12410#endif 12410#endif
12411 } 12411 }
@@ -12543,6 +12543,8 @@ fast_set_selected_frame (Lisp_Object frame)
12543 } 12543 }
12544} 12544}
12545 12545
12546#endif /* HAVE_WINDOW_SYSTEM */
12547
12546/* Update the tab-bar item list for frame F. This has to be done 12548/* Update the tab-bar item list for frame F. This has to be done
12547 before we start to fill in any display lines. Called from 12549 before we start to fill in any display lines. Called from
12548 prepare_menu_bars. If SAVE_MATCH_DATA, we must save 12550 prepare_menu_bars. If SAVE_MATCH_DATA, we must save
@@ -12551,9 +12553,17 @@ fast_set_selected_frame (Lisp_Object frame)
12551static void 12553static void
12552update_tab_bar (struct frame *f, bool save_match_data) 12554update_tab_bar (struct frame *f, bool save_match_data)
12553{ 12555{
12554 bool do_update = ((FRAME_WINDOW_P (f) && WINDOWP (f->tab_bar_window)) 12556 bool do_update = false;
12555 ? (WINDOW_TOTAL_LINES (XWINDOW (f->tab_bar_window)) > 0) 12557
12556 : (FRAME_TAB_BAR_LINES (f) > 0)); 12558#ifdef HAVE_WINDOW_SYSTEM
12559 if (FRAME_WINDOW_P (f) && WINDOWP (f->tab_bar_window)) {
12560 if (WINDOW_TOTAL_LINES (XWINDOW (f->tab_bar_window)) > 0)
12561 do_update = true;
12562 }
12563 else
12564#endif
12565 if (FRAME_TAB_BAR_LINES (f) > 0)
12566 do_update = true;
12557 12567
12558 if (do_update) 12568 if (do_update)
12559 { 12569 {
@@ -12577,7 +12587,7 @@ update_tab_bar (struct frame *f, bool save_match_data)
12577 { 12587 {
12578 struct buffer *prev = current_buffer; 12588 struct buffer *prev = current_buffer;
12579 ptrdiff_t count = SPECPDL_INDEX (); 12589 ptrdiff_t count = SPECPDL_INDEX ();
12580 Lisp_Object frame, new_tab_bar; 12590 Lisp_Object new_tab_bar;
12581 int new_n_tab_bar; 12591 int new_n_tab_bar;
12582 12592
12583 /* Set current_buffer to the buffer of the selected 12593 /* Set current_buffer to the buffer of the selected
@@ -12604,9 +12614,12 @@ update_tab_bar (struct frame *f, bool save_match_data)
12604 /* Since we only explicitly preserve selected_frame, 12614 /* Since we only explicitly preserve selected_frame,
12605 check that selected_window would be redundant. */ 12615 check that selected_window would be redundant. */
12606 XFRAME (selected_frame)->selected_window)); 12616 XFRAME (selected_frame)->selected_window));
12617#ifdef HAVE_WINDOW_SYSTEM
12618 Lisp_Object frame;
12607 record_unwind_protect (fast_set_selected_frame, selected_frame); 12619 record_unwind_protect (fast_set_selected_frame, selected_frame);
12608 XSETFRAME (frame, f); 12620 XSETFRAME (frame, f);
12609 fast_set_selected_frame (frame); 12621 fast_set_selected_frame (frame);
12622#endif
12610 12623
12611 /* Build desired tab-bar items from keymaps. */ 12624 /* Build desired tab-bar items from keymaps. */
12612 new_tab_bar 12625 new_tab_bar
@@ -12633,6 +12646,110 @@ update_tab_bar (struct frame *f, bool save_match_data)
12633 } 12646 }
12634} 12647}
12635 12648
12649/* Redisplay the tab bar in the frame for window W.
12650
12651 The tab bar of X frames that don't have X toolkit support is
12652 displayed in a special window W->frame->tab_bar_window.
12653
12654 The tab bar of terminal frames is treated specially as far as
12655 glyph matrices are concerned. Tab bar lines are not part of
12656 windows, so the update is done directly on the frame matrix rows
12657 for the tab bar. */
12658
12659static void
12660display_tab_bar (struct window *w)
12661{
12662 struct frame *f = XFRAME (WINDOW_FRAME (w));
12663 struct it it;
12664 Lisp_Object items;
12665 int i;
12666 bool has_menu_bar_p = FRAME_MENU_BAR_LINES (f) > 0;
12667
12668 /* Don't do all this for graphical frames. */
12669#ifdef HAVE_NTGUI
12670 if (FRAME_W32_P (f))
12671 return;
12672#endif
12673#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
12674 if (FRAME_X_P (f))
12675 return;
12676#endif
12677
12678#ifdef HAVE_NS
12679 if (FRAME_NS_P (f))
12680 return;
12681#endif /* HAVE_NS */
12682
12683#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
12684 eassert (!FRAME_WINDOW_P (f));
12685 init_iterator (&it, w, -1, -1, f->desired_matrix->rows + (has_menu_bar_p ? 1 : 0), TAB_BAR_FACE_ID);
12686 it.first_visible_x = 0;
12687 it.last_visible_x = FRAME_PIXEL_WIDTH (f);
12688#elif defined (HAVE_X_WINDOWS) /* X without toolkit. */
12689 if (FRAME_WINDOW_P (f))
12690 {
12691 /* Tab bar lines are displayed in the desired matrix of the
12692 dummy window tab_bar_window. */
12693 struct window *tab_w;
12694 tab_w = XWINDOW (f->tab_bar_window);
12695 init_iterator (&it, tab_w, -1, -1, tab_w->desired_matrix->rows + (has_menu_bar_p ? 1 : 0),
12696 TAB_BAR_FACE_ID);
12697 it.first_visible_x = 0;
12698 it.last_visible_x = FRAME_PIXEL_WIDTH (f);
12699 }
12700 else
12701#endif /* not USE_X_TOOLKIT and not USE_GTK */
12702 {
12703 /* This is a TTY frame, i.e. character hpos/vpos are used as
12704 pixel x/y. */
12705 init_iterator (&it, w, -1, -1, f->desired_matrix->rows + (has_menu_bar_p ? 1 : 0),
12706 TAB_BAR_FACE_ID);
12707 it.first_visible_x = 0;
12708 it.last_visible_x = FRAME_COLS (f);
12709 }
12710
12711 /* FIXME: This should be controlled by a user option. See the
12712 comments in redisplay_tool_bar and display_mode_line about
12713 this. */
12714 it.paragraph_embedding = L2R;
12715
12716 /* Clear all rows of the tab bar. */
12717 for (i = 0; i < FRAME_TAB_BAR_LINES (f); ++i)
12718 {
12719 struct glyph_row *row = it.glyph_row + i;
12720 clear_glyph_row (row);
12721 row->enabled_p = true;
12722 row->full_width_p = true;
12723 row->reversed_p = false;
12724 }
12725
12726 /* Display all items of the tab bar. */
12727 items = it.f->tab_bar_items;
12728 for (i = 0; i < it.f->n_tab_bar_items; ++i)
12729 {
12730 Lisp_Object string;
12731
12732 /* Stop at nil string. */
12733 string = AREF (items, i * TAB_BAR_ITEM_NSLOTS + TAB_BAR_ITEM_CAPTION);
12734 if (NILP (string))
12735 break;
12736
12737 /* Display the item, pad with one space. */
12738 if (it.current_x < it.last_visible_x)
12739 display_string (NULL, string, Qnil, 0, 0, &it,
12740 SCHARS (string) + 1, 0, 0, -1);
12741 }
12742
12743 /* Fill out the line with spaces. */
12744 if (it.current_x < it.last_visible_x)
12745 display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1);
12746
12747 /* Compute the total height of the lines. */
12748 compute_line_metrics (&it);
12749}
12750
12751#ifdef HAVE_WINDOW_SYSTEM
12752
12636/* Set F->desired_tab_bar_string to a Lisp string representing frame 12753/* Set F->desired_tab_bar_string to a Lisp string representing frame
12637 F's desired tab-bar contents. F->tab_bar_items must have 12754 F's desired tab-bar contents. F->tab_bar_items must have
12638 been set up previously by calling prepare_menu_bars. */ 12755 been set up previously by calling prepare_menu_bars. */
@@ -13031,108 +13148,6 @@ redisplay_tab_bar (struct frame *f)
13031 return false; 13148 return false;
13032} 13149}
13033 13150
13034/* Redisplay the tab bar in the frame for window W.
13035
13036 The tab bar of X frames that don't have X toolkit support is
13037 displayed in a special window W->frame->tab_bar_window.
13038
13039 The tab bar of terminal frames is treated specially as far as
13040 glyph matrices are concerned. Tab bar lines are not part of
13041 windows, so the update is done directly on the frame matrix rows
13042 for the tab bar. */
13043
13044static void
13045display_tab_bar (struct window *w)
13046{
13047 struct frame *f = XFRAME (WINDOW_FRAME (w));
13048 struct it it;
13049 Lisp_Object items;
13050 int i;
13051 bool has_menu_p = FRAME_MENU_BAR_LINES (f) > 0;
13052
13053 /* Don't do all this for graphical frames. */
13054#ifdef HAVE_NTGUI
13055 if (FRAME_W32_P (f))
13056 return;
13057#endif
13058#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
13059 if (FRAME_X_P (f))
13060 return;
13061#endif
13062
13063#ifdef HAVE_NS
13064 if (FRAME_NS_P (f))
13065 return;
13066#endif /* HAVE_NS */
13067
13068#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
13069 eassert (!FRAME_WINDOW_P (f));
13070 init_iterator (&it, w, -1, -1, f->desired_matrix->rows + (has_menu_p ? 1 : 0), TAB_BAR_FACE_ID);
13071 it.first_visible_x = 0;
13072 it.last_visible_x = FRAME_PIXEL_WIDTH (f);
13073#elif defined (HAVE_X_WINDOWS) /* X without toolkit. */
13074 if (FRAME_WINDOW_P (f))
13075 {
13076 /* Tab bar lines are displayed in the desired matrix of the
13077 dummy window tab_bar_window. */
13078 struct window *tab_w;
13079 tab_w = XWINDOW (f->tab_bar_window);
13080 init_iterator (&it, tab_w, -1, -1, tab_w->desired_matrix->rows + (has_menu_p ? 1 : 0),
13081 TAB_BAR_FACE_ID);
13082 it.first_visible_x = 0;
13083 it.last_visible_x = FRAME_PIXEL_WIDTH (f);
13084 }
13085 else
13086#endif /* not USE_X_TOOLKIT and not USE_GTK */
13087 {
13088 /* This is a TTY frame, i.e. character hpos/vpos are used as
13089 pixel x/y. */
13090 init_iterator (&it, w, -1, -1, f->desired_matrix->rows + (has_menu_p ? 1 : 0),
13091 TAB_BAR_FACE_ID);
13092 it.first_visible_x = 0;
13093 it.last_visible_x = FRAME_COLS (f);
13094 }
13095
13096 /* FIXME: This should be controlled by a user option. See the
13097 comments in redisplay_tool_bar and display_mode_line about
13098 this. */
13099 it.paragraph_embedding = L2R;
13100
13101 /* Clear all rows of the tab bar. */
13102 for (i = 0; i < FRAME_TAB_BAR_LINES (f); ++i)
13103 {
13104 struct glyph_row *row = it.glyph_row + i;
13105 clear_glyph_row (row);
13106 row->enabled_p = true;
13107 row->full_width_p = true;
13108 row->reversed_p = false;
13109 }
13110
13111 /* Display all items of the tab bar. */
13112 items = it.f->tab_bar_items;
13113 for (i = 0; i < it.f->n_tab_bar_items; ++i)
13114 {
13115 Lisp_Object string;
13116
13117 /* Stop at nil string. */
13118 string = AREF (items, i * TAB_BAR_ITEM_NSLOTS + TAB_BAR_ITEM_CAPTION);
13119 if (NILP (string))
13120 break;
13121
13122 /* Display the item, pad with one space. */
13123 if (it.current_x < it.last_visible_x)
13124 display_string (NULL, string, Qnil, 0, 0, &it,
13125 SCHARS (string) + 1, 0, 0, -1);
13126 }
13127
13128 /* Fill out the line with spaces. */
13129 if (it.current_x < it.last_visible_x)
13130 display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1);
13131
13132 /* Compute the total height of the lines. */
13133 compute_line_metrics (&it);
13134}
13135
13136/* Get information about the tab-bar item which is displayed in GLYPH 13151/* Get information about the tab-bar item which is displayed in GLYPH
13137 on frame F. Return in *PROP_IDX the index where tab-bar item 13152 on frame F. Return in *PROP_IDX the index where tab-bar item
13138 properties start in F->tab_bar_items. Value is false if 13153 properties start in F->tab_bar_items. Value is false if
@@ -18742,6 +18757,9 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
18742 } 18757 }
18743 18758
18744 gui_consider_frame_title (w->frame); 18759 gui_consider_frame_title (w->frame);
18760#else
18761 if ((FRAME_TAB_BAR_LINES (f) > 0))
18762 display_tab_bar (w);
18745#endif 18763#endif
18746 } 18764 }
18747 18765