comparison src/redisplay-msw.c @ 384:bbff43aa5eb7 r21-2-7

Import from CVS: tag r21-2-7
author cvs
date Mon, 13 Aug 2007 11:08:24 +0200
parents 8626e4521993
children aabb7f5b1c81
comparison
equal deleted inserted replaced
383:6a50c6a581a5 384:bbff43aa5eb7
56 /* 56 /*
57 * Random forward declarations 57 * Random forward declarations
58 */ 58 */
59 static void mswindows_update_dc (HDC hdc, Lisp_Object font, Lisp_Object fg, 59 static void mswindows_update_dc (HDC hdc, Lisp_Object font, Lisp_Object fg,
60 Lisp_Object bg, Lisp_Object bg_pmap); 60 Lisp_Object bg, Lisp_Object bg_pmap);
61 static void mswindows_clear_region (Lisp_Object locale, face_index findex,
62 int x, int y, int width, int height);
63 static void mswindows_output_vertical_divider (struct window *w, int clear); 61 static void mswindows_output_vertical_divider (struct window *w, int clear);
64 static void mswindows_redraw_exposed_windows (Lisp_Object window, int x, 62 static void mswindows_redraw_exposed_windows (Lisp_Object window, int x,
65 int y, int width, int height); 63 int y, int width, int height);
66 static void mswindows_output_dibitmap (struct frame *f, 64 static void mswindows_output_dibitmap (struct frame *f,
67 struct Lisp_Image_Instance *p, 65 struct Lisp_Image_Instance *p,
349 mswindows_output_cursor (struct window *w, struct display_line *dl, int xpos, 347 mswindows_output_cursor (struct window *w, struct display_line *dl, int xpos,
350 int width, face_index findex, Emchar ch, int image_p) 348 int width, face_index findex, Emchar ch, int image_p)
351 { 349 {
352 struct frame *f = XFRAME (w->frame); 350 struct frame *f = XFRAME (w->frame);
353 struct device *d = XDEVICE (f->device); 351 struct device *d = XDEVICE (f->device);
354 struct face_cachel *cachel; 352 struct face_cachel *cachel=0;
355 Lisp_Object font = Qnil; 353 Lisp_Object font = Qnil;
356 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)); 354 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
357 HDC hdc = FRAME_MSWINDOWS_DC (f); 355 HDC hdc = FRAME_MSWINDOWS_DC (f);
358 unsigned int face_index=0; 356 unsigned int face_index=0;
359 char *p_char = NULL; 357 char *p_char = NULL;
553 { 551 {
554 int clear_start = max (xpos, clip_start); 552 int clear_start = max (xpos, clip_start);
555 int clear_end = min (xpos + this_width, clip_end); 553 int clear_end = min (xpos + this_width, clip_end);
556 554
557 { 555 {
558 mswindows_clear_region (window, findex, clear_start, 556 redisplay_clear_region (window, findex, clear_start,
559 dl->ypos - dl->ascent, 557 dl->ypos - dl->ascent,
560 clear_end - clear_start, 558 clear_end - clear_start,
561 height); 559 height);
562 /* output pixmap calls this so we have to recall to get correct 560 /* output pixmap calls this so we have to recall to get correct
563 references */ 561 references */
792 clear_x = xpos; 790 clear_x = xpos;
793 clear_width = width; 791 clear_width = width;
794 } 792 }
795 793
796 if (!offset_bitmap) /* i.e. not a bg pixmap */ 794 if (!offset_bitmap) /* i.e. not a bg pixmap */
797 mswindows_clear_region (window, findex, clear_x, clear_y, 795 redisplay_clear_region (window, findex, clear_x, clear_y,
798 clear_width, clear_height); 796 clear_width, clear_height);
799 } 797 }
800 798
801 /* Output the pixmap. Have to do this as many times as is required 799 /* Output the pixmap. Have to do this as many times as is required
802 to fill the given area */ 800 to fill the given area */
1179 else if (rb->object.chr.ch == '\n') 1177 else if (rb->object.chr.ch == '\n')
1180 { 1178 {
1181 /* Clear in case a cursor was formerly here. */ 1179 /* Clear in case a cursor was formerly here. */
1182 int height = dl->ascent + dl->descent - dl->clip; 1180 int height = dl->ascent + dl->descent - dl->clip;
1183 1181
1184 mswindows_clear_region (window, findex, xpos, dl->ypos - dl->ascent, 1182 redisplay_clear_region (window, findex, xpos, dl->ypos - dl->ascent,
1185 rb->width, height); 1183 rb->width, height);
1186 elt++; 1184 elt++;
1187 } 1185 }
1188 } 1186 }
1189 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) 1187 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
1260 1258
1261 case IMAGE_POINTER: 1259 case IMAGE_POINTER:
1262 abort (); 1260 abort ();
1263 1261
1264 case IMAGE_SUBWINDOW: 1262 case IMAGE_SUBWINDOW:
1265 /* #### implement me */ 1263 case IMAGE_WIDGET:
1264 redisplay_output_subwindow (w, dl, instance, xpos,
1265 rb->object.dglyph.xoffset, start_pixpos,
1266 rb->width, findex, cursor_start,
1267 cursor_width, cursor_height);
1268 if (rb->cursor_type == CURSOR_ON)
1269 mswindows_output_cursor (w, dl, xpos, cursor_width,
1270 findex, 0, 1);
1266 break; 1271 break;
1267 1272
1268 case IMAGE_NOTHING: 1273 case IMAGE_NOTHING:
1269 /* nothing is as nothing does */ 1274 /* nothing is as nothing does */
1270 break; 1275 break;
1384 1389
1385 Clear the area in the box defined by the given parameters using the 1390 Clear the area in the box defined by the given parameters using the
1386 given face. 1391 given face.
1387 ****************************************************************************/ 1392 ****************************************************************************/
1388 static void 1393 static void
1389 mswindows_clear_region (Lisp_Object locale, face_index findex, int x, int y, 1394 mswindows_clear_region (Lisp_Object locale, struct device* d, struct frame* f,
1390 int width, int height) 1395 face_index findex, int x, int y,
1391 { 1396 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
1392 struct window *w; 1397 Lisp_Object background_pixmap)
1393 struct frame *f; 1398 {
1394 Lisp_Object background_pixmap = Qunbound;
1395 Lisp_Object temp;
1396 RECT rect = { x, y, x+width, y+height }; 1399 RECT rect = { x, y, x+width, y+height };
1397 1400
1398 if (!(width && height)) /* We often seem to get called with width==0 */ 1401 if (!NILP (background_pixmap))
1399 return; 1402 {
1400
1401 if (WINDOWP (locale))
1402 {
1403 w = XWINDOW (locale);
1404 f = XFRAME (w->frame);
1405 }
1406 else if (FRAMEP (locale))
1407 {
1408 w = NULL;
1409 f = XFRAME (locale);
1410 }
1411 else
1412 abort ();
1413
1414 if (w)
1415 {
1416 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex);
1417
1418 if (IMAGE_INSTANCEP (temp)
1419 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
1420 {
1421 /* #### maybe we could implement such that a string
1422 can be a background pixmap? */
1423 background_pixmap = temp;
1424 }
1425 }
1426 else
1427 {
1428 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale);
1429
1430 if (IMAGE_INSTANCEP (temp)
1431 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp)))
1432 {
1433 background_pixmap = temp;
1434 }
1435 }
1436
1437 if (!UNBOUNDP (background_pixmap))
1438 {
1439 Lisp_Object fcolor, bcolor;
1440
1441 if (w)
1442 {
1443 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
1444 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
1445 }
1446 else
1447 {
1448 fcolor = FACE_FOREGROUND (Vdefault_face, locale);
1449 bcolor = FACE_BACKGROUND (Vdefault_face, locale);
1450 }
1451
1452 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), 1403 mswindows_update_dc (FRAME_MSWINDOWS_DC (f),
1453 Qnil, fcolor, bcolor, background_pixmap); 1404 Qnil, fcolor, bcolor, background_pixmap);
1454 1405
1455 mswindows_output_dibitmap_region 1406 mswindows_output_dibitmap_region
1456 ( f, XIMAGE_INSTANCE (background_pixmap), 1407 ( f, XIMAGE_INSTANCE (background_pixmap),
1457 x, y, 0, 0, 0, 0, width, height, 0, TRUE); 1408 x, y, 0, 0, 0, 0, width, height, 0, TRUE);
1458 } 1409 }
1459 else 1410 else
1460 { 1411 {
1461 Lisp_Object color = (w ? WINDOW_FACE_CACHEL_BACKGROUND (w, findex) : 1412 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, fcolor, Qnil);
1462 FACE_BACKGROUND (Vdefault_face, locale)); 1413 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE,
1463 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, color, Qnil); 1414 &rect, NULL, 0, NULL);
1464 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
1465 } 1415 }
1466 1416
1467 #ifdef HAVE_SCROLLBARS 1417 #ifdef HAVE_SCROLLBARS
1468 if (WINDOWP (locale)) 1418 if (WINDOWP (locale))
1469 mswindows_redisplay_deadbox_maybe (w, &rect); 1419 mswindows_redisplay_deadbox_maybe (XWINDOW (locale), &rect);
1470 #endif 1420 #endif
1471 } 1421 }
1472 1422
1473 /***************************************************************************** 1423 /*****************************************************************************
1474 mswindows_clear_to_window_end 1424 mswindows_clear_to_window_end
1491 1441
1492 bounds = calculate_display_line_boundaries (w, bflag); 1442 bounds = calculate_display_line_boundaries (w, bflag);
1493 XSETWINDOW (window, w); 1443 XSETWINDOW (window, w);
1494 1444
1495 if (window_is_leftmost (w)) 1445 if (window_is_leftmost (w))
1496 mswindows_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f), 1446 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
1497 ypos1, FRAME_BORDER_WIDTH (f), height); 1447 ypos1, FRAME_BORDER_WIDTH (f), height);
1498 1448
1499 if (bounds.left_in - bounds.left_out > 0) 1449 if (bounds.left_in - bounds.left_out > 0)
1500 mswindows_clear_region (window, 1450 redisplay_clear_region (window,
1501 get_builtin_face_cache_index (w, Vleft_margin_face), 1451 get_builtin_face_cache_index (w, Vleft_margin_face),
1502 bounds.left_out, ypos1, 1452 bounds.left_out, ypos1,
1503 bounds.left_in - bounds.left_out, height); 1453 bounds.left_in - bounds.left_out, height);
1504 1454
1505 if (bounds.right_in - bounds.left_in > 0) 1455 if (bounds.right_in - bounds.left_in > 0)
1506 mswindows_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1, 1456 redisplay_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1,
1507 bounds.right_in - bounds.left_in, height); 1457 bounds.right_in - bounds.left_in, height);
1508 1458
1509 if (bounds.right_out - bounds.right_in > 0) 1459 if (bounds.right_out - bounds.right_in > 0)
1510 mswindows_clear_region (window, 1460 redisplay_clear_region (window,
1511 get_builtin_face_cache_index (w, Vright_margin_face), 1461 get_builtin_face_cache_index (w, Vright_margin_face),
1512 bounds.right_in, ypos1, 1462 bounds.right_in, ypos1,
1513 bounds.right_out - bounds.right_in, height); 1463 bounds.right_out - bounds.right_in, height);
1514 1464
1515 if (window_is_rightmost (w)) 1465 if (window_is_rightmost (w))
1516 mswindows_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), 1466 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
1517 ypos1, FRAME_BORDER_WIDTH (f), height); 1467 ypos1, FRAME_BORDER_WIDTH (f), height);
1518 } 1468 }
1519 1469
1520 } 1470 }
1521 1471