Mercurial > hg > xemacs-beta
comparison man/internals/internals.texi @ 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 | 865c9a95f21c |
children | d4f666cda5e6 |
comparison
equal
deleted
inserted
replaced
5044:e84a30b0e4a2 | 5045:c3cc3fa503a2 |
---|---|
358 * Buffers:: | 358 * Buffers:: |
359 * Text:: | 359 * Text:: |
360 * Multilingual Support:: | 360 * Multilingual Support:: |
361 * Consoles; Devices; Frames; Windows:: | 361 * Consoles; Devices; Frames; Windows:: |
362 * Window-System Support:: | 362 * Window-System Support:: |
363 * Window and Frame Geometry:: | |
363 * The Redisplay Mechanism:: | 364 * The Redisplay Mechanism:: |
364 * Extents:: | 365 * Extents:: |
365 * Faces:: | 366 * Faces:: |
366 * Glyphs:: | 367 * Glyphs:: |
367 * Specifiers:: | 368 * Specifiers:: |
593 * Modules for the Basic Displayable Lisp Objects:: | 594 * Modules for the Basic Displayable Lisp Objects:: |
594 | 595 |
595 Window-System Support | 596 Window-System Support |
596 | 597 |
597 * Creating a Window-System Type:: | 598 * Creating a Window-System Type:: |
599 | |
600 Window and Frame Geometry | |
601 | |
602 * Intro to Window and Frame Geometry:: | |
603 * The Frame:: | |
604 * The Non-Client Area:: | |
605 * The Client Area:: | |
606 * The Paned Area:: | |
607 * Text Areas:: | |
608 * The Displayable Area:: | |
609 * Which Functions Use Which?:: | |
598 | 610 |
599 The Redisplay Mechanism | 611 The Redisplay Mechanism |
600 | 612 |
601 * Critical Redisplay Sections:: | 613 * Critical Redisplay Sections:: |
602 * Line Start Cache:: | 614 * Line Start Cache:: |
17666 windows), there is no device-type-specific code here; all of that code | 17678 windows), there is no device-type-specific code here; all of that code |
17667 is part of the redisplay mechanism or the code for particular object | 17679 is part of the redisplay mechanism or the code for particular object |
17668 types such as scrollbars. | 17680 types such as scrollbars. |
17669 | 17681 |
17670 | 17682 |
17671 @node Window-System Support, The Redisplay Mechanism, Consoles; Devices; Frames; Windows, Top | 17683 @node Window-System Support, Window and Frame Geometry, Consoles; Devices; Frames; Windows, Top |
17672 @chapter Window-System Support | 17684 @chapter Window-System Support |
17673 @cindex window-system support | 17685 @cindex window-system support |
17674 @cindex window systems | 17686 @cindex window systems |
17675 @cindex X | 17687 @cindex X |
17676 @cindex X Windows | 17688 @cindex X Windows |
17849 Note that this project failed; there are probably many other details to | 17861 Note that this project failed; there are probably many other details to |
17850 be implemented that I didn't get to. But don't let that stop you! | 17862 be implemented that I didn't get to. But don't let that stop you! |
17851 | 17863 |
17852 | 17864 |
17853 | 17865 |
17854 @node The Redisplay Mechanism, Extents, Window-System Support, Top | 17866 @node Window and Frame Geometry, The Redisplay Mechanism, Window-System Support, Top |
17867 @chapter Window and Frame Geometry | |
17868 | |
17869 @menu | |
17870 * Intro to Window and Frame Geometry:: | |
17871 * The Frame:: | |
17872 * The Non-Client Area:: | |
17873 * The Client Area:: | |
17874 * The Paned Area:: | |
17875 * Text Areas:: | |
17876 * The Displayable Area:: | |
17877 * Which Functions Use Which?:: | |
17878 @end menu | |
17879 | |
17880 @node Intro to Window and Frame Geometry, The Frame, Window and Frame Geometry, Window and Frame Geometry | |
17881 @section Intro to Window and Frame Geometry | |
17882 | |
17883 Here is an ASCII diagram: | |
17884 | |
17885 @example | |
17886 +-----------------------------------------------------------------------------| | |
17887 | window-manager decoration | | |
17888 | +-------------------------------------------------------------------------+ | | |
17889 | | menubar | | | |
17890 | ########################################################################### | | |
17891 | # toolbar # | | |
17892 | #-------------------------------------------------------------------------# | | |
17893 | # | gutter | # | | |
17894 | # |-------------------------------------------------------------------| # | | |
17895 | # | | internal border width | | # | | |
17896 | # | |-*************************************************************-| | # | | |
17897 |w# | | * |s|v* |s* | | #w| | |
17898 |i# | | * |c|e* |c* | | #i| | |
17899 |n# | | * |r|r* |r* | | #n| | |
17900 |d# | | * |o|t* |o* | | #d| | |
17901 |o# | | * text area |l|.* text area |l* | | #o| | |
17902 |w# | |i* |l| * |l*i| | #w| | |
17903 |-# | |n* |b|d* |b*n| | #-| | |
17904 |m# | |t* |a|i* |a*t| | #m| | |
17905 |a# | |.* |r|v* |r*.| | #a| | |
17906 |n# t| | *--------------------------+-|i*--------------------------+-* | |t #n| | |
17907 |a# o|g|b* scrollbar | |d* scrollbar | *b|g|o #a| | |
17908 |g# o|u|o*--------------------------+-|e*--------------------------+-*o|u|o #g| | |
17909 |e# l|t|r* modeline |r* modeline *r|t|l #e| | |
17910 |r# b|t|d*************************************************************d|t|b #r| | |
17911 | # a|e|e* =...texttexttex....= |s|v* |s*e|e|a # | | |
17912 |d# r|r|r*o m=...texttexttextt..=o m|c|e* |c*r|r|r #d| | |
17913 |e# | | *u a=.texttexttextte...=u a|r|r* |r* | | #e| | |
17914 |c# | |w*t r=.....texttexttex..=t r|o|t* |o*w| | #c| | |
17915 |o# | |i*s g= etc. =s g|l|.* text area |l*i| | #o| | |
17916 |r# | |d*i i= =i i|l| * |l*d| | #r| | |
17917 |a# | |t*d n= =d n|b|d* |b*t| | #a| | |
17918 |t# | |h*e = inner text area =e |a|i* |a*h| | #t| | |
17919 |i# | | * = = |r|v* |r* | | #i| | |
17920 |o# | | *---====================---+-|i*--------------------------+-* | | #o| | |
17921 |n# | | * scrollbar | |d* scrollbar | * | | #n| | |
17922 | # | | *--------------------------+-|e*--------------------------+-* | | # | | |
17923 | # | | * modeline |r* modeline * | | # | | |
17924 | # | | ************************************************************* | | # | | |
17925 | # | | * minibuffer * | | # | | |
17926 | # | | ************************************************************* | | # | | |
17927 | # | | internal border width | | # | | |
17928 | # |-------------------------------------------------------------------| # | | |
17929 | # | gutter | # | | |
17930 | #-------------------------------------------------------------------------# | | |
17931 | # toolbar # | | |
17932 | ########################################################################### | | |
17933 | window manager decoration | | |
17934 +-----------------------------------------------------------------------------+ | |
17935 | |
17936 # = boundary of client area; * = window boundaries, boundary of paned area | |
17937 = = boundary of inner text area; . = inside margin area | |
17938 @end example | |
17939 | |
17940 Note in particular what happens at the corners, where a "corner box" | |
17941 occurs. Top and bottom toolbars take precedence over left and right | |
17942 toolbars, extending out horizontally into the corner boxes. Gutters | |
17943 work the same way. The corner box where the scrollbars meet, however, | |
17944 is assigned to neither scrollbar, and is known as the "dead box"; it is | |
17945 an area that must be cleared specially. | |
17946 | |
17947 @node The Frame, The Non-Client Area, Intro to Window and Frame Geometry, Window and Frame Geometry | |
17948 @section The Frame | |
17949 | |
17950 The "top-level window area" is the entire area of a top-level window (or | |
17951 "frame"). The "client area" (a term from MS Windows) is the area of a | |
17952 top-level window that XEmacs draws into and manages with redisplay. | |
17953 This includes the toolbar, scrollbars, gutters, dividers, text area, | |
17954 modeline and minibuffer. It does not include the menubar, title or | |
17955 outer borders. The "non-client area" is the area of a top-level window | |
17956 outside of the client area and includes the menubar, title and outer | |
17957 borders. Internally, all frame coordinates are relative to the client | |
17958 area. | |
17959 | |
17960 | |
17961 @node The Non-Client Area, The Client Area, The Frame, Window and Frame Geometry | |
17962 @section The Non-Client Area | |
17963 | |
17964 Under X, the non-client area is split into two parts: | |
17965 | |
17966 @enumerate | |
17967 @item | |
17968 The outer layer is the window-manager decorations: The title and | |
17969 borders. These are controlled by the window manager, a separate process | |
17970 that controls the desktop, the location of icons, etc. When a process | |
17971 tries to create a window, the window manager intercepts this action and | |
17972 "reparents" the window, placing another window around it which contains | |
17973 the window decorations, including the title bar, outer borders used for | |
17974 resizing, etc. The window manager also implements any actions involving | |
17975 the decorations, such as the ability to resize a window by dragging its | |
17976 borders, move a window by dragging its title bar, etc. If there is no | |
17977 window manager or you kill it, windows will have no decorations (and | |
17978 will lose them if they previously had any) and you will not be able to | |
17979 move or resize them. | |
17980 | |
17981 @item | |
17982 Inside of the window-manager decorations is the "shell", which is | |
17983 managed by the toolkit and widget libraries your program is linked with. | |
17984 The code in @file{*-x.c} uses the Xt toolkit and various possible widget | |
17985 libraries built on top of Xt, such as Motif, Athena, the "Lucid" | |
17986 widgets, etc. Another possibility is GTK (@file{*-gtk.c}), which implements | |
17987 both the toolkit and widgets. Under Xt, the "shell" window is an | |
17988 EmacsShell widget, containing an EmacsManager widget of the same size, | |
17989 which in turn contains a menubar widget and an EmacsFrame widget, inside | |
17990 of which is the client area. (The division into EmacsShell and | |
17991 EmacsManager is due to the complex and screwy geometry-management system | |
17992 in Xt [and X more generally]. The EmacsShell handles negotation with | |
17993 the window manager; the place of the EmacsManager widget is normally | |
17994 assumed by a widget that manages the geometry of its child widgets, but | |
17995 the EmacsManager widget just lets the XEmacs redisplay mechanism do the | |
17996 positioning.) | |
17997 @end enumerate | |
17998 | |
17999 Under Windows, the non-client area is managed by the window system. | |
18000 There is no division such as under X. Part of the window-system API | |
18001 (@file{USER.DLL}) of Win32 includes functions to control the menubars, title, | |
18002 etc. and implements the move and resize behavior. There @strong{is} an | |
18003 equivalent of the window manager, called the "shell", but it manages | |
18004 only the desktop, not the windows themselves. The normal shell under | |
18005 Windows is @file{EXPLORER.EXE}; if you kill this, you will lose the bar | |
18006 containing the "Start" menu and tray and such, but the windows | |
18007 themselves will not be affected or lose their decorations. | |
18008 | |
18009 | |
18010 @node The Client Area, The Paned Area, The Non-Client Area, Window and Frame Geometry | |
18011 @section The Client Area | |
18012 | |
18013 Inside of the client area is the toolbars, the gutters (where the buffer | |
18014 tabs are displayed), the minibuffer, the internal border width, and one | |
18015 or more non-overlapping "windows" (this is old Emacs terminology, from | |
18016 before the time when frames existed at all; the standard terminology for | |
18017 this would be "pane"). Each window can contain a modeline, horizontal | |
18018 and/or vertical scrollbars, and (for non-rightmost windows) a vertical | |
18019 divider, surrounding a text area. | |
18020 | |
18021 The dimensions of the toolbars and gutters are determined by the formula | |
18022 (THICKNESS + 2 * BORDER-THICKNESS), where "thickness" is a cover term | |
18023 for height or width, as appropriate. The height and width come from | |
18024 @code{default-toolbar-height} and @code{default-toolbar-width} and the specific | |
18025 versions of these (@code{top-toolbar-height}, @code{left-toolbar-width}, etc.). | |
18026 The border thickness comes from @code{default-toolbar-border-height} and | |
18027 @code{default-toolbar-border-width}, and the specific versions of these. The | |
18028 gutter works exactly equivalently. | |
18029 | |
18030 Note that for any particular toolbar or gutter, it will only be | |
18031 displayed if [a] its visibility specifier (@code{default-toolbar-visible-p} | |
18032 etc.) is non-nil; [b] its thickness (@code{default-toolbar-height} etc.) is | |
18033 greater than 0; [c] its contents (@code{default-toolbar} etc.) are non-nil. | |
18034 | |
18035 The position-specific toolbars interact with the default specifications | |
18036 as follows: If the value for a position-specific specifier is not | |
18037 defined in a particular domain (usually a window), and the position of | |
18038 that specifier is set as the default position (using | |
18039 @code{default-toolbar-position}), then the value from the corresponding | |
18040 default specifier in that domain will be used. The gutters work the | |
18041 same. | |
18042 | |
18043 | |
18044 @node The Paned Area, Text Areas, The Client Area, Window and Frame Geometry | |
18045 @section The Paned Area | |
18046 | |
18047 The area occupied by the "windows" is called the paned area. Note that | |
18048 this includes the minibuffer, which is just another window but is | |
18049 special-cased in XEmacs. Each window can include a horizontal and/or | |
18050 vertical scrollbar, a modeline and a vertical divider to its right, as | |
18051 well as the text area. Only non-rightmost windows can include a | |
18052 vertical divider. (The minibuffer normally does not include either | |
18053 modeline or scrollbars.) | |
18054 | |
18055 Note that, because the toolbars and gutters are controlled by | |
18056 specifiers, and specifiers can have window-specific and buffer-specific | |
18057 values, the size of the paned area can change depending on which window | |
18058 is selected: In other words, if the selected window or buffer changes, | |
18059 the entire paned area for the frame may change. | |
18060 | |
18061 | |
18062 @node Text Areas, The Displayable Area, The Paned Area, Window and Frame Geometry | |
18063 @section Text Areas, Fringes, Margins | |
18064 | |
18065 The space occupied by a window can be divided into the text area and the | |
18066 fringes. The fringes include the modeline, scrollbars and vertical | |
18067 divider on the right side (if any); inside of this is the text area, | |
18068 where the text actually occurs. Note that a window may or may not | |
18069 contain any of the elements that are part of the fringe -- this is | |
18070 controlled by specifiers, e.g. @code{has-modeline-p}, | |
18071 @code{horizontal-scrollbar-visible-p}, @code{vertical-scrollbar-visible-p}, | |
18072 @code{vertical-divider-always-visible-p}, etc. | |
18073 | |
18074 In addition, it is possible to set margins in the text area using the | |
18075 specifiers @code{left-margin-width} and @code{right-margin-width}. When this is | |
18076 done, only the "inner text area" (the area inside of the margins) will | |
18077 be used for normal display of text; the margins will be used for glyphs | |
18078 with a layout policy of @code{outside-margin} (as set on an extent containing | |
18079 the glyph by @code{set-extent-begin-glyph-layout} or | |
18080 @code{set-extent-end-glyph-layout}). However, the calculation of the text | |
18081 area size (e.g. in the function @code{window-text-area-width}) includes the | |
18082 margins. Which margin is used depends on whether a glyph has been set | |
18083 as the begin-glyph or end-glyph of an extent (@code{set-extent-begin-glyph} | |
18084 etc.), using the left and right margins, respectively. | |
18085 | |
18086 Technically, the margins outside of the inner text area are known as the | |
18087 "outside margins". The "inside margins" are in the inner text area and | |
18088 constitute the whitespace between the outside margins and the first or | |
18089 last non-whitespace character in a line; their width can vary from line | |
18090 to line. Glyphs will be placed in the inside margin if their layout | |
18091 policy is @code{inside-margin} or @code{whitespace}, with @code{whitespace} glyphs on | |
18092 the inside and @code{inside-margin} glyphs on the outside. Inside-margin | |
18093 glyphs can spill over into the outside margin if @code{use-left-overflow} or | |
18094 @code{use-right-overflow}, respectively, is non-nil. | |
18095 | |
18096 See the Lisp Reference manual, under Annotations, for more details. | |
18097 | |
18098 | |
18099 @node The Displayable Area, Which Functions Use Which?, Text Areas, Window and Frame Geometry | |
18100 @section The Displayable Area | |
18101 | |
18102 The "displayable area" is not so much an actual area as a convenient | |
18103 fiction. It is the area used to convert between pixel and character | |
18104 dimensions for frames. The character dimensions for a frame (e.g. as | |
18105 returned by @code{frame-width} and @code{frame-height} and set by | |
18106 @code{set-frame-width} and @code{set-frame-height}) are determined from the | |
18107 displayable area by dividing by the pixel size of the default font as | |
18108 instantiated in the frame. (For proportional fonts, the "average" width | |
18109 is used. Under Windows, this is a built-in property of the fonts. | |
18110 Under X, this is based on the width of the lowercase 'n', or if this is | |
18111 zero then the width of the default character. [We prefer 'n' to the | |
18112 specified default character because many X fonts have a default | |
18113 character with a zero or otherwise non-representative width.]) | |
18114 | |
18115 The displayable area is essentially the "theoretical" paned area of the | |
18116 frame excluding the rightmost and bottom-most scrollbars. In this | |
18117 context, "theoretical" means that all calculations on based on | |
18118 frame-level values for toolbar, gutter and scrollbar thicknesses. | |
18119 Because these thicknesses are controlled by specifiers, and specifiers | |
18120 can have window-specific and buffer-specific values, these calculations | |
18121 may or may not reflect the actual size of the paned area or of the | |
18122 scrollbars when any particular window is selected. Note also that the | |
18123 "displayable area" may not even be contiguous! In particular, if the | |
18124 frame-level value of the horizontal scrollbar height is non-zero, then | |
18125 the displayable area includes the paned area above and below the bottom | |
18126 horizontal scrollbar but not the scrollbar itself. | |
18127 | |
18128 As a further twist, the character-dimension calculations are adjusted so | |
18129 that the truncation and continuation glyphs (see @code{truncation-glyph} and | |
18130 @code{continuation-glyph}) count as a single character even if they are wider | |
18131 than the default font width. (Technically, the character width is | |
18132 computed from the displayable-area width by subtracting the maximum of | |
18133 the truncation-glyph width, continuation-glyph width and default-font | |
18134 width before dividing by the default-font width, and then adding 1 to | |
18135 the result.) (The ultimate motivation for this kludge as well as the | |
18136 subtraction of the scrollbars, but not the minibuffer or bottom-most | |
18137 modeline, is to maintain compatibility with TTY's.) | |
18138 | |
18139 Despite all these concerns and kludges, however, the "displayable area" | |
18140 concept works well in practice and mostly ensures that by default the | |
18141 frame will actually fit 79 characters + continuation/truncation glyph. | |
18142 | |
18143 | |
18144 @node Which Functions Use Which?, , The Displayable Area, Window and Frame Geometry | |
18145 @section Which Functions Use Which? | |
18146 | |
18147 @enumerate | |
18148 @item | |
18149 Top-level window area: | |
18150 | |
18151 @example | |
18152 set-frame-position | |
18153 @code{left} and @code{top} frame properties | |
18154 @end example | |
18155 | |
18156 @item | |
18157 Client area: | |
18158 | |
18159 @example | |
18160 frame-pixel-*, set-frame-pixel-* | |
18161 @end example | |
18162 | |
18163 @item | |
18164 Paned area: | |
18165 | |
18166 @example | |
18167 window-pixel-edges | |
18168 event-x-pixel, event-y-pixel, event-properties, make-event | |
18169 @end example | |
18170 | |
18171 @item | |
18172 Displayable area: | |
18173 | |
18174 @example | |
18175 frame-width, frame-height and other all functions specifying frame size | |
18176 in characters | |
18177 frame-displayable-pixel-* | |
18178 @end example | |
18179 @end enumerate | |
18180 | |
18181 | |
18182 | |
18183 @node The Redisplay Mechanism, Extents, Window and Frame Geometry, Top | |
17855 @chapter The Redisplay Mechanism | 18184 @chapter The Redisplay Mechanism |
17856 @cindex redisplay mechanism, the | 18185 @cindex redisplay mechanism, the |
17857 | 18186 |
17858 The redisplay mechanism is one of the most complicated sections of | 18187 The redisplay mechanism is one of the most complicated sections of |
17859 XEmacs, especially from a conceptual standpoint. This is doubly so | 18188 XEmacs, especially from a conceptual standpoint. This is doubly so |