comparison src/window.c @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents 623d57b7fbe8 0d4c9d0f6a8d
children 2a462149bd6a
comparison
equal deleted inserted replaced
5124:623d57b7fbe8 5125:b5df3737028a
304 304
305 static void 305 static void
306 print_window (Lisp_Object obj, Lisp_Object printcharfun, 306 print_window (Lisp_Object obj, Lisp_Object printcharfun,
307 int UNUSED (escapeflag)) 307 int UNUSED (escapeflag))
308 { 308 {
309 Lisp_Object buf;
310
309 if (print_readably) 311 if (print_readably)
310 printing_unreadable_object ("#<window 0x%x>", XWINDOW (obj)->header.uid); 312 printing_unreadable_lcrecord (obj, 0);
311 313
312 write_c_string (printcharfun, "#<window"); 314 write_ascstring (printcharfun, "#<window");
313 if (!NILP (XWINDOW (obj)->buffer)) 315 buf = XWINDOW_BUFFER (obj);
314 { 316 if (EQ (buf, Qt))
315 Lisp_Object name = XBUFFER (XWINDOW (obj)->buffer)->name; 317 write_ascstring (printcharfun, " during creation");
318 else if (!NILP (buf))
319 {
320
321 Lisp_Object name = XBUFFER (buf)->name;
316 write_fmt_string_lisp (printcharfun, " on %S", 1, name); 322 write_fmt_string_lisp (printcharfun, " on %S", 1, name);
317 } 323 }
318 write_fmt_string (printcharfun, " 0x%x>", XWINDOW (obj)->header.uid); 324 write_fmt_string (printcharfun, " 0x%x>", XWINDOW (obj)->header.uid);
319 } 325 }
320 326
1031 else 1037 else
1032 return XINT (w->vertical_divider_line_width) == 0 ? 0 : 1; 1038 return XINT (w->vertical_divider_line_width) == 0 ? 0 : 1;
1033 } 1039 }
1034 1040
1035 int 1041 int
1036 window_scrollbar_width (struct window *w) 1042 window_scrollbar_width (struct window * USED_IF_SCROLLBARS (w))
1037 { 1043 {
1038 #ifdef HAVE_SCROLLBARS 1044 #ifdef HAVE_SCROLLBARS
1039 if (!WINDOW_WIN_P (w) 1045 if (!WINDOW_WIN_P (w)
1040 || MINI_WINDOW_P (w) 1046 || MINI_WINDOW_P (w)
1041 || NILP (w->buffer) 1047 || NILP (w->buffer)
1050 } 1056 }
1051 1057
1052 /* Horizontal scrollbars are only active on windows with truncation 1058 /* Horizontal scrollbars are only active on windows with truncation
1053 turned on. */ 1059 turned on. */
1054 int 1060 int
1055 window_scrollbar_height (struct window *w) 1061 window_scrollbar_height (struct window * USED_IF_SCROLLBARS (w))
1056 { 1062 {
1057 #ifdef HAVE_SCROLLBARS 1063 #ifdef HAVE_SCROLLBARS
1058 if (!WINDOW_WIN_P (w) 1064 if (!WINDOW_WIN_P (w)
1059 || MINI_WINDOW_P (w) 1065 || MINI_WINDOW_P (w)
1060 || NILP (w->buffer) 1066 || NILP (w->buffer)
1108 up-to-date than CURRENT_DISP. For calls to this outside 1114 up-to-date than CURRENT_DISP. For calls to this outside
1109 of redisplay it doesn't matter which structure we check 1115 of redisplay it doesn't matter which structure we check
1110 since there is a redisplay condition that these 1116 since there is a redisplay condition that these
1111 structures be identical outside of redisplay. */ 1117 structures be identical outside of redisplay. */
1112 dla = window_display_lines (w, DESIRED_DISP); 1118 dla = window_display_lines (w, DESIRED_DISP);
1113 if (dla && Dynarr_length (dla) && Dynarr_atp (dla, 0)->modeline) 1119 if (dla && Dynarr_length (dla) && Dynarr_begin (dla)->modeline)
1114 modeline_height = (Dynarr_atp (dla, 0)->ascent + 1120 modeline_height = (Dynarr_begin (dla)->ascent +
1115 Dynarr_atp (dla, 0)->descent); 1121 Dynarr_begin (dla)->descent);
1116 else 1122 else
1117 { 1123 {
1118 dla = window_display_lines (w, CURRENT_DISP); 1124 dla = window_display_lines (w, CURRENT_DISP);
1119 if (dla && Dynarr_length (dla) && Dynarr_atp (dla, 0)->modeline) 1125 if (dla && Dynarr_length (dla) && Dynarr_begin (dla)->modeline)
1120 modeline_height = (Dynarr_atp (dla, 0)->ascent + 1126 modeline_height = (Dynarr_begin (dla)->ascent +
1121 Dynarr_atp (dla, 0)->descent); 1127 Dynarr_begin (dla)->descent);
1122 else 1128 else
1123 /* This should be an abort except I'm not yet 100% 1129 /* This should be an abort except I'm not yet 100%
1124 confident that it won't ever get hit (though I 1130 confident that it won't ever get hit (though I
1125 haven't been able to trigger it). It is extremely 1131 haven't been able to trigger it). It is extremely
1126 unlikely to cause any noticeable problem and even if 1132 unlikely to cause any noticeable problem and even if
1257 { 1263 {
1258 return window_bottom_window_gutter_height (w); 1264 return window_bottom_window_gutter_height (w);
1259 } 1265 }
1260 1266
1261 static int 1267 static int
1262 window_left_window_gutter_width (struct window *w, int modeline) 1268 window_left_window_gutter_width (struct window *w,
1269 int USED_IF_SCROLLBARS (modeline))
1263 { 1270 {
1264 if (!NILP (w->hchild) || !NILP (w->vchild)) 1271 if (!NILP (w->hchild) || !NILP (w->vchild))
1265 return 0; 1272 return 0;
1266 1273
1267 #ifdef HAVE_SCROLLBARS 1274 #ifdef HAVE_SCROLLBARS
1277 { 1284 {
1278 return window_left_window_gutter_width (w, modeline); 1285 return window_left_window_gutter_width (w, modeline);
1279 } 1286 }
1280 1287
1281 static int 1288 static int
1282 window_right_window_gutter_width (struct window *w, int modeline) 1289 window_right_window_gutter_width (struct window *w,
1290 int USED_IF_SCROLLBARS (modeline))
1283 { 1291 {
1284 int gutter = 0; 1292 int gutter = 0;
1285 1293
1286 if (!NILP (w->hchild) || !NILP (w->vchild)) 1294 if (!NILP (w->hchild) || !NILP (w->vchild))
1287 return 0; 1295 return 0;
1904 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP); 1912 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP);
1905 int num_lines = Dynarr_length (dla); 1913 int num_lines = Dynarr_length (dla);
1906 struct display_line *dl; 1914 struct display_line *dl;
1907 1915
1908 /* No lines - no clipped lines */ 1916 /* No lines - no clipped lines */
1909 if (num_lines == 0 || (num_lines == 1 && Dynarr_atp (dla, 0)->modeline)) 1917 if (num_lines == 0 || (num_lines == 1 && Dynarr_begin (dla)->modeline))
1910 return Qnil; 1918 return Qnil;
1911 1919
1912 dl = Dynarr_atp (dla, num_lines - 1); 1920 dl = Dynarr_atp (dla, num_lines - 1);
1913 if (dl->clip == 0) 1921 if (dl->clip == 0)
1914 return Qnil; 1922 return Qnil;
4189 4197
4190 /* #### Document and assert somewhere that w->window_end_pos == -1 4198 /* #### Document and assert somewhere that w->window_end_pos == -1
4191 indicates that end-of-buffer is being displayed. */ 4199 indicates that end-of-buffer is being displayed. */
4192 if (end_pos == -1) 4200 if (end_pos == -1)
4193 { 4201 {
4194 struct display_line *dl = Dynarr_atp (dla, 0); 4202 struct display_line *dl = Dynarr_begin (dla);
4195 int ypos1 = dl->ypos + dl->descent; 4203 int ypos1 = dl->ypos + dl->descent;
4196 int ypos2 = WINDOW_TEXT_BOTTOM (w); 4204 int ypos2 = WINDOW_TEXT_BOTTOM (w);
4197 Lisp_Object window; 4205 Lisp_Object window;
4198 int defheight, defwidth; 4206 int defheight, defwidth;
4199 4207
4224 if (defheight) 4232 if (defheight)
4225 num_lines += ((ypos2 - ypos1) / defheight); 4233 num_lines += ((ypos2 - ypos1) / defheight);
4226 } 4234 }
4227 else 4235 else
4228 { 4236 {
4229 if (num_lines > 1 && Dynarr_atp (dla, 0)->modeline) 4237 if (num_lines > 1 && Dynarr_begin (dla)->modeline)
4230 num_lines--; 4238 num_lines--;
4231 4239
4232 if (scroll_on_clipped_lines 4240 if (scroll_on_clipped_lines
4233 && Dynarr_atp (dla, Dynarr_length (dla) - 1)->clip) 4241 && Dynarr_atp (dla, Dynarr_length (dla) - 1)->clip)
4234 num_lines--; 4242 num_lines--;
4597 fheight = XINT (Vwindow_pixel_scroll_increment); 4605 fheight = XINT (Vwindow_pixel_scroll_increment);
4598 else if (!NILP (Vwindow_pixel_scroll_increment)) 4606 else if (!NILP (Vwindow_pixel_scroll_increment))
4599 default_face_height_and_width (window, &fheight, &fwidth); 4607 default_face_height_and_width (window, &fheight, &fwidth);
4600 4608
4601 if (Dynarr_length (dla) >= 1) 4609 if (Dynarr_length (dla) >= 1)
4602 modeline = Dynarr_atp (dla, 0)->modeline; 4610 modeline = Dynarr_begin (dla)->modeline;
4603 4611
4604 dl = Dynarr_atp (dla, modeline); 4612 dl = Dynarr_atp (dla, modeline);
4605 4613
4606 if (value > 0) 4614 if (value > 0)
4607 { 4615 {
5285 pos = Fwindow_point (window); 5293 pos = Fwindow_point (window);
5286 5294
5287 CHECK_INT (pos); 5295 CHECK_INT (pos);
5288 point = XINT (pos); 5296 point = XINT (pos);
5289 5297
5290 if (Dynarr_length (dla) && Dynarr_atp (dla, 0)->modeline) 5298 if (Dynarr_length (dla) && Dynarr_begin (dla)->modeline)
5291 first_line = 1; 5299 first_line = 1;
5292 else 5300 else
5293 first_line = 0; 5301 first_line = 0;
5294 5302
5295 for (i = first_line; i < Dynarr_length (dla); i++) 5303 for (i = first_line; i < Dynarr_length (dla); i++)