emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115757: Some more tinkering with Bug#16051.


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r115757: Some more tinkering with Bug#16051.
Date: Thu, 26 Dec 2013 11:32:02 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115757
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2013-12-26 12:31:42 +0100
message:
  Some more tinkering with Bug#16051.
  
  * window.c (resize_frame_windows): Don't let the size of the
  root window drop below the frame's default character size.
  Never ever delete any subwindows - let the window manager do the
  clipping.
  
  * w32fns.c (x_set_tool_bar_lines): Rewrite calculation of number
  of toolbar lines needed when they exceed the height of the root
  window.
  (unwind_create_frame_1): New function.
  (Fx_create_frame): Generally inhibit calling the window
  configuration change hook here.  Remove extra call to
  change_frame_size - it's not needed when we don't run the
  configuration change hook.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-12-26 08:57:28 +0000
+++ b/src/ChangeLog     2013-12-26 11:31:42 +0000
@@ -1,3 +1,20 @@
+2013-12-26  Martin Rudalics  <address@hidden>
+
+       Some more tinkering with Bug#16051.
+       * window.c (resize_frame_windows): Don't let the size of the
+       root window drop below the frame's default character size.
+       Never ever delete any subwindows - let the window manager do the
+       clipping.
+
+       * w32fns.c (x_set_tool_bar_lines): Rewrite calculation of number
+       of toolbar lines needed when they exceed the height of the root
+       window.
+       (unwind_create_frame_1): New function.
+       (Fx_create_frame): Generally inhibit calling the window
+       configuration change hook here.  Remove extra call to
+       change_frame_size - it's not needed when we don't run the
+       configuration change hook.
+
 2013-12-26  Paul Eggert  <address@hidden>
 
        Fix core dumps with gcc -fsanitize=address and GNU/Linux.

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2013-12-25 17:30:24 +0000
+++ b/src/w32fns.c      2013-12-26 11:31:42 +0000
@@ -1683,15 +1683,19 @@
   /* DELTA is in pixels now.  */
   delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit;
 
-  /* Don't resize the tool-bar to more than we have room for.  FIXME:
-     This must use window_sizable eventually !!!!!!!!!!!!  */
+  /* Don't resize the tool-bar to more than we have room for.  Note: The
+     calculations below and the subsequent call to resize_frame_windows
+     are inherently flawed because they can make the toolbar higher than
+     the containing frame.  */
   if (delta > 0)
     {
       root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f)));
       if (root_height - delta < unit)
        {
          delta = root_height - unit;
-         nlines = (root_height / unit) + min (1, (root_height % unit));
+         /* When creating a new frame and toolbar mode is enabled, we
+            need at least one toolbar line.  */
+         nlines = max (FRAME_TOOL_BAR_LINES (f) + delta / unit, 1);
        }
     }
 
@@ -4271,6 +4275,12 @@
 }
 
 static void
+unwind_create_frame_1 (Lisp_Object val)
+{
+  inhibit_lisp_code = val;
+}
+
+static void
 x_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
@@ -4377,7 +4387,7 @@
   frame = Qnil;
   GCPRO4 (parameters, parent, name, frame);
   tem = x_get_arg (dpyinfo, parameters, Qminibuffer, "minibuffer", 
"Minibuffer",
-                     RES_TYPE_SYMBOL);
+                  RES_TYPE_SYMBOL);
   if (EQ (tem, Qnone) || NILP (tem))
     f = make_frame_without_minibuffer (Qnil, kb, display);
   else if (EQ (tem, Qonly))
@@ -4407,10 +4417,17 @@
   if (! STRINGP (f->icon_name))
     fset_icon_name (f, Qnil);
 
-/*  FRAME_DISPLAY_INFO (f) = dpyinfo; */
+  /*  FRAME_DISPLAY_INFO (f) = dpyinfo; */
 
   /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe.  */
   record_unwind_protect (do_unwind_create_frame, frame);
+
+  /* Avoid calling window-configuration-change-hook; otherwise we could
+     get into all kinds of nasty things like an infloop in next_frame or
+     violating a (height >= 0) assertion in window_box_height.  */
+  record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code);
+  inhibit_lisp_code = Qt;
+
 #ifdef GLYPH_DEBUG
   image_cache_refcount =
     FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
