Mercurial > hg > xemacs-beta
comparison src/window.c @ 5140:e5380fdaf8f1
merge
| author | Ben Wing <ben@xemacs.org> |
|---|---|
| date | Sat, 13 Mar 2010 05:38:34 -0600 |
| parents | 7be849cb8828 |
| children | f965e31a35f0 |
comparison
equal
deleted
inserted
replaced
| 5139:a48ef26d87ee | 5140:e5380fdaf8f1 |
|---|---|
| 180 { XD_LISP_OBJECT, offsetof (face_cachel, background_pixmap) }, | 180 { XD_LISP_OBJECT, offsetof (face_cachel, background_pixmap) }, |
| 181 { XD_END } | 181 { XD_END } |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 #ifdef NEW_GC | 184 #ifdef NEW_GC |
| 185 DEFINE_LRECORD_IMPLEMENTATION ("face-cachel", face_cachel, | 185 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("face-cachel", face_cachel, |
| 186 1, /*dumpable-flag*/ | 186 0, face_cachel_description_1, |
| 187 0, 0, 0, 0, 0, | 187 Lisp_Face_Cachel); |
| 188 face_cachel_description_1, | |
| 189 Lisp_Face_Cachel); | |
| 190 #endif /* NEW_GC */ | 188 #endif /* NEW_GC */ |
| 191 | 189 |
| 192 static const struct sized_memory_description face_cachel_description = { | 190 static const struct sized_memory_description face_cachel_description = { |
| 193 sizeof (face_cachel), | 191 sizeof (face_cachel), |
| 194 face_cachel_description_1 | 192 face_cachel_description_1 |
| 202 #endif /* not NEW_GC */ | 200 #endif /* not NEW_GC */ |
| 203 { XD_END } | 201 { XD_END } |
| 204 }; | 202 }; |
| 205 | 203 |
| 206 #ifdef NEW_GC | 204 #ifdef NEW_GC |
| 207 DEFINE_LRECORD_IMPLEMENTATION ("face-cachel-dynarr", face_cachel_dynarr, | 205 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("face-cachel-dynarr", face_cachel_dynarr, |
| 208 1, /*dumpable-flag*/ | 206 0, face_cachel_dynarr_description_1, |
| 209 0, 0, 0, 0, 0, | 207 face_cachel_dynarr); |
| 210 face_cachel_dynarr_description_1, | |
| 211 face_cachel_dynarr); | |
| 212 #else /* not NEW_GC */ | 208 #else /* not NEW_GC */ |
| 213 static const struct sized_memory_description face_cachel_dynarr_description = { | 209 static const struct sized_memory_description face_cachel_dynarr_description = { |
| 214 sizeof (face_cachel_dynarr), | 210 sizeof (face_cachel_dynarr), |
| 215 face_cachel_dynarr_description_1 | 211 face_cachel_dynarr_description_1 |
| 216 }; | 212 }; |
| 220 { XD_LISP_OBJECT, offsetof (glyph_cachel, glyph) }, | 216 { XD_LISP_OBJECT, offsetof (glyph_cachel, glyph) }, |
| 221 { XD_END } | 217 { XD_END } |
| 222 }; | 218 }; |
| 223 | 219 |
| 224 #ifdef NEW_GC | 220 #ifdef NEW_GC |
| 225 DEFINE_LRECORD_IMPLEMENTATION ("glyph-cachel", glyph_cachel, | 221 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("glyph-cachel", glyph_cachel, |
| 226 1, /*dumpable-flag*/ | 222 0, glyph_cachel_description_1, |
| 227 0, 0, 0, 0, 0, | 223 Lisp_Glyph_Cachel); |
| 228 glyph_cachel_description_1, | |
| 229 Lisp_Glyph_Cachel); | |
| 230 #endif /* NEW_GC */ | 224 #endif /* NEW_GC */ |
| 231 | 225 |
| 232 static const struct sized_memory_description glyph_cachel_description = { | 226 static const struct sized_memory_description glyph_cachel_description = { |
| 233 sizeof (glyph_cachel), | 227 sizeof (glyph_cachel), |
| 234 glyph_cachel_description_1 | 228 glyph_cachel_description_1 |
| 242 #endif /* not NEW_GC */ | 236 #endif /* not NEW_GC */ |
| 243 { XD_END } | 237 { XD_END } |
| 244 }; | 238 }; |
| 245 | 239 |
| 246 #ifdef NEW_GC | 240 #ifdef NEW_GC |
| 247 DEFINE_LRECORD_IMPLEMENTATION ("glyph-cachel-dynarr", glyph_cachel_dynarr, | 241 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("glyph-cachel-dynarr", |
| 248 1, /*dumpable-flag*/ | 242 glyph_cachel_dynarr, 0, |
| 249 0, 0, 0, 0, 0, | 243 glyph_cachel_dynarr_description_1, |
| 250 glyph_cachel_dynarr_description_1, | 244 glyph_cachel_dynarr); |
| 251 glyph_cachel_dynarr); | |
| 252 #else /* not NEW_GC */ | 245 #else /* not NEW_GC */ |
| 253 static const struct sized_memory_description glyph_cachel_dynarr_description = { | 246 static const struct sized_memory_description glyph_cachel_dynarr_description = { |
| 254 sizeof (glyph_cachel_dynarr), | 247 sizeof (glyph_cachel_dynarr), |
| 255 glyph_cachel_dynarr_description_1 | 248 glyph_cachel_dynarr_description_1 |
| 256 }; | 249 }; |
| 330 } | 323 } |
| 331 write_fmt_string (printcharfun, " 0x%x>", XWINDOW (obj)->header.uid); | 324 write_fmt_string (printcharfun, " 0x%x>", XWINDOW (obj)->header.uid); |
| 332 } | 325 } |
| 333 | 326 |
| 334 static void | 327 static void |
| 335 finalize_window (void *header, int UNUSED (for_disksave)) | 328 finalize_window (Lisp_Object obj) |
| 336 { | 329 { |
| 337 struct window *w = (struct window *) header; | 330 struct window *w = XWINDOW (obj); |
| 338 | 331 |
| 339 if (w->line_start_cache) | 332 if (w->line_start_cache) |
| 340 { | 333 { |
| 341 Dynarr_free (w->line_start_cache); | 334 Dynarr_free (w->line_start_cache); |
| 342 w->line_start_cache = 0; | 335 w->line_start_cache = 0; |
| 373 make_saved_buffer_point_cache (void) | 366 make_saved_buffer_point_cache (void) |
| 374 { | 367 { |
| 375 return make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); | 368 return make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); |
| 376 } | 369 } |
| 377 | 370 |
| 378 DEFINE_LRECORD_IMPLEMENTATION ("window", window, | 371 DEFINE_NODUMP_LISP_OBJECT ("window", window, |
| 379 0, /*dumpable-flag*/ | 372 mark_window, print_window, finalize_window, |
| 380 mark_window, print_window, finalize_window, | 373 0, 0, window_description, struct window); |
| 381 0, 0, window_description, struct window); | |
| 382 | 374 |
| 383 #define INIT_DISP_VARIABLE(field, initialization) \ | 375 #define INIT_DISP_VARIABLE(field, initialization) \ |
| 384 p->field[CURRENT_DISP] = initialization; \ | 376 p->field[CURRENT_DISP] = initialization; \ |
| 385 p->field[DESIRED_DISP] = initialization; \ | 377 p->field[DESIRED_DISP] = initialization; \ |
| 386 p->field[CMOTION_DISP] = initialization; | 378 p->field[CMOTION_DISP] = initialization; |
| 395 here because the window must have its frame pointer set or | 387 here because the window must have its frame pointer set or |
| 396 reset_face_cachels will fail. */ | 388 reset_face_cachels will fail. */ |
| 397 Lisp_Object | 389 Lisp_Object |
| 398 allocate_window (void) | 390 allocate_window (void) |
| 399 { | 391 { |
| 400 struct window *p = ALLOC_LCRECORD_TYPE (struct window, &lrecord_window); | 392 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (window); |
| 401 Lisp_Object val = wrap_window (p); | 393 struct window *p = XWINDOW (obj); |
| 402 | 394 |
| 403 #define WINDOW_SLOT(slot) p->slot = Qnil; | 395 #define WINDOW_SLOT(slot) p->slot = Qnil; |
| 404 #include "winslots.h" | 396 #include "winslots.h" |
| 405 | 397 |
| 406 INIT_DISP_VARIABLE (start, Fmake_marker ()); | 398 INIT_DISP_VARIABLE (start, Fmake_marker ()); |
| 430 p->line_cache_last_updated = Qzero; | 422 p->line_cache_last_updated = Qzero; |
| 431 | 423 |
| 432 p->windows_changed = 1; | 424 p->windows_changed = 1; |
| 433 p->shadow_thickness_changed = 1; | 425 p->shadow_thickness_changed = 1; |
| 434 | 426 |
| 435 return val; | 427 return obj; |
| 436 } | 428 } |
| 437 #undef INIT_DISP_VARIABLE | 429 #undef INIT_DISP_VARIABLE |
| 438 | 430 |
| 439 /************************************************************************/ | 431 /************************************************************************/ |
| 440 /* Window mirror structure */ | 432 /* Window mirror structure */ |
| 529 return wrap_window_mirror (mir->next); | 521 return wrap_window_mirror (mir->next); |
| 530 else | 522 else |
| 531 return Qnil; | 523 return Qnil; |
| 532 } | 524 } |
| 533 | 525 |
| 534 DEFINE_LRECORD_IMPLEMENTATION ("window-mirror", window_mirror, | 526 DEFINE_NODUMP_INTERNAL_LISP_OBJECT ("window-mirror", window_mirror, |
| 535 0, /*dumpable-flag*/ | 527 mark_window_mirror, |
| 536 mark_window_mirror, internal_object_printer, | 528 window_mirror_description, |
| 537 0, 0, 0, window_mirror_description, | 529 struct window_mirror); |
| 538 struct window_mirror); | |
| 539 | 530 |
| 540 /* Create a new window mirror structure and associated redisplay | 531 /* Create a new window mirror structure and associated redisplay |
| 541 structs. */ | 532 structs. */ |
| 542 static struct window_mirror * | 533 static struct window_mirror * |
| 543 new_window_mirror (struct frame *f) | 534 new_window_mirror (struct frame *f) |
| 544 { | 535 { |
| 545 struct window_mirror *t = | 536 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (window_mirror); |
| 546 ALLOC_LCRECORD_TYPE (struct window_mirror, &lrecord_window_mirror); | 537 struct window_mirror *t = XWINDOW_MIRROR (obj); |
| 547 | 538 |
| 548 t->frame = f; | 539 t->frame = f; |
| 549 t->current_display_lines = Dynarr_new (display_line); | 540 t->current_display_lines = Dynarr_new (display_line); |
| 550 t->desired_display_lines = Dynarr_new (display_line); | 541 t->desired_display_lines = Dynarr_new (display_line); |
| 551 | 542 |
| 2142 window_unmap_subwindows (w); | 2133 window_unmap_subwindows (w); |
| 2143 | 2134 |
| 2144 /* Free the extra data structures attached to windows immediately so | 2135 /* Free the extra data structures attached to windows immediately so |
| 2145 they don't sit around consuming excess space. They will be | 2136 they don't sit around consuming excess space. They will be |
| 2146 reinitialized by the window-configuration code as necessary. */ | 2137 reinitialized by the window-configuration code as necessary. */ |
| 2147 finalize_window ((void *) w, 0); | 2138 finalize_window (wrap_window (w)); |
| 2148 | 2139 |
| 2149 /* Nobody should be accessing anything in this object any more, | 2140 /* Nobody should be accessing anything in this object any more, |
| 2150 and making them Qnil allows for better GC'ing in case a pointer | 2141 and making them Qnil allows for better GC'ing in case a pointer |
| 2151 to the dead window continues to hang around. Zero all other | 2142 to the dead window continues to hang around. Zero all other |
| 2152 structs in case someone tries to access something through them. | 2143 structs in case someone tries to access something through them. |
| 3870 } | 3861 } |
| 3871 | 3862 |
| 3872 static void | 3863 static void |
| 3873 make_dummy_parent (Lisp_Object window) | 3864 make_dummy_parent (Lisp_Object window) |
| 3874 { | 3865 { |
| 3875 Lisp_Object new_; | |
| 3876 struct window *o = XWINDOW (window); | 3866 struct window *o = XWINDOW (window); |
| 3877 struct window *p = ALLOC_LCRECORD_TYPE (struct window, &lrecord_window); | 3867 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (window); |
| 3878 | 3868 struct window *p = XWINDOW (obj); |
| 3879 new_ = wrap_window (p); | 3869 |
| 3880 COPY_LCRECORD (p, o); | 3870 copy_lisp_object (obj, window); |
| 3881 | 3871 |
| 3882 /* Don't copy the pointers to the line start cache or the face | 3872 /* Don't copy the pointers to the line start cache or the face |
| 3883 instances. */ | 3873 instances. */ |
| 3884 p->line_start_cache = Dynarr_new (line_start_cache); | 3874 p->line_start_cache = Dynarr_new (line_start_cache); |
| 3885 #ifdef NEW_GC | 3875 #ifdef NEW_GC |
| 3895 #endif /* not NEW_GC */ | 3885 #endif /* not NEW_GC */ |
| 3896 p->subwindow_instance_cache = | 3886 p->subwindow_instance_cache = |
| 3897 make_image_instance_cache_hash_table (); | 3887 make_image_instance_cache_hash_table (); |
| 3898 | 3888 |
| 3899 /* Put new into window structure in place of window */ | 3889 /* Put new into window structure in place of window */ |
| 3900 replace_window (window, new_); | 3890 replace_window (window, obj); |
| 3901 | 3891 |
| 3902 o->next = Qnil; | 3892 o->next = Qnil; |
| 3903 o->prev = Qnil; | 3893 o->prev = Qnil; |
| 3904 o->vchild = Qnil; | 3894 o->vchild = Qnil; |
| 3905 o->hchild = Qnil; | 3895 o->hchild = Qnil; |
| 3906 o->parent = new_; | 3896 o->parent = obj; |
| 3907 | 3897 |
| 3908 p->start[CURRENT_DISP] = Qnil; | 3898 p->start[CURRENT_DISP] = Qnil; |
| 3909 p->start[DESIRED_DISP] = Qnil; | 3899 p->start[DESIRED_DISP] = Qnil; |
| 3910 p->start[CMOTION_DISP] = Qnil; | 3900 p->start[CMOTION_DISP] = Qnil; |
| 3911 p->pointm[CURRENT_DISP] = Qnil; | 3901 p->pointm[CURRENT_DISP] = Qnil; |
| 5183 struct window_stats *stats, | 5173 struct window_stats *stats, |
| 5184 struct overhead_stats *ovstats) | 5174 struct overhead_stats *ovstats) |
| 5185 { | 5175 { |
| 5186 if (!mir) | 5176 if (!mir) |
| 5187 return; | 5177 return; |
| 5188 stats->other += LISPOBJ_STORAGE_SIZE (mir, sizeof (*mir), ovstats); | 5178 stats->other += lisp_object_storage_size (wrap_window_mirror (mir), ovstats); |
| 5189 #ifdef HAVE_SCROLLBARS | 5179 #ifdef HAVE_SCROLLBARS |
| 5190 { | 5180 { |
| 5191 struct device *d = XDEVICE (FRAME_DEVICE (mir->frame)); | 5181 struct device *d = XDEVICE (FRAME_DEVICE (mir->frame)); |
| 5192 | 5182 |
| 5193 stats->scrollbar += | 5183 stats->scrollbar += |
| 5207 static void | 5197 static void |
| 5208 compute_window_usage (struct window *w, struct window_stats *stats, | 5198 compute_window_usage (struct window *w, struct window_stats *stats, |
| 5209 struct overhead_stats *ovstats) | 5199 struct overhead_stats *ovstats) |
| 5210 { | 5200 { |
| 5211 xzero (*stats); | 5201 xzero (*stats); |
| 5212 stats->other += LISPOBJ_STORAGE_SIZE (w, sizeof (*w), ovstats); | 5202 stats->other += lisp_object_storage_size (wrap_window (w), ovstats); |
| 5213 stats->face += compute_face_cachel_usage (w->face_cachels, ovstats); | 5203 stats->face += compute_face_cachel_usage (w->face_cachels, ovstats); |
| 5214 stats->glyph += compute_glyph_cachel_usage (w->glyph_cachels, ovstats); | 5204 stats->glyph += compute_glyph_cachel_usage (w->glyph_cachels, ovstats); |
| 5215 stats->line_start += | 5205 stats->line_start += |
| 5216 compute_line_start_cache_dynarr_usage (w->line_start_cache, ovstats); | 5206 compute_line_start_cache_dynarr_usage (w->line_start_cache, ovstats); |
| 5217 compute_window_mirror_usage (find_window_mirror (w), stats, ovstats); | 5207 compute_window_mirror_usage (find_window_mirror (w), stats, ovstats); |
| 5440 /************************************************************************/ | 5430 /************************************************************************/ |
| 5441 | 5431 |
| 5442 void | 5432 void |
| 5443 syms_of_window (void) | 5433 syms_of_window (void) |
| 5444 { | 5434 { |
| 5445 INIT_LRECORD_IMPLEMENTATION (window); | 5435 INIT_LISP_OBJECT (window); |
| 5446 INIT_LRECORD_IMPLEMENTATION (window_mirror); | 5436 INIT_LISP_OBJECT (window_mirror); |
| 5447 #ifdef NEW_GC | 5437 #ifdef NEW_GC |
| 5448 INIT_LRECORD_IMPLEMENTATION (face_cachel); | 5438 INIT_LISP_OBJECT (face_cachel); |
| 5449 INIT_LRECORD_IMPLEMENTATION (face_cachel_dynarr); | 5439 INIT_LISP_OBJECT (face_cachel_dynarr); |
| 5450 INIT_LRECORD_IMPLEMENTATION (glyph_cachel); | 5440 INIT_LISP_OBJECT (glyph_cachel); |
| 5451 INIT_LRECORD_IMPLEMENTATION (glyph_cachel_dynarr); | 5441 INIT_LISP_OBJECT (glyph_cachel_dynarr); |
| 5452 #endif /* NEW_GC */ | 5442 #endif /* NEW_GC */ |
| 5453 | 5443 |
| 5454 DEFSYMBOL (Qwindowp); | 5444 DEFSYMBOL (Qwindowp); |
| 5455 DEFSYMBOL (Qwindow_live_p); | 5445 DEFSYMBOL (Qwindow_live_p); |
| 5456 DEFSYMBOL (Qdisplay_buffer); | 5446 DEFSYMBOL (Qdisplay_buffer); |
