Mercurial > hg > xemacs-beta
comparison src/window.h @ 617:af57a77cbc92
[xemacs-hg @ 2001-06-18 07:09:50 by ben]
---------------------------------------------------------------
DOCUMENTATION FIXES:
---------------------------------------------------------------
eval.c: Correct documentation.
elhash.c: Doc correction.
---------------------------------------------------------------
LISP OBJECT CLEANUP:
---------------------------------------------------------------
bytecode.h, buffer.h, casetab.h, chartab.h, console-msw.h, console.h, database.c, device.h, eldap.h, elhash.h, events.h, extents.h, faces.h, file-coding.h, frame.h, glyphs.h, gui-x.h, gui.h, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lrecord.h, lstream.h, mule-charset.h, objects.h, opaque.h, postgresql.h, process.h, rangetab.h, specifier.h, toolbar.h, tooltalk.h, ui-gtk.h: Add wrap_* to all objects (it was already there for a few of them)
-- an expression to encapsulate a pointer into a Lisp object,
rather than the inconvenient XSET*. "wrap" was chosen because
"make" as in make_int(), make_char() is not appropriate. (It
implies allocation. The issue does not exist for ints and chars
because they are not allocated.)
Full error checking has been added to these expressions. When
used without error checking, non-union build, use of these
expressions will incur no loss of efficiency. (In fact, XSET* is
now defined in terms of wrap_* in a non-union build.) In a union
build, you will also get no loss of efficiency provided that you
have a decent optimizing compiler, and a compiler that either
understands inlines or automatically inlines those particular
functions. (And since people don't normally do their production
builds on union, it doesn't matter.)
Update the sample Lisp object definition in lrecord.h accordingly.
dumper.c: Fix places in dumper that referenced wrap_object to reference
its new name, wrap_pointer_1.
buffer.c, bufslots.h, conslots.h, console.c, console.h, devslots.h, device.c, device.h, frame.c, frame.h, frameslots.h, window.c, window.h, winslots.h: -- Extract out the Lisp objects of `struct device' into devslots.h,
just like for the other structures.
-- Extract out the remaining (not copied into the window config)
Lisp objects in `struct window' into winslots.h; use different
macros (WINDOW_SLOT vs. WINDOW_SAVED_SLOT) to differentiate them.
-- Eliminate the `dead' flag of `struct frame', since it
duplicates information already available in `framemeths', and fix
FRAME_LIVE_P accordingly. (Devices and consoles already work this
way.)
-- In *slots.h, switch to system where MARKED_SLOT is automatically
undef'd at the end of the file. (Follows what winslots.h already
does.)
-- Update the comments at the beginning of *slots.h to be accurate.
-- When making any of the above objects dead, zero it out entirely
and reset all Lisp object slots to Qnil. (We were already doing
this somewhat, but not consistently.) This (1) Eliminates the
possibility of extra objects hanging around that ought to be
GC'd, (2) Causes an immediate crash if anyone tries to access a
structure in one of these objects, (3) Ensures consistent behavior
wrt dead objects.
dialog-msw.c: Use internal_object_printer, since this object should not escape.
---------------------------------------------------------------
FIXING A CRASH THAT I HIT ONCE (AND A RELATED BAD BEHAVIOR):
---------------------------------------------------------------
eval.c: Fix up some comments about the FSF implementation.
Fix two nasty bugs:
(1) condition_case_unwind frees the conses sitting in the
catch->tag slot too quickly, resulting in a crash that I hit.
(2) catches need to be unwound one at a time when calling
unwind-protect code, rather than all at once at the end; otherwise,
incorrect behavior can result. (A comment shows exactly how.)
backtrace.h: Improve comment about FSF differences in the handler stack.
---------------------------------------------------------------
FIXING A CRASH THAT I REPEATEDLY HIT WHEN USING THE MOUSE WHEEL
UNDER MSWINDOWS:
---------------------------------------------------------------
Basic idea: My crash is due either to a dead, non-marked,
GC-collected frame inside of a window mirror, or a prematurely
freed window mirror. We need to mark the Lisp objects inside of
window mirrors. Tracking the lifespan of window mirrors and
scrollbar instances is extremely hard, and there may well be
lurking bugs where such objects are freed too soon. The only safe
way to fix these problems (and it fixes both problems at once) is
to make both of these structures Lisp objects.
lrecord.h, emacs.c, inline.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, symsinit.h: Make scrollbar instances actual Lisp objects. Mark the window
mirrors in them. inline.c needs to know about scrollbar.h now.
Record the new type in lrecord.h. Fix up scrollbar-*.c
appropriately. Create a hash table in scrollbar-msw.c so that the
scrollbar instances stored in scrollbar HWND's are properly
GC-protected. Create complex_vars_of_scrollbar_mswindows() to
create the hash table at startup, and call it from emacs.c. Don't
store the scrollbar instance as a property of the GTK scrollbar,
as it's not used and if we did this, we'd have to separately
GC-protect it in a hash table, like in MS Windows.
lrecord.h, frame.h, frame.c, frameslots.h, redisplay.c, window.c, window.h: Move mark_window_mirror from redisplay.c to window.c. Make window
mirrors actual Lisp objects. Tell lrecord.h about them. Change
the window mirror member of struct frame from a pointer to a Lisp
object, and add XWINDOW_MIRROR in appropriate places. Mark the
scrollbar instances in the window mirror.
redisplay.c, redisplay.h, alloc.c: Delete mark_redisplay. Don't call mark_redisplay. We now mark
frame-specific structures in mark_frame.
NOTE: I also deleted an extremely questionable call to
update_frame_window_mirrors(). It was extremely questionable
before, and now totally impossible, since it will create
Lisp objects during redisplay.
frame.c: Mark the scrollbar instances, which are now Lisp objects.
Call mark_gutter() here, not in mark_redisplay().
gutter.c: Update comments about correct marking.
---------------------------------------------------------------
ISSUES BROUGHT UP BY MARTIN:
---------------------------------------------------------------
buffer.h: Put back these macros the way Steve T and I think they ought to be.
I already explained in a previous changelog entry why I think these
macros should be the way I'd defined them. Once again:
We fix these macros so they don't care about the type of their
lvalues. The non-C-string equivalents of these already function
in the same way, and it's correct because it should be OK to pass
in a CBufbyte *, a BufByte *, a Char_Binary *, an UChar_Binary *,
etc. The whole reason for these different types is to work around
errors caused by signed-vs-unsigned non-matching types. Any
possible error that might be caught in a DFC macro would also be
caught wherever the argument is used elsewhere. So creating
multiple macro versions would add no useful error-checking and
just further complicate an already complicated area.
As for Martin's "ANSI aliasing" bug, XEmacs is not ANSI-aliasing
clean and probably never will be. Unless the board agrees to
change XEmacs in this way (and we really don't want to go down
that road), this is not a bug.
sound.h: Undo Martin's type change.
signal.c: Fix problem identified by Martin with Linux and g++ due to
non-standard declaration of setitimer().
systime.h: Update the docs for "qxe_" to point out why making the
encapsulation explicit is always the right way to go. (setitimer()
itself serves as an example.)
For 21.4:
update-elc-2.el: Correct misplaced parentheses, making lisp/mule not get
recompiled.
author | ben |
---|---|
date | Mon, 18 Jun 2001 07:10:32 +0000 |
parents | 190b164ddcac |
children | fdefd0186b75 |
comparison
equal
deleted
inserted
replaced
616:4f1c7a4ac1e6 | 617:af57a77cbc92 |
---|---|
87 | 87 |
88 struct window | 88 struct window |
89 { | 89 { |
90 struct lcrecord_header header; | 90 struct lcrecord_header header; |
91 | 91 |
92 /* The frame this window is on. */ | |
93 Lisp_Object frame; | |
94 /* t if this window is a minibuffer window. */ | |
95 Lisp_Object mini_p; | |
96 /* Following child (to right or down) at same level of tree */ | |
97 Lisp_Object next; | |
98 /* Preceding child (to left or up) at same level of tree */ | |
99 Lisp_Object prev; | |
100 /* First child of this window. */ | |
101 /* vchild is used if this is a vertical combination, | |
102 hchild if this is a horizontal combination. */ | |
103 Lisp_Object hchild, vchild; | |
104 /* The window this one is a child of. */ | |
105 Lisp_Object parent; | |
106 | |
107 /* The upper left corner coordinates of this window, | 92 /* The upper left corner coordinates of this window, |
108 as integers (pixels) relative to upper left corner of frame = 0, 0 */ | 93 as integers (pixels) relative to upper left corner of frame = 0, 0 */ |
109 int pixel_left; | 94 int pixel_left; |
110 int pixel_top; | 95 int pixel_top; |
111 /* The size of the window (in pixels) */ | 96 /* The size of the window (in pixels) */ |
112 int pixel_height; | 97 int pixel_height; |
113 int pixel_width; | 98 int pixel_width; |
114 | 99 |
115 /* The buffer displayed in this window */ | |
116 /* Of the fields vchild, hchild and buffer, only one is non-nil. */ | |
117 Lisp_Object buffer; | |
118 /* A marker pointing to where in the text to start displaying */ | |
119 /* need one for each set of display structures */ | |
120 Lisp_Object start[3]; | |
121 /* A marker pointing to where in the text point is in this window, | |
122 used only when the window is not selected. | |
123 This exists so that when multiple windows show one buffer | |
124 each one can have its own value of point. */ | |
125 /* need one for each set of display structures */ | |
126 Lisp_Object pointm[3]; | |
127 /* A marker pointing to where in the text the scrollbar is pointing */ | |
128 Lisp_Object sb_point; | |
129 /* Number of columns display within the window is scrolled to the left. */ | 100 /* Number of columns display within the window is scrolled to the left. */ |
130 int hscroll; | 101 int hscroll; |
131 /* Idem for the window's modeline */ | 102 /* Idem for the window's modeline */ |
132 Charcount modeline_hscroll; | 103 Charcount modeline_hscroll; |
133 /* Amount to clip off the top line for pixel-based scrolling. Point | 104 /* Amount to clip off the top line for pixel-based scrolling. Point |
136 int top_yoffset; | 107 int top_yoffset; |
137 /* Amount to clip off the left of the lines for pixel-based | 108 /* Amount to clip off the left of the lines for pixel-based |
138 scrolling. Hscroll will remain constant but this will be | 109 scrolling. Hscroll will remain constant but this will be |
139 incremented to incrementally shift lines left.*/ | 110 incremented to incrementally shift lines left.*/ |
140 int left_xoffset; | 111 int left_xoffset; |
141 /* Number saying how recently window was selected */ | |
142 Lisp_Object use_time; | |
143 /* text.modified of displayed buffer as of last time display completed */ | |
144 Lisp_Object last_modified[3]; | |
145 /* Value of point at that time */ | |
146 Lisp_Object last_point[3]; | |
147 /* Value of start at that time */ | |
148 Lisp_Object last_start[3]; | |
149 /* buf.face_change as of last time display completed */ | |
150 Lisp_Object last_facechange[3]; | |
151 | 112 |
152 /* face cache elements correct for this window and its current buffer */ | 113 /* face cache elements correct for this window and its current buffer */ |
153 face_cachel_dynarr *face_cachels; | 114 face_cachel_dynarr *face_cachels; |
154 /* glyph cache elements correct for this window and its current buffer */ | 115 /* glyph cache elements correct for this window and its current buffer */ |
155 glyph_cachel_dynarr *glyph_cachels; | 116 glyph_cachel_dynarr *glyph_cachels; |
156 /* we cannot have a per-device cache of widgets / subwindows because | |
157 each visible instance needs to be a separate instance. The lowest | |
158 level of granularity we can get easily is the window that the | |
159 subwindow is in. This will fail if we attach the same subwindow | |
160 twice to a buffer. However, we are quite unlikely to do this, | |
161 especially with buttons which will need individual callbacks. The | |
162 proper solution is probably not worth the effort. */ | |
163 Lisp_Object subwindow_instance_cache; | |
164 /* List of starting positions for display lines. Only valid if | 117 /* List of starting positions for display lines. Only valid if |
165 buffer has not changed. */ | 118 buffer has not changed. */ |
166 line_start_cache_dynarr *line_start_cache; | 119 line_start_cache_dynarr *line_start_cache; |
167 Lisp_Object line_cache_last_updated; | |
168 int line_cache_validation_override; | 120 int line_cache_validation_override; |
169 | 121 |
170 /* Length of longest line currently displayed. Used to control the | 122 /* Length of longest line currently displayed. Used to control the |
171 width of the horizontal scrollbars. */ | 123 width of the horizontal scrollbars. */ |
172 int max_line_len; | 124 int max_line_len; |
178 /* Number of characters in buffer past bottom of window, | 130 /* Number of characters in buffer past bottom of window, |
179 as of last redisplay that finished. */ | 131 as of last redisplay that finished. */ |
180 /* need one for each set of display structures */ | 132 /* need one for each set of display structures */ |
181 int window_end_pos[3]; | 133 int window_end_pos[3]; |
182 | 134 |
183 /* If redisplay in this window goes beyond this buffer position, | |
184 must run the redisplay-end-trigger-functions. */ | |
185 Lisp_Object redisplay_end_trigger; | |
186 | |
187 /* Set by the extent code when extents in the gutter are changed. */ | 135 /* Set by the extent code when extents in the gutter are changed. */ |
188 int gutter_extent_modiff[4]; | 136 int gutter_extent_modiff[4]; |
189 | 137 |
190 /* Set by redisplay to the last position seen. This is used | 138 /* Set by redisplay to the last position seen. This is used |
191 to implement the redisplay-end-trigger-functions. */ | 139 to implement the redisplay-end-trigger-functions. */ |
192 Bufpos last_redisplay_pos; | 140 Bufpos last_redisplay_pos; |
193 | 141 |
194 #define WINDOW_SLOT_DECLARATION | 142 #define WINDOW_SLOT_DECLARATION |
195 #define WINDOW_SLOT(slot, compare) Lisp_Object slot | 143 #define WINDOW_SLOT(slot) Lisp_Object slot; |
196 #include "winslots.h" | 144 #include "winslots.h" |
197 | 145 |
198 /* one-bit flags: */ | 146 /* one-bit flags: */ |
199 | 147 |
200 /* marker used when restoring a window configuration */ | 148 /* marker used when restoring a window configuration */ |
215 /* Vertical divider flag and validity of it */ | 163 /* Vertical divider flag and validity of it */ |
216 unsigned int need_vertical_divider_p :1; | 164 unsigned int need_vertical_divider_p :1; |
217 unsigned int need_vertical_divider_valid_p :1; | 165 unsigned int need_vertical_divider_valid_p :1; |
218 }; | 166 }; |
219 | 167 |
168 DECLARE_LRECORD (window, struct window); | |
169 #define XWINDOW(x) XRECORD (x, window, struct window) | |
170 #define XSETWINDOW(x, p) XSETRECORD (x, p, window) | |
171 #define wrap_window(p) wrap_record (p, window) | |
172 #define WINDOWP(x) RECORDP (x, window) | |
173 #define CHECK_WINDOW(x) CHECK_RECORD (x, window) | |
174 #define CONCHECK_WINDOW(x) CONCHECK_RECORD (x, window) | |
175 | |
220 #define CURRENT_DISP 0 | 176 #define CURRENT_DISP 0 |
221 #define DESIRED_DISP 1 | 177 #define DESIRED_DISP 1 |
222 #define CMOTION_DISP 2 | 178 #define CMOTION_DISP 2 |
223 | 179 |
224 struct window_mirror | 180 struct window_mirror |
225 { | 181 { |
182 struct lcrecord_header header; | |
183 | |
226 /* Frame this mirror is on. */ | 184 /* Frame this mirror is on. */ |
227 struct frame *frame; | 185 struct frame *frame; |
228 | 186 |
229 /* Following child (to right or down) at same level of tree */ | 187 /* Following child (to right or down) at same level of tree */ |
230 struct window_mirror *next; | 188 struct window_mirror *next; |
257 detect when it has changed. #### Magic variables would be a huge | 215 detect when it has changed. #### Magic variables would be a huge |
258 win here. */ | 216 win here. */ |
259 unsigned int truncate_win :1; | 217 unsigned int truncate_win :1; |
260 }; | 218 }; |
261 | 219 |
262 #ifdef emacs /* some things other than emacs want the structs */ | 220 DECLARE_LRECORD (window_mirror, struct window_mirror); |
263 | 221 #define XWINDOW_MIRROR(x) XRECORD (x, window_mirror, struct window_mirror) |
264 DECLARE_LRECORD (window, struct window); | 222 #define XSETWINDOW_MIRROR(x, p) XSETRECORD (x, p, window_mirror) |
265 #define XWINDOW(x) XRECORD (x, window, struct window) | 223 #define wrap_window_mirror(p) wrap_record (p, window_mirror) |
266 #define XSETWINDOW(x, p) XSETRECORD (x, p, window) | 224 #define WINDOW_MIRRORP(x) RECORDP (x, window_mirror) |
267 #define WINDOWP(x) RECORDP (x, window) | 225 #define CHECK_WINDOW_MIRROR(x) CHECK_RECORD (x, window_mirror) |
268 #define CHECK_WINDOW(x) CHECK_RECORD (x, window) | 226 #define CONCHECK_WINDOW_MIRROR(x) CONCHECK_RECORD (x, window_mirror) |
269 #define CONCHECK_WINDOW(x) CONCHECK_RECORD (x, window) | |
270 | 227 |
271 #define WINDOW_LIVE_P(x) (!(x)->dead) | 228 #define WINDOW_LIVE_P(x) (!(x)->dead) |
272 #define CHECK_LIVE_WINDOW(x) do { \ | 229 #define CHECK_LIVE_WINDOW(x) do { \ |
273 CHECK_WINDOW (x); \ | 230 CHECK_WINDOW (x); \ |
274 if (!WINDOW_LIVE_P (XWINDOW (x))) \ | 231 if (!WINDOW_LIVE_P (XWINDOW (x))) \ |
373 int frame_pixsize_valid_p (struct frame *frame, int width, int height); | 330 int frame_pixsize_valid_p (struct frame *frame, int width, int height); |
374 int frame_size_valid_p (struct frame *frame, int rows, int cols); | 331 int frame_size_valid_p (struct frame *frame, int rows, int cols); |
375 struct window *decode_window (Lisp_Object window); | 332 struct window *decode_window (Lisp_Object window); |
376 struct window *find_window_by_pixel_pos (int pix_x, int pix_y, Lisp_Object win); | 333 struct window *find_window_by_pixel_pos (int pix_x, int pix_y, Lisp_Object win); |
377 | 334 |
378 /* new functions to handle the window mirror */ | |
379 void free_window_mirror (struct window_mirror *mir); | 335 void free_window_mirror (struct window_mirror *mir); |
380 Lisp_Object real_window (struct window_mirror *mir, int no_abort); | 336 Lisp_Object real_window (struct window_mirror *mir, int no_abort); |
381 struct window_mirror *find_window_mirror (struct window *w); | 337 struct window_mirror *find_window_mirror (struct window *w); |
382 display_line_dynarr *window_display_lines (struct window *w, int); | 338 display_line_dynarr *window_display_lines (struct window *w, int); |
383 struct buffer *window_display_buffer (struct window *w); | 339 struct buffer *window_display_buffer (struct window *w); |
437 #define MODELINE_SHADOW_THICKNESS(win) \ | 393 #define MODELINE_SHADOW_THICKNESS(win) \ |
438 (MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win) > 10 \ | 394 (MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win) > 10 \ |
439 ? 10 \ | 395 ? 10 \ |
440 : MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win)) | 396 : MODELINE_OFF_SHADOW_THICKNESS_ADJUSTED (win)) |
441 | 397 |
442 #endif /* emacs */ | |
443 | |
444 #endif /* INCLUDED_window_h_ */ | 398 #endif /* INCLUDED_window_h_ */ |