Mercurial > hg > xemacs-beta
comparison src/window.c @ 404:2f8bb876ab1d r21-2-32
Import from CVS: tag r21-2-32
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:16:07 +0200 |
parents | a86b2b5e0111 |
children | 501cfd01ee6d |
comparison
equal
deleted
inserted
replaced
403:9f011ab08d48 | 404:2f8bb876ab1d |
---|---|
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; |
292 | |
293 p->gutter_extent_modiff[0] = 0; | |
294 p->gutter_extent_modiff[1] = 0; | |
295 p->gutter_extent_modiff[2] = 0; | |
296 p->gutter_extent_modiff[3] = 0; | |
292 | 297 |
293 #define WINDOW_SLOT(slot, compare) p->slot = Qnil | 298 #define WINDOW_SLOT(slot, compare) p->slot = Qnil |
294 #include "winslots.h" | 299 #include "winslots.h" |
295 | 300 |
296 p->windows_changed = 1; | 301 p->windows_changed = 1; |
1008 functions refer to the Y coord for bottom and top gutters and the X | 1013 functions refer to the Y coord for bottom and top gutters and the X |
1009 coord for left and right gutters. All starting positions are | 1014 coord for left and right gutters. All starting positions are |
1010 relative to the frame, not the window. | 1015 relative to the frame, not the window. |
1011 ****************************************************************************/ | 1016 ****************************************************************************/ |
1012 | 1017 |
1018 static int | |
1019 window_top_window_gutter_height (struct window *w) | |
1020 { | |
1021 if (!NILP (w->hchild) || !NILP (w->vchild)) | |
1022 return 0; | |
1023 | |
1024 #ifdef HAVE_SCROLLBARS | |
1025 if (!NILP (w->scrollbar_on_top_p)) | |
1026 return window_scrollbar_height (w); | |
1027 else | |
1028 #endif | |
1029 return 0; | |
1030 } | |
1031 | |
1013 int | 1032 int |
1014 window_top_gutter_height (struct window *w) | 1033 window_top_gutter_height (struct window *w) |
1015 { | 1034 { |
1016 int gutter = WINDOW_REAL_TOP_GUTTER_BOUNDS (w); | 1035 return window_top_window_gutter_height (w); |
1036 } | |
1037 | |
1038 static int | |
1039 window_bottom_window_gutter_height (struct window *w) | |
1040 { | |
1041 int gutter; | |
1017 | 1042 |
1018 if (!NILP (w->hchild) || !NILP (w->vchild)) | 1043 if (!NILP (w->hchild) || !NILP (w->vchild)) |
1019 return 0; | 1044 return 0; |
1020 | 1045 |
1021 #ifdef HAVE_SCROLLBARS | 1046 gutter = window_modeline_height (w); |
1022 if (!NILP (w->scrollbar_on_top_p)) | |
1023 return window_scrollbar_height (w) + gutter; | |
1024 else | |
1025 #endif | |
1026 return gutter; | |
1027 } | |
1028 | |
1029 int | |
1030 window_bottom_gutter_height (struct window *w) | |
1031 { | |
1032 int gutter = WINDOW_REAL_BOTTOM_GUTTER_BOUNDS (w); | |
1033 | |
1034 if (!NILP (w->hchild) || !NILP (w->vchild)) | |
1035 return 0; | |
1036 | |
1037 gutter += window_modeline_height (w); | |
1038 | 1047 |
1039 #ifdef HAVE_SCROLLBARS | 1048 #ifdef HAVE_SCROLLBARS |
1040 if (NILP (w->scrollbar_on_top_p)) | 1049 if (NILP (w->scrollbar_on_top_p)) |
1041 return window_scrollbar_height (w) + gutter; | 1050 return window_scrollbar_height (w) + gutter; |
1042 else | 1051 else |
1043 #endif | 1052 #endif |
1044 return gutter; | 1053 return gutter; |
1045 } | 1054 } |
1046 | 1055 |
1047 int | 1056 int |
1048 window_left_gutter_width (struct window *w, int modeline) | 1057 window_bottom_gutter_height (struct window *w) |
1049 { | 1058 { |
1050 int gutter = WINDOW_REAL_LEFT_GUTTER_BOUNDS (w); | 1059 return window_bottom_window_gutter_height (w); |
1051 | 1060 } |
1061 | |
1062 static int | |
1063 window_left_window_gutter_width (struct window *w, int modeline) | |
1064 { | |
1052 if (!NILP (w->hchild) || !NILP (w->vchild)) | 1065 if (!NILP (w->hchild) || !NILP (w->vchild)) |
1053 return 0; | 1066 return 0; |
1054 | 1067 |
1055 #ifdef HAVE_SCROLLBARS | 1068 #ifdef HAVE_SCROLLBARS |
1056 if (!modeline && !NILP (w->scrollbar_on_left_p)) | 1069 if (!modeline && !NILP (w->scrollbar_on_left_p)) |
1057 gutter += window_scrollbar_width (w); | 1070 return window_scrollbar_width (w); |
1058 #endif | 1071 #endif |
1059 | 1072 |
1060 return gutter; | 1073 return 0; |
1061 } | 1074 } |
1062 | 1075 |
1063 int | 1076 int |
1064 window_right_gutter_width (struct window *w, int modeline) | 1077 window_left_gutter_width (struct window *w, int modeline) |
1065 { | 1078 { |
1066 int gutter = WINDOW_REAL_RIGHT_GUTTER_BOUNDS (w); | 1079 return window_left_window_gutter_width (w, modeline); |
1080 } | |
1081 | |
1082 static int | |
1083 window_right_window_gutter_width (struct window *w, int modeline) | |
1084 { | |
1085 int gutter = 0; | |
1067 | 1086 |
1068 if (!NILP (w->hchild) || !NILP (w->vchild)) | 1087 if (!NILP (w->hchild) || !NILP (w->vchild)) |
1069 return 0; | 1088 return 0; |
1070 | 1089 |
1071 #ifdef HAVE_SCROLLBARS | 1090 #ifdef HAVE_SCROLLBARS |
1075 | 1094 |
1076 if (window_needs_vertical_divider (w)) | 1095 if (window_needs_vertical_divider (w)) |
1077 gutter += window_divider_width (w); | 1096 gutter += window_divider_width (w); |
1078 | 1097 |
1079 return gutter; | 1098 return gutter; |
1099 } | |
1100 | |
1101 int | |
1102 window_right_gutter_width (struct window *w, int modeline) | |
1103 { | |
1104 return window_right_window_gutter_width (w, modeline); | |
1105 } | |
1106 | |
1107 static int | |
1108 window_pixel_height (struct window* w) | |
1109 { | |
1110 return WINDOW_HEIGHT (w); | |
1080 } | 1111 } |
1081 | 1112 |
1082 | 1113 |
1083 DEFUN ("windowp", Fwindowp, 1, 1, 0, /* | 1114 DEFUN ("windowp", Fwindowp, 1, 1, 0, /* |
1084 Return t if OBJ is a window. | 1115 Return t if OBJ is a window. |
1292 default font; therefore, the number of displayed lines will probably | 1323 default font; therefore, the number of displayed lines will probably |
1293 be different. | 1324 be different. |
1294 Use `window-height' to get consistent results in geometry calculations. | 1325 Use `window-height' to get consistent results in geometry calculations. |
1295 Use `window-displayed-height' to get the actual number of lines | 1326 Use `window-displayed-height' to get the actual number of lines |
1296 currently displayed in a window. | 1327 currently displayed in a window. |
1328 | |
1329 The names are somewhat confusing; here's a table to help out: | |
1330 | |
1331 width height | |
1332 ------------------------------------------------------------------------- | |
1333 w/o gutters | |
1334 (rows/columns) window-width window-text-area-height | |
1335 (pixels) window-text-area-pixel-width window-text-area-pixel-height | |
1336 | |
1337 with gutters | |
1338 (rows/columns) window-full-width window-height | |
1339 (pixels) window-pixel-width window-pixel-height | |
1340 | |
1341 actually displayed | |
1342 (rows/columns) ---- window-displayed-height | |
1343 (pixels) ---- window-displayed-text-pixel-height | |
1297 */ | 1344 */ |
1298 (window)) | 1345 (window)) |
1299 { | 1346 { |
1300 return make_int (window_char_height (decode_window (window), 1)); | 1347 return make_int (window_char_height (decode_window (window), 1)); |
1301 } | 1348 } |
1318 Return the height of WINDOW in pixels. Defaults to current window. | 1365 Return the height of WINDOW in pixels. Defaults to current window. |
1319 This includes the window's modeline and horizontal scrollbar (if any). | 1366 This includes the window's modeline and horizontal scrollbar (if any). |
1320 */ | 1367 */ |
1321 (window)) | 1368 (window)) |
1322 { | 1369 { |
1323 return make_int (decode_window (window)->pixel_height); | 1370 return make_int (window_pixel_height (decode_window (window))); |
1371 } | |
1372 | |
1373 DEFUN ("window-text-area-height", Fwindow_text_area_height, 0, 1, 0, /* | |
1374 Return the number of default lines in the text area of WINDOW. | |
1375 This actually works by dividing the window's text area pixel height (i.e. | |
1376 excluding the modeline and horizontal scrollbar, if any) by the height of the | |
1377 default font; therefore, the number of displayed lines will probably | |
1378 be different. | |
1379 See also `window-height' and `window-displayed-height'. | |
1380 */ | |
1381 (window)) | |
1382 { | |
1383 return make_int (window_char_height (decode_window (window), 0)); | |
1324 } | 1384 } |
1325 | 1385 |
1326 DEFUN ("window-text-area-pixel-height", | 1386 DEFUN ("window-text-area-pixel-height", |
1327 Fwindow_text_area_pixel_height, 0, 1, 0, /* | 1387 Fwindow_text_area_pixel_height, 0, 1, 0, /* |
1328 Return the height in pixels of the text-displaying portion of WINDOW. | 1388 Return the height in pixels of the text-displaying portion of WINDOW. |
1399 RETURN_NOT_REACHED(make_int (0)) /* shut up compiler */ | 1459 RETURN_NOT_REACHED(make_int (0)) /* shut up compiler */ |
1400 } | 1460 } |
1401 | 1461 |
1402 DEFUN ("window-width", Fwindow_width, 0, 1, 0, /* | 1462 DEFUN ("window-width", Fwindow_width, 0, 1, 0, /* |
1403 Return the number of display columns in WINDOW. | 1463 Return the number of display columns in WINDOW. |
1404 This is the width that is usable columns available for text in WINDOW. | 1464 This is the width that is usable columns available for text in WINDOW, |
1465 and does not include vertical scrollbars, dividers, or the like. See also | |
1466 `window-full-width' and `window-height'. | |
1405 */ | 1467 */ |
1406 (window)) | 1468 (window)) |
1407 { | 1469 { |
1408 return make_int (window_char_width (decode_window (window), 0)); | 1470 return make_int (window_char_width (decode_window (window), 0)); |
1471 } | |
1472 | |
1473 DEFUN ("window-full-width", Fwindow_full_width, 0, 1, 0, /* | |
1474 Return the total number of columns in WINDOW. | |
1475 This is like `window-width' but includes vertical scrollbars, dividers, | |
1476 etc. | |
1477 */ | |
1478 (window)) | |
1479 { | |
1480 return make_int (window_char_width (decode_window (window), 1)); | |
1409 } | 1481 } |
1410 | 1482 |
1411 DEFUN ("window-pixel-width", Fwindow_pixel_width, 0, 1, 0, /* | 1483 DEFUN ("window-pixel-width", Fwindow_pixel_width, 0, 1, 0, /* |
1412 Return the width of WINDOW in pixels. Defaults to current window. | 1484 Return the width of WINDOW in pixels. Defaults to current window. |
1413 */ | 1485 */ |
1524 #endif /* 0 */ | 1596 #endif /* 0 */ |
1525 | 1597 |
1526 DEFUN ("window-pixel-edges", Fwindow_pixel_edges, 0, 1, 0, /* | 1598 DEFUN ("window-pixel-edges", Fwindow_pixel_edges, 0, 1, 0, /* |
1527 Return a list of the pixel edge coordinates of WINDOW. | 1599 Return a list of the pixel edge coordinates of WINDOW. |
1528 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame. | 1600 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame. |
1529 The frame toolbars and menubars are considered to be outside of this area. | 1601 The frame toolbars, menubars and gutters are considered to be outside of this area. |
1530 */ | 1602 */ |
1531 (window)) | 1603 (window)) |
1532 { | 1604 { |
1533 struct window *w = decode_window (window); | 1605 struct window *w = decode_window (window); |
1534 struct frame *f = XFRAME (w->frame); | 1606 |
1535 | 1607 int left = w->pixel_left; |
1536 int left = w->pixel_left - FRAME_LEFT_BORDER_END (f); | 1608 int top = w->pixel_top; |
1537 int top = w->pixel_top - FRAME_TOP_BORDER_END (f); | |
1538 | 1609 |
1539 return list4 (make_int (left), | 1610 return list4 (make_int (left), |
1540 make_int (top), | 1611 make_int (top), |
1541 make_int (left + w->pixel_width), | 1612 make_int (left + w->pixel_width), |
1542 make_int (top + w->pixel_height)); | 1613 make_int (top + w->pixel_height)); |
3275 w = XWINDOW (window); | 3346 w = XWINDOW (window); |
3276 | 3347 |
3277 /* we have already caught dead-window errors */ | 3348 /* we have already caught dead-window errors */ |
3278 if (!NILP (w->hchild) || !NILP (w->vchild)) | 3349 if (!NILP (w->hchild) || !NILP (w->vchild)) |
3279 error ("Trying to select non-leaf window"); | 3350 error ("Trying to select non-leaf window"); |
3280 | 3351 |
3281 w->use_time = make_int (++window_select_count); | 3352 w->use_time = make_int (++window_select_count); |
3353 | |
3282 if (EQ (window, old_selected_window)) | 3354 if (EQ (window, old_selected_window)) |
3283 return window; | 3355 return window; |
3284 | 3356 |
3285 /* deselect the old window, if it exists (it might not exist if | 3357 /* deselect the old window, if it exists (it might not exist if |
3286 the selected device has no frames, which occurs at startup) */ | 3358 the selected device has no frames, which occurs at startup) */ |
3400 /* Don't copy the pointers to the line start cache or the face | 3472 /* Don't copy the pointers to the line start cache or the face |
3401 instances. */ | 3473 instances. */ |
3402 p->line_start_cache = Dynarr_new (line_start_cache); | 3474 p->line_start_cache = Dynarr_new (line_start_cache); |
3403 p->face_cachels = Dynarr_new (face_cachel); | 3475 p->face_cachels = Dynarr_new (face_cachel); |
3404 p->glyph_cachels = Dynarr_new (glyph_cachel); | 3476 p->glyph_cachels = Dynarr_new (glyph_cachel); |
3477 p->subwindow_instance_cache = | |
3478 make_lisp_hash_table (10, | |
3479 HASH_TABLE_KEY_WEAK, | |
3480 HASH_TABLE_EQ); | |
3405 | 3481 |
3406 /* Put new into window structure in place of window */ | 3482 /* Put new into window structure in place of window */ |
3407 replace_window (window, new); | 3483 replace_window (window, new); |
3408 | 3484 |
3409 o->next = Qnil; | 3485 o->next = Qnil; |
3615 /* inpixels */ 1); | 3691 /* inpixels */ 1); |
3616 return Qnil; | 3692 return Qnil; |
3617 } | 3693 } |
3618 | 3694 |
3619 static int | 3695 static int |
3620 window_pixel_height (Lisp_Object window) | |
3621 { | |
3622 return WINDOW_HEIGHT (XWINDOW (window)); | |
3623 } | |
3624 | |
3625 static int | |
3626 window_pixel_height_to_char_height (struct window *w, int pixel_height, | 3696 window_pixel_height_to_char_height (struct window *w, int pixel_height, |
3627 int include_gutters_p) | 3697 int include_gutters_p) |
3628 { | 3698 { |
3629 int avail_height; | 3699 int avail_height; |
3630 int defheight, defwidth; | 3700 int defheight, defwidth; |
3633 | 3703 |
3634 XSETWINDOW (window, w); | 3704 XSETWINDOW (window, w); |
3635 | 3705 |
3636 avail_height = (pixel_height - | 3706 avail_height = (pixel_height - |
3637 (include_gutters_p ? 0 : | 3707 (include_gutters_p ? 0 : |
3638 window_top_gutter_height (w) + | 3708 window_top_window_gutter_height (w) + |
3639 window_bottom_gutter_height (w))); | 3709 window_bottom_window_gutter_height (w))); |
3640 | 3710 |
3641 default_face_height_and_width (window, &defheight, &defwidth); | 3711 default_face_height_and_width (window, &defheight, &defwidth); |
3642 | 3712 |
3643 char_height = avail_height / defheight; | 3713 char_height = avail_height / defheight; |
3644 | 3714 |
3665 default_face_height_and_width (window, &defheight, &defwidth); | 3735 default_face_height_and_width (window, &defheight, &defwidth); |
3666 | 3736 |
3667 avail_height = char_height * defheight; | 3737 avail_height = char_height * defheight; |
3668 pixel_height = (avail_height + | 3738 pixel_height = (avail_height + |
3669 (include_gutters_p ? 0 : | 3739 (include_gutters_p ? 0 : |
3670 window_top_gutter_height (w) + | 3740 window_top_window_gutter_height (w) + |
3671 window_bottom_gutter_height (w))); | 3741 window_bottom_window_gutter_height (w))); |
3672 | 3742 |
3673 /* It's the calling function's responsibility to check these values | 3743 /* It's the calling function's responsibility to check these values |
3674 and make sure they're not out of range. | 3744 and make sure they're not out of range. |
3675 | 3745 |
3676 #### We need to go through the calling functions and actually | 3746 #### We need to go through the calling functions and actually |
3679 } | 3749 } |
3680 | 3750 |
3681 /* Return number of default lines of text can fit in the window W. | 3751 /* Return number of default lines of text can fit in the window W. |
3682 If INCLUDE_GUTTERS_P is 1, include "gutter" space (modeline plus | 3752 If INCLUDE_GUTTERS_P is 1, include "gutter" space (modeline plus |
3683 horizontal scrollbar) in the space that is used for the calculation. | 3753 horizontal scrollbar) in the space that is used for the calculation. |
3754 This doesn't include space used by the frame gutters. | |
3684 */ | 3755 */ |
3685 int | 3756 int |
3686 window_char_height (struct window *w, int include_gutters_p) | 3757 window_char_height (struct window *w, int include_gutters_p) |
3687 { | 3758 { |
3688 return window_pixel_height_to_char_height (w, WINDOW_HEIGHT (w), | 3759 return window_pixel_height_to_char_height (w, window_pixel_height (w), |
3689 include_gutters_p); | 3760 include_gutters_p); |
3690 } | 3761 } |
3691 | 3762 |
3692 /* | 3763 /* |
3693 * Return number of lines currently displayed in window w. If | 3764 * Return number of lines currently displayed in window w. If |
3763 window_pixel_width (Lisp_Object window) | 3834 window_pixel_width (Lisp_Object window) |
3764 { | 3835 { |
3765 return WINDOW_WIDTH (XWINDOW (window)); | 3836 return WINDOW_WIDTH (XWINDOW (window)); |
3766 } | 3837 } |
3767 | 3838 |
3839 /* Calculate the pixel of a window, optionally including margin space | |
3840 but no vertical gutters. */ | |
3768 static int | 3841 static int |
3769 window_pixel_width_to_char_width (struct window *w, int pixel_width, | 3842 window_pixel_width_to_char_width (struct window *w, int pixel_width, |
3770 int include_margins_p) | 3843 int include_margins_p) |
3771 { | 3844 { |
3772 int avail_width; | 3845 int avail_width; |
3807 | 3880 |
3808 default_face_height_and_width (window, &defheight, &defwidth); | 3881 default_face_height_and_width (window, &defheight, &defwidth); |
3809 | 3882 |
3810 avail_width = char_width * defwidth; | 3883 avail_width = char_width * defwidth; |
3811 pixel_width = (avail_width + | 3884 pixel_width = (avail_width + |
3812 window_left_gutter_width (w, 0) + | 3885 window_left_window_gutter_width (w, 0) + |
3813 window_right_gutter_width (w, 0) + | 3886 window_right_window_gutter_width (w, 0) + |
3814 (include_margins_p ? 0 : window_left_margin_width (w)) + | 3887 (include_margins_p ? 0 : window_left_margin_width (w)) + |
3815 (include_margins_p ? 0 : window_right_margin_width (w))); | 3888 (include_margins_p ? 0 : window_right_margin_width (w))); |
3816 | 3889 |
3817 /* It's the calling function's responsibility to check these values | 3890 /* It's the calling function's responsibility to check these values |
3818 and make sure they're not out of range. | 3891 and make sure they're not out of range. |
3846 (widthflag ? window_char_width (w, 0) : window_char_height (w, 1)) | 3919 (widthflag ? window_char_width (w, 0) : window_char_height (w, 1)) |
3847 | 3920 |
3848 #define MINCHARSIZE(window) \ | 3921 #define MINCHARSIZE(window) \ |
3849 (widthflag ? window_min_width : MINI_WINDOW_P (XWINDOW (window)) \ | 3922 (widthflag ? window_min_width : MINI_WINDOW_P (XWINDOW (window)) \ |
3850 ? 1 : window_min_height) | 3923 ? 1 : window_min_height) |
3924 | |
3925 static int | |
3926 window_pixheight (Lisp_Object w) | |
3927 { | |
3928 return window_pixel_height (XWINDOW (w)); | |
3929 } | |
3851 | 3930 |
3852 /* Unlike set_window_pixheight, this function | 3931 /* Unlike set_window_pixheight, this function |
3853 also changes the heights of the siblings so as to | 3932 also changes the heights of the siblings so as to |
3854 keep everything consistent. */ | 3933 keep everything consistent. */ |
3855 | 3934 |
3862 struct window *w; | 3941 struct window *w; |
3863 struct frame *f; | 3942 struct frame *f; |
3864 int *sizep; | 3943 int *sizep; |
3865 int (*sizefun) (Lisp_Object) = (widthflag | 3944 int (*sizefun) (Lisp_Object) = (widthflag |
3866 ? window_pixel_width | 3945 ? window_pixel_width |
3867 : window_pixel_height); | 3946 : window_pixheight); |
3868 void (*setsizefun) (Lisp_Object, int, int) = (widthflag | 3947 void (*setsizefun) (Lisp_Object, int, int) = (widthflag |
3869 ? set_window_pixwidth | 3948 ? set_window_pixwidth |
3870 : set_window_pixheight); | 3949 : set_window_pixheight); |
3871 int dim; | 3950 int dim; |
3872 int defheight, defwidth; | 3951 int defheight, defwidth; |
5100 in characters but the window sizes are stored in pixels. So if a | 5179 in characters but the window sizes are stored in pixels. So if a |
5101 font size change happened between saving and restoring, the | 5180 font size change happened between saving and restoring, the |
5102 frame "sizes" maybe equal but the windows still should be | 5181 frame "sizes" maybe equal but the windows still should be |
5103 resized. This is tickled alot by the new "character size | 5182 resized. This is tickled alot by the new "character size |
5104 stays constant" policy in 21.0. It leads to very wierd | 5183 stays constant" policy in 21.0. It leads to very wierd |
5105 glitches (and possibly craches when asserts are tickled). | 5184 glitches (and possibly crashes when asserts are tickled). |
5106 | 5185 |
5107 Just changing the units doens't help because changing the | 5186 Just changing the units doens't help because changing the |
5108 toolbar configuration can also change the pixel positions. | 5187 toolbar configuration can also change the pixel positions. |
5109 Luckily there is a much simpler way of doing this, see below. | 5188 Luckily there is a much simpler way of doing this, see below. |
5110 */ | 5189 */ |
5173 } | 5252 } |
5174 if (!w->glyph_cachels) | 5253 if (!w->glyph_cachels) |
5175 w->glyph_cachels = Dynarr_new (glyph_cachel); | 5254 w->glyph_cachels = Dynarr_new (glyph_cachel); |
5176 if (!w->line_start_cache) | 5255 if (!w->line_start_cache) |
5177 w->line_start_cache = Dynarr_new (line_start_cache); | 5256 w->line_start_cache = Dynarr_new (line_start_cache); |
5257 w->gutter_extent_modiff[0] = 0; | |
5258 w->gutter_extent_modiff[1] = 0; | |
5259 w->gutter_extent_modiff[2] = 0; | |
5260 w->gutter_extent_modiff[3] = 0; | |
5178 w->dead = 0; | 5261 w->dead = 0; |
5179 | 5262 |
5180 if (p->parent_index >= 0) | 5263 if (p->parent_index >= 0) |
5181 w->parent = SAVED_WINDOW_N (config, p->parent_index)->window; | 5264 w->parent = SAVED_WINDOW_N (config, p->parent_index)->window; |
5182 else | 5265 else |
5372 /* If restoring in the current frame make the window current, | 5455 /* If restoring in the current frame make the window current, |
5373 otherwise just update the frame selected_window slot to be | 5456 otherwise just update the frame selected_window slot to be |
5374 the restored current_window. */ | 5457 the restored current_window. */ |
5375 if (f == selected_frame ()) | 5458 if (f == selected_frame ()) |
5376 { | 5459 { |
5460 #if 0 | |
5377 /* When using `pop-window-configuration', often the minibuffer | 5461 /* When using `pop-window-configuration', often the minibuffer |
5378 ends up as the selected window even though it's not active ... | 5462 ends up as the selected window even though it's not active ... |
5379 I really don't know the cause of this, but it should never | 5463 I really don't know the cause of this, but it should never |
5380 happen. This kludge should fix it. | 5464 happen. This kludge should fix it. |
5381 | 5465 |
5382 #### Find out why this is really going wrong. */ | 5466 #### Find out why this is really going wrong. */ |
5383 if (!minibuf_level && | 5467 if (!minibuf_level && |
5384 MINI_WINDOW_P (XWINDOW (config->current_window))) | 5468 MINI_WINDOW_P (XWINDOW (config->current_window))) |
5385 Fselect_window (Fnext_window (config->current_window, | 5469 window_to_select = Fnext_window (config->current_window, |
5386 Qnil, Qnil, Qnil), | 5470 Qnil, Qnil, Qnil); |
5387 Qnil); | |
5388 else | 5471 else |
5389 Fselect_window (config->current_window, Qnil); | 5472 window_to_select = config->current_window; |
5473 #endif | |
5474 /* Do this last so that buffer stacking is calculated | |
5475 correctly. */ | |
5476 Fselect_window (config->current_window, Qnil); | |
5477 | |
5390 if (!NILP (new_current_buffer)) | 5478 if (!NILP (new_current_buffer)) |
5391 Fset_buffer (new_current_buffer); | 5479 { |
5480 Fset_buffer (new_current_buffer); | |
5481 Frecord_buffer (new_current_buffer); | |
5482 } | |
5392 else | 5483 else |
5393 Fset_buffer (XWINDOW (Fselected_window (Qnil))->buffer); | 5484 { |
5485 Fset_buffer (XWINDOW (config->current_window)->buffer); | |
5486 Frecord_buffer (XWINDOW (config->current_window)->buffer); | |
5487 } | |
5394 } | 5488 } |
5395 else | 5489 else |
5396 set_frame_selected_window (f, config->current_window); | 5490 set_frame_selected_window (f, config->current_window); |
5397 } | 5491 } |
5398 else | 5492 else |
5597 &lrecord_window_configuration); | 5691 &lrecord_window_configuration); |
5598 XSETWINDOW_CONFIGURATION (result, config); | 5692 XSETWINDOW_CONFIGURATION (result, config); |
5599 /* | 5693 /* |
5600 config->frame_width = FRAME_WIDTH (f); | 5694 config->frame_width = FRAME_WIDTH (f); |
5601 config->frame_height = FRAME_HEIGHT (f); */ | 5695 config->frame_height = FRAME_HEIGHT (f); */ |
5602 config->current_window = FRAME_SELECTED_WINDOW (f); | 5696 /* When using `push-window-configuration', often the minibuffer ends |
5697 up as the selected window because functions run as the result of | |
5698 user interaction e.g. hyper-apropros. It seems to me the sensible | |
5699 thing to do is not record the minibuffer here. */ | |
5700 if (FRAME_MINIBUF_ONLY_P (f) || minibuf_level) | |
5701 config->current_window = FRAME_SELECTED_WINDOW (f); | |
5702 else | |
5703 config->current_window = FRAME_LAST_NONMINIBUF_WINDOW (f); | |
5603 XSETBUFFER (config->current_buffer, current_buffer); | 5704 XSETBUFFER (config->current_buffer, current_buffer); |
5604 config->minibuffer_scroll_window = Vminibuffer_scroll_window; | 5705 config->minibuffer_scroll_window = Vminibuffer_scroll_window; |
5605 config->root_window = FRAME_ROOT_WINDOW (f); | 5706 config->root_window = FRAME_ROOT_WINDOW (f); |
5606 config->min_height = window_min_height; | 5707 config->min_height = window_min_height; |
5607 config->min_width = window_min_width; | 5708 config->min_width = window_min_width; |
5737 | 5838 |
5738 if (NILP (child)) | 5839 if (NILP (child)) |
5739 child = Fwindow_first_hchild (window); | 5840 child = Fwindow_first_hchild (window); |
5740 | 5841 |
5741 for (i = level; i > 0; i--) | 5842 for (i = level; i > 0; i--) |
5742 putc ('\t', stderr); | 5843 stderr_out ("\t"); |
5743 | 5844 |
5744 fputs ("#<window", stderr); | 5845 stderr_out ("#<window"); |
5745 { | 5846 { |
5746 Lisp_Object buffer = XWINDOW (window)->buffer; | 5847 Lisp_Object buffer = XWINDOW (window)->buffer; |
5747 if (!NILP (buffer) && BUFFERP (buffer)) | 5848 if (!NILP (buffer) && BUFFERP (buffer)) |
5748 fprintf (stderr, " on %s", XSTRING_DATA (XBUFFER (buffer)->name)); | 5849 stderr_out (" on %s", XSTRING_DATA (XBUFFER (buffer)->name)); |
5749 } | 5850 } |
5750 fprintf (stderr, " 0x%x>", XWINDOW (window)->header.uid); | 5851 stderr_out (" 0x%x>", XWINDOW (window)->header.uid); |
5751 | 5852 |
5752 while (!NILP (child)) | 5853 while (!NILP (child)) |
5753 { | 5854 { |
5754 debug_print_window (child, level + 1); | 5855 debug_print_window (child, level + 1); |
5755 child = Fwindow_next_child (child); | 5856 child = Fwindow_next_child (child); |
5813 DEFSUBR (Fwindow_buffer); | 5914 DEFSUBR (Fwindow_buffer); |
5814 DEFSUBR (Fwindow_frame); | 5915 DEFSUBR (Fwindow_frame); |
5815 DEFSUBR (Fwindow_height); | 5916 DEFSUBR (Fwindow_height); |
5816 DEFSUBR (Fwindow_displayed_height); | 5917 DEFSUBR (Fwindow_displayed_height); |
5817 DEFSUBR (Fwindow_width); | 5918 DEFSUBR (Fwindow_width); |
5919 DEFSUBR (Fwindow_full_width); | |
5818 DEFSUBR (Fwindow_pixel_height); | 5920 DEFSUBR (Fwindow_pixel_height); |
5819 DEFSUBR (Fwindow_pixel_width); | 5921 DEFSUBR (Fwindow_pixel_width); |
5922 DEFSUBR (Fwindow_text_area_height); | |
5820 DEFSUBR (Fwindow_text_area_pixel_height); | 5923 DEFSUBR (Fwindow_text_area_pixel_height); |
5821 DEFSUBR (Fwindow_displayed_text_pixel_height); | 5924 DEFSUBR (Fwindow_displayed_text_pixel_height); |
5822 DEFSUBR (Fwindow_text_area_pixel_width); | 5925 DEFSUBR (Fwindow_text_area_pixel_width); |
5823 DEFSUBR (Fwindow_hscroll); | 5926 DEFSUBR (Fwindow_hscroll); |
5824 DEFSUBR (Fset_window_hscroll); | 5927 DEFSUBR (Fset_window_hscroll); |