@@ -4464,7 +4481,7 @@
       Lisp_Object value;
 
       value = x_get_arg (dpyinfo, parameters, Qinternal_border_width,
-                           "internalBorder", "InternalBorder", 
RES_TYPE_NUMBER);
+                        "internalBorder", "InternalBorder", RES_TYPE_NUMBER);
       if (! EQ (value, Qunbound))
        parameters = Fcons (Fcons (Qinternal_border_width, value),
                             parameters);
@@ -4505,20 +4522,6 @@
      happen.  */
   init_frame_faces (f);
 
-  /* PXW: This is a duplicate from below.  We have to do it here since
-     otherwise x_set_tool_bar_lines will work with the character sizes
-     installed by init_frame_faces while the frame's pixel size is still
-     calculated from a character size of 1 and we subsequently hit the
-     eassert (height >= 0) assertion in window_box_height.  The
-     non-pixelwise code apparently worked around this because it had one
-     frame line vs one toolbar line which left us with a zero root
-     window height which was obviously wrong as well ...  */
-  width = FRAME_TEXT_WIDTH (f);
-  height = FRAME_TEXT_HEIGHT (f);
-  FRAME_TEXT_HEIGHT (f) = 0;
-  SET_FRAME_WIDTH (f, 0);
-  change_frame_size (f, width, height, 1, 0, 0, 1);
-
   /* The X resources controlling the menu-bar and tool-bar are
      processed specially at startup, and reflected in the mode
      variables; ignore them here.  */

=== modified file 'src/window.c'
--- a/src/window.c      2013-12-22 15:19:09 +0000
+++ b/src/window.c      2013-12-26 11:31:42 +0000
@@ -4040,31 +4040,34 @@
   int old_pixel_size = horflag ? r->pixel_width : r->pixel_height;
   /* new_size is the new size of the frame's root window.  */
   int new_size, new_pixel_size;
+  int unit = horflag ? FRAME_COLUMN_WIDTH (f) : FRAME_LINE_HEIGHT (f);
 
+  /* Don't let the size drop below one unit.  This is more comforting
+     when we are called from x_set_tool_bar_lines since the latter may
+     have implicitly given us a zero or negative height.  */
   if (pixelwise)
     {
-      new_pixel_size
-       = (horflag
-          ? size
-          : (size
-             - FRAME_TOP_MARGIN_HEIGHT (f)
-             - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
-                ? FRAME_LINE_HEIGHT (f) : 0)));
-      new_size = new_pixel_size / (horflag
-                                  ? FRAME_COLUMN_WIDTH (f)
-                                  : FRAME_LINE_HEIGHT (f));
+      new_pixel_size = max (horflag
+                           ? size
+                           : (size
+                              - FRAME_TOP_MARGIN_HEIGHT (f)
+                              - ((FRAME_HAS_MINIBUF_P (f)
+                                  && !FRAME_MINIBUF_ONLY_P (f))
+                                 ? FRAME_LINE_HEIGHT (f) : 0)),
+                           unit);
+      new_size = new_pixel_size / unit;
     }
   else
     {
-      new_size= (horflag
-                ? size
-                : (size
-                   - FRAME_TOP_MARGIN (f)
-                   - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
-                      ? 1 : 0)));
-      new_pixel_size = new_size * (horflag
-                                  ? FRAME_COLUMN_WIDTH (f)
-                                  : FRAME_LINE_HEIGHT (f));
+      new_size = max (horflag
+                     ? size
+                     : (size
+                        - FRAME_TOP_MARGIN (f)
+                        - ((FRAME_HAS_MINIBUF_P (f)
+                            && !FRAME_MINIBUF_ONLY_P (f))
+                           ? 1 : 0)),
+                     1);
+      new_pixel_size = new_size * unit;
     }
 
   r->top_line = FRAME_TOP_MARGIN (f);
@@ -4124,6 +4127,7 @@
                  window_resize_apply (r, horflag);
                  window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
                }
+#if 0 /* Let's try without killing other windows.  */
              else
                {
                  /* We lost.  Delete all windows but the frame's
@@ -4141,6 +4145,7 @@
                      XWINDOW (root)->pixel_height = new_pixel_size;
                    }
                }
+#endif /* 0 */
            }
        }
     }


reply via email to

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