emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115720: Last portion of fix for bug #16051 with red


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r115720: Last portion of fix for bug #16051 with redisplay loops.
Date: Mon, 23 Dec 2013 19:25:12 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115720
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16051
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-23 21:24:25 +0200
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-12-23 16:36:34 +0000
+++ b/src/ChangeLog     2013-12-23 19:24:25 +0000
@@ -5,6 +5,9 @@
        redisplay_tool_bar does.  Improve and fix commentary.
        (hscroll_window_tree): Don't assume w->cursor.vpos is within the
        limits of the glyph matrices.  (Bug#16051)
+       (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.
 
 2013-12-23  Jan Djärv  <address@hidden>
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-12-23 16:36:34 +0000
+++ b/src/xdisp.c       2013-12-23 19:24:25 +0000
@@ -12289,18 +12289,35 @@
 
          if (change_height_p)
            {
+             /* Current size of the tool-bar window in canonical line
+                units.  */
+             int old_lines = WINDOW_TOTAL_LINES (w);
+             /* Required size of the tool-bar window in canonical
+                line units. */
              int new_lines = ((new_height + FRAME_LINE_HEIGHT (f) - 1)
                               / FRAME_LINE_HEIGHT (f));
+             /* Maximum size of the tool-bar window in canonical line
+                units that this frame can allow. */
+             int max_lines =
+               WINDOW_TOTAL_LINES (XWINDOW (FRAME_ROOT_WINDOW (f))) - 1;
 
-             XSETFRAME (frame, f);
-             Fmodify_frame_parameters (frame,
-                                       list1 (Fcons (Qtool_bar_lines,
-                                                     make_number 
(new_lines))));
-             /* Always do that now.  */
-             clear_glyph_matrix (w->desired_matrix);
-             f->n_tool_bar_rows = nrows;
-             f->fonts_changed = 1;
-             return 1;
+             /* Don't try to change the tool-bar window size and set
+                the fonts_changed flag unless really necessary.  That
+                flag causes redisplay to give up and retry
+                redisplaying the frame from scratch, so setting it
+                unnecessarily can lead to nasty redisplay loops.  */
+             if (new_lines <= max_lines
+                 && eabs (new_lines - old_lines) >= 1)
+               {
+                 XSETFRAME (frame, f);
+                 Fmodify_frame_parameters (frame,
+                                           list1 (Fcons (Qtool_bar_lines,
+                                                         make_number 
(new_lines))));
+                 clear_glyph_matrix (w->desired_matrix);
+                 f->n_tool_bar_rows = nrows;
+                 f->fonts_changed = 1;
+                 return 1;
+               }
            }
        }
     }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]