Mercurial > hg > xemacs-beta
comparison src/window.c @ 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 | 16ff693bd768 |
comparison
equal
deleted
inserted
replaced
616:4f1c7a4ac1e6 | 617:af57a77cbc92 |
---|---|
147 | 147 |
148 static Lisp_Object | 148 static Lisp_Object |
149 mark_window (Lisp_Object obj) | 149 mark_window (Lisp_Object obj) |
150 { | 150 { |
151 struct window *window = XWINDOW (obj); | 151 struct window *window = XWINDOW (obj); |
152 mark_object (window->frame); | |
153 mark_object (window->mini_p); | |
154 mark_object (window->next); | |
155 mark_object (window->prev); | |
156 mark_object (window->hchild); | |
157 mark_object (window->vchild); | |
158 mark_object (window->parent); | |
159 mark_object (window->buffer); | |
160 MARK_DISP_VARIABLE (start); | |
161 MARK_DISP_VARIABLE (pointm); | |
162 mark_object (window->sb_point); /* #### move to scrollbar.c? */ | |
163 mark_object (window->use_time); | |
164 MARK_DISP_VARIABLE (last_modified); | |
165 MARK_DISP_VARIABLE (last_point); | |
166 MARK_DISP_VARIABLE (last_start); | |
167 MARK_DISP_VARIABLE (last_facechange); | |
168 mark_object (window->line_cache_last_updated); | |
169 mark_object (window->redisplay_end_trigger); | |
170 mark_object (window->subwindow_instance_cache); | |
171 | 152 |
172 mark_face_cachels (window->face_cachels); | 153 mark_face_cachels (window->face_cachels); |
173 mark_glyph_cachels (window->glyph_cachels); | 154 mark_glyph_cachels (window->glyph_cachels); |
174 | 155 |
175 #define WINDOW_SLOT(slot, compare) mark_object (window->slot) | 156 #define WINDOW_SLOT(slot) mark_object (window->slot); |
176 #include "winslots.h" | 157 #include "winslots.h" |
177 | 158 |
178 return Qnil; | 159 return Qnil; |
179 } | 160 } |
180 | 161 |
259 | 240 |
260 zero_lcrecord (p); | 241 zero_lcrecord (p); |
261 XSETWINDOW (val, p); | 242 XSETWINDOW (val, p); |
262 | 243 |
263 p->dead = 0; | 244 p->dead = 0; |
264 p->frame = Qnil; | 245 |
265 p->mini_p = Qnil; | 246 #define WINDOW_SLOT(slot) p->slot = Qnil; |
266 p->next = Qnil; | 247 #include "winslots.h" |
267 p->prev = Qnil; | 248 |
268 p->hchild = Qnil; | |
269 p->vchild = Qnil; | |
270 p->parent = Qnil; | |
271 p->buffer = Qnil; | |
272 INIT_DISP_VARIABLE (start, Fmake_marker ()); | 249 INIT_DISP_VARIABLE (start, Fmake_marker ()); |
273 INIT_DISP_VARIABLE (pointm, Fmake_marker ()); | 250 INIT_DISP_VARIABLE (pointm, Fmake_marker ()); |
274 p->sb_point = Fmake_marker (); | 251 p->sb_point = Fmake_marker (); |
275 p->use_time = Qzero; | 252 p->use_time = Qzero; |
276 INIT_DISP_VARIABLE (last_modified, Qzero); | 253 INIT_DISP_VARIABLE (last_modified, Qzero); |
284 | 261 |
285 p->line_cache_last_updated = Qzero; | 262 p->line_cache_last_updated = Qzero; |
286 INIT_DISP_VARIABLE (last_point_x, 0); | 263 INIT_DISP_VARIABLE (last_point_x, 0); |
287 INIT_DISP_VARIABLE (last_point_y, 0); | 264 INIT_DISP_VARIABLE (last_point_y, 0); |
288 INIT_DISP_VARIABLE (window_end_pos, 0); | 265 INIT_DISP_VARIABLE (window_end_pos, 0); |
289 p->redisplay_end_trigger = Qnil; | |
290 | 266 |
291 p->gutter_extent_modiff[0] = 0; | 267 p->gutter_extent_modiff[0] = 0; |
292 p->gutter_extent_modiff[1] = 0; | 268 p->gutter_extent_modiff[1] = 0; |
293 p->gutter_extent_modiff[2] = 0; | 269 p->gutter_extent_modiff[2] = 0; |
294 p->gutter_extent_modiff[3] = 0; | 270 p->gutter_extent_modiff[3] = 0; |
295 | 271 |
296 #define WINDOW_SLOT(slot, compare) p->slot = Qnil | |
297 #include "winslots.h" | |
298 | |
299 p->windows_changed = 1; | 272 p->windows_changed = 1; |
300 p->shadow_thickness_changed = 1; | 273 p->shadow_thickness_changed = 1; |
301 | 274 |
302 return val; | 275 return val; |
303 } | 276 } |
304 #undef INIT_DISP_VARIABLE | 277 #undef INIT_DISP_VARIABLE |
278 | |
279 /************************************************************************/ | |
280 /* Window mirror structure */ | |
281 /************************************************************************/ | |
305 | 282 |
306 /* | 283 /* |
307 * The redisplay structures used to be stored with each window. While | 284 * The redisplay structures used to be stored with each window. While |
308 * they are logically something associated with frames they can't be | 285 * they are logically something associated with frames they can't be |
309 * stored there with a redisplay which handles variable height lines. | 286 * stored there with a redisplay which handles variable height lines. |
320 * It also becomes a convenient place to stick scrollbar instances | 297 * It also becomes a convenient place to stick scrollbar instances |
321 * since they extrapolate out to having the same problem described for | 298 * since they extrapolate out to having the same problem described for |
322 * the display structures. | 299 * the display structures. |
323 */ | 300 */ |
324 | 301 |
302 /* NOTE: The window-mirror structure formerly was not a Lisp object, and | |
303 marking was handled specially. I've gotten recurring crashes, however, | |
304 using the mouse wheel under Windows, where either the window mirror | |
305 accessed through a scrollbar instance, or the frame pointed to by that | |
306 window mirror, gets garbaged. Things are tricky under windows because | |
307 the scrollbar instances are stored in HWND-specific data. Furthermore, | |
308 we have scrollbar-instance caches to complicate things. Both of these | |
309 make it very difficult (for me at least, not being intimately familiar | |
310 with the redisplay code) to track exactly when and where a particular | |
311 window mirror or scrollbar instance has pointers to it, or whether a | |
312 window mirror might have a dead frame or buffer in it (i.e. not | |
313 necessarily gc-protected by being on a global list). By far the safest | |
314 thing, then, is to make both structures Lisp objects and not explicitly | |
315 xfree() them. This should make no practical difference in memory usage | |
316 because neither structure is created very often (only when windows are | |
317 created or deleted). --ben */ | |
318 | |
319 static Lisp_Object | |
320 mark_window_mirror (Lisp_Object obj) | |
321 { | |
322 struct window_mirror *mir = XWINDOW_MIRROR (obj); | |
323 | |
324 if (mir->current_display_lines) | |
325 mark_redisplay_structs (mir->current_display_lines); | |
326 if (mir->desired_display_lines) | |
327 mark_redisplay_structs (mir->desired_display_lines); | |
328 | |
329 if (mir->hchild) | |
330 mark_object (wrap_window_mirror (mir->hchild)); | |
331 if (mir->vchild) | |
332 mark_object (wrap_window_mirror (mir->vchild)); | |
333 | |
334 if (mir->frame) | |
335 mark_object (wrap_frame (mir->frame)); | |
336 if (mir->buffer) | |
337 mark_object (wrap_buffer (mir->buffer)); | |
338 | |
339 #ifdef HAVE_SCROLLBARS | |
340 if (mir->scrollbar_vertical_instance) | |
341 mark_object (wrap_scrollbar_instance (mir->scrollbar_vertical_instance)); | |
342 if (mir->scrollbar_horizontal_instance) | |
343 mark_object (wrap_scrollbar_instance (mir->scrollbar_horizontal_instance)); | |
344 #endif /* HAVE_SCROLLBARS */ | |
345 if (mir->next) | |
346 return wrap_window_mirror (mir->next); | |
347 else | |
348 return Qnil; | |
349 } | |
350 | |
351 DEFINE_LRECORD_IMPLEMENTATION ("window-mirror", window_mirror, | |
352 mark_window_mirror, internal_object_printer, | |
353 0, 0, 0, 0, struct window_mirror); | |
354 | |
325 /* Create a new window mirror structure and associated redisplay | 355 /* Create a new window mirror structure and associated redisplay |
326 structs. */ | 356 structs. */ |
327 static struct window_mirror * | 357 static struct window_mirror * |
328 new_window_mirror (struct frame *f) | 358 new_window_mirror (struct frame *f) |
329 { | 359 { |
330 struct window_mirror *t = xnew_and_zero (struct window_mirror); | 360 struct window_mirror *t = |
361 alloc_lcrecord_type (struct window_mirror, &lrecord_window_mirror); | |
362 zero_lcrecord (t); | |
331 | 363 |
332 t->frame = f; | 364 t->frame = f; |
333 | |
334 t->current_display_lines = Dynarr_new (display_line); | 365 t->current_display_lines = Dynarr_new (display_line); |
335 t->desired_display_lines = Dynarr_new (display_line); | 366 t->desired_display_lines = Dynarr_new (display_line); |
336 t->buffer = NULL; | |
337 | |
338 #ifdef HAVE_SCROLLBARS | |
339 t->scrollbar_vertical_instance = NULL; | |
340 t->scrollbar_horizontal_instance = NULL; | |
341 #endif | |
342 | 367 |
343 return t; | 368 return t; |
344 } | 369 } |
345 | 370 |
346 /* Synchronize the mirror structure with a given window structure. | 371 /* Synchronize the mirror structure with a given window structure. |
454 | 479 |
455 /* Update the mirror structure for the given frame. */ | 480 /* Update the mirror structure for the given frame. */ |
456 void | 481 void |
457 update_frame_window_mirror (struct frame *f) | 482 update_frame_window_mirror (struct frame *f) |
458 { | 483 { |
459 f->root_mirror = update_mirror_internal (f->root_window, f->root_mirror); | 484 f->root_mirror = |
485 wrap_window_mirror (update_mirror_internal | |
486 (f->root_window, | |
487 NILP (f->root_mirror) ? 0 : | |
488 XWINDOW_MIRROR (f->root_mirror))); | |
460 f->mirror_dirty = 0; | 489 f->mirror_dirty = 0; |
461 } | 490 } |
462 | 491 |
463 /* Free a given mirror structure along with all of its children as | 492 /* Free a given mirror structure along with all of its children as |
464 well as their associated display structures. */ | 493 well as their associated display structures. */ |
465 void | 494 void |
466 free_window_mirror (struct window_mirror *mir) | 495 free_window_mirror (struct window_mirror *mir) |
467 { | 496 { |
468 while (mir) | 497 while (mir) |
469 { | 498 { |
470 struct window_mirror *prev = mir; | |
471 if (mir->hchild) free_window_mirror (mir->hchild); | 499 if (mir->hchild) free_window_mirror (mir->hchild); |
472 if (mir->vchild) free_window_mirror (mir->vchild); | 500 if (mir->vchild) free_window_mirror (mir->vchild); |
473 #ifdef HAVE_SCROLLBARS | 501 #ifdef HAVE_SCROLLBARS |
474 release_window_mirror_scrollbars (mir); | 502 release_window_mirror_scrollbars (mir); |
475 #endif | 503 #endif |
476 free_display_structs (mir); | 504 free_display_structs (mir); |
477 mir = mir->next; | 505 mir = mir->next; |
478 xfree (prev); | 506 /* not worth calling free_managed_lcrecord() -- window mirrors |
507 are not created that frequently and it's dangerous. we don't | |
508 know for sure that there aren't other pointers around -- e.g. | |
509 in a scrollbar instance. */ | |
479 } | 510 } |
480 } | 511 } |
481 | 512 |
482 /* Given a mirror structure, return the window it mirrors. Calls | 513 /* Given a mirror structure, return the window it mirrors. Calls |
483 real_window_internal to do most of the work. */ | 514 real_window_internal to do most of the work. */ |
484 Lisp_Object | 515 Lisp_Object |
485 real_window (struct window_mirror *mir, int no_abort) | 516 real_window (struct window_mirror *mir, int no_abort) |
486 { | 517 { |
487 Lisp_Object retval = real_window_internal (mir->frame->root_window, | 518 Lisp_Object retval = |
488 mir->frame->root_mirror, mir); | 519 real_window_internal (mir->frame->root_window, |
520 XWINDOW_MIRROR (mir->frame->root_mirror), mir); | |
489 if (NILP (retval) && !no_abort) | 521 if (NILP (retval) && !no_abort) |
490 abort (); | 522 abort (); |
491 | 523 |
492 return retval; | 524 return retval; |
493 } | 525 } |
498 find_window_mirror (struct window *w) | 530 find_window_mirror (struct window *w) |
499 { | 531 { |
500 struct frame *f = XFRAME (w->frame); | 532 struct frame *f = XFRAME (w->frame); |
501 if (f->mirror_dirty) | 533 if (f->mirror_dirty) |
502 update_frame_window_mirror (f); | 534 update_frame_window_mirror (f); |
503 return find_window_mirror_internal (f->root_window, f->root_mirror, w); | 535 return find_window_mirror_internal (f->root_window, |
536 XWINDOW_MIRROR (f->root_mirror), w); | |
504 } | 537 } |
505 | 538 |
506 /***************************************************************************** | 539 /***************************************************************************** |
507 find_window_by_pixel_pos | 540 find_window_by_pixel_pos |
508 | 541 |
1902 going away, it is safer to just unmap them all while we know the | 1935 going away, it is safer to just unmap them all while we know the |
1903 domain is still valid. */ | 1936 domain is still valid. */ |
1904 ERROR_CHECK_SUBWINDOW_CACHE (w); | 1937 ERROR_CHECK_SUBWINDOW_CACHE (w); |
1905 window_unmap_subwindows (w); | 1938 window_unmap_subwindows (w); |
1906 | 1939 |
1907 /* In the loop | 1940 /* Free the extra data structures attached to windows immediately so |
1941 they don't sit around consuming excess space. They will be | |
1942 reinitialized by the window-configuration code as necessary. */ | |
1943 finalize_window ((void *) w, 0); | |
1944 | |
1945 /* Nobody should be accessing anything in this object any more, and | |
1946 making them Qnil allows for better GC'ing in case a pointer to | |
1947 the dead window continues to hang around. Zero all other structs | |
1948 in case someone tries to access something through them. | |
1949 | |
1950 As an example of why setting the values to Qnil is good, here | |
1951 is an old comment: | |
1952 | |
1953 In the loop | |
1908 (while t (split-window) (delete-window)) | 1954 (while t (split-window) (delete-window)) |
1909 we end up with a tree of deleted windows which are all connected | 1955 we end up with a tree of deleted windows which are all connected |
1910 through the `next' slot. This might not seem so bad, as they're | 1956 through the `next' slot. This might not seem so bad, as they're |
1911 deleted, and will presumably be GCed - but if even *one* of those | 1957 deleted, and will presumably be GCed - but if even *one* of those |
1912 windows is still being pointed to, by the user, or by a window | 1958 windows is still being pointed to, by the user, or by a window |
1914 | 1960 |
1915 Since the window-configuration code doesn't need any of the | 1961 Since the window-configuration code doesn't need any of the |
1916 pointers to other windows (they are all recreated from the | 1962 pointers to other windows (they are all recreated from the |
1917 window-config data), we set them all to nil so that we | 1963 window-config data), we set them all to nil so that we |
1918 are able to collect more actual garbage. */ | 1964 are able to collect more actual garbage. */ |
1919 w->next = Qnil; | 1965 |
1920 w->prev = Qnil; | 1966 zero_lcrecord (w); |
1921 w->hchild = Qnil; | 1967 |
1922 w->vchild = Qnil; | 1968 #define WINDOW_SLOT(slot) w->slot = Qnil; |
1923 w->parent = Qnil; | 1969 #include "winslots.h" |
1924 w->subwindow_instance_cache = Qnil; | |
1925 | 1970 |
1926 w->dead = 1; | 1971 w->dead = 1; |
1927 | |
1928 /* Free the extra data structures attached to windows immediately so | |
1929 they don't sit around consuming excess space. They will be | |
1930 reinitialized by the window-configuration code as necessary. */ | |
1931 finalize_window ((void *) w, 0); | |
1932 } | 1972 } |
1933 | 1973 |
1934 DEFUN ("delete-window", Fdelete_window, 0, 2, "", /* | 1974 DEFUN ("delete-window", Fdelete_window, 0, 2, "", /* |
1935 Remove WINDOW from the display. Default is selected window. | 1975 Remove WINDOW from the display. Default is selected window. |
1936 If window is the only one on its frame, the frame is deleted as well. | 1976 If window is the only one on its frame, the frame is deleted as well. |
5000 int parent_index; /* index into saved_windows */ | 5040 int parent_index; /* index into saved_windows */ |
5001 int prev_index; /* index into saved_windows */ | 5041 int prev_index; /* index into saved_windows */ |
5002 char start_at_line_beg; /* boolean */ | 5042 char start_at_line_beg; /* boolean */ |
5003 | 5043 |
5004 #define WINDOW_SLOT_DECLARATION | 5044 #define WINDOW_SLOT_DECLARATION |
5005 #define WINDOW_SLOT(slot, compare) Lisp_Object slot | 5045 #define WINDOW_SLOT(slot) |
5046 #define WINDOW_SAVED_SLOT(slot, compare) Lisp_Object slot; | |
5006 #include "winslots.h" | 5047 #include "winslots.h" |
5007 }; | 5048 }; |
5008 | 5049 |
5009 /* If you add anything to this structure make sure window_config_equal | 5050 /* If you add anything to this structure make sure window_config_equal |
5010 knows about it. */ | 5051 knows about it. */ |
5030 }; | 5071 }; |
5031 | 5072 |
5032 #define SAVED_WINDOW_N(conf, n) (&((conf)->saved_windows[(n)])) | 5073 #define SAVED_WINDOW_N(conf, n) (&((conf)->saved_windows[(n)])) |
5033 #define XWINDOW_CONFIGURATION(x) XRECORD (x, window_configuration, struct window_config) | 5074 #define XWINDOW_CONFIGURATION(x) XRECORD (x, window_configuration, struct window_config) |
5034 #define XSETWINDOW_CONFIGURATION(x, p) XSETRECORD (x, p, window_configuration) | 5075 #define XSETWINDOW_CONFIGURATION(x, p) XSETRECORD (x, p, window_configuration) |
5076 #define wrap_window_configuration(p) wrap_record (p, window_configuration) | |
5035 #define WINDOW_CONFIGURATIONP(x) RECORDP (x, window_configuration) | 5077 #define WINDOW_CONFIGURATIONP(x) RECORDP (x, window_configuration) |
5036 #define CHECK_WINDOW_CONFIGURATION(x) CHECK_RECORD (x, window_configuration) | 5078 #define CHECK_WINDOW_CONFIGURATION(x) CHECK_RECORD (x, window_configuration) |
5037 | 5079 |
5038 static Lisp_Object | 5080 static Lisp_Object |
5039 mark_window_config (Lisp_Object obj) | 5081 mark_window_config (Lisp_Object obj) |
5059 values should not be marked, as such specifiers as toolbars | 5101 values should not be marked, as such specifiers as toolbars |
5060 might have GC-able instances. Freed configs are not marked, | 5102 might have GC-able instances. Freed configs are not marked, |
5061 aren't they? -- kkm */ | 5103 aren't they? -- kkm */ |
5062 mark_object (s->dedicated); | 5104 mark_object (s->dedicated); |
5063 #else | 5105 #else |
5064 #define WINDOW_SLOT(slot, compare) mark_object (s->slot) | 5106 #define WINDOW_SLOT(slot) |
5107 #define WINDOW_SAVED_SLOT(slot, compare) mark_object (s->slot); | |
5065 #include "winslots.h" | 5108 #include "winslots.h" |
5066 #endif | 5109 #endif |
5067 } | 5110 } |
5068 return Qnil; | 5111 return Qnil; |
5069 } | 5112 } |
5106 /* Returns a boolean indicating whether the two saved windows are | 5149 /* Returns a boolean indicating whether the two saved windows are |
5107 identical. */ | 5150 identical. */ |
5108 static int | 5151 static int |
5109 saved_window_equal (struct saved_window *win1, struct saved_window *win2) | 5152 saved_window_equal (struct saved_window *win1, struct saved_window *win2) |
5110 { | 5153 { |
5111 #define WINDOW_SLOT(slot, compare) \ | 5154 #define WINDOW_SLOT(slot) |
5155 #define WINDOW_SAVED_SLOT(slot, compare) \ | |
5112 if (!compare (win1->slot, win2->slot)) \ | 5156 if (!compare (win1->slot, win2->slot)) \ |
5113 return 0; | 5157 return 0; |
5114 #include "winslots.h" | 5158 #include "winslots.h" |
5115 | 5159 |
5116 return | 5160 return |
5496 | 5540 |
5497 SET_LAST_MODIFIED (w, 1); | 5541 SET_LAST_MODIFIED (w, 1); |
5498 SET_LAST_FACECHANGE (w); | 5542 SET_LAST_FACECHANGE (w); |
5499 w->config_mark = 0; | 5543 w->config_mark = 0; |
5500 | 5544 |
5501 /* #### Consider making the instance cache a winslot. */ | 5545 /* #### Consider making the instance cache a WINDOW_SAVED_SLOT. */ |
5502 #define WINDOW_SLOT(slot, compare) w->slot = p->slot | 5546 #define WINDOW_SLOT(slot) |
5547 #define WINDOW_SAVED_SLOT(slot, compare) w->slot = p->slot; | |
5503 #include "winslots.h" | 5548 #include "winslots.h" |
5504 | 5549 |
5505 /* Reinstall the saved buffer and pointers into it. */ | 5550 /* Reinstall the saved buffer and pointers into it. */ |
5506 if (NILP (p->buffer)) | 5551 if (NILP (p->buffer)) |
5507 w->buffer = p->buffer; | 5552 w->buffer = p->buffer; |
5782 WINDOW_WIDTH (p) = WINDOW_WIDTH (w); | 5827 WINDOW_WIDTH (p) = WINDOW_WIDTH (w); |
5783 WINDOW_HEIGHT (p) = WINDOW_HEIGHT (w); | 5828 WINDOW_HEIGHT (p) = WINDOW_HEIGHT (w); |
5784 p->hscroll = w->hscroll; | 5829 p->hscroll = w->hscroll; |
5785 p->modeline_hscroll = w->modeline_hscroll; | 5830 p->modeline_hscroll = w->modeline_hscroll; |
5786 | 5831 |
5787 #define WINDOW_SLOT(slot, compare) p->slot = w->slot | 5832 #define WINDOW_SLOT(slot) |
5833 #define WINDOW_SAVED_SLOT(slot, compare) p->slot = w->slot; | |
5788 #include "winslots.h" | 5834 #include "winslots.h" |
5789 | 5835 |
5790 if (!NILP (w->buffer)) | 5836 if (!NILP (w->buffer)) |
5791 { | 5837 { |
5792 /* Save w's value of point in the window configuration. | 5838 /* Save w's value of point in the window configuration. |
6061 void | 6107 void |
6062 syms_of_window (void) | 6108 syms_of_window (void) |
6063 { | 6109 { |
6064 INIT_LRECORD_IMPLEMENTATION (window); | 6110 INIT_LRECORD_IMPLEMENTATION (window); |
6065 INIT_LRECORD_IMPLEMENTATION (window_configuration); | 6111 INIT_LRECORD_IMPLEMENTATION (window_configuration); |
6112 INIT_LRECORD_IMPLEMENTATION (window_mirror); | |
6066 | 6113 |
6067 DEFSYMBOL (Qwindowp); | 6114 DEFSYMBOL (Qwindowp); |
6068 DEFSYMBOL (Qwindow_live_p); | 6115 DEFSYMBOL (Qwindow_live_p); |
6069 DEFSYMBOL_MULTIWORD_PREDICATE (Qwindow_configurationp); | 6116 DEFSYMBOL_MULTIWORD_PREDICATE (Qwindow_configurationp); |
6070 DEFSYMBOL (Qtemp_buffer_show_hook); | 6117 DEFSYMBOL (Qtemp_buffer_show_hook); |