aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2013-12-23 21:24:25 +0200
committerEli Zaretskii2013-12-23 21:24:25 +0200
commitcdcec25959e82297a2af58073084d45f353aefb7 (patch)
tree846e3ba170cc3caa3df30d353c6d94c2c1da336d
parent631357625658a08121b441d45da697f18780c85e (diff)
downloademacs-cdcec25959e82297a2af58073084d45f353aefb7.tar.gz
emacs-cdcec25959e82297a2af58073084d45f353aefb7.zip
Last portion of fix for bug #16051 with redisplay loops.
src/xdisp.c (redisplay_tool_bar): Modify the tool-bar-lines frame parameter only when the new size is different from the old one, and the new size can be achieved given the frame height.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xdisp.c37
2 files changed, 30 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e1df65bbfe8..818ff2784be 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -5,6 +5,9 @@
5 redisplay_tool_bar does. Improve and fix commentary. 5 redisplay_tool_bar does. Improve and fix commentary.
6 (hscroll_window_tree): Don't assume w->cursor.vpos is within the 6 (hscroll_window_tree): Don't assume w->cursor.vpos is within the
7 limits of the glyph matrices. (Bug#16051) 7 limits of the glyph matrices. (Bug#16051)
8 (redisplay_tool_bar): Modify the tool-bar-lines frame parameter
9 only when the new size is different from the old one, and the new
10 size can be achieved given the frame height.
8 11
92013-12-23 Jan Djärv <jan.h.d@swipnet.se> 122013-12-23 Jan Djärv <jan.h.d@swipnet.se>
10 13
diff --git a/src/xdisp.c b/src/xdisp.c
index 9a3c27fc6ae..1c157c7be0a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12289,18 +12289,35 @@ redisplay_tool_bar (struct frame *f)
12289 12289
12290 if (change_height_p) 12290 if (change_height_p)
12291 { 12291 {
12292 /* Current size of the tool-bar window in canonical line
12293 units. */
12294 int old_lines = WINDOW_TOTAL_LINES (w);
12295 /* Required size of the tool-bar window in canonical
12296 line units. */
12292 int new_lines = ((new_height + FRAME_LINE_HEIGHT (f) - 1) 12297 int new_lines = ((new_height + FRAME_LINE_HEIGHT (f) - 1)
12293 / FRAME_LINE_HEIGHT (f)); 12298 / FRAME_LINE_HEIGHT (f));
12294 12299 /* Maximum size of the tool-bar window in canonical line
12295 XSETFRAME (frame, f); 12300 units that this frame can allow. */
12296 Fmodify_frame_parameters (frame, 12301 int max_lines =
12297 list1 (Fcons (Qtool_bar_lines, 12302 WINDOW_TOTAL_LINES (XWINDOW (FRAME_ROOT_WINDOW (f))) - 1;
12298 make_number (new_lines)))); 12303
12299 /* Always do that now. */ 12304 /* Don't try to change the tool-bar window size and set
12300 clear_glyph_matrix (w->desired_matrix); 12305 the fonts_changed flag unless really necessary. That
12301 f->n_tool_bar_rows = nrows; 12306 flag causes redisplay to give up and retry
12302 f->fonts_changed = 1; 12307 redisplaying the frame from scratch, so setting it
12303 return 1; 12308 unnecessarily can lead to nasty redisplay loops. */
12309 if (new_lines <= max_lines
12310 && eabs (new_lines - old_lines) >= 1)
12311 {
12312 XSETFRAME (frame, f);
12313 Fmodify_frame_parameters (frame,
12314 list1 (Fcons (Qtool_bar_lines,
12315 make_number (new_lines))));
12316 clear_glyph_matrix (w->desired_matrix);
12317 f->n_tool_bar_rows = nrows;
12318 f->fonts_changed = 1;
12319 return 1;
12320 }
12304 } 12321 }
12305 } 12322 }
12306 } 12323 }