diff src/frame.c @ 5045:c3cc3fa503a2

more frame-sizing cleanups -------------------- ChangeLog entries follow: -------------------- man/ChangeLog addition: 2010-02-16 Ben Wing <ben@xemacs.org> * internals/internals.texi (Top): * internals/internals.texi (Modules for the Basic Displayable Lisp Objects): * internals/internals.texi (Creating a Window-System Type): * internals/internals.texi (Window and Frame Geometry): * internals/internals.texi (Intro to Window and Frame Geometry): * internals/internals.texi (The Frame): * internals/internals.texi (The Non-Client Area): * internals/internals.texi (The Client Area): * internals/internals.texi (The Paned Area): * internals/internals.texi (Text Areas): * internals/internals.texi (The Displayable Area): * internals/internals.texi (Which Functions Use Which?): * internals/internals.texi (The Redisplay Mechanism): Integrate the long comment in frame.c into the internals manual. src/ChangeLog addition: 2010-02-16 Ben Wing <ben@xemacs.org> * frame-impl.h: * frame-impl.h (FRAME_INTERNAL_BORDER_WIDTH): * frame-impl.h (FRAME_REAL_TOOLBAR_BOUNDS): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BOUNDS): * frame-impl.h (FRAME_BOTTOM_BORDER_START): * frame-impl.h (FRAME_LEFT_BORDER_START): * frame-impl.h (FRAME_RIGHT_BORDER_START): * frame.c (frame_conversion_internal_1): * frame.c (change_frame_size_1): * redisplay-output.c (clear_left_border): * redisplay-output.c (clear_right_border): * redisplay-output.c (redisplay_clear_top_of_window): * redisplay-output.c (redisplay_clear_to_window_end): * redisplay-output.c (redisplay_clear_bottom_of_window): Rename FRAME_BORDER_* to FRAME_INTERNAL_BORDER_*. Add general FRAME_INTERNAL_BORDER_SIZE(). Add FRAME_REAL_TOOLBAR_BOUNDS() to encompass the entire size of the toolbar including its border. Add specific top/left/bottom/right versions of this macro. Rewrite FRAME_*_BORDER_START and FRAME_*_BORDER_END to take into use FRAME_REAL_*_TOOLBAR_BOUNDS(). Add some comments about existing problems in frame sizing and how they might be fixed. Simplify change_frame_size_1() using the macros just created.
author Ben Wing <ben@xemacs.org>
date Tue, 16 Feb 2010 01:21:32 -0600
parents e84a30b0e4a2
children d4f666cda5e6
line wrap: on
line diff
--- a/src/frame.c	Mon Feb 15 22:58:10 2010 -0600
+++ b/src/frame.c	Tue Feb 16 01:21:32 2010 -0600
@@ -3318,6 +3318,14 @@
 
   window = FRAME_SELECTED_WINDOW (f);
 
+  /* #### It really seems like we should also be subtracting out the
+     theoretical gutter width and height, just like we do for toolbars.
+     There is currently a bug where if you call `set-frame-pixel-width'
+     on MS Windows (at least, possibly also X) things get confused and
+     the top of the root window overlaps the top gutter instead of being
+     below it.  This gets fixed next time you resize the frame using the
+     mouse.  Possibly this is caused by not handling the gutter height
+     here? */
   egw = max (glyph_width (Vcontinuation_glyph, window),
 	     glyph_width (Vtruncation_glyph, window));
   egw = max (egw, cpw);
@@ -3554,8 +3562,9 @@
 			     out_width, out_height);
 }
 
-/* Change the frame height and/or width.  Values may be given as zero to
-   indicate no change is to take place. */
+/* Change the frame height and/or width.  Values passed in are in
+   frame units (character cells on X/GTK, displayable-area pixels
+   on MS Windows or generally on pixelated-geometry window systems). */
 static void
 change_frame_size_1 (struct frame *f, int newwidth, int newheight)
 {
@@ -3586,37 +3595,20 @@
   FRAME_NEW_HEIGHT (f) = 0;
   FRAME_NEW_WIDTH (f) = 0;
 
-  /* when frame_conversion_internal() calculated the number of rows/cols
-     in the frame, the theoretical toolbar sizes were subtracted out.
-     The calculations below adjust for real toolbar height/width in
-     frame, which may be different from frame spec, taking the above
-     fact into account */
-  new_pixheight +=
-    - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f)
-    - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
-
-  new_pixheight +=
-    - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f)
-    - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
-
-  new_pixwidth +=
-    - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f)
-    - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
-
-  new_pixwidth +=
-    - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f)
-    - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
-
-  /* Adjust for gutters here so that we always get set
-     properly. */
+  /* We need to remove the boundaries of the paned area (see top of file)
+     from the total-area pixel size, which is what we have now.
+
+     #### We should also be subtracting the internal borders. */
   new_pixheight -=
-    (FRAME_TOP_GUTTER_BOUNDS (f)
+    (FRAME_REAL_TOP_TOOLBAR_BOUNDS (f)
+     + FRAME_REAL_BOTTOM_TOOLBAR_BOUNDS (f)
+     + FRAME_TOP_GUTTER_BOUNDS (f)
      + FRAME_BOTTOM_GUTTER_BOUNDS (f));
 
-  /* Adjust for gutters here so that we always get set
-     properly. */
   new_pixwidth -=
-    (FRAME_LEFT_GUTTER_BOUNDS (f)
+    (FRAME_REAL_LEFT_TOOLBAR_BOUNDS (f)
+     + FRAME_REAL_RIGHT_TOOLBAR_BOUNDS (f)
+     + FRAME_LEFT_GUTTER_BOUNDS (f)
      + FRAME_RIGHT_GUTTER_BOUNDS (f));
 
   XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top
@@ -3676,6 +3668,12 @@
   if (FRAME_TTY_P (f))
     f->pixwidth = newwidth;
 
+  /* #### On MS Windows, this references FRAME_PIXWIDTH() and FRAME_PIXHEIGHT().
+     I'm not sure we can count on those values being set.  Instead we should
+     use the total pixel size we got near the top by calling
+     frame_conversion_internal().  We should inline the logic in
+     get_frame_char_size() here and change that function so it just looks
+     at FRAME_CHARWIDTH() and FRAME_CHARHEIGHT(). */
   get_frame_char_size (f, &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f));
 
   MARK_FRAME_TOOLBARS_CHANGED (f);