aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-09-05 15:48:57 +0000
committerGerd Moellmann1999-09-05 15:48:57 +0000
commite037b9ecb3c11b1775171da6e9376a5221fefd78 (patch)
tree38f9e74706b41d8a545da451e4cf3523d912d8e7 /src
parent533322cdbc7fa3ee3c71d461abea2cdcf406e1cc (diff)
downloademacs-e037b9ecb3c11b1775171da6e9376a5221fefd78.tar.gz
emacs-e037b9ecb3c11b1775171da6e9376a5221fefd78.zip
(row_containing_pos): New.
(try_window_id): Use it. Change spelling of `toolbar' to `tool_bar' or `tool-bar'. Likewise for upper-case etc.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c321
1 files changed, 175 insertions, 146 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 348fdb29514..1c83bd79987 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -227,23 +227,23 @@ Lisp_Object Qfontified;
227Lisp_Object Vfontification_functions; 227Lisp_Object Vfontification_functions;
228Lisp_Object Qfontification_functions; 228Lisp_Object Qfontification_functions;
229 229
230/* Non-zero means draw toolbar buttons raised when the mouse moves 230/* Non-zero means draw tool bar buttons raised when the mouse moves
231 over them. */ 231 over them. */
232 232
233int auto_raise_toolbar_buttons_p; 233int auto_raise_tool_bar_buttons_p;
234 234
235/* Margin around toolbar buttons in pixels. */ 235/* Margin around tool bar buttons in pixels. */
236 236
237int toolbar_button_margin; 237int tool_bar_button_margin;
238 238
239/* Thickness of shadow to draw around toolbar buttons. */ 239/* Thickness of shadow to draw around tool bar buttons. */
240 240
241int toolbar_button_relief; 241int tool_bar_button_relief;
242 242
243/* Non-zero means automatically resize toolbars so that all toolbar 243/* Non-zero means automatically resize tool-bars so that all tool-bar
244 items are visible, and no blank lines remain. */ 244 items are visible, and no blank lines remain. */
245 245
246int auto_resize_toolbars_p; 246int auto_resize_tool_bars_p;
247 247
248/* Non-nil means don't actually do any redisplay. */ 248/* Non-nil means don't actually do any redisplay. */
249 249
@@ -584,6 +584,9 @@ enum move_it_result
584 584
585/* Function prototypes. */ 585/* Function prototypes. */
586 586
587static struct glyph_row *row_containing_pos P_ ((struct window *, int,
588 struct glyph_row *,
589 struct glyph_row *));
587static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); 590static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
588static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); 591static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *));
589static void clear_garbaged_frames P_ ((void)); 592static void clear_garbaged_frames P_ ((void));
@@ -678,10 +681,10 @@ static int handle_single_display_prop P_ ((struct it *, Lisp_Object,
678 681
679#ifdef HAVE_WINDOW_SYSTEM 682#ifdef HAVE_WINDOW_SYSTEM
680 683
681static void update_toolbar P_ ((struct frame *, int)); 684static void update_tool_bar P_ ((struct frame *, int));
682static void build_desired_toolbar_string P_ ((struct frame *f)); 685static void build_desired_tool_bar_string P_ ((struct frame *f));
683static int redisplay_toolbar P_ ((struct frame *)); 686static int redisplay_tool_bar P_ ((struct frame *));
684static void display_toolbar_line P_ ((struct it *)); 687static void display_tool_bar_line P_ ((struct it *));
685 688
686#endif /* HAVE_WINDOW_SYSTEM */ 689#endif /* HAVE_WINDOW_SYSTEM */
687 690
@@ -1156,8 +1159,8 @@ check_window_end (w)
1156 1159
1157 BASE_FACE_ID is the id of a base face to use. It must be one of 1160 BASE_FACE_ID is the id of a base face to use. It must be one of
1158 DEFAULT_FACE_ID for normal text, MODE_LINE_FACE_ID or 1161 DEFAULT_FACE_ID for normal text, MODE_LINE_FACE_ID or
1159 TOP_LINE_FACE_ID for displaying mode lines, or TOOLBAR_FACE_ID for 1162 TOP_LINE_FACE_ID for displaying mode lines, or TOOL_BAR_FACE_ID for
1160 displaying the toolbar. 1163 displaying the tool-bar.
1161 1164
1162 If ROW is null and BASE_FACE_ID is equal to MODE_LINE_FACE_ID or 1165 If ROW is null and BASE_FACE_ID is equal to MODE_LINE_FACE_ID or
1163 TOP_LINE_FACE_ID, the iterator will be initialized to use the 1166 TOP_LINE_FACE_ID, the iterator will be initialized to use the
@@ -6070,7 +6073,7 @@ prepare_menu_bars ()
6070 GCPRO1 (tail); 6073 GCPRO1 (tail);
6071 update_menu_bar (f, 0); 6074 update_menu_bar (f, 0);
6072#ifdef HAVE_WINDOW_SYSTEM 6075#ifdef HAVE_WINDOW_SYSTEM
6073 update_toolbar (f, 0); 6076 update_tool_bar (f, 0);
6074#endif 6077#endif
6075 UNGCPRO; 6078 UNGCPRO;
6076 } 6079 }
@@ -6081,7 +6084,7 @@ prepare_menu_bars ()
6081 { 6084 {
6082 update_menu_bar (selected_frame, 1); 6085 update_menu_bar (selected_frame, 1);
6083#ifdef HAVE_WINDOW_SYSTEM 6086#ifdef HAVE_WINDOW_SYSTEM
6084 update_toolbar (selected_frame, 1); 6087 update_tool_bar (selected_frame, 1);
6085#endif 6088#endif
6086 } 6089 }
6087 6090
@@ -6184,23 +6187,23 @@ update_menu_bar (f, save_match_data)
6184 6187
6185 6188
6186/*********************************************************************** 6189/***********************************************************************
6187 Toolbars 6190 Tool-bars
6188 ***********************************************************************/ 6191 ***********************************************************************/
6189 6192
6190#ifdef HAVE_WINDOW_SYSTEM 6193#ifdef HAVE_WINDOW_SYSTEM
6191 6194
6192/* Update the toolbar item list for frame F. This has to be done 6195/* Update the tool-bar item list for frame F. This has to be done
6193 before we start to fill in any display lines. Called from 6196 before we start to fill in any display lines. Called from
6194 prepare_menu_bars. If SAVE_MATCH_DATA is non-zero, we must save 6197 prepare_menu_bars. If SAVE_MATCH_DATA is non-zero, we must save
6195 and restore it here. */ 6198 and restore it here. */
6196 6199
6197static void 6200static void
6198update_toolbar (f, save_match_data) 6201update_tool_bar (f, save_match_data)
6199 struct frame *f; 6202 struct frame *f;
6200 int save_match_data; 6203 int save_match_data;
6201{ 6204{
6202 if (WINDOWP (f->toolbar_window) 6205 if (WINDOWP (f->tool_bar_window)
6203 && XFASTINT (XWINDOW (f->toolbar_window)->height) > 0) 6206 && XFASTINT (XWINDOW (f->tool_bar_window)->height) > 0)
6204 { 6207 {
6205 Lisp_Object window; 6208 Lisp_Object window;
6206 struct window *w; 6209 struct window *w;
@@ -6243,12 +6246,12 @@ update_toolbar (f, save_match_data)
6243 specbind (Qoverriding_local_map, Qnil); 6246 specbind (Qoverriding_local_map, Qnil);
6244 } 6247 }
6245 6248
6246 /* Build desired toolbar items from keymaps. */ 6249 /* Build desired tool-bar items from keymaps. */
6247 f->desired_toolbar_items 6250 f->desired_tool_bar_items
6248 = toolbar_items (f->desired_toolbar_items, 6251 = tool_bar_items (f->desired_tool_bar_items,
6249 &f->n_desired_toolbar_items); 6252 &f->n_desired_tool_bar_items);
6250 6253
6251 /* Redisplay the toolbar in case we changed it. */ 6254 /* Redisplay the tool-bar in case we changed it. */
6252 w->update_mode_line = Qt; 6255 w->update_mode_line = Qt;
6253 6256
6254 unbind_to (count, Qnil); 6257 unbind_to (count, Qnil);
@@ -6258,12 +6261,12 @@ update_toolbar (f, save_match_data)
6258} 6261}
6259 6262
6260 6263
6261/* Set F->desired_toolbar_string to a Lisp string representing frame 6264/* Set F->desired_tool_bar_string to a Lisp string representing frame
6262 F's desired toolbar contents. F->desired_toolbar_items must have 6265 F's desired tool-bar contents. F->desired_tool_bar_items must have
6263 been set up previously by calling prepare_menu_bars. */ 6266 been set up previously by calling prepare_menu_bars. */
6264 6267
6265static void 6268static void
6266build_desired_toolbar_string (f) 6269build_desired_tool_bar_string (f)
6267 struct frame *f; 6270 struct frame *f;
6268{ 6271{
6269 int i, size, size_needed, string_idx; 6272 int i, size, size_needed, string_idx;
@@ -6273,60 +6276,60 @@ build_desired_toolbar_string (f)
6273 image = plist = props = Qnil; 6276 image = plist = props = Qnil;
6274 GCPRO3 (image, plist, props); 6277 GCPRO3 (image, plist, props);
6275 6278
6276 /* Prepare F->desired_toolbar_string. If we can reuse it, do so. 6279 /* Prepare F->desired_tool_bar_string. If we can reuse it, do so.
6277 Otherwise, make a new string. */ 6280 Otherwise, make a new string. */
6278 6281
6279 /* The size of the string we might be able to reuse. */ 6282 /* The size of the string we might be able to reuse. */
6280 size = (STRINGP (f->desired_toolbar_string) 6283 size = (STRINGP (f->desired_tool_bar_string)
6281 ? XSTRING (f->desired_toolbar_string)->size 6284 ? XSTRING (f->desired_tool_bar_string)->size
6282 : 0); 6285 : 0);
6283 6286
6284 /* Each image in the string we build is preceded by a space, 6287 /* Each image in the string we build is preceded by a space,
6285 and there is a space at the end. */ 6288 and there is a space at the end. */
6286 size_needed = f->n_desired_toolbar_items + 1; 6289 size_needed = f->n_desired_tool_bar_items + 1;
6287 6290
6288 /* Reuse f->desired_toolbar_string, if possible. */ 6291 /* Reuse f->desired_tool_bar_string, if possible. */
6289 if (size < size_needed) 6292 if (size < size_needed)
6290 f->desired_toolbar_string = Fmake_string (make_number (size_needed), ' '); 6293 f->desired_tool_bar_string = Fmake_string (make_number (size_needed), ' ');
6291 else 6294 else
6292 { 6295 {
6293 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); 6296 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
6294 Fremove_text_properties (make_number (0), make_number (size), 6297 Fremove_text_properties (make_number (0), make_number (size),
6295 props, f->desired_toolbar_string); 6298 props, f->desired_tool_bar_string);
6296 } 6299 }
6297 6300
6298 /* Put a `display' property on the string for the images to display, 6301 /* Put a `display' property on the string for the images to display,
6299 put a `menu_item' property on toolbar items with a value that 6302 put a `menu_item' property on tool-bar items with a value that
6300 is the index of the item in F's toolbar item vector. */ 6303 is the index of the item in F's tool-bar item vector. */
6301 for (i = 0, string_idx = 0; 6304 for (i = 0, string_idx = 0;
6302 i < f->n_desired_toolbar_items; 6305 i < f->n_desired_tool_bar_items;
6303 ++i, string_idx += 1) 6306 ++i, string_idx += 1)
6304 { 6307 {
6305#define PROP(IDX) \ 6308#define PROP(IDX) \
6306 (XVECTOR (f->desired_toolbar_items) \ 6309 (XVECTOR (f->desired_tool_bar_items) \
6307 ->contents[i * TOOLBAR_ITEM_NSLOTS + (IDX)]) 6310 ->contents[i * TOOL_BAR_ITEM_NSLOTS + (IDX)])
6308 6311
6309 int enabled_p = !NILP (PROP (TOOLBAR_ITEM_ENABLED_P)); 6312 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
6310 int selected_p = !NILP (PROP (TOOLBAR_ITEM_SELECTED_P)); 6313 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
6311 int margin, relief; 6314 int margin, relief;
6312 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage; 6315 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage;
6313 extern Lisp_Object Qlaplace; 6316 extern Lisp_Object Qlaplace;
6314 6317
6315 /* If image is a vector, choose the image according to the 6318 /* If image is a vector, choose the image according to the
6316 button state. */ 6319 button state. */
6317 image = PROP (TOOLBAR_ITEM_IMAGES); 6320 image = PROP (TOOL_BAR_ITEM_IMAGES);
6318 if (VECTORP (image)) 6321 if (VECTORP (image))
6319 { 6322 {
6320 enum toolbar_item_image idx; 6323 enum tool_bar_item_image idx;
6321 6324
6322 if (enabled_p) 6325 if (enabled_p)
6323 idx = (selected_p 6326 idx = (selected_p
6324 ? TOOLBAR_IMAGE_ENABLED_SELECTED 6327 ? TOOL_BAR_IMAGE_ENABLED_SELECTED
6325 : TOOLBAR_IMAGE_ENABLED_DESELECTED); 6328 : TOOL_BAR_IMAGE_ENABLED_DESELECTED);
6326 else 6329 else
6327 idx = (selected_p 6330 idx = (selected_p
6328 ? TOOLBAR_IMAGE_DISABLED_SELECTED 6331 ? TOOL_BAR_IMAGE_DISABLED_SELECTED
6329 : TOOLBAR_IMAGE_DISABLED_DESELECTED); 6332 : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
6330 6333
6331 xassert (XVECTOR (image)->size >= idx); 6334 xassert (XVECTOR (image)->size >= idx);
6332 image = XVECTOR (image)->contents[idx]; 6335 image = XVECTOR (image)->contents[idx];
@@ -6336,14 +6339,14 @@ build_desired_toolbar_string (f)
6336 if (!valid_image_p (image)) 6339 if (!valid_image_p (image))
6337 continue; 6340 continue;
6338 6341
6339 /* Display the toolbar button pressed, or depressed. */ 6342 /* Display the tool-bar button pressed, or depressed. */
6340 plist = Fcopy_sequence (XCDR (image)); 6343 plist = Fcopy_sequence (XCDR (image));
6341 6344
6342 /* Compute margin and relief to draw. */ 6345 /* Compute margin and relief to draw. */
6343 relief = toolbar_button_relief > 0 ? toolbar_button_relief : 3; 6346 relief = tool_bar_button_relief > 0 ? tool_bar_button_relief : 3;
6344 margin = relief + max (0, toolbar_button_margin); 6347 margin = relief + max (0, tool_bar_button_margin);
6345 6348
6346 if (auto_raise_toolbar_buttons_p) 6349 if (auto_raise_tool_bar_buttons_p)
6347 { 6350 {
6348 /* Add a `:relief' property to the image spec if the item is 6351 /* Add a `:relief' property to the image spec if the item is
6349 selected. */ 6352 selected. */
@@ -6376,14 +6379,14 @@ build_desired_toolbar_string (f)
6376 6379
6377 /* Put a `display' text property on the string for the image to 6380 /* Put a `display' text property on the string for the image to
6378 display. Put a `menu-item' property on the string that gives 6381 display. Put a `menu-item' property on the string that gives
6379 the start of this item's properties in the toolbar items 6382 the start of this item's properties in the tool-bar items
6380 vector. */ 6383 vector. */
6381 image = Fcons (Qimage, plist); 6384 image = Fcons (Qimage, plist);
6382 props = list4 (Qdisplay, image, 6385 props = list4 (Qdisplay, image,
6383 Qmenu_item, make_number (i * TOOLBAR_ITEM_NSLOTS)), 6386 Qmenu_item, make_number (i * TOOL_BAR_ITEM_NSLOTS)),
6384 Fadd_text_properties (make_number (string_idx), 6387 Fadd_text_properties (make_number (string_idx),
6385 make_number (string_idx + 1), 6388 make_number (string_idx + 1),
6386 props, f->desired_toolbar_string); 6389 props, f->desired_tool_bar_string);
6387#undef PROP 6390#undef PROP
6388 } 6391 }
6389 6392
@@ -6391,10 +6394,10 @@ build_desired_toolbar_string (f)
6391} 6394}
6392 6395
6393 6396
6394/* Display one line of the toolbar of frame IT->f. */ 6397/* Display one line of the tool-bar of frame IT->f. */
6395 6398
6396static void 6399static void
6397display_toolbar_line (it) 6400display_tool_bar_line (it)
6398 struct it *it; 6401 struct it *it;
6399{ 6402{
6400 struct glyph_row *row = it->glyph_row; 6403 struct glyph_row *row = it->glyph_row;
@@ -6452,7 +6455,7 @@ display_toolbar_line (it)
6452 last->right_box_line_p = 1; 6455 last->right_box_line_p = 1;
6453 compute_line_metrics (it); 6456 compute_line_metrics (it);
6454 6457
6455 /* If line is empty, make it occupy the rest of the toolbar. */ 6458 /* If line is empty, make it occupy the rest of the tool-bar. */
6456 if (!row->displays_text_p) 6459 if (!row->displays_text_p)
6457 { 6460 {
6458 row->height = row->phys_height = it->last_visible_y - row->y; 6461 row->height = row->phys_height = it->last_visible_y - row->y;
@@ -6471,39 +6474,39 @@ display_toolbar_line (it)
6471} 6474}
6472 6475
6473 6476
6474/* Value is the number of screen lines needed to make all toolbar 6477/* Value is the number of screen lines needed to make all tool-bar
6475 items of frame F visible. */ 6478 items of frame F visible. */
6476 6479
6477static int 6480static int
6478toolbar_lines_needed (f) 6481tool_bar_lines_needed (f)
6479 struct frame *f; 6482 struct frame *f;
6480{ 6483{
6481 struct window *w = XWINDOW (f->toolbar_window); 6484 struct window *w = XWINDOW (f->tool_bar_window);
6482 struct it it; 6485 struct it it;
6483 6486
6484 /* Initialize an iterator for iteration over F->desired_toolbar_string 6487 /* Initialize an iterator for iteration over
6485 in the toolbar window of frame F. */ 6488 F->desired_tool_bar_string in the tool-bar window of frame F. */
6486 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOLBAR_FACE_ID); 6489 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
6487 it.first_visible_x = 0; 6490 it.first_visible_x = 0;
6488 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); 6491 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
6489 reseat_to_string (&it, NULL, f->desired_toolbar_string, 0, 0, 0, -1); 6492 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
6490 6493
6491 while (!ITERATOR_AT_END_P (&it)) 6494 while (!ITERATOR_AT_END_P (&it))
6492 { 6495 {
6493 it.glyph_row = w->desired_matrix->rows; 6496 it.glyph_row = w->desired_matrix->rows;
6494 clear_glyph_row (it.glyph_row); 6497 clear_glyph_row (it.glyph_row);
6495 display_toolbar_line (&it); 6498 display_tool_bar_line (&it);
6496 } 6499 }
6497 6500
6498 return (it.current_y + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); 6501 return (it.current_y + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
6499} 6502}
6500 6503
6501 6504
6502/* Display the toolbar of frame F. Value is non-zero if toolbar's 6505/* Display the tool-bar of frame F. Value is non-zero if tool-bar's
6503 height should be changed. */ 6506 height should be changed. */
6504 6507
6505static int 6508static int
6506redisplay_toolbar (f) 6509redisplay_tool_bar (f)
6507 struct frame *f; 6510 struct frame *f;
6508{ 6511{
6509 struct window *w; 6512 struct window *w;
@@ -6511,65 +6514,65 @@ redisplay_toolbar (f)
6511 struct glyph_row *row; 6514 struct glyph_row *row;
6512 int change_height_p = 0; 6515 int change_height_p = 0;
6513 6516
6514 /* If frame hasn't a toolbar window or if it is zero-height, don't 6517 /* If frame hasn't a tool-bar window or if it is zero-height, don't
6515 do anything. This means you must start with toolbar-lines 6518 do anything. This means you must start with tool-bar-lines
6516 non-zero to get the auto-sizing effect. Or in other words, you 6519 non-zero to get the auto-sizing effect. Or in other words, you
6517 can turn off toolbars by specifying toolbar-lines zero. */ 6520 can turn off tool-bars by specifying tool-bar-lines zero. */
6518 if (!WINDOWP (f->toolbar_window) 6521 if (!WINDOWP (f->tool_bar_window)
6519 || (w = XWINDOW (f->toolbar_window), 6522 || (w = XWINDOW (f->tool_bar_window),
6520 XFASTINT (w->height) == 0)) 6523 XFASTINT (w->height) == 0))
6521 return 0; 6524 return 0;
6522 6525
6523 /* Set up an iterator for the toolbar window. */ 6526 /* Set up an iterator for the tool-bar window. */
6524 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOLBAR_FACE_ID); 6527 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
6525 it.first_visible_x = 0; 6528 it.first_visible_x = 0;
6526 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); 6529 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
6527 row = it.glyph_row; 6530 row = it.glyph_row;
6528 6531
6529 /* Build a string that represents the contents of the toolbar. */ 6532 /* Build a string that represents the contents of the tool-bar. */
6530 build_desired_toolbar_string (f); 6533 build_desired_tool_bar_string (f);
6531 reseat_to_string (&it, NULL, f->desired_toolbar_string, 0, 0, 0, -1); 6534 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
6532 6535
6533 /* Display as many lines as needed to display all toolbar items. */ 6536 /* Display as many lines as needed to display all tool-bar items. */
6534 while (it.current_y < it.last_visible_y) 6537 while (it.current_y < it.last_visible_y)
6535 display_toolbar_line (&it); 6538 display_tool_bar_line (&it);
6536 6539
6537 /* It doesn't make much sense to try scrolling in the toolbar 6540 /* It doesn't make much sense to try scrolling in the tool-bar
6538 window, so don't do it. */ 6541 window, so don't do it. */
6539 w->desired_matrix->no_scrolling_p = 1; 6542 w->desired_matrix->no_scrolling_p = 1;
6540 w->must_be_updated_p = 1; 6543 w->must_be_updated_p = 1;
6541 6544
6542 if (auto_resize_toolbars_p) 6545 if (auto_resize_tool_bars_p)
6543 { 6546 {
6544 int nlines; 6547 int nlines;
6545 6548
6546 /* If there are blank lines at the end, except for a partially 6549 /* If there are blank lines at the end, except for a partially
6547 visible blank line at the end that is smaller than 6550 visible blank line at the end that is smaller than
6548 CANON_Y_UNIT, change the toolbar's height. */ 6551 CANON_Y_UNIT, change the tool-bar's height. */
6549 row = it.glyph_row - 1; 6552 row = it.glyph_row - 1;
6550 if (!row->displays_text_p 6553 if (!row->displays_text_p
6551 && row->height >= CANON_Y_UNIT (f)) 6554 && row->height >= CANON_Y_UNIT (f))
6552 change_height_p = 1; 6555 change_height_p = 1;
6553 6556
6554 /* If row displays toolbar items, but is partially visible, 6557 /* If row displays tool-bar items, but is partially visible,
6555 change the toolbar's height. */ 6558 change the tool-bar's height. */
6556 if (row->displays_text_p 6559 if (row->displays_text_p
6557 && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y) 6560 && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y)
6558 change_height_p = 1; 6561 change_height_p = 1;
6559 6562
6560 /* Resize windows as needed by changing the `toolbar-lines' 6563 /* Resize windows as needed by changing the `tool-bar-lines'
6561 frame parameter. */ 6564 frame parameter. */
6562 if (change_height_p 6565 if (change_height_p
6563 && (nlines = toolbar_lines_needed (f), 6566 && (nlines = tool_bar_lines_needed (f),
6564 nlines != XFASTINT (w->height))) 6567 nlines != XFASTINT (w->height)))
6565 { 6568 {
6566 extern Lisp_Object Qtoolbar_lines; 6569 extern Lisp_Object Qtool_bar_lines;
6567 Lisp_Object frame; 6570 Lisp_Object frame;
6568 6571
6569 XSETFRAME (frame, f); 6572 XSETFRAME (frame, f);
6570 clear_glyph_matrix (w->desired_matrix); 6573 clear_glyph_matrix (w->desired_matrix);
6571 Fmodify_frame_parameters (frame, 6574 Fmodify_frame_parameters (frame,
6572 Fcons (Fcons (Qtoolbar_lines, 6575 Fcons (Fcons (Qtool_bar_lines,
6573 make_number (nlines)), 6576 make_number (nlines)),
6574 Qnil)); 6577 Qnil));
6575 fonts_changed_p = 1; 6578 fonts_changed_p = 1;
@@ -6580,13 +6583,13 @@ redisplay_toolbar (f)
6580} 6583}
6581 6584
6582 6585
6583/* Get information about the toolbar item which is displayed in GLYPH 6586/* Get information about the tool-bar item which is displayed in GLYPH
6584 on frame F. Return in *PROP_IDX the index where toolbar item 6587 on frame F. Return in *PROP_IDX the index where tool-bar item
6585 properties start in F->current_toolbar_items. Value is zero if 6588 properties start in F->current_tool_bar_items. Value is zero if
6586 GLYPH doesn't display a toolbar item. */ 6589 GLYPH doesn't display a tool-bar item. */
6587 6590
6588int 6591int
6589toolbar_item_info (f, glyph, prop_idx) 6592tool_bar_item_info (f, glyph, prop_idx)
6590 struct frame *f; 6593 struct frame *f;
6591 struct glyph *glyph; 6594 struct glyph *glyph;
6592 int *prop_idx; 6595 int *prop_idx;
@@ -6596,9 +6599,9 @@ toolbar_item_info (f, glyph, prop_idx)
6596 6599
6597 /* Get the text property `menu-item' at pos. The value of that 6600 /* Get the text property `menu-item' at pos. The value of that
6598 property is the start index of this item's properties in 6601 property is the start index of this item's properties in
6599 F->current_toolbar_items. */ 6602 F->current_tool_bar_items. */
6600 prop = Fget_text_property (make_number (glyph->charpos), 6603 prop = Fget_text_property (make_number (glyph->charpos),
6601 Qmenu_item, f->current_toolbar_string); 6604 Qmenu_item, f->current_tool_bar_string);
6602 if (INTEGERP (prop)) 6605 if (INTEGERP (prop))
6603 { 6606 {
6604 *prop_idx = XINT (prop); 6607 *prop_idx = XINT (prop);
@@ -6990,7 +6993,7 @@ redisplay_internal (preserve_echo_area)
6990 if (frame_garbaged) 6993 if (frame_garbaged)
6991 clear_garbaged_frames (); 6994 clear_garbaged_frames ();
6992 6995
6993 /* Build menubar and toolbar items. */ 6996 /* Build menubar and tool-bar items. */
6994 prepare_menu_bars (); 6997 prepare_menu_bars ();
6995 6998
6996 if (windows_or_buffers_changed) 6999 if (windows_or_buffers_changed)
@@ -8206,7 +8209,7 @@ redisplay_window (window, just_this_one_p)
8206 { 8209 {
8207 if (update_mode_line) 8210 if (update_mode_line)
8208 /* We may have to update a tty frame's menu bar or a 8211 /* We may have to update a tty frame's menu bar or a
8209 toolbar. Example `M-x C-h C-h C-g'. */ 8212 tool-bar. Example `M-x C-h C-h C-g'. */
8210 goto finish_menu_bars; 8213 goto finish_menu_bars;
8211 else 8214 else
8212 /* We've already displayed the echo area glyphs in this window. */ 8215 /* We've already displayed the echo area glyphs in this window. */
@@ -8923,10 +8926,10 @@ redisplay_window (window, just_this_one_p)
8923 display_menu_bar (w); 8926 display_menu_bar (w);
8924 8927
8925#ifdef HAVE_WINDOW_SYSTEM 8928#ifdef HAVE_WINDOW_SYSTEM
8926 if (WINDOWP (f->toolbar_window) 8929 if (WINDOWP (f->tool_bar_window)
8927 && (FRAME_TOOLBAR_LINES (f) > 0 8930 && (FRAME_TOOL_BAR_LINES (f) > 0
8928 || auto_resize_toolbars_p)) 8931 || auto_resize_tool_bars_p))
8929 redisplay_toolbar (f); 8932 redisplay_tool_bar (f);
8930#endif 8933#endif
8931 } 8934 }
8932 8935
@@ -9613,6 +9616,51 @@ sync_frame_with_window_matrix_rows (w)
9613} 9616}
9614 9617
9615 9618
9619/* Find the glyph row in window W containing CHARPOS. Consider all
9620 rows between START and END (not inclusive). END null means search
9621 all rows to the end of the display area of W. Value is the row
9622 containing CHARPOS or null. */
9623
9624static struct glyph_row *
9625row_containing_pos (w, charpos, start, end)
9626 struct window *w;
9627 int charpos;
9628 struct glyph_row *start, *end;
9629{
9630 struct glyph_row *row = start;
9631 int last_y;
9632
9633 /* If we happen to start on a header-line, skip that. */
9634 if (row->mode_line_p)
9635 ++row;
9636
9637 if ((end && row >= end) || !row->enabled_p)
9638 return NULL;
9639
9640 last_y = window_text_bottom_y (w);
9641
9642 while ((end == NULL || row < end)
9643 && (MATRIX_ROW_END_CHARPOS (row) < charpos
9644 /* The end position of a row equals the start
9645 position of the next row. If CHARPOS is there, we
9646 would rather display it in the next line, except
9647 when this line ends in ZV. */
9648 || (MATRIX_ROW_END_CHARPOS (row) == charpos
9649 && (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)
9650 || !row->ends_at_zv_p)))
9651 && MATRIX_ROW_BOTTOM_Y (row) < last_y)
9652 ++row;
9653
9654 /* Give up if CHARPOS not found. */
9655 if ((end && row >= end)
9656 || charpos < MATRIX_ROW_START_CHARPOS (row)
9657 || charpos > MATRIX_ROW_END_CHARPOS (row))
9658 row = NULL;
9659
9660 return row;
9661}
9662
9663
9616/* Try to redisplay window W by reusing its existing display. W's 9664/* Try to redisplay window W by reusing its existing display. W's
9617 current matrix must be up to date when this function is called, 9665 current matrix must be up to date when this function is called,
9618 i.e. window_end_valid must not be nil. 9666 i.e. window_end_valid must not be nil.
@@ -9885,38 +9933,19 @@ try_window_id (w)
9885 if (PT < CHARPOS (start_pos) 9933 if (PT < CHARPOS (start_pos)
9886 && last_unchanged_at_beg_row) 9934 && last_unchanged_at_beg_row)
9887 { 9935 {
9888 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 9936 row = row_containing_pos (w, PT,
9889 while (row <= last_unchanged_at_beg_row 9937 MATRIX_FIRST_TEXT_ROW (w->current_matrix),
9890 && MATRIX_ROW_END_CHARPOS (row) <= PT) 9938 last_unchanged_at_beg_row + 1);
9891 ++row; 9939 xassert (row && row <= last_unchanged_at_beg_row);
9892 xassert (row <= last_unchanged_at_beg_row);
9893 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); 9940 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
9894 } 9941 }
9895 9942
9896 /* Start from first_unchanged_at_end_row looking for PT. */ 9943 /* Start from first_unchanged_at_end_row looking for PT. */
9897 else if (first_unchanged_at_end_row) 9944 else if (first_unchanged_at_end_row)
9898 { 9945 {
9899 row = first_unchanged_at_end_row; 9946 row = row_containing_pos (w, PT - delta,
9900 9947 first_unchanged_at_end_row, NULL);
9901 while (MATRIX_ROW_DISPLAYS_TEXT_P (row)) 9948 if (row)
9902 {
9903 if (PT - delta >= MATRIX_ROW_START_CHARPOS (row)
9904 && PT - delta < MATRIX_ROW_END_CHARPOS (row))
9905 {
9906 set_cursor_from_row (w, row, w->current_matrix, delta,
9907 delta_bytes, dy, dvpos);
9908 break;
9909 }
9910 else if (MATRIX_ROW_BOTTOM_Y (row) >= last_y)
9911 break;
9912 ++row;
9913 }
9914
9915 /* If PT is at ZV, this is not in a line displaying text.
9916 Check that case. */
9917 if (w->cursor.vpos < 0
9918 && PT - delta == MATRIX_ROW_START_CHARPOS (row)
9919 && row->ends_at_zv_p)
9920 set_cursor_from_row (w, row, w->current_matrix, delta, 9949 set_cursor_from_row (w, row, w->current_matrix, delta,
9921 delta_bytes, dy, dvpos); 9950 delta_bytes, dy, dvpos);
9922 } 9951 }
@@ -10348,11 +10377,11 @@ DEFUN ("dump-glyph-row", Fdump_glyph_row, Sdump_glyph_row, 1, 1, "",
10348} 10377}
10349 10378
10350 10379
10351DEFUN ("dump-toolbar-row", Fdump_toolbar_row, Sdump_toolbar_row, 10380DEFUN ("dump-tool-bar-row", Fdump_tool_bar_row, Sdump_tool_bar_row,
10352 0, 0, "", "") 10381 0, 0, "", "")
10353 () 10382 ()
10354{ 10383{
10355 struct glyph_matrix *m = (XWINDOW (selected_frame->toolbar_window) 10384 struct glyph_matrix *m = (XWINDOW (selected_frame->tool_bar_window)
10356 ->current_matrix); 10385 ->current_matrix);
10357 dump_glyph_row (m, 0, 1); 10386 dump_glyph_row (m, 0, 1);
10358 return Qnil; 10387 return Qnil;
@@ -12477,7 +12506,7 @@ syms_of_xdisp ()
12477#if GLYPH_DEBUG 12506#if GLYPH_DEBUG
12478 defsubr (&Sdump_glyph_matrix); 12507 defsubr (&Sdump_glyph_matrix);
12479 defsubr (&Sdump_glyph_row); 12508 defsubr (&Sdump_glyph_row);
12480 defsubr (&Sdump_toolbar_row); 12509 defsubr (&Sdump_tool_bar_row);
12481 defsubr (&Strace_redisplay_toggle); 12510 defsubr (&Strace_redisplay_toggle);
12482#endif 12511#endif
12483 12512
@@ -12669,24 +12698,24 @@ and its new display-start position. Note that the value of `window-end'\n\
12669is not valid when these functions are called."); 12698is not valid when these functions are called.");
12670 Vwindow_scroll_functions = Qnil; 12699 Vwindow_scroll_functions = Qnil;
12671 12700
12672 DEFVAR_BOOL ("auto-resize-toolbars", &auto_resize_toolbars_p, 12701 DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p,
12673 "*Non-nil means automatically resize toolbars.\n\ 12702 "*Non-nil means automatically resize tool-bars.\n\
12674This increases a toolbar's height if not all toolbar items are visible.\n\ 12703This increases a tool-bar's height if not all tool-bar items are visible.\n\
12675It decreases a toolbar's height when it would display blank lines\n\ 12704It decreases a tool-bar's height when it would display blank lines\n\
12676otherwise."); 12705otherwise.");
12677 auto_resize_toolbars_p = 1; 12706 auto_resize_tool_bars_p = 1;
12678 12707
12679 DEFVAR_BOOL ("auto-raise-toolbar-buttons", &auto_raise_toolbar_buttons_p, 12708 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p,
12680 "*Non-nil means raise toolbar buttons when the mouse moves over them."); 12709 "*Non-nil means raise tool-bar buttons when the mouse moves over them.");
12681 auto_raise_toolbar_buttons_p = 1; 12710 auto_raise_tool_bar_buttons_p = 1;
12682 12711
12683 DEFVAR_INT ("toolbar-button-margin", &toolbar_button_margin, 12712 DEFVAR_INT ("tool-bar-button-margin", &tool_bar_button_margin,
12684 "*Margin around toolbar buttons in pixels."); 12713 "*Margin around tool-bar buttons in pixels.");
12685 toolbar_button_margin = 1; 12714 tool_bar_button_margin = 1;
12686 12715
12687 DEFVAR_INT ("toolbar-button-relief", &toolbar_button_relief, 12716 DEFVAR_INT ("tool-bar-button-relief", &tool_bar_button_relief,
12688 "Relief thickness of toolbar buttons."); 12717 "Relief thickness of tool-bar buttons.");
12689 toolbar_button_relief = 3; 12718 tool_bar_button_relief = 3;
12690 12719
12691 DEFVAR_LISP ("fontification-functions", &Vfontification_functions, 12720 DEFVAR_LISP ("fontification-functions", &Vfontification_functions,
12692 "List of functions to call to fontify regions of text.\n\ 12721 "List of functions to call to fontify regions of text.\n\