comparison src/xdisp.c @ 83484:a380ca43a190

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-128 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-129 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-130 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-131 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-132 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-133 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-134 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-135 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-43 Munge arch explicit ids in etc/images to match Emacs * emacs@sv.gnu.org/gnus--rel--5.10--patch-44 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-45 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-46 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-47 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-48 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-524
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 04 Mar 2006 23:07:13 +0000
parents d08a7ef0cb8a b3f04bf9fce0
children 414faf8dce4e
comparison
equal deleted inserted replaced
83483:8976b9f5eda1 83484:a380ca43a190
267 267
268 /* Non-zero means to reposition window if cursor line is only partially visible. */ 268 /* Non-zero means to reposition window if cursor line is only partially visible. */
269 269
270 int make_cursor_line_fully_visible_p; 270 int make_cursor_line_fully_visible_p;
271 271
272 /* Margin below tool bar in pixels. 0 or nil means no margin.
273 If value is `internal-border-width' or `border-width',
274 the corresponding frame parameter is used. */
275
276 Lisp_Object Vtool_bar_border;
277
272 /* Margin around tool bar buttons in pixels. */ 278 /* Margin around tool bar buttons in pixels. */
273 279
274 Lisp_Object Vtool_bar_button_margin; 280 Lisp_Object Vtool_bar_button_margin;
275 281
276 /* Thickness of shadow to draw around tool bar buttons. */ 282 /* Thickness of shadow to draw around tool bar buttons. */
837 static int text_outside_line_unchanged_p P_ ((struct window *, int, int)); 843 static int text_outside_line_unchanged_p P_ ((struct window *, int, int));
838 static void store_mode_line_noprop_char P_ ((char)); 844 static void store_mode_line_noprop_char P_ ((char));
839 static int store_mode_line_noprop P_ ((const unsigned char *, int, int)); 845 static int store_mode_line_noprop P_ ((const unsigned char *, int, int));
840 static void x_consider_frame_title P_ ((Lisp_Object)); 846 static void x_consider_frame_title P_ ((Lisp_Object));
841 static void handle_stop P_ ((struct it *)); 847 static void handle_stop P_ ((struct it *));
842 static int tool_bar_lines_needed P_ ((struct frame *)); 848 static int tool_bar_lines_needed P_ ((struct frame *, int *));
843 static int single_display_spec_intangible_p P_ ((Lisp_Object)); 849 static int single_display_spec_intangible_p P_ ((Lisp_Object));
844 static void ensure_echo_area_buffers P_ ((void)); 850 static void ensure_echo_area_buffers P_ ((void));
845 static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); 851 static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
846 static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); 852 static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *));
847 static int with_echo_area_buffer P_ ((struct window *, int, 853 static int with_echo_area_buffer P_ ((struct window *, int,
948 #ifdef HAVE_WINDOW_SYSTEM 954 #ifdef HAVE_WINDOW_SYSTEM
949 955
950 static void update_tool_bar P_ ((struct frame *, int)); 956 static void update_tool_bar P_ ((struct frame *, int));
951 static void build_desired_tool_bar_string P_ ((struct frame *f)); 957 static void build_desired_tool_bar_string P_ ((struct frame *f));
952 static int redisplay_tool_bar P_ ((struct frame *)); 958 static int redisplay_tool_bar P_ ((struct frame *));
953 static void display_tool_bar_line P_ ((struct it *)); 959 static void display_tool_bar_line P_ ((struct it *, int));
954 static void notice_overwritten_cursor P_ ((struct window *, 960 static void notice_overwritten_cursor P_ ((struct window *,
955 enum glyph_row_area, 961 enum glyph_row_area,
956 int, int, int, int)); 962 int, int, int, int));
957 963
958 964
9427 9433
9428 UNGCPRO; 9434 UNGCPRO;
9429 } 9435 }
9430 9436
9431 9437
9432 /* Display one line of the tool-bar of frame IT->f. */ 9438 /* Display one line of the tool-bar of frame IT->f.
9439
9440 HEIGHT specifies the desired height of the tool-bar line.
9441 If the actual height of the glyph row is less than HEIGHT, the
9442 row's height is increased to HEIGHT, and the icons are centered
9443 vertically in the new height. */
9433 9444
9434 static void 9445 static void
9435 display_tool_bar_line (it) 9446 display_tool_bar_line (it, height)
9436 struct it *it; 9447 struct it *it;
9448 int height;
9437 { 9449 {
9438 struct glyph_row *row = it->glyph_row; 9450 struct glyph_row *row = it->glyph_row;
9439 int max_x = it->last_visible_x; 9451 int max_x = it->last_visible_x;
9440 struct glyph *last; 9452 struct glyph *last;
9441 9453
9487 } 9499 }
9488 9500
9489 out:; 9501 out:;
9490 9502
9491 row->displays_text_p = row->used[TEXT_AREA] != 0; 9503 row->displays_text_p = row->used[TEXT_AREA] != 0;
9504 /* Use default face for the border below the tool bar. */
9505 if (!row->displays_text_p)
9506 it->face_id = DEFAULT_FACE_ID;
9492 extend_face_to_end_of_line (it); 9507 extend_face_to_end_of_line (it);
9493 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; 9508 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
9494 last->right_box_line_p = 1; 9509 last->right_box_line_p = 1;
9495 if (last == row->glyphs[TEXT_AREA]) 9510 if (last == row->glyphs[TEXT_AREA])
9496 last->left_box_line_p = 1; 9511 last->left_box_line_p = 1;
9512
9513 /* Make line the desired height and center it vertically. */
9514 if ((height -= it->max_ascent + it->max_descent) > 0)
9515 {
9516 it->max_ascent += height / 2;
9517 it->max_descent += (height + 1) / 2;
9518 }
9519
9497 compute_line_metrics (it); 9520 compute_line_metrics (it);
9498 9521
9499 /* If line is empty, make it occupy the rest of the tool-bar. */ 9522 /* If line is empty, make it occupy the rest of the tool-bar. */
9500 if (!row->displays_text_p) 9523 if (!row->displays_text_p)
9501 { 9524 {
9515 ++it->glyph_row; 9538 ++it->glyph_row;
9516 } 9539 }
9517 9540
9518 9541
9519 /* Value is the number of screen lines needed to make all tool-bar 9542 /* Value is the number of screen lines needed to make all tool-bar
9520 items of frame F visible. */ 9543 items of frame F visible. The number of actual rows needed is
9544 returned in *N_ROWS if non-NULL. */
9521 9545
9522 static int 9546 static int
9523 tool_bar_lines_needed (f) 9547 tool_bar_lines_needed (f, n_rows)
9524 struct frame *f; 9548 struct frame *f;
9549 int *n_rows;
9525 { 9550 {
9526 struct window *w = XWINDOW (f->tool_bar_window); 9551 struct window *w = XWINDOW (f->tool_bar_window);
9527 struct it it; 9552 struct it it;
9528 9553
9529 /* Initialize an iterator for iteration over 9554 /* Initialize an iterator for iteration over
9535 9560
9536 while (!ITERATOR_AT_END_P (&it)) 9561 while (!ITERATOR_AT_END_P (&it))
9537 { 9562 {
9538 it.glyph_row = w->desired_matrix->rows; 9563 it.glyph_row = w->desired_matrix->rows;
9539 clear_glyph_row (it.glyph_row); 9564 clear_glyph_row (it.glyph_row);
9540 display_tool_bar_line (&it); 9565 display_tool_bar_line (&it, 0);
9541 } 9566 }
9567
9568 if (n_rows)
9569 *n_rows = it.vpos;
9542 9570
9543 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); 9571 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
9544 } 9572 }
9545 9573
9546 9574
9566 { 9594 {
9567 update_tool_bar (f, 1); 9595 update_tool_bar (f, 1);
9568 if (f->n_tool_bar_items) 9596 if (f->n_tool_bar_items)
9569 { 9597 {
9570 build_desired_tool_bar_string (f); 9598 build_desired_tool_bar_string (f);
9571 nlines = tool_bar_lines_needed (f); 9599 nlines = tool_bar_lines_needed (f, NULL);
9572 } 9600 }
9573 } 9601 }
9574 9602
9575 return make_number (nlines); 9603 return make_number (nlines);
9576 } 9604 }
9611 9639
9612 /* Build a string that represents the contents of the tool-bar. */ 9640 /* Build a string that represents the contents of the tool-bar. */
9613 build_desired_tool_bar_string (f); 9641 build_desired_tool_bar_string (f);
9614 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 9642 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
9615 9643
9644 if (f->n_tool_bar_rows == 0)
9645 {
9646 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
9647 if (f->n_tool_bar_rows == 0)
9648 f->n_tool_bar_rows = -1;
9649 }
9650
9616 /* Display as many lines as needed to display all tool-bar items. */ 9651 /* Display as many lines as needed to display all tool-bar items. */
9617 while (it.current_y < it.last_visible_y) 9652
9618 display_tool_bar_line (&it); 9653 if (f->n_tool_bar_rows > 0)
9654 {
9655 int border, rows, height, extra;
9656
9657 if (INTEGERP (Vtool_bar_border))
9658 border = XINT (Vtool_bar_border);
9659 else if (EQ (Vtool_bar_border, Qinternal_border_width))
9660 border = FRAME_INTERNAL_BORDER_WIDTH (f);
9661 else if (EQ (Vtool_bar_border, Qborder_width))
9662 border = f->border_width;
9663 else
9664 border = 0;
9665 if (border < 0)
9666 border = 0;
9667
9668 rows = f->n_tool_bar_rows;
9669 height = (it.last_visible_y - border) / rows;
9670 extra = it.last_visible_y - border - height * rows;
9671
9672 while (it.current_y < it.last_visible_y)
9673 {
9674 int h = 0;
9675 if (extra > 0 && rows-- > 0)
9676 {
9677 h = (extra + rows - 1) / rows;
9678 extra -= h;
9679 }
9680 display_tool_bar_line (&it, height + h);
9681 }
9682 }
9683 else
9684 {
9685 while (it.current_y < it.last_visible_y)
9686 display_tool_bar_line (&it, 0);
9687 }
9619 9688
9620 /* It doesn't make much sense to try scrolling in the tool-bar 9689 /* It doesn't make much sense to try scrolling in the tool-bar
9621 window, so don't do it. */ 9690 window, so don't do it. */
9622 w->desired_matrix->no_scrolling_p = 1; 9691 w->desired_matrix->no_scrolling_p = 1;
9623 w->must_be_updated_p = 1; 9692 w->must_be_updated_p = 1;
9646 change_height_p = 1; 9715 change_height_p = 1;
9647 9716
9648 /* Resize windows as needed by changing the `tool-bar-lines' 9717 /* Resize windows as needed by changing the `tool-bar-lines'
9649 frame parameter. */ 9718 frame parameter. */
9650 if (change_height_p 9719 if (change_height_p
9651 && (nlines = tool_bar_lines_needed (f), 9720 && (nlines = tool_bar_lines_needed (f, &f->n_tool_bar_rows),
9652 nlines != WINDOW_TOTAL_LINES (w))) 9721 nlines != WINDOW_TOTAL_LINES (w)))
9653 { 9722 {
9654 extern Lisp_Object Qtool_bar_lines; 9723 extern Lisp_Object Qtool_bar_lines;
9655 Lisp_Object frame; 9724 Lisp_Object frame;
9656 int old_height = WINDOW_TOTAL_LINES (w); 9725 int old_height = WINDOW_TOTAL_LINES (w);
23659 23728
23660 DEFVAR_BOOL ("make-cursor-line-fully-visible", &make_cursor_line_fully_visible_p, 23729 DEFVAR_BOOL ("make-cursor-line-fully-visible", &make_cursor_line_fully_visible_p,
23661 doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */); 23730 doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */);
23662 make_cursor_line_fully_visible_p = 1; 23731 make_cursor_line_fully_visible_p = 1;
23663 23732
23733 DEFVAR_LISP ("tool-bar-border", &Vtool_bar_border,
23734 doc: /* *Border below tool-bar in pixels.
23735 If an integer, use it as the height of the border.
23736 If it is one of `internal-border-width' or `border-width', use the
23737 value of the corresponding frame parameter.
23738 Otherwise, no border is added below the tool-bar. */);
23739 Vtool_bar_border = Qinternal_border_width;
23740
23664 DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin, 23741 DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin,
23665 doc: /* *Margin around tool-bar buttons in pixels. 23742 doc: /* *Margin around tool-bar buttons in pixels.
23666 If an integer, use that for both horizontal and vertical margins. 23743 If an integer, use that for both horizontal and vertical margins.
23667 Otherwise, value should be a pair of integers `(HORZ . VERT)' with 23744 Otherwise, value should be a pair of integers `(HORZ . VERT)' with
23668 HORZ specifying the horizontal margin, and VERT specifying the 23745 HORZ specifying the horizontal margin, and VERT specifying the