Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
5044:e84a30b0e4a2 | 5045:c3cc3fa503a2 |
---|---|
3316 frame = wrap_frame (f); | 3316 frame = wrap_frame (f); |
3317 default_face_height_and_width (frame, &cph, &cpw); | 3317 default_face_height_and_width (frame, &cph, &cpw); |
3318 | 3318 |
3319 window = FRAME_SELECTED_WINDOW (f); | 3319 window = FRAME_SELECTED_WINDOW (f); |
3320 | 3320 |
3321 /* #### It really seems like we should also be subtracting out the | |
3322 theoretical gutter width and height, just like we do for toolbars. | |
3323 There is currently a bug where if you call `set-frame-pixel-width' | |
3324 on MS Windows (at least, possibly also X) things get confused and | |
3325 the top of the root window overlaps the top gutter instead of being | |
3326 below it. This gets fixed next time you resize the frame using the | |
3327 mouse. Possibly this is caused by not handling the gutter height | |
3328 here? */ | |
3321 egw = max (glyph_width (Vcontinuation_glyph, window), | 3329 egw = max (glyph_width (Vcontinuation_glyph, window), |
3322 glyph_width (Vtruncation_glyph, window)); | 3330 glyph_width (Vtruncation_glyph, window)); |
3323 egw = max (egw, cpw); | 3331 egw = max (egw, cpw); |
3324 bdr = 2 * f->internal_border_width; | 3332 bdr = 2 * f->internal_border_width; |
3325 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) + | 3333 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) + |
3552 frame_conversion_internal (f, SIZE_FRAME_UNIT, FRAME_WIDTH (f), | 3560 frame_conversion_internal (f, SIZE_FRAME_UNIT, FRAME_WIDTH (f), |
3553 FRAME_HEIGHT (f), SIZE_DISPLAYABLE_PIXEL, | 3561 FRAME_HEIGHT (f), SIZE_DISPLAYABLE_PIXEL, |
3554 out_width, out_height); | 3562 out_width, out_height); |
3555 } | 3563 } |
3556 | 3564 |
3557 /* Change the frame height and/or width. Values may be given as zero to | 3565 /* Change the frame height and/or width. Values passed in are in |
3558 indicate no change is to take place. */ | 3566 frame units (character cells on X/GTK, displayable-area pixels |
3567 on MS Windows or generally on pixelated-geometry window systems). */ | |
3559 static void | 3568 static void |
3560 change_frame_size_1 (struct frame *f, int newwidth, int newheight) | 3569 change_frame_size_1 (struct frame *f, int newwidth, int newheight) |
3561 { | 3570 { |
3562 int new_pixheight, new_pixwidth; | 3571 int new_pixheight, new_pixwidth; |
3563 int real_font_height, real_font_width; | 3572 int real_font_height, real_font_width; |
3584 /* This size-change overrides any pending one for this frame. */ | 3593 /* This size-change overrides any pending one for this frame. */ |
3585 f->size_change_pending = 0; | 3594 f->size_change_pending = 0; |
3586 FRAME_NEW_HEIGHT (f) = 0; | 3595 FRAME_NEW_HEIGHT (f) = 0; |
3587 FRAME_NEW_WIDTH (f) = 0; | 3596 FRAME_NEW_WIDTH (f) = 0; |
3588 | 3597 |
3589 /* when frame_conversion_internal() calculated the number of rows/cols | 3598 /* We need to remove the boundaries of the paned area (see top of file) |
3590 in the frame, the theoretical toolbar sizes were subtracted out. | 3599 from the total-area pixel size, which is what we have now. |
3591 The calculations below adjust for real toolbar height/width in | 3600 |
3592 frame, which may be different from frame spec, taking the above | 3601 #### We should also be subtracting the internal borders. */ |
3593 fact into account */ | |
3594 new_pixheight += | |
3595 - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) | |
3596 - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f); | |
3597 | |
3598 new_pixheight += | |
3599 - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) | |
3600 - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f); | |
3601 | |
3602 new_pixwidth += | |
3603 - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) | |
3604 - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f); | |
3605 | |
3606 new_pixwidth += | |
3607 - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) | |
3608 - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f); | |
3609 | |
3610 /* Adjust for gutters here so that we always get set | |
3611 properly. */ | |
3612 new_pixheight -= | 3602 new_pixheight -= |
3613 (FRAME_TOP_GUTTER_BOUNDS (f) | 3603 (FRAME_REAL_TOP_TOOLBAR_BOUNDS (f) |
3604 + FRAME_REAL_BOTTOM_TOOLBAR_BOUNDS (f) | |
3605 + FRAME_TOP_GUTTER_BOUNDS (f) | |
3614 + FRAME_BOTTOM_GUTTER_BOUNDS (f)); | 3606 + FRAME_BOTTOM_GUTTER_BOUNDS (f)); |
3615 | 3607 |
3616 /* Adjust for gutters here so that we always get set | |
3617 properly. */ | |
3618 new_pixwidth -= | 3608 new_pixwidth -= |
3619 (FRAME_LEFT_GUTTER_BOUNDS (f) | 3609 (FRAME_REAL_LEFT_TOOLBAR_BOUNDS (f) |
3610 + FRAME_REAL_RIGHT_TOOLBAR_BOUNDS (f) | |
3611 + FRAME_LEFT_GUTTER_BOUNDS (f) | |
3620 + FRAME_RIGHT_GUTTER_BOUNDS (f)); | 3612 + FRAME_RIGHT_GUTTER_BOUNDS (f)); |
3621 | 3613 |
3622 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top | 3614 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top |
3623 = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f); | 3615 = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f); |
3624 | 3616 |
3674 | 3666 |
3675 FRAME_WIDTH (f) = newwidth; | 3667 FRAME_WIDTH (f) = newwidth; |
3676 if (FRAME_TTY_P (f)) | 3668 if (FRAME_TTY_P (f)) |
3677 f->pixwidth = newwidth; | 3669 f->pixwidth = newwidth; |
3678 | 3670 |
3671 /* #### On MS Windows, this references FRAME_PIXWIDTH() and FRAME_PIXHEIGHT(). | |
3672 I'm not sure we can count on those values being set. Instead we should | |
3673 use the total pixel size we got near the top by calling | |
3674 frame_conversion_internal(). We should inline the logic in | |
3675 get_frame_char_size() here and change that function so it just looks | |
3676 at FRAME_CHARWIDTH() and FRAME_CHARHEIGHT(). */ | |
3679 get_frame_char_size (f, &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f)); | 3677 get_frame_char_size (f, &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f)); |
3680 | 3678 |
3681 MARK_FRAME_TOOLBARS_CHANGED (f); | 3679 MARK_FRAME_TOOLBARS_CHANGED (f); |
3682 MARK_FRAME_GUTTERS_CHANGED (f); | 3680 MARK_FRAME_GUTTERS_CHANGED (f); |
3683 MARK_FRAME_CHANGED (f); | 3681 MARK_FRAME_CHANGED (f); |