Mercurial > hg > xemacs-beta
comparison src/window.c @ 408:501cfd01ee6d r21-2-34
Import from CVS: tag r21-2-34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:18:11 +0200 |
parents | 2f8bb876ab1d |
children | de805c49cfc1 |
comparison
equal
deleted
inserted
replaced
407:ed6218a7d4d3 | 408:501cfd01ee6d |
---|---|
279 INIT_DISP_VARIABLE (last_start, Fmake_marker ()); | 279 INIT_DISP_VARIABLE (last_start, Fmake_marker ()); |
280 INIT_DISP_VARIABLE (last_facechange, Qzero); | 280 INIT_DISP_VARIABLE (last_facechange, Qzero); |
281 p->face_cachels = Dynarr_new (face_cachel); | 281 p->face_cachels = Dynarr_new (face_cachel); |
282 p->glyph_cachels = Dynarr_new (glyph_cachel); | 282 p->glyph_cachels = Dynarr_new (glyph_cachel); |
283 p->line_start_cache = Dynarr_new (line_start_cache); | 283 p->line_start_cache = Dynarr_new (line_start_cache); |
284 p->subwindow_instance_cache = make_lisp_hash_table (10, | 284 p->subwindow_instance_cache = make_lisp_hash_table (30, |
285 HASH_TABLE_KEY_WEAK, | 285 HASH_TABLE_KEY_WEAK, |
286 HASH_TABLE_EQ); | 286 HASH_TABLE_EQUAL); |
287 p->line_cache_last_updated = Qzero; | 287 p->line_cache_last_updated = Qzero; |
288 INIT_DISP_VARIABLE (last_point_x, 0); | 288 INIT_DISP_VARIABLE (last_point_x, 0); |
289 INIT_DISP_VARIABLE (last_point_y, 0); | 289 INIT_DISP_VARIABLE (last_point_y, 0); |
290 INIT_DISP_VARIABLE (window_end_pos, 0); | 290 INIT_DISP_VARIABLE (window_end_pos, 0); |
291 p->redisplay_end_trigger = Qnil; | 291 p->redisplay_end_trigger = Qnil; |
1865 } | 1865 } |
1866 | 1866 |
1867 /* #### Here, if replacement is a vertical combination | 1867 /* #### Here, if replacement is a vertical combination |
1868 and so is its new parent, we should make replacement's | 1868 and so is its new parent, we should make replacement's |
1869 children be children of that parent instead. */ | 1869 children be children of that parent instead. */ |
1870 | |
1871 ERROR_CHECK_SUBWINDOW_CACHE (p); | |
1872 } | |
1873 | |
1874 static int | |
1875 window_unmap_subwindows_cache_mapper (Lisp_Object key, Lisp_Object value, | |
1876 void *flag_closure) | |
1877 { | |
1878 /* value can be nil; we cache failures as well as successes */ | |
1879 if (!NILP (value)) | |
1880 { | |
1881 struct frame* f = XFRAME (XIMAGE_INSTANCE_FRAME (value)); | |
1882 unmap_subwindow (value); | |
1883 /* In case GC doesn't catch up fast enough, remove from the frame | |
1884 cache also. Otherwise code that checks the sanity of the instance | |
1885 will fail. */ | |
1886 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) | |
1887 = delq_no_quit (value, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); | |
1888 } | |
1889 return 0; | |
1890 } | |
1891 | |
1892 static void | |
1893 window_unmap_subwindows (struct window* w) | |
1894 { | |
1895 assert (!NILP (w->subwindow_instance_cache)); | |
1896 elisp_maphash (window_unmap_subwindows_cache_mapper, | |
1897 w->subwindow_instance_cache, 0); | |
1870 } | 1898 } |
1871 | 1899 |
1872 /* we're deleting W; set the structure of W to indicate this. */ | 1900 /* we're deleting W; set the structure of W to indicate this. */ |
1873 | 1901 |
1874 static void | 1902 static void |
1875 mark_window_as_deleted (struct window *w) | 1903 mark_window_as_deleted (struct window *w) |
1876 { | 1904 { |
1905 /* The window instance cache is going away now, so need to get the | |
1906 cachels reset by redisplay. */ | |
1907 MARK_FRAME_SUBWINDOWS_CHANGED (XFRAME (WINDOW_FRAME (w))); | |
1908 | |
1909 /* The cache is going away. If we leave unmapping to | |
1910 reset_subwindow_cachels then we get in a situation where the | |
1911 domain (the window) has been deleted but we still need access to | |
1912 its attributes in order to unmap windows properly. Since the | |
1913 subwindows are going to get GC'd anyway as a result of the domain | |
1914 going away, it is safer to just unmap them all while we know the | |
1915 domain is still valid. */ | |
1916 ERROR_CHECK_SUBWINDOW_CACHE (w); | |
1917 window_unmap_subwindows (w); | |
1918 | |
1877 /* In the loop | 1919 /* In the loop |
1878 (while t (split-window) (delete-window)) | 1920 (while t (split-window) (delete-window)) |
1879 we end up with a tree of deleted windows which are all connected | 1921 we end up with a tree of deleted windows which are all connected |
1880 through the `next' slot. This might not seem so bad, as they're | 1922 through the `next' slot. This might not seem so bad, as they're |
1881 deleted, and will presumably be GCed - but if even *one* of those | 1923 deleted, and will presumably be GCed - but if even *one* of those |
1883 configuration, then *all* of those windows stick around. | 1925 configuration, then *all* of those windows stick around. |
1884 | 1926 |
1885 Since the window-configuration code doesn't need any of the | 1927 Since the window-configuration code doesn't need any of the |
1886 pointers to other windows (they are all recreated from the | 1928 pointers to other windows (they are all recreated from the |
1887 window-config data), we set them all to nil so that we | 1929 window-config data), we set them all to nil so that we |
1888 are able to collect more actual garbage. | 1930 are able to collect more actual garbage. */ |
1889 */ | |
1890 w->next = Qnil; | 1931 w->next = Qnil; |
1891 w->prev = Qnil; | 1932 w->prev = Qnil; |
1892 w->hchild = Qnil; | 1933 w->hchild = Qnil; |
1893 w->vchild = Qnil; | 1934 w->vchild = Qnil; |
1894 w->parent = Qnil; | 1935 w->parent = Qnil; |
1936 w->subwindow_instance_cache = Qnil; | |
1895 | 1937 |
1896 w->dead = 1; | 1938 w->dead = 1; |
1897 | 1939 |
1898 /* Free the extra data structures attached to windows immediately so | 1940 /* Free the extra data structures attached to windows immediately so |
1899 they don't sit around consuming excess space. They will be | 1941 they don't sit around consuming excess space. They will be |
1926 deleted window; it's OK to delete an already-deleted window. */ | 1968 deleted window; it's OK to delete an already-deleted window. */ |
1927 if (NILP (window)) | 1969 if (NILP (window)) |
1928 window = Fselected_window (Qnil); | 1970 window = Fselected_window (Qnil); |
1929 else | 1971 else |
1930 CHECK_WINDOW (window); | 1972 CHECK_WINDOW (window); |
1973 | |
1931 w = XWINDOW (window); | 1974 w = XWINDOW (window); |
1932 | 1975 |
1933 /* It's okay to delete an already-deleted window. */ | 1976 /* It's okay to delete an already-deleted window. */ |
1934 if (! WINDOW_LIVE_P (w)) | 1977 if (! WINDOW_LIVE_P (w)) |
1935 return Qnil; | 1978 return Qnil; |
3473 instances. */ | 3516 instances. */ |
3474 p->line_start_cache = Dynarr_new (line_start_cache); | 3517 p->line_start_cache = Dynarr_new (line_start_cache); |
3475 p->face_cachels = Dynarr_new (face_cachel); | 3518 p->face_cachels = Dynarr_new (face_cachel); |
3476 p->glyph_cachels = Dynarr_new (glyph_cachel); | 3519 p->glyph_cachels = Dynarr_new (glyph_cachel); |
3477 p->subwindow_instance_cache = | 3520 p->subwindow_instance_cache = |
3478 make_lisp_hash_table (10, | 3521 make_lisp_hash_table (30, |
3479 HASH_TABLE_KEY_WEAK, | 3522 HASH_TABLE_KEY_WEAK, |
3480 HASH_TABLE_EQ); | 3523 HASH_TABLE_EQUAL); |
3481 | 3524 |
3482 /* Put new into window structure in place of window */ | 3525 /* Put new into window structure in place of window */ |
3483 replace_window (window, new); | 3526 replace_window (window, new); |
3484 | 3527 |
3485 o->next = Qnil; | 3528 o->next = Qnil; |
5170 in an inconsistent state. */ | 5213 in an inconsistent state. */ |
5171 begin_dont_check_for_quit (); | 5214 begin_dont_check_for_quit (); |
5172 record_unwind_protect (free_window_configuration, old_window_config); | 5215 record_unwind_protect (free_window_configuration, old_window_config); |
5173 | 5216 |
5174 mark_windows_in_use (f, 1); | 5217 mark_windows_in_use (f, 1); |
5218 | |
5219 /* Force subwindows to be reinstantiated. They are all going | |
5220 anyway and if we don't do this GC may not happen between now | |
5221 and the next time we check their integrity. */ | |
5222 reset_frame_subwindow_instance_cache (f); | |
5175 | 5223 |
5176 #if 0 | 5224 #if 0 |
5177 /* JV: This is bogus, | 5225 /* JV: This is bogus, |
5178 First of all, the units are inconsistent. The frame sizes are measured | 5226 First of all, the units are inconsistent. The frame sizes are measured |
5179 in characters but the window sizes are stored in pixels. So if a | 5227 in characters but the window sizes are stored in pixels. So if a |
5313 WINDOW_WIDTH (w) = WINDOW_WIDTH (p); | 5361 WINDOW_WIDTH (w) = WINDOW_WIDTH (p); |
5314 WINDOW_HEIGHT (w) = WINDOW_HEIGHT (p); | 5362 WINDOW_HEIGHT (w) = WINDOW_HEIGHT (p); |
5315 w->hscroll = p->hscroll; | 5363 w->hscroll = p->hscroll; |
5316 w->modeline_hscroll = p->modeline_hscroll; | 5364 w->modeline_hscroll = p->modeline_hscroll; |
5317 w->line_cache_last_updated = Qzero; | 5365 w->line_cache_last_updated = Qzero; |
5366 /* The subwindow instance cache isn't preserved across | |
5367 window configurations, and in fact doing so would be | |
5368 wrong. We just reset to zero and then redisplay will fill | |
5369 it up as needed. */ | |
5370 w->subwindow_instance_cache = | |
5371 make_lisp_hash_table (30, | |
5372 HASH_TABLE_KEY_WEAK, | |
5373 HASH_TABLE_EQUAL); | |
5318 SET_LAST_MODIFIED (w, 1); | 5374 SET_LAST_MODIFIED (w, 1); |
5319 SET_LAST_FACECHANGE (w); | 5375 SET_LAST_FACECHANGE (w); |
5320 w->config_mark = 0; | 5376 w->config_mark = 0; |
5321 | 5377 |
5322 #define WINDOW_SLOT(slot, compare) w->slot = p->slot | 5378 #define WINDOW_SLOT(slot, compare) w->slot = p->slot |