comparison src/redisplay-msw.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
24 24
25 /* Authorship: 25 /* Authorship:
26 26
27 Chuck Thompson 27 Chuck Thompson
28 Lots of work done by Ben Wing for Mule 28 Lots of work done by Ben Wing for Mule
29 Partially rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. 29
30 */ 30 Partially rewritten for mswindows by Jonathan Harris, November 1997
31 for 21.0. */
31 32
32 #include <config.h> 33 #include <config.h>
33 #include "lisp.h" 34 #include "lisp.h"
34 35
35 #include "console-msw.h" 36 #include "console-msw.h"
89 Returns the number of runs actually used. */ 90 Returns the number of runs actually used. */
90 91
91 static int 92 static int
92 separate_textual_runs (unsigned char *text_storage, 93 separate_textual_runs (unsigned char *text_storage,
93 textual_run *run_storage, 94 textual_run *run_storage,
94 CONST Emchar *str, Charcount len) 95 const Emchar *str, Charcount len)
95 { 96 {
96 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a 97 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
97 possible valid charset when 98 possible valid charset when
98 MULE is not defined */ 99 MULE is not defined */
99 int runs_so_far = 0; 100 int runs_so_far = 0;
199 } 200 }
200 } 201 }
201 202
202 /* 203 /*
203 * Given F, retrieve device context. F can be a display frame, or 204 * Given F, retrieve device context. F can be a display frame, or
204 * a print job. 205 * a print job. For a print job, page is also started when printer's
206 * device context is first time requested.
205 */ 207 */
206 static HDC 208 static HDC
207 get_frame_dc (struct frame *f) 209 get_frame_dc (struct frame *f, int start_page_p)
208 { 210 {
209 if (FRAME_MSWINDOWS_P (f)) 211 if (FRAME_MSWINDOWS_P (f))
210 return FRAME_MSWINDOWS_DC (f); 212 return FRAME_MSWINDOWS_DC (f);
211 else 213 else
212 return DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f))); 214 {
215 if (start_page_p && !FRAME_MSPRINTER_PAGE_STARTED (f))
216 msprinter_start_page (f);
217 return DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f)));
218 }
213 } 219 }
214 220
215 /* 221 /*
216 * Given F, retrieve compatible device context. F can be a display 222 * Given F, retrieve compatible device context. F can be a display
217 * frame, or a print job. 223 * frame, or a print job.
218 */ 224 */
219 static HDC 225 static HDC
220 get_frame_compdc (struct frame *f) 226 get_frame_compdc (struct frame *f)
221 { 227 {
222 if (FRAME_MSWINDOWS_P (f)) 228 struct device *d = XDEVICE (FRAME_DEVICE (f));
223 return FRAME_MSWINDOWS_CDC (f); 229 if (DEVICE_MSWINDOWS_P (d))
230 return DEVICE_MSWINDOWS_HCDC (d);
224 else 231 else
225 return FRAME_MSPRINTER_CDC (f); 232 return DEVICE_MSPRINTER_HCDC (d);
226 } 233 }
227 234
228 /***************************************************************************** 235 /*****************************************************************************
229 mswindows_update_dc 236 mswindows_update_dc
230 237
278 static void 285 static void
279 mswindows_output_blank (struct window *w, struct display_line *dl, 286 mswindows_output_blank (struct window *w, struct display_line *dl,
280 struct rune *rb, int start_pixpos) 287 struct rune *rb, int start_pixpos)
281 { 288 {
282 struct frame *f = XFRAME (w->frame); 289 struct frame *f = XFRAME (w->frame);
283 HDC hdc = get_frame_dc (f); 290 HDC hdc = get_frame_dc (f, 1);
284 RECT rect = { rb->xpos, DISPLAY_LINE_YPOS (dl), 291 RECT rect = { rb->xpos, DISPLAY_LINE_YPOS (dl),
285 rb->xpos+rb->width, 292 rb->xpos+rb->width,
286 DISPLAY_LINE_YEND (dl) }; 293 DISPLAY_LINE_YEND (dl) };
287 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, rb->findex); 294 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, rb->findex);
288 295
331 struct frame *f = XFRAME (w->frame); 338 struct frame *f = XFRAME (w->frame);
332 struct device *d = XDEVICE (f->device); 339 struct device *d = XDEVICE (f->device);
333 struct face_cachel *cachel=0; 340 struct face_cachel *cachel=0;
334 Lisp_Object font = Qnil; 341 Lisp_Object font = Qnil;
335 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)); 342 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
336 HDC hdc = get_frame_dc (f); 343 HDC hdc = get_frame_dc (f, 1);
337 unsigned int local_face_index=0; 344 unsigned int local_face_index=0;
338 char *p_char = NULL; 345 char *p_char = NULL;
339 int n_char = 0; 346 int n_char = 0;
340 RECT rect = { xpos, 347 RECT rect = { xpos,
341 DISPLAY_LINE_YPOS (dl), 348 DISPLAY_LINE_YPOS (dl),
451 int cursor_height) 458 int cursor_height)
452 { 459 {
453 struct frame *f = XFRAME (w->frame); 460 struct frame *f = XFRAME (w->frame);
454 /* struct device *d = XDEVICE (f->device);*/ 461 /* struct device *d = XDEVICE (f->device);*/
455 Lisp_Object window; 462 Lisp_Object window;
456 HDC hdc = get_frame_dc (f); 463 HDC hdc = get_frame_dc (f, 1);
457 int clip_end; 464 int clip_end;
458 Lisp_Object bg_pmap; 465 Lisp_Object bg_pmap;
459 int len = Dynarr_length (buf); 466 int len = Dynarr_length (buf);
460 unsigned char *text_storage = (unsigned char *) alloca (2 * len); 467 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
461 textual_run *runs = alloca_array (textual_run, len); 468 textual_run *runs = alloca_array (textual_run, len);
564 static void 571 static void
565 mswindows_output_dibitmap (struct frame *f, Lisp_Image_Instance *p, 572 mswindows_output_dibitmap (struct frame *f, Lisp_Image_Instance *p,
566 struct display_box* db, 573 struct display_box* db,
567 struct display_glyph_area* dga) 574 struct display_glyph_area* dga)
568 { 575 {
569 HDC hdc = get_frame_dc (f); 576 HDC hdc = get_frame_dc (f, 1);
570 HDC hcompdc = get_frame_compdc (f); 577 HDC hcompdc = get_frame_compdc (f);
571 HGDIOBJ old=NULL; 578 HGDIOBJ old=NULL;
572 COLORREF bgcolor = GetBkColor (hdc); 579 const int real_x = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (p);
573 580 const int real_y = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (p);
574 /* first blt the mask */ 581 const int surface_x = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
582 const int surface_y = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
583
584 /* first blit the mask */
575 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) 585 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
576 { 586 {
577 RGBQUAD col; 587 RGBQUAD bg;
578 col.rgbBlue = GetBValue (bgcolor); 588 COLORREF bgcolor;
579 col.rgbRed = GetRValue (bgcolor);
580 col.rgbGreen = GetGValue (bgcolor);
581 col.rgbReserved = 0;
582 589
583 old = SelectObject (hcompdc, IMAGE_INSTANCE_MSWINDOWS_MASK (p)); 590 old = SelectObject (hcompdc, IMAGE_INSTANCE_MSWINDOWS_MASK (p));
584 591
585 SetDIBColorTable (hcompdc, 1, 1, &col); 592 if (IMAGE_INSTANCE_TYPE (p) == IMAGE_MONO_PIXMAP)
586 593 {
587 BitBlt (hdc, 594 COLORREF fgcolor;
588 db->xpos, db->ypos, 595 RGBQUAD fg;
589 dga->width, dga->height, 596
590 hcompdc, 597 fgcolor = GetTextColor (hdc);
591 dga->xoffset, dga->yoffset, 598 fg.rgbBlue = GetBValue (fgcolor);
592 SRCCOPY); 599 fg.rgbRed = GetRValue (fgcolor);
600 fg.rgbGreen = GetGValue (fgcolor);
601 fg.rgbReserved = 0;
602 SetDIBColorTable (hcompdc, 0, 1, &fg);
603 }
604
605 bgcolor = GetBkColor (hdc);
606 bg.rgbBlue = GetBValue (bgcolor);
607 bg.rgbRed = GetRValue (bgcolor);
608 bg.rgbGreen = GetGValue (bgcolor);
609 bg.rgbReserved = 0;
610 SetDIBColorTable (hcompdc, 1, 1, &bg);
611
612 StretchBlt (hdc,
613 db->xpos, db->ypos,
614 dga->width, dga->height,
615 hcompdc,
616 MulDiv (dga->xoffset, real_x, surface_x),
617 MulDiv (dga->yoffset, real_y, surface_y),
618 MulDiv (dga->width, real_x, surface_x),
619 MulDiv (dga->height, real_y, surface_y),
620 SRCCOPY);
593 621
594 SelectObject (hcompdc, old); 622 SelectObject (hcompdc, old);
595 } 623 }
596 624
597 /* Now blt the bitmap itself, or one of its slices. */ 625 /* Now blit the bitmap itself, or one of its slices. */
598 old = SelectObject (hcompdc, 626 old = SelectObject (hcompdc,
599 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE 627 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE
600 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p))); 628 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)));
601 629
602 BitBlt (hdc, 630 StretchBlt (hdc,
603 db->xpos, db->ypos, 631 db->xpos, db->ypos,
604 dga->width, dga->height, 632 dga->width, dga->height,
605 hcompdc, 633 hcompdc,
606 dga->xoffset, dga->yoffset, 634 MulDiv (dga->xoffset, real_x, surface_x),
607 IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY); 635 MulDiv (dga->yoffset, real_y, surface_y),
636 MulDiv (dga->width, real_x, surface_x),
637 MulDiv (dga->height, real_y, surface_y),
638 IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY);
608 639
609 SelectObject (hcompdc, old); 640 SelectObject (hcompdc, old);
610 } 641 }
611 642
612 /* X gc's have this nice property that setting the bg pixmap will 643 /* X gc's have this nice property that setting the bg pixmap will
673 struct display_box *db, struct display_glyph_area *dga, 704 struct display_box *db, struct display_glyph_area *dga,
674 face_index findex, int cursor_start, int cursor_width, 705 face_index findex, int cursor_start, int cursor_width,
675 int cursor_height, int bg_pixmap) 706 int cursor_height, int bg_pixmap)
676 { 707 {
677 struct frame *f = XFRAME (w->frame); 708 struct frame *f = XFRAME (w->frame);
678 HDC hdc = get_frame_dc (f); 709 HDC hdc = get_frame_dc (f, 1);
679 710
680 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); 711 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
681 Lisp_Object window; 712 Lisp_Object window;
682 713
683 XSETWINDOW (window, w); 714 XSETWINDOW (window, w);
701 * 732 *
702 * Function checks whether deadbox intersects with the rectangle pointed 733 * Function checks whether deadbox intersects with the rectangle pointed
703 * to by PRC, and paints only the intersection 734 * to by PRC, and paints only the intersection
704 */ 735 */
705 static void 736 static void
706 mswindows_redisplay_deadbox_maybe (struct window *w, CONST RECT* prc) 737 mswindows_redisplay_deadbox_maybe (struct window *w, const RECT* prc)
707 { 738 {
708 int sbh = window_scrollbar_height (w); 739 int sbh = window_scrollbar_height (w);
709 int sbw = window_scrollbar_width (w); 740 int sbw = window_scrollbar_width (w);
710 RECT rect_dead, rect_paint; 741 RECT rect_dead, rect_paint;
711 if (sbh == 0 || sbw == 0) 742 if (sbh == 0 || sbw == 0)
724 rect_dead.bottom = rect_dead.top + sbh; 755 rect_dead.bottom = rect_dead.top + sbh;
725 756
726 if (IntersectRect (&rect_paint, &rect_dead, prc)) 757 if (IntersectRect (&rect_paint, &rect_dead, prc))
727 { 758 {
728 struct frame *f = XFRAME (WINDOW_FRAME (w)); 759 struct frame *f = XFRAME (WINDOW_FRAME (w));
729 FillRect (get_frame_dc (f), &rect_paint, 760 FillRect (get_frame_dc (f, 1), &rect_paint,
730 (HBRUSH) (COLOR_BTNFACE+1)); 761 (HBRUSH) (COLOR_BTNFACE+1));
731 } 762 }
732 } 763 }
733 764
734 #endif /* HAVE_SCROLLBARS */ 765 #endif /* HAVE_SCROLLBARS */
903 border |= BF_RIGHT; 934 border |= BF_RIGHT;
904 935
905 { 936 {
906 RECT rect = { x, y, x + width, y + height }; 937 RECT rect = { x, y, x + width, y + height };
907 Lisp_Object color = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); 938 Lisp_Object color = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
908 HDC hdc = get_frame_dc (f); 939 HDC hdc = get_frame_dc (f, 1);
909 940
910 mswindows_update_dc (hdc, Qnil, color, Qnil); 941 mswindows_update_dc (hdc, Qnil, color, Qnil);
911 DrawEdge (hdc, &rect, edge, border); 942 DrawEdge (hdc, &rect, edge, border);
912 } 943 }
913 } 944 }
938 { 969 {
939 return MSWINDOWS_EOL_CURSOR_WIDTH; 970 return MSWINDOWS_EOL_CURSOR_WIDTH;
940 } 971 }
941 972
942 /***************************************************************************** 973 /*****************************************************************************
943 mswindows_output_begin 974 mswindows_frame_output_begin
944 975
945 Perform any necessary initialization prior to an update. 976 Perform any necessary initialization prior to an update.
946 ****************************************************************************/ 977 ****************************************************************************/
947 static void 978 static void
948 mswindows_output_begin (struct device *d) 979 mswindows_frame_output_begin (struct frame *f)
949 { 980 {
950 } 981 }
951 982
952 /***************************************************************************** 983 /*****************************************************************************
953 mswindows_output_end 984 mswindows_frame_output_end
954 985
955 Perform any necessary flushing of queues when an update has completed. 986 Perform any necessary flushing of queues when an update has completed.
956 ****************************************************************************/ 987 ****************************************************************************/
957 static void 988 static void
958 mswindows_output_end (struct device *d) 989 mswindows_frame_output_end (struct frame *f)
990 {
991 #ifdef DEFER_WINDOW_POS
992 HDWP hdwp = FRAME_MSWINDOWS_DATA (f)->hdwp;
993
994 if (hdwp != 0)
995 {
996 EndDeferWindowPos (hdwp);
997 FRAME_MSWINDOWS_DATA (f)->hdwp = 0;
998 }
999 #endif
1000 GdiFlush();
1001 }
1002
1003 /* Printer version is more lightweight. */
1004 static void
1005 msprinter_frame_output_end (struct frame *f)
959 { 1006 {
960 GdiFlush(); 1007 GdiFlush();
961 } 1008 }
962 1009
963 static int 1010 static int
964 mswindows_flash (struct device *d) 1011 mswindows_flash (struct device *d)
965 { 1012 {
966 struct frame *f = device_selected_frame (d); 1013 struct frame *f = device_selected_frame (d);
967 HDC hdc = get_frame_dc (f); 1014 HDC hdc = get_frame_dc (f, 1);
968 RECT rc; 1015 RECT rc;
969 1016
970 GetClientRect (FRAME_MSWINDOWS_HANDLE (f), &rc); 1017 GetClientRect (FRAME_MSWINDOWS_HANDLE (f), &rc);
971 InvertRect (hdc, &rc); 1018 InvertRect (hdc, &rc);
972 GdiFlush (); 1019 GdiFlush ();
1114 else if (rb->type == RUNE_DGLYPH) 1161 else if (rb->type == RUNE_DGLYPH)
1115 { 1162 {
1116 Lisp_Object instance; 1163 Lisp_Object instance;
1117 struct display_box dbox; 1164 struct display_box dbox;
1118 struct display_glyph_area dga; 1165 struct display_glyph_area dga;
1166
1119 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset, 1167 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
1120 start_pixpos, rb->width, 1168 start_pixpos, rb->width,
1121 &dbox, &dga); 1169 &dbox, &dga);
1122 1170
1123 XSETWINDOW (window, w); 1171 XSETWINDOW (window, w);
1124 instance = glyph_image_instance (rb->object.dglyph.glyph, 1172 instance = glyph_image_instance (rb->object.dglyph.glyph,
1125 window, ERROR_ME_NOT, 1); 1173 window, ERROR_ME_NOT, 1);
1126 findex = rb->findex; 1174 findex = rb->findex;
1127 1175
1128 if (IMAGE_INSTANCEP (instance)) 1176 if (IMAGE_INSTANCEP (instance))
1129 switch (XIMAGE_INSTANCE_TYPE (instance)) 1177 {
1130 { 1178 switch (XIMAGE_INSTANCE_TYPE (instance))
1131 case IMAGE_TEXT:
1132 { 1179 {
1133 /* #### This is way losing. See the comment in 1180 case IMAGE_MONO_PIXMAP:
1134 add_glyph_rune(). */ 1181 case IMAGE_COLOR_PIXMAP:
1135 Lisp_Object string = 1182 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
1136 XIMAGE_INSTANCE_TEXT_STRING (instance); 1183 cursor_start, cursor_width,
1137 convert_bufbyte_string_into_emchar_dynarr 1184 cursor_height, 0);
1138 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
1139
1140 if (rb->cursor_type == CURSOR_ON) 1185 if (rb->cursor_type == CURSOR_ON)
1141 mswindows_output_cursor (w, dl, xpos, cursor_width, 1186 mswindows_output_cursor (w, dl, xpos, cursor_width,
1142 findex, Dynarr_at (buf, 0), 0); 1187 findex, 0, 1);
1143 else /* #### redisplay-x passes -1 as the width: why ? */ 1188 break;
1144 mswindows_output_string (w, dl, buf, xpos, 1189
1145 rb->object.dglyph.xoffset, 1190 case IMAGE_WIDGET:
1146 start_pixpos, rb->width, findex, 1191 if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
1147 0, 0, 0, 0); 1192 Qlayout))
1148 Dynarr_reset (buf); 1193 {
1194 redisplay_output_layout (window, instance, &dbox, &dga, findex,
1195 cursor_start, cursor_width,
1196 cursor_height);
1197 if (rb->cursor_type == CURSOR_ON)
1198 mswindows_output_cursor (w, dl, xpos, cursor_width,
1199 findex, 0, 1);
1200 break;
1201 }
1202 case IMAGE_SUBWINDOW:
1203 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
1204 cursor_start, cursor_width,
1205 cursor_height);
1206 if (rb->cursor_type == CURSOR_ON)
1207 mswindows_output_cursor (w, dl, xpos, cursor_width,
1208 findex, 0, 1);
1209 break;
1210
1211 case IMAGE_NOTHING:
1212 /* nothing is as nothing does */
1213 break;
1214
1215 case IMAGE_TEXT:
1216 case IMAGE_POINTER:
1217 default:
1218 abort ();
1149 } 1219 }
1150 break; 1220 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
1151 1221 (XIMAGE_INSTANCE (instance)) = 0;
1152 case IMAGE_MONO_PIXMAP: 1222 }
1153 case IMAGE_COLOR_PIXMAP:
1154 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
1155 cursor_start, cursor_width,
1156 cursor_height, 0);
1157 if (rb->cursor_type == CURSOR_ON)
1158 mswindows_output_cursor (w, dl, xpos, cursor_width,
1159 findex, 0, 1);
1160 break;
1161
1162 case IMAGE_POINTER:
1163 abort ();
1164
1165 case IMAGE_SUBWINDOW:
1166 case IMAGE_WIDGET:
1167 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
1168 cursor_start, cursor_width,
1169 cursor_height);
1170 if (rb->cursor_type == CURSOR_ON)
1171 mswindows_output_cursor (w, dl, xpos, cursor_width,
1172 findex, 0, 1);
1173 break;
1174
1175 case IMAGE_LAYOUT:
1176 redisplay_output_layout (w, instance, &dbox, &dga, findex,
1177 cursor_start, cursor_width,
1178 cursor_height);
1179 if (rb->cursor_type == CURSOR_ON)
1180 mswindows_output_cursor (w, dl, xpos, cursor_width,
1181 findex, 0, 1);
1182 break;
1183
1184 case IMAGE_NOTHING:
1185 /* nothing is as nothing does */
1186 break;
1187
1188 default:
1189 abort ();
1190 }
1191
1192 xpos += rb->width; 1223 xpos += rb->width;
1193 elt++; 1224 elt++;
1194 } 1225 }
1195 else 1226 else
1196 abort (); 1227 abort ();
1219 ****************************************************************************/ 1250 ****************************************************************************/
1220 static void 1251 static void
1221 mswindows_output_vertical_divider (struct window *w, int clear_unused) 1252 mswindows_output_vertical_divider (struct window *w, int clear_unused)
1222 { 1253 {
1223 struct frame *f = XFRAME (w->frame); 1254 struct frame *f = XFRAME (w->frame);
1224 HDC hdc = get_frame_dc (f); 1255 HDC hdc = get_frame_dc (f, 1);
1225 RECT rect; 1256 RECT rect;
1226 int spacing = XINT (w->vertical_divider_spacing); 1257 int spacing = XINT (w->vertical_divider_spacing);
1227 int shadow = XINT (w->vertical_divider_shadow_thickness); 1258 int shadow = XINT (w->vertical_divider_shadow_thickness);
1228 int abs_shadow = abs (shadow); 1259 int abs_shadow = abs (shadow);
1229 int line_width = XINT (w->vertical_divider_line_width); 1260 int line_width = XINT (w->vertical_divider_line_width);
1230 int div_left = WINDOW_RIGHT (w) - window_divider_width (w); 1261 int div_left = WINDOW_RIGHT (w) - window_divider_width (w);
1231 int y1 = WINDOW_TOP (w) + FRAME_TOP_GUTTER_BOUNDS (f); 1262 int y1 = WINDOW_TOP (w);
1232 int y2 = WINDOW_BOTTOM (w) + FRAME_BOTTOM_GUTTER_BOUNDS (f); 1263 int y2 = WINDOW_BOTTOM (w);
1233 1264
1234 /* Clear left and right spacing areas */ 1265 /* Clear left and right spacing areas */
1235 if (spacing) 1266 if (spacing)
1236 { 1267 {
1237 rect.top = y1; 1268 rect.top = y1;
1278 Given a string and a face, return the string's length in pixels when 1309 Given a string and a face, return the string's length in pixels when
1279 displayed in the font associated with the face. 1310 displayed in the font associated with the face.
1280 ****************************************************************************/ 1311 ****************************************************************************/
1281 static int 1312 static int
1282 mswindows_text_width (struct frame *f, struct face_cachel *cachel, 1313 mswindows_text_width (struct frame *f, struct face_cachel *cachel,
1283 CONST Emchar *str, Charcount len) 1314 const Emchar *str, Charcount len)
1284 { 1315 {
1285 HDC hdc = get_frame_dc (f); 1316 HDC hdc = get_frame_dc (f, 0);
1286 int width_so_far = 0; 1317 int width_so_far = 0;
1287 unsigned char *text_storage = (unsigned char *) alloca (2 * len); 1318 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
1288 textual_run *runs = alloca_array (textual_run, len); 1319 textual_run *runs = alloca_array (textual_run, len);
1289 int nruns; 1320 int nruns;
1290 int i; 1321 int i;
1310 face_index findex, int x, int y, 1341 face_index findex, int x, int y,
1311 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, 1342 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
1312 Lisp_Object background_pixmap) 1343 Lisp_Object background_pixmap)
1313 { 1344 {
1314 RECT rect = { x, y, x+width, y+height }; 1345 RECT rect = { x, y, x+width, y+height };
1315 HDC hdc = get_frame_dc (f); 1346 HDC hdc = get_frame_dc (f, 1);
1316 1347
1317 if (!NILP (background_pixmap)) 1348 if (!NILP (background_pixmap))
1318 { 1349 {
1319 struct display_box db = { x, y, width, height }; 1350 struct display_box db = { x, y, width, height };
1320 mswindows_update_dc (hdc, 1351 mswindows_update_dc (hdc,
1357 CONSOLE_HAS_METHOD (mswindows, divider_height); 1388 CONSOLE_HAS_METHOD (mswindows, divider_height);
1358 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width); 1389 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width);
1359 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider); 1390 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider);
1360 CONSOLE_HAS_METHOD (mswindows, clear_region); 1391 CONSOLE_HAS_METHOD (mswindows, clear_region);
1361 CONSOLE_HAS_METHOD (mswindows, clear_frame); 1392 CONSOLE_HAS_METHOD (mswindows, clear_frame);
1362 CONSOLE_HAS_METHOD (mswindows, output_begin); 1393 CONSOLE_HAS_METHOD (mswindows, frame_output_begin);
1363 CONSOLE_HAS_METHOD (mswindows, output_end); 1394 CONSOLE_HAS_METHOD (mswindows, frame_output_end);
1364 CONSOLE_HAS_METHOD (mswindows, flash); 1395 CONSOLE_HAS_METHOD (mswindows, flash);
1365 CONSOLE_HAS_METHOD (mswindows, ring_bell); 1396 CONSOLE_HAS_METHOD (mswindows, ring_bell);
1366 CONSOLE_HAS_METHOD (mswindows, bevel_area); 1397 CONSOLE_HAS_METHOD (mswindows, bevel_area);
1367 CONSOLE_HAS_METHOD (mswindows, output_string); 1398 CONSOLE_HAS_METHOD (mswindows, output_string);
1368 CONSOLE_HAS_METHOD (mswindows, output_pixmap); 1399 CONSOLE_HAS_METHOD (mswindows, output_pixmap);
1369 1400
1370 /* redisplay methods - printer */ 1401 /* redisplay methods - printer */
1402 CONSOLE_HAS_METHOD (msprinter, frame_output_end);
1371 CONSOLE_INHERITS_METHOD (msprinter, mswindows, text_width); 1403 CONSOLE_INHERITS_METHOD (msprinter, mswindows, text_width);
1372 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_display_block); 1404 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_display_block);
1373 CONSOLE_INHERITS_METHOD (msprinter, mswindows, divider_height); 1405 CONSOLE_INHERITS_METHOD (msprinter, mswindows, divider_height);
1374 CONSOLE_INHERITS_METHOD (msprinter, mswindows, eol_cursor_width); 1406 CONSOLE_INHERITS_METHOD (msprinter, mswindows, eol_cursor_width);
1375 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_vertical_divider); 1407 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_vertical_divider);
1376 CONSOLE_INHERITS_METHOD (msprinter, mswindows, clear_region); 1408 CONSOLE_INHERITS_METHOD (msprinter, mswindows, clear_region);
1377 CONSOLE_INHERITS_METHOD (msprinter, mswindows, clear_frame); 1409 CONSOLE_INHERITS_METHOD (msprinter, mswindows, clear_frame);
1378 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_begin); 1410 CONSOLE_INHERITS_METHOD (msprinter, mswindows, frame_output_begin);
1379 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_end);
1380 CONSOLE_INHERITS_METHOD (msprinter, mswindows, bevel_area); 1411 CONSOLE_INHERITS_METHOD (msprinter, mswindows, bevel_area);
1381 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_string); 1412 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_string);
1382 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_pixmap); 1413 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_pixmap);
1383 } 1414 }