comparison src/redisplay-output.c @ 434:9d177e8d4150 r21-2-25

Import from CVS: tag r21-2-25
author cvs
date Mon, 13 Aug 2007 11:30:53 +0200
parents a5df635868b2
children 84b14dcb0985
comparison
equal deleted inserted replaced
433:892ca416f0fb 434:9d177e8d4150
45 struct rune *drb); 45 struct rune *drb);
46 static void redraw_cursor_in_window (struct window *w, 46 static void redraw_cursor_in_window (struct window *w,
47 int run_end_begin_glyphs); 47 int run_end_begin_glyphs);
48 static void redisplay_output_display_block (struct window *w, struct display_line *dl, 48 static void redisplay_output_display_block (struct window *w, struct display_line *dl,
49 int block, int start, int end, int start_pixpos, 49 int block, int start, int end, int start_pixpos,
50 int cursor_start, int cursor_width, 50 int cursor_start, int cursor_width,
51 int cursor_height); 51 int cursor_height);
52 static void redisplay_normalize_display_box (struct display_box* dest, 52 static void redisplay_normalize_display_box (struct display_box* dest,
53 struct display_glyph_area* src); 53 struct display_glyph_area* src);
54 static int redisplay_display_boxes_in_window_p (struct window* w, 54 static int redisplay_display_boxes_in_window_p (struct window* w,
55 struct display_box* db, 55 struct display_box* db,
56 struct display_glyph_area* dga); 56 struct display_glyph_area* dga);
57 static void redisplay_clear_clipped_region (Lisp_Object locale, face_index findex, 57 static void redisplay_clear_clipped_region (Lisp_Object locale, face_index findex,
58 struct display_box* dest, 58 struct display_box* dest,
59 struct display_glyph_area* glyphsrc, 59 struct display_glyph_area* glyphsrc,
60 int fullheight_p, Lisp_Object); 60 int fullheight_p, Lisp_Object);
61 61
62 /***************************************************************************** 62 /*****************************************************************************
63 sync_rune_structs 63 sync_rune_structs
64 64
208 208
209 So I (JV) conjecture 209 So I (JV) conjecture
210 210
211 #### It would really be worth it to arrange for this function to 211 #### It would really be worth it to arrange for this function to
212 be (almost) a single call to memcmp. */ 212 be (almost) a single call to memcmp. */
213 213
214 if ((crb->findex != drb->findex) || 214 if ((crb->findex != drb->findex) ||
215 (WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))) 215 (WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
216 return 0; 216 return 0;
217 else if (crb->xpos != drb->xpos) 217 else if (crb->xpos != drb->xpos)
218 return 0; 218 return 0;
227 return 0; 227 return 0;
228 else if (crb->type == RUNE_HLINE && 228 else if (crb->type == RUNE_HLINE &&
229 (crb->object.hline.thickness != drb->object.hline.thickness || 229 (crb->object.hline.thickness != drb->object.hline.thickness ||
230 crb->object.hline.yoffset != drb->object.hline.yoffset)) 230 crb->object.hline.yoffset != drb->object.hline.yoffset))
231 return 0; 231 return 0;
232 else if (crb->type == RUNE_DGLYPH && 232 else if (crb->type == RUNE_DGLYPH &&
233 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) || 233 (!EQ (crb->object.dglyph.glyph, drb->object.dglyph.glyph) ||
234 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) || 234 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) ||
235 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset)) 235 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset))
236 return 0; 236 return 0;
237 /* Only check dirtiness if we know something has changed. */ 237 /* Only check dirtiness if we know something has changed. */
242 /* Although doing the cachel lookup for every comparison is 242 /* Although doing the cachel lookup for every comparison is
243 very expensive.we have to do it to make sure the cache is 243 very expensive.we have to do it to make sure the cache is
244 up-to-date. */ 244 up-to-date. */
245 if (GLYPH_CACHEL_DIRTYP (w, gindex)) 245 if (GLYPH_CACHEL_DIRTYP (w, gindex))
246 return 0; 246 return 0;
247 else 247 else
248 return 1; 248 return 1;
249 } 249 }
250 else 250 else
251 return 1; 251 return 1;
252 } 252 }
655 height = DISPLAY_LINE_HEIGHT (ddl); 655 height = DISPLAY_LINE_HEIGHT (ddl);
656 656
657 if (x < ddl->bounds.left_in) 657 if (x < ddl->bounds.left_in)
658 { 658 {
659 findex = ddl->left_margin_findex ? 659 findex = ddl->left_margin_findex ?
660 ddl->left_margin_findex 660 ddl->left_margin_findex
661 : get_builtin_face_cache_index (w, Vleft_margin_face); 661 : get_builtin_face_cache_index (w, Vleft_margin_face);
662 } 662 }
663 else if (x < ddl->bounds.right_in) 663 else if (x < ddl->bounds.right_in)
664 { 664 {
665 /* no check here because DEFAULT_INDEX == 0 anyway */ 665 /* no check here because DEFAULT_INDEX == 0 anyway */
666 findex = ddl->default_findex; 666 findex = ddl->default_findex;
667 } 667 }
668 else if (x < ddl->bounds.right_out) 668 else if (x < ddl->bounds.right_out)
669 { 669 {
670 findex = ddl->right_margin_findex ? 670 findex = ddl->right_margin_findex ?
671 ddl->right_margin_findex 671 ddl->right_margin_findex
672 : get_builtin_face_cache_index (w, Vright_margin_face); 672 : get_builtin_face_cache_index (w, Vright_margin_face);
673 } 673 }
674 else 674 else
675 findex = (face_index) -1; 675 findex = (face_index) -1;
676 676
710 710
711 /* If there was formerly no block over the current 711 /* If there was formerly no block over the current
712 region or if it was a block of a different type, then 712 region or if it was a block of a different type, then
713 output the entire ddb. Otherwise, compare cdb and 713 output the entire ddb. Otherwise, compare cdb and
714 ddb and output only the changed region. */ 714 ddb and output only the changed region. */
715 if (!force && cdb && ddb->type == cdb->type 715 if (!force && cdb && ddb->type == cdb->type
716 /* If there was no buffer being display before the 716 /* If there was no buffer being display before the
717 compare anyway as we might be outputting a gutter. */ 717 compare anyway as we might be outputting a gutter. */
718 && 718 &&
719 (b == old_b || !old_b)) 719 (b == old_b || !old_b))
720 { 720 {
721 must_sync |= compare_display_blocks (w, cdl, ddl, old_block, 721 must_sync |= compare_display_blocks (w, cdl, ddl, old_block,
722 block, start_pixpos, 722 block, start_pixpos,
723 cursor_start, cursor_width, 723 cursor_start, cursor_width,
752 last_elt, 752 last_elt,
753 start_pixpos, 753 start_pixpos,
754 cursor_start, cursor_width, 754 cursor_start, cursor_width,
755 cursor_height); 755 cursor_height);
756 } 756 }
757 757
758 start_pixpos = next_start_pixpos; 758 start_pixpos = next_start_pixpos;
759 } 759 }
760 } 760 }
761 761
762 /* Clear the internal border if we are next to it and the window 762 /* Clear the internal border if we are next to it and the window
776 if (ddl->modeline) 776 if (ddl->modeline)
777 { 777 {
778 y -= MODELINE_SHADOW_THICKNESS (w); 778 y -= MODELINE_SHADOW_THICKNESS (w);
779 height += (2 * MODELINE_SHADOW_THICKNESS (w)); 779 height += (2 * MODELINE_SHADOW_THICKNESS (w));
780 } 780 }
781 781
782 if (window_is_leftmost (w)) 782 if (window_is_leftmost (w))
783 clear_left_border (w, y, height); 783 clear_left_border (w, y, height);
784 if (window_is_rightmost (w)) 784 if (window_is_rightmost (w))
785 clear_right_border (w, y, height); 785 clear_right_border (w, y, height);
786 } 786 }
922 cur_dl = y; 922 cur_dl = y;
923 first = 1; 923 first = 1;
924 } 924 }
925 } 925 }
926 926
927 while ((up ? (cur_dl < Dynarr_length (cla)) : (cur_dl >= 0))) 927 while (up ? (cur_dl < Dynarr_length (cla)) : (cur_dl >= 0))
928 { 928 {
929 dl = Dynarr_atp (cla, cur_dl); 929 dl = Dynarr_atp (cla, cur_dl);
930 db = get_display_block_from_line (dl, TEXT); 930 db = get_display_block_from_line (dl, TEXT);
931 931
932 if (!up && !first) 932 if (!up && !first)
1110 if (cachel->being_displayed 1110 if (cachel->being_displayed
1111 && 1111 &&
1112 cachel->x + cachel->width > x && cachel->x < x + width 1112 cachel->x + cachel->width > x && cachel->x < x + width
1113 && 1113 &&
1114 cachel->y + cachel->height > y && cachel->y < y + height 1114 cachel->y + cachel->height > y && cachel->y < y + height
1115 && 1115 &&
1116 !EQ (cachel->subwindow, ignored_window)) 1116 !EQ (cachel->subwindow, ignored_window))
1117 { 1117 {
1118 unmap_subwindow (cachel->subwindow); 1118 unmap_subwindow (cachel->subwindow);
1119 } 1119 }
1120 } 1120 }
1132 { 1132 {
1133 redisplay_unmap_subwindows (f, x, y, width, height, Qnil); 1133 redisplay_unmap_subwindows (f, x, y, width, height, Qnil);
1134 } 1134 }
1135 } 1135 }
1136 1136
1137 static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width, 1137 static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width,
1138 int height, Lisp_Object subwindow) 1138 int height, Lisp_Object subwindow)
1139 { 1139 {
1140 if (Dynarr_length (FRAME_SUBWINDOW_CACHE (f))) 1140 if (Dynarr_length (FRAME_SUBWINDOW_CACHE (f)))
1141 { 1141 {
1142 redisplay_unmap_subwindows (f, x, y, width, height, subwindow); 1142 redisplay_unmap_subwindows (f, x, y, width, height, subwindow);
1149 output a subwindow. This code borrows heavily from the pixmap stuff, 1149 output a subwindow. This code borrows heavily from the pixmap stuff,
1150 although is much simpler not needing to account for partial 1150 although is much simpler not needing to account for partial
1151 pixmaps, backgrounds etc. 1151 pixmaps, backgrounds etc.
1152 ****************************************************************************/ 1152 ****************************************************************************/
1153 void 1153 void
1154 redisplay_output_subwindow (struct window *w, 1154 redisplay_output_subwindow (struct window *w,
1155 Lisp_Object image_instance, 1155 Lisp_Object image_instance,
1156 struct display_box* db, struct display_glyph_area* dga, 1156 struct display_box* db, struct display_glyph_area* dga,
1157 face_index findex, int cursor_start, int cursor_width, 1157 face_index findex, int cursor_start, int cursor_width,
1158 int cursor_height) 1158 int cursor_height)
1159 { 1159 {
1187 cases.*/ 1187 cases.*/
1188 sdga.xoffset = -dga->xoffset; 1188 sdga.xoffset = -dga->xoffset;
1189 sdga.yoffset = -dga->yoffset; 1189 sdga.yoffset = -dga->yoffset;
1190 sdga.height = IMAGE_INSTANCE_SUBWINDOW_HEIGHT (p); 1190 sdga.height = IMAGE_INSTANCE_SUBWINDOW_HEIGHT (p);
1191 sdga.width = IMAGE_INSTANCE_SUBWINDOW_WIDTH (p); 1191 sdga.width = IMAGE_INSTANCE_SUBWINDOW_WIDTH (p);
1192 1192
1193 if (redisplay_display_boxes_in_window_p (w, db, &sdga) < 0) 1193 if (redisplay_display_boxes_in_window_p (w, db, &sdga) < 0)
1194 { 1194 {
1195 map_subwindow (image_instance, db->xpos, db->ypos, dga); 1195 map_subwindow (image_instance, db->xpos, db->ypos, dga);
1196 } 1196 }
1197 else 1197 else
1198 { 1198 {
1199 sdga.xoffset = sdga.yoffset = 0; 1199 sdga.xoffset = sdga.yoffset = 0;
1200 map_subwindow (image_instance, db->xpos - dga->xoffset, 1200 map_subwindow (image_instance, db->xpos - dga->xoffset,
1201 db->ypos - dga->yoffset, &sdga); 1201 db->ypos - dga->yoffset, &sdga);
1202 } 1202 }
1203 } 1203 }
1204 1204
1205 /**************************************************************************** 1205 /****************************************************************************
1206 redisplay_output_layout 1206 redisplay_output_layout
1207 1207
1208 Output a widget hierarchy. This can safely call itself recursively. 1208 Output a widget hierarchy. This can safely call itself recursively.
1209 ****************************************************************************/ 1209 ****************************************************************************/
1210 void 1210 void
1211 redisplay_output_layout (struct window *w, 1211 redisplay_output_layout (struct window *w,
1212 Lisp_Object image_instance, 1212 Lisp_Object image_instance,
1213 struct display_box* db, struct display_glyph_area* dga, 1213 struct display_box* db, struct display_glyph_area* dga,
1214 face_index findex, int cursor_start, int cursor_width, 1214 face_index findex, int cursor_start, int cursor_width,
1215 int cursor_height) 1215 int cursor_height)
1216 { 1216 {
1250 { 1250 {
1251 /* First clear the area we are drawing into. This is the easiest 1251 /* First clear the area we are drawing into. This is the easiest
1252 thing to do since we have many gaps that we have to make sure are 1252 thing to do since we have many gaps that we have to make sure are
1253 filled in. */ 1253 filled in. */
1254 redisplay_clear_clipped_region (window, findex, db, dga, 1, Qnil); 1254 redisplay_clear_clipped_region (window, findex, db, dga, 1, Qnil);
1255 1255
1256 /* Output a border if required */ 1256 /* Output a border if required */
1257 if (!NILP (IMAGE_INSTANCE_LAYOUT_BORDER (p))) 1257 if (!NILP (IMAGE_INSTANCE_LAYOUT_BORDER (p)))
1258 { 1258 {
1259 int edges = 0; 1259 int edges = 0;
1260 enum edge_style style; 1260 enum edge_style style;
1261 int ypos = db->ypos; 1261 int ypos = db->ypos;
1262 int height = dga->height; 1262 int height = dga->height;
1263 1263
1264 if (dga->xoffset >= 0) 1264 if (dga->xoffset >= 0)
1265 edges |= EDGE_LEFT; 1265 edges |= EDGE_LEFT;
1266 if (dga->width - dga->xoffset == layout_width) 1266 if (dga->width - dga->xoffset == layout_width)
1267 edges |= EDGE_RIGHT; 1267 edges |= EDGE_RIGHT;
1268 if (dga->yoffset >= 0) 1268 if (dga->yoffset >= 0)
1269 edges |= EDGE_TOP; 1269 edges |= EDGE_TOP;
1270 if (dga->height - dga->yoffset == layout_height) 1270 if (dga->height - dga->yoffset == layout_height)
1271 edges |= EDGE_BOTTOM; 1271 edges |= EDGE_BOTTOM;
1272 1272
1273 if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in)) 1273 if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
1274 style = EDGE_ETCHED_IN; 1274 style = EDGE_ETCHED_IN;
1275 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out)) 1275 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
1276 style = EDGE_ETCHED_OUT; 1276 style = EDGE_ETCHED_OUT;
1277 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qbevel_in)) 1277 else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qbevel_in))
1286 } 1286 }
1287 } 1287 }
1288 else 1288 else
1289 style = EDGE_BEVEL_OUT; 1289 style = EDGE_BEVEL_OUT;
1290 1290
1291 MAYBE_DEVMETH (d, bevel_area, 1291 MAYBE_DEVMETH (d, bevel_area,
1292 (w, findex, db->xpos, 1292 (w, findex, db->xpos,
1293 ypos, 1293 ypos,
1294 dga->width, height, 2, edges, style)); 1294 dga->width, height, 2, edges, style));
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 /* This shrinks the display box to exactly enclose the glyph 1298 /* This shrinks the display box to exactly enclose the glyph
1299 area. */ 1299 area. */
1300 redisplay_normalize_display_box (db, dga); 1300 redisplay_normalize_display_box (db, dga);
1301 1301
1302 /* Flip through the widgets in the layout displaying as necessary */ 1302 /* Flip through the widgets in the layout displaying as necessary */
1344 { 1344 {
1345 case IMAGE_TEXT: 1345 case IMAGE_TEXT:
1346 { 1346 {
1347 /* #### This is well hacked and could use some 1347 /* #### This is well hacked and could use some
1348 generalisation.*/ 1348 generalisation.*/
1349 if (redisplay_normalize_glyph_area (&cdb, &cdga) 1349 if (redisplay_normalize_glyph_area (&cdb, &cdga)
1350 && 1350 &&
1351 (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii))) 1351 (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii)))
1352 { 1352 {
1353 struct display_line dl; /* this is fake */ 1353 struct display_line dl; /* this is fake */
1354 Lisp_Object string = 1354 Lisp_Object string =
1355 IMAGE_INSTANCE_TEXT_STRING (childii); 1355 IMAGE_INSTANCE_TEXT_STRING (childii);
1356 convert_bufbyte_string_into_emchar_dynarr 1356 convert_bufbyte_string_into_emchar_dynarr
1357 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); 1357 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
1358 1358
1359 redisplay_normalize_display_box (&cdb, &cdga); 1359 redisplay_normalize_display_box (&cdb, &cdga);
1360 /* Offsets are now +ve again so be careful 1360 /* Offsets are now +ve again so be careful
1361 when fixing up the display line. */ 1361 when fixing up the display line. */
1362 xzero (dl); 1362 xzero (dl);
1363 /* Munge boxes into display lines. */ 1363 /* Munge boxes into display lines. */
1377 findex, 0, 0, 0, 0)); 1377 findex, 0, 0, 0, 0));
1378 Dynarr_reset (buf); 1378 Dynarr_reset (buf);
1379 } 1379 }
1380 } 1380 }
1381 break; 1381 break;
1382 1382
1383 case IMAGE_MONO_PIXMAP: 1383 case IMAGE_MONO_PIXMAP:
1384 case IMAGE_COLOR_PIXMAP: 1384 case IMAGE_COLOR_PIXMAP:
1385 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii)) 1385 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii))
1386 redisplay_output_pixmap (w, child, &cdb, &cdga, findex, 1386 redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
1387 0, 0, 0, 0); 1387 0, 0, 0, 0);
1388 break; 1388 break;
1389 1389
1390 case IMAGE_WIDGET: 1390 case IMAGE_WIDGET:
1391 case IMAGE_SUBWINDOW: 1391 case IMAGE_SUBWINDOW:
1392 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii)) 1392 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii))
1393 redisplay_output_subwindow (w, child, &cdb, &cdga, findex, 1393 redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
1394 0, 0, 0); 1394 0, 0, 0);
1395 break; 1395 break;
1396 1396
1397 case IMAGE_LAYOUT: 1397 case IMAGE_LAYOUT:
1398 redisplay_output_layout (w, child, &cdb, &cdga, findex, 1398 redisplay_output_layout (w, child, &cdb, &cdga, findex,
1399 0, 0, 0); 1399 0, 0, 0);
1400 break; 1400 break;
1401 1401
1402 case IMAGE_NOTHING: 1402 case IMAGE_NOTHING:
1403 /* nothing is as nothing does */ 1403 /* nothing is as nothing does */
1404 break; 1404 break;
1405 1405
1406 case IMAGE_POINTER: 1406 case IMAGE_POINTER:
1407 default: 1407 default:
1408 abort (); 1408 abort ();
1409 } 1409 }
1410 } 1410 }
1418 1418
1419 1419
1420 output a pixmap. 1420 output a pixmap.
1421 ****************************************************************************/ 1421 ****************************************************************************/
1422 void 1422 void
1423 redisplay_output_pixmap (struct window *w, 1423 redisplay_output_pixmap (struct window *w,
1424 Lisp_Object image_instance, 1424 Lisp_Object image_instance,
1425 struct display_box* db, struct display_glyph_area* dga, 1425 struct display_box* db, struct display_glyph_area* dga,
1426 face_index findex, int cursor_start, int cursor_width, 1426 face_index findex, int cursor_start, int cursor_width,
1427 int cursor_height, int offset_bitmap) 1427 int cursor_height, int offset_bitmap)
1428 { 1428 {
1447 since we can't yet clear just the area not included in the 1447 since we can't yet clear just the area not included in the
1448 mask. */ 1448 mask. */
1449 if (!offset_bitmap) 1449 if (!offset_bitmap)
1450 { 1450 {
1451 redisplay_clear_clipped_region (window, findex, 1451 redisplay_clear_clipped_region (window, findex,
1452 db, dga, 1452 db, dga,
1453 (int)IMAGE_INSTANCE_PIXMAP_MASK (p), 1453 (int)IMAGE_INSTANCE_PIXMAP_MASK (p),
1454 Qnil); 1454 Qnil);
1455 1455
1456 /* This shrinks the display box to exactly enclose the glyph 1456 /* This shrinks the display box to exactly enclose the glyph
1457 area. */ 1457 area. */
1504 /* if we have subwindows in the region we have to unmap them */ 1504 /* if we have subwindows in the region we have to unmap them */
1505 redisplay_unmap_subwindows_maybe (f, x, y, width, height); 1505 redisplay_unmap_subwindows_maybe (f, x, y, width, height);
1506 1506
1507 /* #### This isn't quite right for when this function is called 1507 /* #### This isn't quite right for when this function is called
1508 from the toolbar code. */ 1508 from the toolbar code. */
1509 1509
1510 /* Don't use a backing pixmap in the border area */ 1510 /* Don't use a backing pixmap in the border area */
1511 if (x >= FRAME_LEFT_BORDER_END (f) 1511 if (x >= FRAME_LEFT_BORDER_END (f)
1512 && x < FRAME_RIGHT_BORDER_START (f) 1512 && x < FRAME_RIGHT_BORDER_START (f)
1513 && y >= FRAME_TOP_BORDER_END (f) 1513 && y >= FRAME_TOP_BORDER_END (f)
1514 && y < FRAME_BOTTOM_BORDER_START (f)) 1514 && y < FRAME_BOTTOM_BORDER_START (f))
1515 { 1515 {
1516 Lisp_Object temp; 1516 Lisp_Object temp;
1517 1517
1518 if (w) 1518 if (w)
1519 { 1519 {
1520 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex); 1520 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex);
1521 1521
1522 if (IMAGE_INSTANCEP (temp) 1522 if (IMAGE_INSTANCEP (temp)
1523 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp))) 1523 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
1524 { 1524 {
1525 /* #### maybe we could implement such that a string 1525 /* #### maybe we could implement such that a string
1526 can be a background pixmap? */ 1526 can be a background pixmap? */
1528 } 1528 }
1529 } 1529 }
1530 else 1530 else
1531 { 1531 {
1532 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale); 1532 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale);
1533 1533
1534 if (IMAGE_INSTANCEP (temp) 1534 if (IMAGE_INSTANCEP (temp)
1535 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp))) 1535 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
1536 { 1536 {
1537 background_pixmap = temp; 1537 background_pixmap = temp;
1538 } 1538 }
1539 } 1539 }
1540 } 1540 }
1541 1541
1542 if (!UNBOUNDP (background_pixmap) && 1542 if (!UNBOUNDP (background_pixmap) &&
1543 XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0) 1543 XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0)
1544 { 1544 {
1545 if (w) 1545 if (w)
1556 else 1556 else
1557 { 1557 {
1558 fcolor = (w ? 1558 fcolor = (w ?
1559 WINDOW_FACE_CACHEL_BACKGROUND (w, findex) : 1559 WINDOW_FACE_CACHEL_BACKGROUND (w, findex) :
1560 FACE_BACKGROUND (Vdefault_face, locale)); 1560 FACE_BACKGROUND (Vdefault_face, locale));
1561 1561
1562 } 1562 }
1563 1563
1564 if (UNBOUNDP (background_pixmap)) 1564 if (UNBOUNDP (background_pixmap))
1565 background_pixmap = Qnil; 1565 background_pixmap = Qnil;
1566 1566
1567 DEVMETH (d, clear_region, 1567 DEVMETH (d, clear_region,
1568 (locale, d, f, findex, x, y, width, height, fcolor, bcolor, background_pixmap)); 1568 (locale, d, f, findex, x, y, width, height, fcolor, bcolor, background_pixmap));
1569 } 1569 }
1570 1570
1571 /**************************************************************************** 1571 /****************************************************************************
1572 redisplay_clear_clipped_region 1572 redisplay_clear_clipped_region
1575 display_glyph_area using the given face. This is a common occurance 1575 display_glyph_area using the given face. This is a common occurance
1576 for images shorter than the display line. Clipping can be played 1576 for images shorter than the display line. Clipping can be played
1577 around with by altering these. glyphsrc should be normalized. 1577 around with by altering these. glyphsrc should be normalized.
1578 ****************************************************************************/ 1578 ****************************************************************************/
1579 static void 1579 static void
1580 redisplay_clear_clipped_region (Lisp_Object window, face_index findex, 1580 redisplay_clear_clipped_region (Lisp_Object window, face_index findex,
1581 struct display_box* dest, struct display_glyph_area* glyphsrc, 1581 struct display_box* dest, struct display_glyph_area* glyphsrc,
1582 int fullheight_p, Lisp_Object ignored_subwindow) 1582 int fullheight_p, Lisp_Object ignored_subwindow)
1583 { 1583 {
1584 /* assume dest->xpos >= 0 */ 1584 /* assume dest->xpos >= 0 */
1585 int clear_x; 1585 int clear_x;
1586 struct frame* f = XFRAME (XWINDOW (window)->frame); 1586 struct frame* f = XFRAME (XWINDOW (window)->frame);
1600 redisplay_clear_region (window, findex, clear_x, dest->ypos, 1600 redisplay_clear_region (window, findex, clear_x, dest->ypos,
1601 glyphsrc->width, dest->height); 1601 glyphsrc->width, dest->height);
1602 } 1602 }
1603 else 1603 else
1604 { 1604 {
1605 int yoffset = (glyphsrc->yoffset > 0 ? glyphsrc->yoffset : 0); 1605 int yoffset = (glyphsrc->yoffset > 0 ? glyphsrc->yoffset : 0);
1606 1606
1607 /* We need to make sure that subwindows are unmapped from the 1607 /* We need to make sure that subwindows are unmapped from the
1608 whole area. */ 1608 whole area. */
1609 redisplay_unmap_subwindows_except_us (f, clear_x, dest->ypos, 1609 redisplay_unmap_subwindows_except_us (f, clear_x, dest->ypos,
1610 glyphsrc->width, dest->height, 1610 glyphsrc->width, dest->height,
1611 ignored_subwindow); 1611 ignored_subwindow);
1612 /* first the top box */ 1612 /* first the top box */
1613 if (yoffset > 0) 1613 if (yoffset > 0)
1614 { 1614 {
1615 redisplay_clear_region (window, findex, clear_x, dest->ypos, 1615 redisplay_clear_region (window, findex, clear_x, dest->ypos,
1616 glyphsrc->width, yoffset); 1616 glyphsrc->width, yoffset);
1617 1617
1618 } 1618 }
1619 /* Then the bottom box */ 1619 /* Then the bottom box */
1620 if (yoffset + glyphsrc->height < dest->height) 1620 if (yoffset + glyphsrc->height < dest->height)
1621 { 1621 {
1622 redisplay_clear_region (window, findex, clear_x, 1622 redisplay_clear_region (window, findex, clear_x,
1623 dest->ypos + yoffset + glyphsrc->height, 1623 dest->ypos + yoffset + glyphsrc->height,
1624 glyphsrc->width, 1624 glyphsrc->width,
1625 dest->height - (yoffset + glyphsrc->height)); 1625 dest->height - (yoffset + glyphsrc->height));
1626 1626
1627 } 1627 }
1628 } 1628 }
1629 } 1629 }
1633 redisplay_normalize_display_box 1633 redisplay_normalize_display_box
1634 1634
1635 Calculate the visible box for displaying src in dest. 1635 Calculate the visible box for displaying src in dest.
1636 ****************************************************************************/ 1636 ****************************************************************************/
1637 int 1637 int
1638 redisplay_normalize_glyph_area (struct display_box* dest, 1638 redisplay_normalize_glyph_area (struct display_box* dest,
1639 struct display_glyph_area* glyphsrc) 1639 struct display_glyph_area* glyphsrc)
1640 { 1640 {
1641 if (dest->xpos + glyphsrc->xoffset > dest->xpos + dest->width 1641 if (dest->xpos + glyphsrc->xoffset > dest->xpos + dest->width
1642 || 1642 ||
1643 dest->ypos + glyphsrc->yoffset > dest->ypos + dest->height 1643 dest->ypos + glyphsrc->yoffset > dest->ypos + dest->height
1676 1676
1677 return 1; 1677 return 1;
1678 } 1678 }
1679 1679
1680 static void 1680 static void
1681 redisplay_normalize_display_box (struct display_box* dest, 1681 redisplay_normalize_display_box (struct display_box* dest,
1682 struct display_glyph_area* glyphsrc) 1682 struct display_glyph_area* glyphsrc)
1683 { 1683 {
1684 /* Adjust the destination area. At the end of this the destination 1684 /* Adjust the destination area. At the end of this the destination
1685 area will exactly enclose the glyph area. The only remaining 1685 area will exactly enclose the glyph area. The only remaining
1686 adjustment will be offsets into the glyph area. */ 1686 adjustment will be offsets into the glyph area. */
1733 if (db->xpos < left || db->ypos < top 1733 if (db->xpos < left || db->ypos < top
1734 || db->xpos + db->width > right 1734 || db->xpos + db->width > right
1735 || db->ypos + db->height > bottom) 1735 || db->ypos + db->height > bottom)
1736 /* We are not displaying in a window at all */ 1736 /* We are not displaying in a window at all */
1737 return 0; 1737 return 0;
1738 1738
1739 if (db->xpos + dga->xoffset >= left 1739 if (db->xpos + dga->xoffset >= left
1740 && 1740 &&
1741 db->ypos + dga->yoffset >= top 1741 db->ypos + dga->yoffset >= top
1742 && 1742 &&
1743 db->xpos + dga->xoffset + dga->width <= right 1743 db->xpos + dga->xoffset + dga->width <= right
1755 co-ordinates. 1755 co-ordinates.
1756 ****************************************************************************/ 1756 ****************************************************************************/
1757 int 1757 int
1758 redisplay_calculate_display_boxes (struct display_line *dl, int xpos, 1758 redisplay_calculate_display_boxes (struct display_line *dl, int xpos,
1759 int xoffset, int start_pixpos, int width, 1759 int xoffset, int start_pixpos, int width,
1760 struct display_box* dest, 1760 struct display_box* dest,
1761 struct display_glyph_area* src) 1761 struct display_glyph_area* src)
1762 { 1762 {
1763 dest->xpos = xpos; 1763 dest->xpos = xpos;
1764 dest->ypos = DISPLAY_LINE_YPOS (dl); 1764 dest->ypos = DISPLAY_LINE_YPOS (dl);
1765 dest->width = width; 1765 dest->width = width;
1836 if (HAS_DEVMETH_P (d, clear_to_window_end)) 1836 if (HAS_DEVMETH_P (d, clear_to_window_end))
1837 DEVMETH (d, clear_to_window_end, (w, ypos1, ypos2)); 1837 DEVMETH (d, clear_to_window_end, (w, ypos1, ypos2));
1838 else 1838 else
1839 { 1839 {
1840 int height = ypos2 - ypos1; 1840 int height = ypos2 - ypos1;
1841 1841
1842 if (height) 1842 if (height)
1843 { 1843 {
1844 Lisp_Object window; 1844 Lisp_Object window;
1845 int bflag = 0 ; /* (window_needs_vertical_divider (w) ? 0 : 1);*/ 1845 int bflag = 0 ; /* (window_needs_vertical_divider (w) ? 0 : 1);*/
1846 layout_bounds bounds; 1846 layout_bounds bounds;
1847 1847
1848 bounds = calculate_display_line_boundaries (w, bflag); 1848 bounds = calculate_display_line_boundaries (w, bflag);
1849 XSETWINDOW (window, w); 1849 XSETWINDOW (window, w);
1850 1850
1851 if (window_is_leftmost (w)) 1851 if (window_is_leftmost (w))
1852 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f), 1852 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
1853 ypos1, FRAME_BORDER_WIDTH (f), height); 1853 ypos1, FRAME_BORDER_WIDTH (f), height);
1854 1854
1855 if (bounds.left_in - bounds.left_out > 0) 1855 if (bounds.left_in - bounds.left_out > 0)
1856 redisplay_clear_region (window, 1856 redisplay_clear_region (window,
1857 get_builtin_face_cache_index (w, Vleft_margin_face), 1857 get_builtin_face_cache_index (w, Vleft_margin_face),
1858 bounds.left_out, ypos1, 1858 bounds.left_out, ypos1,
1859 bounds.left_in - bounds.left_out, height); 1859 bounds.left_in - bounds.left_out, height);
1860 1860
1861 if (bounds.right_in - bounds.left_in > 0) 1861 if (bounds.right_in - bounds.left_in > 0)
1862 redisplay_clear_region (window, 1862 redisplay_clear_region (window,
1863 DEFAULT_INDEX, 1863 DEFAULT_INDEX,
1864 bounds.left_in, ypos1, 1864 bounds.left_in, ypos1,
1865 bounds.right_in - bounds.left_in, height); 1865 bounds.right_in - bounds.left_in, height);
1866 1866
1867 if (bounds.right_out - bounds.right_in > 0) 1867 if (bounds.right_out - bounds.right_in > 0)
1868 redisplay_clear_region (window, 1868 redisplay_clear_region (window,
1869 get_builtin_face_cache_index (w, Vright_margin_face), 1869 get_builtin_face_cache_index (w, Vright_margin_face),
1870 bounds.right_in, ypos1, 1870 bounds.right_in, ypos1,
1871 bounds.right_out - bounds.right_in, height); 1871 bounds.right_out - bounds.right_in, height);
1872 1872
1873 if (window_is_rightmost (w)) 1873 if (window_is_rightmost (w))
1874 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), 1874 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
1875 ypos1, FRAME_BORDER_WIDTH (f), height); 1875 ypos1, FRAME_BORDER_WIDTH (f), height);
1876 } 1876 }
1877 } 1877 }
2254 else 2254 else
2255 { 2255 {
2256 style = EDGE_BEVEL_OUT; 2256 style = EDGE_BEVEL_OUT;
2257 } 2257 }
2258 2258
2259 MAYBE_DEVMETH (d, bevel_area, 2259 MAYBE_DEVMETH (d, bevel_area,
2260 (w, MODELINE_INDEX, x, y, width, height, shadow_thickness, 2260 (w, MODELINE_INDEX, x, y, width, height, shadow_thickness,
2261 EDGE_ALL, style)); 2261 EDGE_ALL, style));
2262 } 2262 }