# HG changeset patch # User Ben Wing # Date 1267614467 21600 # Node ID 0ca81354c4c7d7718de03ab91ed4f09b1135ecdb # Parent 5502045ec510cb3ba067d448676b321f1b107949 Further frame-geometry cleanups -------------------- ChangeLog entries follow: -------------------- man/ChangeLog addition: 2010-03-03 Ben Wing * internals/internals.texi (Intro to Window and Frame Geometry): * internals/internals.texi (The Paned Area): * internals/internals.texi (The Displayable Area): Update to make note of e.g. the fact that the bottom gutter is actually above the minibuffer. src/ChangeLog addition: 2010-03-03 Ben Wing * emacs.c: * emacs.c (assert_equal_failed): * lisp.h: * lisp.h (assert_equal): New fun assert_equal, asserting that two values == each other, and printing out both values upon failure. * frame-gtk.c (gtk_initialize_frame_size): * frame-impl.h: * frame-impl.h (FRAME_TOP_INTERNAL_BORDER_START): * frame-impl.h (FRAME_BOTTOM_INTERNAL_BORDER_START): * frame-impl.h (FRAME_LEFT_INTERNAL_BORDER_START): * frame-impl.h (FRAME_PANED_TOP_EDGE): * frame-impl.h (FRAME_NONPANED_SIZE): * frame-x.c (x_initialize_frame_size): * frame.c: * gutter.c (get_gutter_coords): * gutter.c (calculate_gutter_size): * gutter.h: * gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS): * gutter.h (FRAME_TOP_GUTTER_BOUNDS): * input-method-xlib.c: * input-method-xlib.c (XIM_SetGeometry): * redisplay-output.c (clear_left_border): * redisplay-output.c (clear_right_border): * redisplay-output.c (redisplay_output_pixmap): * redisplay-output.c (redisplay_clear_region): * redisplay-output.c (redisplay_clear_top_of_window): * redisplay-output.c (redisplay_clear_to_window_end): * redisplay-xlike-inc.c (XLIKE_clear_frame): * redisplay.c: * redisplay.c (UPDATE_CACHE_RETURN): * redisplay.c (pixel_to_glyph_translation): * toolbar.c (update_frame_toolbars_geometry): * window.c (Fwindow_pixel_edges): Get rid of some redundant macros. Consistently use the FRAME_TOP_*_START, FRAME_RIGHT_*_END, etc. format. Rename FRAME_*_BORDER_* to FRAME_*_INTERNAL_BORDER_*. Comment out FRAME_BOTTOM_* for gutters and the paned area due to the uncertainty over where the paned area actually begins. (Eventually we should probably move the gutters outside the minibuffer so that the paned area is contiguous.) Use FRAME_PANED_* more often in the code to make things clearer. Update the diagram to show that the bottom gutter is inside the minibuffer (!) and that there are "junk boxes" when you have left and/or right gutters (dead boxes that are mistakenly left uncleared, unlike the corresponding scrollbar dead boxes). Update the text appropriately to cover the bottom gutter position, etc. Rewrite gutter-geometry code to use the FRAME_*_GUTTER_* in place of equivalent expressions referencing other frame elements, to make the code more portable in case we move around the gutter location. Cleanup FRAME_*_GUTTER_BOUNDS() in gutter.h. Add some #### GEOM! comments where I think code is incorrect -- typically, it wasn't fixed up properly when the gutter was added. Some cosmetic changes. diff -r 5502045ec510 -r 0ca81354c4c7 man/ChangeLog --- a/man/ChangeLog Thu Feb 25 16:19:01 2010 +0100 +++ b/man/ChangeLog Wed Mar 03 05:07:47 2010 -0600 @@ -1,3 +1,11 @@ +2010-03-03 Ben Wing + + * internals/internals.texi (Intro to Window and Frame Geometry): + * internals/internals.texi (The Paned Area): + * internals/internals.texi (The Displayable Area): + Update to make note of e.g. the fact that the bottom gutter is + actually above the minibuffer. + 2010-02-25 Didier Verna The background-placement face property. diff -r 5502045ec510 -r 0ca81354c4c7 man/internals/internals.texi --- a/man/internals/internals.texi Thu Feb 25 16:19:01 2010 +0100 +++ b/man/internals/internals.texi Wed Mar 03 05:07:47 2010 -0600 @@ -17890,59 +17890,62 @@ | ###################################################################### | | # toolbar # | | #--------------------------------------------------------------------# | -| # | gutter | # | -| # |--------------------------------------------------------------| # | -| # | | internal border width | | # | -| # | | ******************************************************** | | # | -|w# | | * |s|v* |s* | | #w| -|i# | | * |c|e* |c* | | #i| -|n# | | * |r|r* |r* | | #n| -|d# | | * |o|t* |o* | | #d| -|o# | | * text area |l|.* text area |l* | | #o| -|w# | |i* |l| * |l*i| | #w| -|-# | |n* |b|d* |b*n| | #-| -|m# | |t* |a|i* |a*t| | #m| -|a# | |.* |r|v* |r*.| | #a| -|n# t| | *-------------------------+-|i*----------------------+-* | |t #n| -|a# o|g|b* scrollbar | |d* scrollbar | *b|g|o #a| -|g# o|u|o*-------------------------+-|e*----------------------+-*o|u|o #g| -|e# l|t|r* modeline |r* modeline *r|t|l #e| -|r# b|t|d********************************************************d|t|b #r| -| # a|e|e* =..texttexttex....= |s|v* |s*e|e|a # | -|d# r|r|r*o m=..texttexttextt..=o m|c|e* |c*r|r|r #d| -|e# | | *u a=.exttexttextte...=u a|r|r* |r* | | #e| -|c# | |w*t r=....texttexttex..=t r|o|t* |o*w| | #c| -|o# | |i*s g= etc. =s g|l|.* text area |l*i| | #o| -|r# | |d*i i= =i i|l| * |l*d| | #r| -|a# | |t*d n= =d n|b|d* |b*t| | #a| -|t# | |h*e = inner text area =e |a|i* |a*h| | #t| +| # | internal border | # | +| # | +----------------------------------------------------------+ | # | +| # | | gutter | | # | +| # | |-********************************************************-| | # | +|w# | | *@| scrollbar |v* |s* | | #w| +|i# | | *-+-------------------------|e* |c* | | #i| +|n# | | *s| |r* |r* | | #n| +|d# | | *c| |t* |o* | | #d| +|o# | | *r| |.* text area |l* | | #o| +|w# |i| *o| | * |l* |i| #w| +|-# |n| *l| text area |d* |b* |n| #-| +|m# |t| *l| |i* |a* |t| #m| +|a# |e| *b| |v* |r* |e| #a| +|n# t|r| *a| |i*----------------------+-* |r|t #n| +|a# o|n|g*r| |d* scrollbar |@*g|n|o #a| +|g# o|a|u*-+-------------------------|e*----------------------+-*u|a|o #g| +|e# l|l|t* modeline |r* modeline *t|l|l #e| +|r# b| |t********************************************************t| |b #r| +| # a|b|e* =..texttexttex....= |s|v* |s*e|b|a # | +|d# r|o|r*o m=..texttexttextt..=o m|c|e* |c*r|o|r #d| +|e# |r| *u a=.exttexttextte...=u a|r|r* |r* |r| #e| +|c# |d| *t r=....texttexttex..=t r|o|t* |o* |d| #c| +|o# |e| *s g= etc. =s g|l|.* text area |l* |e| #o| +|r# |r| *i i= =i i|l| * |l* |r| #r| +|a# | | *d n= =d n|b|d* |b* | | #a| +|t# | | *e = inner text area =e |a|i* |a* | | #t| |i# | | * = = |r|v* |r* | | #i| |o# | | *---===================---+-|i*----------------------+-* | | #o| -|n# | | * scrollbar | |d* scrollbar | * | | #n| +|n# | | * scrollbar |@|d* scrollbar |@* | | #n| | # | | *-------------------------+-|e*----------------------+-* | | # | | # | | * modeline |r* modeline * | | # | -| # | | ******************************************************** | | # | -| # | | * minibuffer * | | # | -| # | | ******************************************************** | | # | -| # | | internal border width | | # | -| # |--------------------------------------------------------------| # | -| # | gutter | # | +| # | |-********************************************************-| | # | +| # | | gutter | | # | +| # | |-********************************************************-| | # | +| # | |@* minibuffer *@| | # | +| # | +-********************************************************-+ | # | +| # | internal border | # | | #--------------------------------------------------------------------# | | # toolbar # | | ###################################################################### | | window manager decoration | +------------------------------------------------------------------------+ - # = boundary of client area; * = window boundaries, boundary of paned area - = = boundary of inner text area; . = inside margin area -@end example - -Note in particular what happens at the corners, where a "corner box" +# = boundary of client area; * = window boundaries, boundary of paned area += = boundary of inner text area; . = inside margin area; @ = dead boxes +@end example + +Note in particular what happens at the corners, where a ``corner box'' occurs. Top and bottom toolbars take precedence over left and right toolbars, extending out horizontally into the corner boxes. Gutters work the same way. The corner box where the scrollbars meet, however, -is assigned to neither scrollbar, and is known as the "dead box"; it is -an area that must be cleared specially. +is assigned to neither scrollbar, and is known as the ``dead box''; it is +an area that must be cleared specially. There are similar dead boxes at +the bottom-right and bottom-left corners where the minibuffer and +left/right gutters meet, but there is currently a bug in that these dead +boxes are not explicitly cleared and may contain junk. @node The Frame, The Non-Client Area, Intro to Window and Frame Geometry, Window and Frame Geometry @section The Frame @@ -18044,13 +18047,19 @@ @node The Paned Area, Text Areas, The Client Area, Window and Frame Geometry @section The Paned Area -The area occupied by the "windows" is called the paned area. Note that -this includes the minibuffer, which is just another window but is -special-cased in XEmacs. Each window can include a horizontal and/or -vertical scrollbar, a modeline and a vertical divider to its right, as -well as the text area. Only non-rightmost windows can include a -vertical divider. (The minibuffer normally does not include either -modeline or scrollbars.) +The area occupied by the "windows" is called the paned area. +Unfortunately, because of the presence of the gutter @strong{between} the +minibuffer and other windows, the bottom of the paned area is not +well-defined -- does it include the minibuffer (in which case it also +includes the bottom gutter, but none others) or does it not include +the minibuffer? (In which case not all windows are included.) It would +be cleaner to put the bottom gutter @strong{below} the minibuffer instead of +above it. + +Each window can include a horizontal and/or vertical scrollbar, a +modeline and a vertical divider to its right, as well as the text area. +Only non-rightmost windows can include a vertical divider. (The +minibuffer normally does not include either modeline or scrollbars.) Note that, because the toolbars and gutters are controlled by specifiers, and specifiers can have window-specific and buffer-specific @@ -18112,18 +18121,23 @@ specified default character because many X fonts have a default character with a zero or otherwise non-representative width.]) -The displayable area is essentially the "theoretical" paned area of the -frame excluding the rightmost and bottom-most scrollbars. In this -context, "theoretical" means that all calculations on based on -frame-level values for toolbar, gutter and scrollbar thicknesses. -Because these thicknesses are controlled by specifiers, and specifiers -can have window-specific and buffer-specific values, these calculations -may or may not reflect the actual size of the paned area or of the -scrollbars when any particular window is selected. Note also that the -"displayable area" may not even be contiguous! In particular, if the -frame-level value of the horizontal scrollbar height is non-zero, then -the displayable area includes the paned area above and below the bottom -horizontal scrollbar but not the scrollbar itself. +The displayable area is essentially the "theoretical" gutter area of the +frame, excluding the rightmost and bottom-most scrollbars. That is, it +starts from the client (or "total") area and then excludes the +"theoretical" toolbars and bottom-most/rightmost scrollbars, and the +internal border width. In this context, "theoretical" means that all +calculations on based on frame-level values for toolbar and scrollbar +thicknesses. Because these thicknesses are controlled by specifiers, +and specifiers can have window-specific and buffer-specific values, +these calculations may or may not reflect the actual size of the paned +area or of the scrollbars when any particular window is selected. Note +also that the "displayable area" may not even be contiguous! In +particular, the gutters are included, but the bottom-most and rightmost +scrollbars are excluded even though they are inside of the gutters. +Furthermore, if the frame-level value of the horizontal scrollbar height +is non-zero, then the displayable area includes the paned area above and +below the bottom horizontal scrollbar (i.e. the modeline and minibuffer) +but not the scrollbar itself. As a further twist, the character-dimension calculations are adjusted so that the truncation and continuation glyphs (see @code{truncation-glyph} and diff -r 5502045ec510 -r 0ca81354c4c7 src/ChangeLog --- a/src/ChangeLog Thu Feb 25 16:19:01 2010 +0100 +++ b/src/ChangeLog Wed Mar 03 05:07:47 2010 -0600 @@ -1,3 +1,66 @@ +2010-03-03 Ben Wing + + * emacs.c: + * emacs.c (assert_equal_failed): + * lisp.h: + * lisp.h (assert_equal): + New fun assert_equal, asserting that two values == each other, and + printing out both values upon failure. + + * frame-gtk.c (gtk_initialize_frame_size): + * frame-impl.h: + * frame-impl.h (FRAME_TOP_INTERNAL_BORDER_START): + * frame-impl.h (FRAME_BOTTOM_INTERNAL_BORDER_START): + * frame-impl.h (FRAME_LEFT_INTERNAL_BORDER_START): + * frame-impl.h (FRAME_PANED_TOP_EDGE): + * frame-impl.h (FRAME_NONPANED_SIZE): + * frame-x.c (x_initialize_frame_size): + * frame.c: + * gutter.c (get_gutter_coords): + * gutter.c (calculate_gutter_size): + * gutter.h: + * gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS): + * gutter.h (FRAME_TOP_GUTTER_BOUNDS): + * input-method-xlib.c: + * input-method-xlib.c (XIM_SetGeometry): + * redisplay-output.c (clear_left_border): + * redisplay-output.c (clear_right_border): + * redisplay-output.c (redisplay_output_pixmap): + * redisplay-output.c (redisplay_clear_region): + * redisplay-output.c (redisplay_clear_top_of_window): + * redisplay-output.c (redisplay_clear_to_window_end): + * redisplay-xlike-inc.c (XLIKE_clear_frame): + * redisplay.c: + * redisplay.c (UPDATE_CACHE_RETURN): + * redisplay.c (pixel_to_glyph_translation): + * toolbar.c (update_frame_toolbars_geometry): + * window.c (Fwindow_pixel_edges): + Get rid of some redundant macros. Consistently use the + FRAME_TOP_*_START, FRAME_RIGHT_*_END, etc. format. Rename + FRAME_*_BORDER_* to FRAME_*_INTERNAL_BORDER_*. Comment out + FRAME_BOTTOM_* for gutters and the paned area due to the + uncertainty over where the paned area actually begins. (Eventually + we should probably move the gutters outside the minibuffer so that + the paned area is contiguous.) Use FRAME_PANED_* more often in the + code to make things clearer. + + Update the diagram to show that the bottom gutter is inside the + minibuffer (!) and that there are "junk boxes" when you have left + and/or right gutters (dead boxes that are mistakenly left uncleared, + unlike the corresponding scrollbar dead boxes). Update the text + appropriately to cover the bottom gutter position, etc. + + Rewrite gutter-geometry code to use the FRAME_*_GUTTER_* in place of + equivalent expressions referencing other frame elements, to make the + code more portable in case we move around the gutter location. + + Cleanup FRAME_*_GUTTER_BOUNDS() in gutter.h. + + Add some #### GEOM! comments where I think code is incorrect -- + typically, it wasn't fixed up properly when the gutter was added. + + Some cosmetic changes. + 2010-02-25 Didier Verna The background-placement face property. diff -r 5502045ec510 -r 0ca81354c4c7 src/emacs.c --- a/src/emacs.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/emacs.c Wed Mar 03 05:07:47 2010 -0600 @@ -4056,6 +4056,20 @@ in_assert_failed--; } +/* This is called when an assert() fails or when ABORT() is called -- both + of those are defined in the preprocessor to an expansion involving + assert_failed(). */ +void +assert_equal_failed (const Ascbyte *file, int line, EMACS_INT x, EMACS_INT y, + const Ascbyte *exprx, const Ascbyte *expry) +{ + Ascbyte bigstr[1000]; /* #### Could overflow, but avoids any need to do any + allocation, even alloca(), hence safer */ + sprintf (bigstr, "%s (%ld) should == %s (%ld) but doesn't", + exprx, x, expry, y); + assert_failed (file, line, bigstr); +} + /* -------------------------------------- */ /* low-memory notification */ /* -------------------------------------- */ diff -r 5502045ec510 -r 0ca81354c4c7 src/frame-gtk.c --- a/src/frame-gtk.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/frame-gtk.c Wed Mar 03 05:07:47 2010 -0600 @@ -635,13 +635,13 @@ { struct window *win = XWINDOW (f->root_window); - WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f); - WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f); + WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); + WINDOW_TOP (win) = FRAME_PANED_TOP_EDGE (f); if (!NILP (f->minibuffer_window)) { win = XWINDOW (f->minibuffer_window); - WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f); + WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); } } diff -r 5502045ec510 -r 0ca81354c4c7 src/frame-impl.h --- a/src/frame-impl.h Thu Feb 25 16:19:01 2010 +0100 +++ b/src/frame-impl.h Wed Mar 03 05:07:47 2010 -0600 @@ -705,73 +705,68 @@ /* frame dimensions defined using toolbars and gutters */ /************************************************************************/ -/* #### These should be using the gutter sizes, but aren't yet */ - -#define FRAME_TOP_BORDER_START(f) \ - FRAME_REAL_TOP_TOOLBAR_BOUNDS (f) -#define FRAME_TOP_BORDER_END(f) \ - (FRAME_TOP_BORDER_START (f) + FRAME_INTERNAL_BORDER_HEIGHT (f)) - -#define FRAME_BOTTOM_BORDER_START(f) \ - (FRAME_BOTTOM_BORDER_END (f) - FRAME_INTERNAL_BORDER_HEIGHT (f)) -#define FRAME_BOTTOM_BORDER_END(f) \ - (FRAME_PIXHEIGHT (f) - FRAME_REAL_BOTTOM_TOOLBAR_BOUNDS (f)) - -#define FRAME_LEFT_BORDER_START(f) \ - FRAME_REAL_LEFT_TOOLBAR_BOUNDS (f) -#define FRAME_LEFT_BORDER_END(f) \ - (FRAME_LEFT_BORDER_START (f) + FRAME_INTERNAL_BORDER_WIDTH (f)) - -#define FRAME_RIGHT_BORDER_START(f) \ - (FRAME_RIGHT_BORDER_END (f) - FRAME_INTERNAL_BORDER_WIDTH (f)) -#define FRAME_RIGHT_BORDER_END(f) \ - (FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_BOUNDS (f)) - - -/************************************************************************/ -/* frame dimensions defined using toolbars and gutters */ -/************************************************************************/ - /* Bounds of the area framed by the toolbars is the client area -- (0, 0) - (FRAME_PIXWIDTH, FRAME_PIXHEIGHT). */ -/* Bounds of the area framed by the gutters -- inside of the toolbars, - outside of everything else. */ +/* Bounds of the area framed by the internal border width -- inside of the + toolbars, outside of everything else. */ + +#define FRAME_TOP_INTERNAL_BORDER_START(f) \ + FRAME_REAL_TOP_TOOLBAR_BOUNDS (f) +#define FRAME_TOP_INTERNAL_BORDER_END(f) \ + (FRAME_TOP_INTERNAL_BORDER_START (f) + FRAME_INTERNAL_BORDER_HEIGHT (f)) -#define FRAME_GUTTER_TOP_EDGE(f) \ - FRAME_REAL_TOOLBAR_BOUNDS (f, TOP_EDGE) -#define FRAME_GUTTER_BOTTOM_EDGE(f) \ - (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOOLBAR_BOUNDS (f, BOTTOM_EDGE)) -#define FRAME_GUTTER_LEFT_EDGE(f) \ - FRAME_REAL_TOOLBAR_BOUNDS (f, LEFT_EDGE) -#define FRAME_GUTTER_RIGHT_EDGE(f) \ - (FRAME_PIXWIDTH (f) - FRAME_REAL_TOOLBAR_BOUNDS (f, RIGHT_EDGE)) +#define FRAME_BOTTOM_INTERNAL_BORDER_START(f) \ + (FRAME_BOTTOM_INTERNAL_BORDER_END (f) - FRAME_INTERNAL_BORDER_HEIGHT (f)) +#define FRAME_BOTTOM_INTERNAL_BORDER_END(f) \ + (FRAME_PIXHEIGHT (f) - FRAME_REAL_BOTTOM_TOOLBAR_BOUNDS (f)) + +#define FRAME_LEFT_INTERNAL_BORDER_START(f) \ + FRAME_REAL_LEFT_TOOLBAR_BOUNDS (f) +#define FRAME_LEFT_INTERNAL_BORDER_END(f) \ + (FRAME_LEFT_INTERNAL_BORDER_START (f) + FRAME_INTERNAL_BORDER_WIDTH (f)) + +#define FRAME_RIGHT_INTERNAL_BORDER_START(f) \ + (FRAME_RIGHT_INTERNAL_BORDER_END (f) - FRAME_INTERNAL_BORDER_WIDTH (f)) +#define FRAME_RIGHT_INTERNAL_BORDER_END(f) \ + (FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_BOUNDS (f)) -/* Bounds of the area framed by the internal border width -- inside of the - toolbars and gutters. */ +/* Bounds of the area framed by the gutter -- inside of the + toolbars and internal border width. */ + +#define FRAME_TOP_GUTTER_START(f) \ + FRAME_TOP_INTERNAL_BORDER_END (f) +#define FRAME_TOP_GUTTER_END(f) \ + (FRAME_TOP_GUTTER_START (f) + FRAME_TOP_GUTTER_BOUNDS (f)) -#define FRAME_INTERNAL_BORDER_TOP_EDGE(f) \ - (FRAME_GUTTER_TOP_EDGE (f) + FRAME_GUTTER_BOUNDS (f, TOP_EDGE)) -#define FRAME_INTERNAL_BORDER_BOTTOM_EDGE(f) \ - (FRAME_GUTTER_BOTTOM_EDGE (f) - FRAME_GUTTER_BOUNDS (f, BOTTOM_EDGE)) -#define FRAME_INTERNAL_BORDER_LEFT_EDGE(f) \ - (FRAME_GUTTER_LEFT_EDGE (f) + FRAME_GUTTER_BOUNDS (f, LEFT_EDGE)) -#define FRAME_INTERNAL_BORDER_RIGHT_EDGE(f) \ - (FRAME_GUTTER_RIGHT_EDGE (f) - FRAME_GUTTER_BOUNDS (f, RIGHT_EDGE)) +#ifdef BOTTOM_GUTTER_IS_OUTSIDE_MINIBUFFER +#define FRAME_BOTTOM_GUTTER_START(f) \ + (FRAME_BOTTOM_GUTTER_END (f) - FRAME_BOTTOM_GUTTER_BOUNDS (f)) +#define FRAME_BOTTOM_GUTTER_END(f) \ + FRAME_BOTTOM_INTERNAL_BORDER_START (f) +#endif /* BOTTOM_GUTTER_IS_OUTSIDE_MINIBUFFER */ + +#define FRAME_LEFT_GUTTER_START(f) \ + FRAME_LEFT_INTERNAL_BORDER_END (f) +#define FRAME_LEFT_GUTTER_END(f) \ + (FRAME_LEFT_GUTTER_START (f) + FRAME_LEFT_GUTTER_BOUNDS (f)) + +#define FRAME_RIGHT_GUTTER_START(f) \ + (FRAME_RIGHT_GUTTER_END (f) - FRAME_RIGHT_GUTTER_BOUNDS (f)) +#define FRAME_RIGHT_GUTTER_END(f) \ + FRAME_RIGHT_INTERNAL_BORDER_START (f) /* These are the bounds of the paned area -- inside of the toolbars, gutters, and internal border width. The paned area is the same as the area occupied by windows, including the minibuffer. See long comment in frame.c. */ -#define FRAME_PANED_TOP_EDGE(f) \ - (FRAME_INTERNAL_BORDER_TOP_EDGE (f) + FRAME_INTERNAL_BORDER_HEIGHT (f)) -#define FRAME_PANED_BOTTOM_EDGE(f) \ - (FRAME_INTERNAL_BORDER_BOTTOM_EDGE (f) - FRAME_INTERNAL_BORDER_HEIGHT (f)) -#define FRAME_PANED_LEFT_EDGE(f) \ - (FRAME_INTERNAL_BORDER_LEFT_EDGE (f) + FRAME_INTERNAL_BORDER_WIDTH (f)) -#define FRAME_PANED_RIGHT_EDGE(f) \ - (FRAME_INTERNAL_BORDER_RIGHT_EDGE (f) - FRAME_INTERNAL_BORDER_WIDTH (f)) +#define FRAME_PANED_TOP_EDGE(f) FRAME_TOP_GUTTER_END (f) +#ifdef BOTTOM_GUTTER_IS_OUTSIDE_MINIBUFFER +#define FRAME_PANED_BOTTOM_EDGE(f) FRAME_BOTTOM_GUTTER_START (f) +#endif /* BOTTOM_GUTTER_IS_OUTSIDE_MINIBUFFER */ +#define FRAME_PANED_LEFT_EDGE(f) FRAME_LEFT_GUTTER_END (f) +#define FRAME_PANED_RIGHT_EDGE(f) FRAME_RIGHT_GUTTER_START (f) /* Thickness of non-paned area at edge of frame; @@ -784,8 +779,8 @@ */ #define FRAME_NONPANED_SIZE(f, pos) \ - (FRAME_REAL_TOOLBAR_BOUNDS (f, pos) + FRAME_GUTTER_BOUNDS (f, pos) + \ - FRAME_INTERNAL_BORDER_SIZE (f, pos)) + (FRAME_REAL_TOOLBAR_BOUNDS (f, pos) + FRAME_INTERNAL_BORDER_SIZE (f, pos) + \ + FRAME_GUTTER_BOUNDS (f, pos)) diff -r 5502045ec510 -r 0ca81354c4c7 src/frame-x.c --- a/src/frame-x.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/frame-x.c Wed Mar 03 05:07:47 2010 -0600 @@ -1452,16 +1452,13 @@ { struct window *win = XWINDOW (f->root_window); - WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) - + FRAME_LEFT_GUTTER_BOUNDS (f); - WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f) - + FRAME_TOP_GUTTER_BOUNDS (f); + WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); + WINDOW_TOP (win) = FRAME_PANED_TOP_EDGE (f); if (!NILP (f->minibuffer_window)) { win = XWINDOW (f->minibuffer_window); - WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) - + FRAME_LEFT_GUTTER_BOUNDS (f); + WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); } } diff -r 5502045ec510 -r 0ca81354c4c7 src/frame.c --- a/src/frame.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/frame.c Wed Mar 03 05:07:47 2010 -0600 @@ -35,43 +35,43 @@ | ###################################################################### | | # toolbar # | | #--------------------------------------------------------------------# | -| # | gutter | # | -| # |--------------------------------------------------------------| # | -| # | | internal border width | | # | -| # | | ******************************************************** | | # | -|w# | | * |s|v* |s* | | #w| -|i# | | * |c|e* |c* | | #i| -|n# | | * |r|r* |r* | | #n| -|d# | | * |o|t* |o* | | #d| -|o# | | * text area |l|.* text area |l* | | #o| -|w# | |i* |l| * |l*i| | #w| -|-# | |n* |b|d* |b*n| | #-| -|m# | |t* |a|i* |a*t| | #m| -|a# | |.* |r|v* |r*.| | #a| -|n# t| | *-------------------------+-|i*----------------------+-* | |t #n| -|a# o|g|b* scrollbar | |d* scrollbar | *b|g|o #a| -|g# o|u|o*-------------------------+-|e*----------------------+-*o|u|o #g| -|e# l|t|r* modeline |r* modeline *r|t|l #e| -|r# b|t|d********************************************************d|t|b #r| -| # a|e|e* =..texttexttex....= |s|v* |s*e|e|a # | -|d# r|r|r*o m=..texttexttextt..=o m|c|e* |c*r|r|r #d| -|e# | | *u a=.exttexttextte...=u a|r|r* |r* | | #e| -|c# | |w*t r=....texttexttex..=t r|o|t* |o*w| | #c| -|o# | |i*s g= etc. =s g|l|.* text area |l*i| | #o| -|r# | |d*i i= =i i|l| * |l*d| | #r| -|a# | |t*d n= =d n|b|d* |b*t| | #a| -|t# | |h*e = inner text area =e |a|i* |a*h| | #t| +| # | internal border | # | +| # | +----------------------------------------------------------+ | # | +| # | | gutter | | # | +| # | |-********************************************************-| | # | +|w# | | *@| scrollbar |v* |s* | | #w| +|i# | | *-+-------------------------|e* |c* | | #i| +|n# | | *s| |r* |r* | | #n| +|d# | | *c| |t* |o* | | #d| +|o# | | *r| |.* text area |l* | | #o| +|w# |i| *o| | * |l* |i| #w| +|-# |n| *l| text area |d* |b* |n| #-| +|m# |t| *l| |i* |a* |t| #m| +|a# |e| *b| |v* |r* |e| #a| +|n# t|r| *a| |i*----------------------+-* |r|t #n| +|a# o|n|g*r| |d* scrollbar |@*g|n|o #a| +|g# o|a|u*-+-------------------------|e*----------------------+-*u|a|o #g| +|e# l|l|t* modeline |r* modeline *t|l|l #e| +|r# b| |t********************************************************t| |b #r| +| # a|b|e* =..texttexttex....= |s|v* |s*e|b|a # | +|d# r|o|r*o m=..texttexttextt..=o m|c|e* |c*r|o|r #d| +|e# |r| *u a=.exttexttextte...=u a|r|r* |r* |r| #e| +|c# |d| *t r=....texttexttex..=t r|o|t* |o* |d| #c| +|o# |e| *s g= etc. =s g|l|.* text area |l* |e| #o| +|r# |r| *i i= =i i|l| * |l* |r| #r| +|a# | | *d n= =d n|b|d* |b* | | #a| +|t# | | *e = inner text area =e |a|i* |a* | | #t| |i# | | * = = |r|v* |r* | | #i| |o# | | *---===================---+-|i*----------------------+-* | | #o| -|n# | | * scrollbar | |d* scrollbar | * | | #n| +|n# | | * scrollbar |@|d* scrollbar |@* | | #n| | # | | *-------------------------+-|e*----------------------+-* | | # | | # | | * modeline |r* modeline * | | # | -| # | | ******************************************************** | | # | -| # | | * minibuffer * | | # | -| # | | ******************************************************** | | # | -| # | | internal border width | | # | -| # |--------------------------------------------------------------| # | -| # | gutter | # | +| # | |-********************************************************-| | # | +| # | | gutter | | # | +| # | |-********************************************************-| | # | +| # | |@* minibuffer *@| | # | +| # | +-********************************************************-+ | # | +| # | internal border | # | | #--------------------------------------------------------------------# | | # toolbar # | | ###################################################################### | @@ -79,14 +79,17 @@ +------------------------------------------------------------------------+ # = boundary of client area; * = window boundaries, boundary of paned area - = = boundary of inner text area; . = inside margin area + = = boundary of inner text area; . = inside margin area; @ = dead boxes Note in particular what happens at the corners, where a "corner box" occurs. Top and bottom toolbars take precedence over left and right toolbars, extending out horizontally into the corner boxes. Gutters work the same way. The corner box where the scrollbars meet, however, is assigned to neither scrollbar, and is known as the "dead box"; it is - an area that must be cleared specially. + an area that must be cleared specially. There are similar dead boxes at + the bottom-right and bottom-left corners where the minibuffer and + left/right gutters meet, but there is currently a bug in that these dead + boxes are not explicitly cleared and may contain junk. THE FRAME --------- @@ -184,13 +187,18 @@ THE PANED AREA -------------- - The area occupied by the "windows" is called the paned area. Note that - this includes the minibuffer, which is just another window but is - special-cased in XEmacs. Each window can include a horizontal and/or - vertical scrollbar, a modeline and a vertical divider to its right, as - well as the text area. Only non-rightmost windows can include a - vertical divider. (The minibuffer normally does not include either - modeline or scrollbars.) + The area occupied by the "windows" is called the paned area. Unfortunately, + because of the presence of the gutter *between* the minibuffer and other + windows, the bottom of the paned area is not well-defined -- does it + include the minibuffer (in which case it also includes the bottom gutter, + but none others) or does it not include the minibuffer? (In which case + not all windows are included.) #### GEOM! It would be cleaner to put the + bottom gutter *below* the minibuffer instead of above it. + + Each window can include a horizontal and/or vertical scrollbar, a + modeline and a vertical divider to its right, as well as the text area. + Only non-rightmost windows can include a vertical divider. (The + minibuffer normally does not include either modeline or scrollbars.) Note that, because the toolbars and gutters are controlled by specifiers, and specifiers can have window-specific and buffer-specific @@ -252,18 +260,23 @@ specified default character because many X fonts have a default character with a zero or otherwise non-representative width.]) - The displayable area is essentially the "theoretical" paned area of the - frame excluding the rightmost and bottom-most scrollbars. In this - context, "theoretical" means that all calculations on based on - frame-level values for toolbar, gutter and scrollbar thicknesses. - Because these thicknesses are controlled by specifiers, and specifiers - can have window-specific and buffer-specific values, these calculations - may or may not reflect the actual size of the paned area or of the - scrollbars when any particular window is selected. Note also that the - "displayable area" may not even be contiguous! In particular, if the - frame-level value of the horizontal scrollbar height is non-zero, then - the displayable area includes the paned area above and below the bottom - horizontal scrollbar but not the scrollbar itself. + The displayable area is essentially the "theoretical" gutter area of the + frame, excluding the rightmost and bottom-most scrollbars. That is, it + starts from the client (or "total") area and then excludes the + "theoretical" toolbars and bottom-most/rightmost scrollbars, and the + internal border width. In this context, "theoretical" means that all + calculations on based on frame-level values for toolbar and scrollbar + thicknesses. Because these thicknesses are controlled by specifiers, + and specifiers can have window-specific and buffer-specific values, + these calculations may or may not reflect the actual size of the paned + area or of the scrollbars when any particular window is selected. Note + also that the "displayable area" may not even be contiguous! In + particular, the gutters are included, but the bottom-most and rightmost + scrollbars are excluded even though they are inside of the gutters. + Furthermore, if the frame-level value of the horizontal scrollbar height + is non-zero, then the displayable area includes the paned area above and + below the bottom horizontal scrollbar (i.e. the modeline and minibuffer) + but not the scrollbar itself. As a further twist, the character-dimension calculations are adjusted so that the truncation and continuation glyphs (see `truncation-glyph' and diff -r 5502045ec510 -r 0ca81354c4c7 src/gutter.c --- a/src/gutter.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/gutter.c Wed Mar 03 05:07:47 2010 -0600 @@ -136,43 +136,45 @@ get_gutter_coords (struct frame *f, enum edge_pos pos, int *x, int *y, int *width, int *height) { - struct window - * bot = XWINDOW (frame_bottommost_window (f)); + /* We use the bottommost window (not the minibuffer, but the bottommost + non-minibuffer window) rather than any FRAME_BOTTOM_GUTTER_START + because the gutter goes *above* the minibuffer -- for this same reason, + FRAME_BOTTOM_GUTTER_START isn't currently defined. */ + struct window *bot = XWINDOW (frame_bottommost_window (f)); /* The top and bottom gutters take precedence over the left and right. */ switch (pos) { case TOP_EDGE: - *x = FRAME_LEFT_BORDER_END (f); - *y = FRAME_TOP_BORDER_END (f); - *width = FRAME_RIGHT_BORDER_START (f) - - FRAME_LEFT_BORDER_END (f); + *x = FRAME_LEFT_GUTTER_START (f); + *y = FRAME_TOP_GUTTER_START (f); + *width = FRAME_RIGHT_GUTTER_END (f) - *x; *height = FRAME_TOP_GUTTER_BOUNDS (f); break; case BOTTOM_EDGE: - *x = FRAME_LEFT_BORDER_END (f); + *x = FRAME_LEFT_GUTTER_START (f); +#ifdef BOTTOM_GUTTER_IS_OUTSIDE_MINIBUFFER + *y = FRAME_BOTTOM_GUTTER_START (f); +#else *y = WINDOW_BOTTOM (bot); - *width = FRAME_RIGHT_BORDER_START (f) - - FRAME_LEFT_BORDER_END (f); +#endif + *width = FRAME_RIGHT_GUTTER_END (f) - *x; *height = FRAME_BOTTOM_GUTTER_BOUNDS (f); break; case LEFT_EDGE: - *x = FRAME_LEFT_BORDER_END (f); - *y = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f); + *x = FRAME_LEFT_GUTTER_START (f); + *y = FRAME_TOP_GUTTER_END (f); *width = FRAME_LEFT_GUTTER_BOUNDS (f); - *height = WINDOW_BOTTOM (bot) - - (FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f)); + *height = WINDOW_BOTTOM (bot) - *y; break; case RIGHT_EDGE: - *x = FRAME_RIGHT_BORDER_START (f) - - FRAME_RIGHT_GUTTER_BOUNDS (f); - *y = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f); + *x = FRAME_RIGHT_GUTTER_START (f); + *y = FRAME_TOP_GUTTER_END (f); *width = FRAME_RIGHT_GUTTER_BOUNDS (f); - *height = WINDOW_BOTTOM (bot) - - (FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f)); + *height = WINDOW_BOTTOM (bot) - *y; break; default: @@ -321,12 +323,20 @@ ddla = Dynarr_new (display_line); /* generate some display lines */ generate_displayable_area (w, WINDOW_GUTTER (w, pos), - FRAME_LEFT_BORDER_END (f), - FRAME_TOP_BORDER_END (f), - FRAME_RIGHT_BORDER_START (f) - - FRAME_LEFT_BORDER_END (f), - FRAME_BOTTOM_BORDER_START (f) - - FRAME_TOP_BORDER_END (f), + FRAME_LEFT_GUTTER_START (f), + FRAME_TOP_GUTTER_START (f), + FRAME_RIGHT_GUTTER_END (f) + - FRAME_LEFT_GUTTER_START (f), +#ifdef BOTTOM_GUTTER_IS_OUTSIDE_MINIBUFFER + FRAME_BOTTOM_GUTTER_END (f) +#else + /* #### GEOM! This is how it used to read, + and this includes both gutter and + minibuffer below it. Not clear whether + it was intended that way. --ben */ + FRAME_BOTTOM_INTERNAL_BORDER_START (f) +#endif + - FRAME_TOP_GUTTER_START (f), ddla, 0, DEFAULT_INDEX); /* Let GC happen again. */ diff -r 5502045ec510 -r 0ca81354c4c7 src/gutter.h --- a/src/gutter.h Thu Feb 25 16:19:01 2010 +0100 +++ b/src/gutter.h Wed Mar 03 05:07:47 2010 -0600 @@ -86,13 +86,13 @@ /* these macros predicate size on position and type of window */ #define WINDOW_REAL_TOP_GUTTER_BOUNDS(w) \ - WINDOW_REAL_GUTTER_BOUNDS (w,TOP_EDGE) + WINDOW_REAL_GUTTER_BOUNDS (w, TOP_EDGE) #define WINDOW_REAL_BOTTOM_GUTTER_BOUNDS(w) \ - WINDOW_REAL_GUTTER_BOUNDS (w,BOTTOM_EDGE) + WINDOW_REAL_GUTTER_BOUNDS (w, BOTTOM_EDGE) #define WINDOW_REAL_LEFT_GUTTER_BOUNDS(w) \ - WINDOW_REAL_GUTTER_BOUNDS (w,LEFT_EDGE) + WINDOW_REAL_GUTTER_BOUNDS (w, LEFT_EDGE) #define WINDOW_REAL_RIGHT_GUTTER_BOUNDS(w) \ - WINDOW_REAL_GUTTER_BOUNDS (w,RIGHT_EDGE) + WINDOW_REAL_GUTTER_BOUNDS (w, RIGHT_EDGE) #define FRAME_GUTTER_VISIBLE(f, pos) \ WINDOW_REAL_GUTTER_VISIBLE (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) @@ -107,13 +107,9 @@ WINDOW_GUTTER (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos) /* these macros predicate size on position and type of window */ -#define FRAME_TOP_GUTTER_BOUNDS(f) \ - WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), TOP_EDGE) -#define FRAME_BOTTOM_GUTTER_BOUNDS(f) \ - WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), BOTTOM_EDGE) -#define FRAME_LEFT_GUTTER_BOUNDS(f) \ - WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), LEFT_EDGE) -#define FRAME_RIGHT_GUTTER_BOUNDS(f) \ - WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), RIGHT_EDGE) +#define FRAME_TOP_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, TOP_EDGE) +#define FRAME_BOTTOM_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, BOTTOM_EDGE) +#define FRAME_LEFT_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, LEFT_EDGE) +#define FRAME_RIGHT_GUTTER_BOUNDS(f) FRAME_GUTTER_BOUNDS (f, RIGHT_EDGE) #endif /* INCLUDED_gutter_h_ */ diff -r 5502045ec510 -r 0ca81354c4c7 src/input-method-xlib.c --- a/src/input-method-xlib.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/input-method-xlib.c Wed Mar 03 05:07:47 2010 -0600 @@ -1,6 +1,6 @@ /* Various functions for X11R5+ input methods, using the Xlib interface. Copyright (C) 1996 Sun Microsystems. - Copyright (C) 2002 Ben Wing. + Copyright (C) 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -411,10 +411,15 @@ if (needed->width == 0) /* Use XNArea instead of XNAreaNeeded */ XIC_Value (Get, xic, XNStatusAttributes, XNArea, &needed); + /* #### This will partially cover the gutter if there is a bottom + gutter. Perhaps what was intended was FRAME_PANED_RIGHT_EDGE() + and FRAME_PANED_BOTTOM_EDGE()? That will actually place itself + in the paned area (covering the right edge of the minibuffer) + in all circumstances. */ area.width = needed->width; area.height = needed->height; - area.x = FRAME_RIGHT_BORDER_START (f) - area.width; - area.y = FRAME_BOTTOM_BORDER_START (f) - area.height; + area.x = FRAME_RIGHT_INTERNAL_BORDER_START (f) - area.width; + area.y = FRAME_BOTTOM_INTERNAL_BORDER_START (f) - area.height; #ifdef DEBUG_XIM stderr_out ("Putting StatusArea in x=%d y=%d w=%d h=%d\n", @@ -430,10 +435,10 @@ /* We include the border because Preedit window might be larger than display line at edge. #### FIX: we should adjust to make sure that there is always room for the spot sub-window */ - area.x = FRAME_LEFT_BORDER_START (f); - area.y = FRAME_TOP_BORDER_START (f); - area.width = FRAME_RIGHT_BORDER_END (f) - area.x; - area.height = FRAME_BOTTOM_BORDER_END (f) - area.y; + area.x = FRAME_LEFT_INTERNAL_BORDER_START (f); + area.y = FRAME_TOP_INTERNAL_BORDER_START (f); + area.width = FRAME_RIGHT_INTERNAL_BORDER_END (f) - area.x; + area.height = FRAME_BOTTOM_INTERNAL_BORDER_END (f) - area.y; XIC_Value(Set, xic, XNPreeditAttributes, XNArea, &area); } diff -r 5502045ec510 -r 0ca81354c4c7 src/lisp.h --- a/src/lisp.h Thu Feb 25 16:19:01 2010 +0100 +++ b/src/lisp.h Wed Mar 03 05:07:47 2010 -0600 @@ -85,6 +85,16 @@ %%#### marks places that need work for KKCC (the new garbage collector). + @@#### marks places that need work to get Unicode-internal working, + i.e. using UTF-8 as the internal text format. + + #### BILL! marks places that need work for GTK. + + #### GEOM! marks places needing work to fix various bugs in the handling + of window and frame sizing and positioning. Often the root of the + problems is that the code was originally written before there was a + gutter and then not completely fixed up to accommodate the gutter. + */ /************************************************************************/ @@ -1229,6 +1239,9 @@ /* Highly dubious kludge */ /* (thanks, Jamie, I feel better now -- ben) */ MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); +void assert_equal_failed (const Ascbyte *file, int line, EMACS_INT x, + EMACS_INT y, const Ascbyte *exprx, + const Ascbyte *expry); #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()") #define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg) @@ -1249,6 +1262,10 @@ ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) # define assert_at_line(x, file, line) \ ((x) ? (void) 0 : assert_failed (file, line, #x)) +# define assert_equal(x, y) \ + ((x) == (y) ? (void) 0 : \ + assert_equal_failed (__FILE__, __LINE__, (EMACS_INT) x, (EMACS_INT) y, \ + #x, #y)) #else /* This used to be ((void) (0)) but that triggers lots of unused variable warnings. It's pointless to force all that code to be rewritten, with @@ -1257,6 +1274,7 @@ # define assert(x) disabled_assert (x) # define assert_with_message(x, msg) disabled_assert_with_message (x, msg) # define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line) +# define assert_equal(x, y) disabled_assert ((x) == (y)) #endif /************************************************************************/ diff -r 5502045ec510 -r 0ca81354c4c7 src/redisplay-output.c --- a/src/redisplay-output.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/redisplay-output.c Wed Mar 03 05:07:47 2010 -0600 @@ -638,8 +638,8 @@ Lisp_Object window = wrap_window (w); redisplay_clear_region (window, DEFAULT_INDEX, - FRAME_LEFT_BORDER_START (f), y, - FRAME_INTERNAL_BORDER_WIDTH (f), height); + FRAME_LEFT_INTERNAL_BORDER_START (f), y, + FRAME_INTERNAL_BORDER_WIDTH (f), height); } /***************************************************************************** @@ -654,8 +654,8 @@ Lisp_Object window = wrap_window (w); redisplay_clear_region (window, DEFAULT_INDEX, - FRAME_RIGHT_BORDER_START (f), - y, FRAME_INTERNAL_BORDER_WIDTH (f), height); + FRAME_RIGHT_INTERNAL_BORDER_START (f), + y, FRAME_INTERNAL_BORDER_WIDTH (f), height); } /***************************************************************************** @@ -1663,8 +1663,7 @@ dga->width = IMAGE_INSTANCE_PIXMAP_WIDTH (p); #ifdef DEBUG_REDISPLAY - printf ("redisplay_output_pixmap(request) \ -[%dx%d@%d+%d] in [%dx%d@%d+%d]\n", + printf ("redisplay_output_pixmap(request) [%dx%d@%d+%d] in [%dx%d@%d+%d]\n", db->width, db->height, db->xpos, db->ypos, dga->width, dga->height, dga->xoffset, dga->yoffset); #endif @@ -1674,8 +1673,7 @@ return; #ifdef DEBUG_REDISPLAY - printf ("redisplay_output_pixmap(normalized) \ -[%dx%d@%d+%d] in [%dx%d@%d+%d]\n", + printf ("redisplay_output_pixmap(normalized) [%dx%d@%d+%d] in [%dx%d@%d+%d]\n", db->width, db->height, db->xpos, db->ypos, dga->width, dga->height, dga->xoffset, dga->yoffset); #endif @@ -1749,11 +1747,12 @@ /* #### This isn't quite right for when this function is called from the toolbar code. */ + /* #### GEOM! This uses a backing pixmap in the gutter. Correct? */ /* Don't use a backing pixmap in the border area */ - if (x >= FRAME_LEFT_BORDER_END (f) - && x < FRAME_RIGHT_BORDER_START (f) - && y >= FRAME_TOP_BORDER_END (f) - && y < FRAME_BOTTOM_BORDER_START (f)) + if (x >= FRAME_LEFT_INTERNAL_BORDER_END (f) + && x < FRAME_RIGHT_INTERNAL_BORDER_START (f) + && y >= FRAME_TOP_INTERNAL_BORDER_END (f) + && y < FRAME_BOTTOM_INTERNAL_BORDER_START (f)) { Lisp_Object temp; @@ -2098,7 +2097,10 @@ { Lisp_Object window = wrap_window (w); - + /* #### GEOM! FIXME #### This is definitely wrong. It was clearly not + fixed up to accommodate the gutter. The internal border width is now + no longer adjacent to the leftmost window, since the gutter + intervenes. */ if (!NILP (Fwindow_highest_p (window))) { struct frame *f = XFRAME (w->frame); @@ -2115,7 +2117,8 @@ if (window_is_rightmost (w)) width += FRAME_INTERNAL_BORDER_WIDTH (f); - y = FRAME_TOP_BORDER_START (f) - 1; + /* #### This off-by-one stuff also occurs in XLIKE_clear_frame(). */ + y = FRAME_TOP_INTERNAL_BORDER_START (f) - 1; height = FRAME_INTERNAL_BORDER_HEIGHT (f) + 1; redisplay_clear_region (window, DEFAULT_INDEX, x, y, width, height); @@ -2151,12 +2154,15 @@ window = wrap_window (w); if (window_is_leftmost (w)) - redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f), - ypos1, FRAME_INTERNAL_BORDER_WIDTH (f), height); + redisplay_clear_region (window, DEFAULT_INDEX, + FRAME_LEFT_INTERNAL_BORDER_START (f), + ypos1, FRAME_INTERNAL_BORDER_WIDTH (f), + height); if (bounds.left_in - bounds.left_out > 0) redisplay_clear_region (window, - get_builtin_face_cache_index (w, Vleft_margin_face), + get_builtin_face_cache_index + (w, Vleft_margin_face), bounds.left_out, ypos1, bounds.left_in - bounds.left_out, height); @@ -2168,13 +2174,17 @@ if (bounds.right_out - bounds.right_in > 0) redisplay_clear_region (window, - get_builtin_face_cache_index (w, Vright_margin_face), + get_builtin_face_cache_index + (w, Vright_margin_face), bounds.right_in, ypos1, - bounds.right_out - bounds.right_in, height); + bounds.right_out - bounds.right_in, + height); if (window_is_rightmost (w)) - redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), - ypos1, FRAME_INTERNAL_BORDER_WIDTH (f), height); + redisplay_clear_region (window, DEFAULT_INDEX, + FRAME_RIGHT_INTERNAL_BORDER_START (f), + ypos1, FRAME_INTERNAL_BORDER_WIDTH (f), + height); } } } diff -r 5502045ec510 -r 0ca81354c4c7 src/redisplay-xlike-inc.c --- a/src/redisplay-xlike-inc.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/redisplay-xlike-inc.c Wed Mar 03 05:07:47 2010 -0600 @@ -2158,19 +2158,16 @@ int x, y, width, height; Lisp_Object frame; - x = FRAME_LEFT_BORDER_START (f); - width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) - - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) - - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) - - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f)); + /* #### GEOM! This clears the internal border and gutter (and scrollbars) + but not the toolbar. Correct? */ + x = FRAME_LEFT_INTERNAL_BORDER_START (f); + width = (FRAME_RIGHT_INTERNAL_BORDER_END (f) - x); /* #### This adjustment by 1 should be being done in the macros. There is some small differences between when the menubar is on - and off that we still need to deal with. */ - y = FRAME_TOP_BORDER_START (f) - 1; - height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) - - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) - - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) - - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1; + and off that we still need to deal with. The adjustment also occurs in + redisplay_clear_top_of_window(). */ + y = FRAME_TOP_INTERNAL_BORDER_START (f) - 1; + height = (FRAME_BOTTOM_INTERNAL_BORDER_END (f) - y); XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height); diff -r 5502045ec510 -r 0ca81354c4c7 src/redisplay.c --- a/src/redisplay.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/redisplay.c Wed Mar 03 05:07:47 2010 -0600 @@ -8768,7 +8768,7 @@ d->pixel_to_glyph_cache.obj_x = *obj_x; \ d->pixel_to_glyph_cache.obj_y = *obj_y; \ d->pixel_to_glyph_cache.w = *w; \ - d->pixel_to_glyph_cache.charpos = *charpos; \ + d->pixel_to_glyph_cache.charpos = *charpos; \ d->pixel_to_glyph_cache.closest = *closest; \ d->pixel_to_glyph_cache.modeline_closest = *modeline_closest; \ d->pixel_to_glyph_cache.obj1 = *obj1; \ @@ -8785,10 +8785,15 @@ OVER_TOOLBAR: over one of the 4 frame toolbars OVER_MODELINE: over a modeline OVER_BORDER: over an internal border + OVER_V_DIVIDER: over a vertical divider between windows (used as a + grab bar for resizing) OVER_NOTHING: over the text area, but not over text OVER_OUTSIDE: outside of the frame border OVER_TEXT: over text in the text area + #### GEOM! We need to also have an OVER_GUTTER, OVER_SCROLLBAR and + OVER_DEAD_BOX. + OBJ1 is one of -- a toolbar button @@ -8881,25 +8886,28 @@ if (device_check_failed) return OVER_NOTHING; - frm_left = FRAME_LEFT_BORDER_END (f); - frm_right = FRAME_RIGHT_BORDER_START (f); - frm_top = FRAME_TOP_BORDER_END (f); - frm_bottom = FRAME_BOTTOM_BORDER_START (f); + /* #### GEOM! The gutter is just inside of this. We should also have an + OVER_GUTTER return value to indicate that we're over a gutter. See + above. */ + frm_left = FRAME_LEFT_INTERNAL_BORDER_END (f); + frm_right = FRAME_RIGHT_INTERNAL_BORDER_START (f); + frm_top = FRAME_TOP_INTERNAL_BORDER_END (f); + frm_bottom = FRAME_BOTTOM_INTERNAL_BORDER_START (f); /* Check if the mouse is outside of the text area actually used by redisplay. */ if (y_coord < frm_top) { - if (y_coord >= FRAME_TOP_BORDER_START (f)) - { - low_y_coord = FRAME_TOP_BORDER_START (f); + if (y_coord >= FRAME_TOP_INTERNAL_BORDER_START (f)) + { + low_y_coord = FRAME_TOP_INTERNAL_BORDER_START (f); high_y_coord = frm_top; position = OVER_BORDER; } else if (y_coord >= 0) { low_y_coord = 0; - high_y_coord = FRAME_TOP_BORDER_START (f); + high_y_coord = FRAME_TOP_INTERNAL_BORDER_START (f); position = OVER_TOOLBAR; } else @@ -8911,15 +8919,15 @@ } else if (y_coord >= frm_bottom) { - if (y_coord < FRAME_BOTTOM_BORDER_END (f)) + if (y_coord < FRAME_BOTTOM_INTERNAL_BORDER_END (f)) { low_y_coord = frm_bottom; - high_y_coord = FRAME_BOTTOM_BORDER_END (f); + high_y_coord = FRAME_BOTTOM_INTERNAL_BORDER_END (f); position = OVER_BORDER; } else if (y_coord < FRAME_PIXHEIGHT (f)) { - low_y_coord = FRAME_BOTTOM_BORDER_END (f); + low_y_coord = FRAME_BOTTOM_INTERNAL_BORDER_END (f); high_y_coord = FRAME_PIXHEIGHT (f); position = OVER_TOOLBAR; } @@ -8935,16 +8943,16 @@ { if (x_coord < frm_left) { - if (x_coord >= FRAME_LEFT_BORDER_START (f)) - { - low_x_coord = FRAME_LEFT_BORDER_START (f); + if (x_coord >= FRAME_LEFT_INTERNAL_BORDER_START (f)) + { + low_x_coord = FRAME_LEFT_INTERNAL_BORDER_START (f); high_x_coord = frm_left; position = OVER_BORDER; } else if (x_coord >= 0) { low_x_coord = 0; - high_x_coord = FRAME_LEFT_BORDER_START (f); + high_x_coord = FRAME_LEFT_INTERNAL_BORDER_START (f); position = OVER_TOOLBAR; } else @@ -8956,15 +8964,15 @@ } else if (x_coord >= frm_right) { - if (x_coord < FRAME_RIGHT_BORDER_END (f)) + if (x_coord < FRAME_RIGHT_INTERNAL_BORDER_END (f)) { low_x_coord = frm_right; - high_x_coord = FRAME_RIGHT_BORDER_END (f); + high_x_coord = FRAME_RIGHT_INTERNAL_BORDER_END (f); position = OVER_BORDER; } else if (x_coord < FRAME_PIXWIDTH (f)) { - low_x_coord = FRAME_RIGHT_BORDER_END (f); + low_x_coord = FRAME_RIGHT_INTERNAL_BORDER_END (f); high_x_coord = FRAME_PIXWIDTH (f); position = OVER_TOOLBAR; } diff -r 5502045ec510 -r 0ca81354c4c7 src/toolbar.c --- a/src/toolbar.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/toolbar.c Wed Mar 03 05:07:47 2010 -0600 @@ -778,6 +778,17 @@ throughout the toolbar code. */ compute_frame_toolbars_data (f); + /* #### GEOM! Turning the toolbar on and off repeatedly causes the + frame to steadily shrink. Basically, turning it on doesn't + increase the frame size, while turning it off does reduce the + frame size. The cause has something to do with the combination + of this maybe questionable code here, plus the fact that toolbars + are included in the displayable area, and the difference between + real and theoretical toolbar sizes, and exactly when the various + computations happen w.r.t. the specifiers or whatever that control + whether toolbars are visible and hence whether their thickness is + greater than zero. --ben */ + if (frame_size_changed) { int width, height; diff -r 5502045ec510 -r 0ca81354c4c7 src/window.c --- a/src/window.c Thu Feb 25 16:19:01 2010 +0100 +++ b/src/window.c Wed Mar 03 05:07:47 2010 -0600 @@ -1813,10 +1813,8 @@ struct window *w = decode_window (window); struct frame *f = XFRAME (w->frame); - int left = - w->pixel_left - FRAME_LEFT_BORDER_END (f) - FRAME_LEFT_GUTTER_BOUNDS (f); - int top = - w->pixel_top - FRAME_TOP_BORDER_END (f) - FRAME_TOP_GUTTER_BOUNDS (f); + int left = w->pixel_left - FRAME_PANED_LEFT_EDGE (f); + int top = w->pixel_top - FRAME_PANED_TOP_EDGE (f); return list4 (make_int (left), make_int (top),