comparison src/redisplay-msw.c @ 239:41f2f0e326e9 r20-5b18

Import from CVS: tag r20-5b18
author cvs
date Mon, 13 Aug 2007 10:15:48 +0200
parents 0e522484dd2a
children 51092a27c943
comparison
equal deleted inserted replaced
238:b5f2e56b938d 239:41f2f0e326e9
309 struct frame *f = XFRAME (w->frame); 309 struct frame *f = XFRAME (w->frame);
310 struct device *d = XDEVICE (f->device); 310 struct device *d = XDEVICE (f->device);
311 struct face_cachel *cachel; 311 struct face_cachel *cachel;
312 Lisp_Object font = Qnil; 312 Lisp_Object font = Qnil;
313 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)); 313 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
314 HBRUSH brush;
315 HDC hdc = FRAME_MSWINDOWS_DC (f); 314 HDC hdc = FRAME_MSWINDOWS_DC (f);
316 int real_char_p = (rb->type == RUNE_CHAR && rb->object.chr.ch != '\n'); 315 int real_char_p = (rb->type == RUNE_CHAR && rb->object.chr.ch != '\n');
317 char *p_char = NULL; 316 char *p_char = NULL;
318 int n_char = 0; 317 int n_char = 0;
319 RECT rect = { xpos, 318 RECT rect = { xpos,
320 dl->ypos - dl->ascent, 319 dl->ypos - dl->ascent,
321 xpos + width, 320 xpos + width,
322 dl->ypos + dl->descent - dl->clip}; 321 dl->ypos + dl->descent - dl->clip};
323 322
324 #if 0 /* XXX FIXME: Whar about the bar_cursor? */ 323 Lisp_Object bar = symbol_value_in_buffer (Qbar_cursor,
325 Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor, 324 WINDOW_BUFFER (w));
326 WINDOW_BUFFER (w)); 325 int bar_p = !NILP (bar);
327 #endif
328 326
329 if (real_char_p) 327 if (real_char_p)
330 { 328 {
331 /* Use the font from the underlying character */ 329 /* Use the font from the underlying character */
332 cachel = WINDOW_FACE_CACHEL (w, rb->findex); 330 cachel = WINDOW_FACE_CACHEL (w, rb->findex);
333 331
334 /* XXX MULE: Need to know the charset! */ 332 /* XXX MULE: Need to know the charset! */
335 font = FACE_CACHEL_FONT (cachel, Vcharset_ascii); 333 font = FACE_CACHEL_FONT (cachel, Vcharset_ascii);
336 } 334 }
337 335
338 336 if ((focus || bar_p) && real_char_p)
339 if (focus && real_char_p)
340 { 337 {
341 p_char = (char*) &rb->object.chr.ch; 338 p_char = (char*) &rb->object.chr.ch;
342 n_char = 1; 339 n_char = 1;
343 } 340 }
344 341
342 /* Use cursor fg/bg for block cursor, or character fg/bg for the bar.
343 Output nothing at eol if bar cursor */
345 cachel = WINDOW_FACE_CACHEL (w, 344 cachel = WINDOW_FACE_CACHEL (w,
346 get_builtin_face_cache_index (w, Vtext_cursor_face)); 345 (bar_p
346 ? rb->findex
347 : get_builtin_face_cache_index (w, Vtext_cursor_face)));
347 mswindows_update_gc (hdc, font, cachel->foreground, 348 mswindows_update_gc (hdc, font, cachel->foreground,
348 cachel->background, Qnil, Qnil); 349 cachel->background, Qnil, Qnil);
349 ExtTextOut (FRAME_MSWINDOWS_DC (f), xpos, dl->ypos, ETO_OPAQUE, 350 ExtTextOut (FRAME_MSWINDOWS_DC (f), xpos, dl->ypos, ETO_OPAQUE,
350 &rect, p_char, n_char, NULL); 351 &rect, p_char, n_char, NULL);
351 352
352 if (focus) 353 if (focus && bar_p)
353 return; 354 {
354 355 rect.right = rect.left + (EQ (bar, Qt) ? 1 : 2);
355 InflateRect (&rect, -1, -1); 356 cachel = WINDOW_FACE_CACHEL (w,
356 357 get_builtin_face_cache_index (w, Vtext_cursor_face));
357 if (real_char_p) 358 mswindows_update_gc (hdc, Qnil, Qnil,
358 { 359 cachel->background, Qnil, Qnil);
359 p_char = (char*) &rb->object.chr.ch; 360 ExtTextOut (FRAME_MSWINDOWS_DC (f), xpos, dl->ypos, ETO_OPAQUE,
360 n_char = 1; 361 &rect, NULL, 0, NULL);
361 } 362 }
362 363 else if (!focus)
363 cachel = WINDOW_FACE_CACHEL (w, (real_char_p ? rb->findex 364 {
364 : get_builtin_face_cache_index (w, Vdefault_face))); 365 /* Now have real character drawn in its own color. We defalte
365 mswindows_update_gc (hdc, Qnil, cachel->foreground, 366 the rectangle so character cell will be bounded by the
366 cachel->background, Qnil, Qnil); 367 previously drawn cursor shape */
367 ExtTextOut (FRAME_MSWINDOWS_DC (f), xpos, dl->ypos, ETO_OPAQUE | ETO_CLIPPED, 368 InflateRect (&rect, -1, -1);
368 &rect, p_char, n_char, NULL); 369
370 if (real_char_p)
371 {
372 p_char = (char*) &rb->object.chr.ch;
373 n_char = 1;
374 }
375
376 cachel = WINDOW_FACE_CACHEL (w, (real_char_p ? rb->findex
377 : get_builtin_face_cache_index (w, Vdefault_face)));
378 mswindows_update_gc (hdc, Qnil, cachel->foreground,
379 cachel->background, Qnil, Qnil);
380 ExtTextOut (FRAME_MSWINDOWS_DC (f), xpos, dl->ypos, ETO_OPAQUE | ETO_CLIPPED,
381 &rect, p_char, n_char, NULL);
382 }
369 } 383 }
370 384
371 385
372 /***************************************************************************** 386 /*****************************************************************************
373 mswindows_output_string 387 mswindows_output_string
479 * 493 *
480 * Function checks whether deadbox intersects with the rectangle pointed 494 * Function checks whether deadbox intersects with the rectangle pointed
481 * to by PRC, and paints only the intersection 495 * to by PRC, and paints only the intersection
482 */ 496 */
483 static void 497 static void
484 mswindows_redisplay_deadbox_maybe (CONST struct window *w, 498 mswindows_redisplay_deadbox_maybe (struct window *w,
485 CONST RECT* prc) 499 CONST RECT* prc)
486 { 500 {
487 int sbh = window_scrollbar_height (w); 501 int sbh = window_scrollbar_height (w);
488 int sbw = window_scrollbar_width (w); 502 int sbw = window_scrollbar_width (w);
489 RECT rect_dead, rect_paint; 503 RECT rect_dead, rect_paint;
490 struct frame *f; 504 struct frame *f;
656 int shadow_width = MODELINE_SHADOW_THICKNESS (w); 670 int shadow_width = MODELINE_SHADOW_THICKNESS (w);
657 RECT rect = { WINDOW_MODELINE_LEFT (w), 671 RECT rect = { WINDOW_MODELINE_LEFT (w),
658 dl->ypos - dl->ascent - shadow_width, 672 dl->ypos - dl->ascent - shadow_width,
659 WINDOW_MODELINE_RIGHT (w), 673 WINDOW_MODELINE_RIGHT (w),
660 dl->ypos + dl->descent + shadow_width}; 674 dl->ypos + dl->descent + shadow_width};
661 675 UINT edge;
662 676
663 color = WINDOW_FACE_CACHEL_BACKGROUND (w, MODELINE_INDEX); 677 color = WINDOW_FACE_CACHEL_BACKGROUND (w, MODELINE_INDEX);
664 mswindows_update_gc(FRAME_MSWINDOWS_DC(f), Qnil, Qnil, color, Qnil, Qnil); 678 mswindows_update_gc(FRAME_MSWINDOWS_DC(f), Qnil, Qnil, color, Qnil, Qnil);
665 679
666 #if 0 /* XXX Eh? */ 680 if (XINT (w->modeline_shadow_thickness) < 0)
667 if (shadow_width < 0) 681 shadow_width = -shadow_width;
668 { 682
669 GC temp; 683 if (shadow_width < -1)
670 684 edge = EDGE_SUNKEN;
671 temp = top_shadow_gc; 685 else if (shadow_width < 0)
672 top_shadow_gc = bottom_shadow_gc; 686 edge = BDR_SUNKENINNER;
673 bottom_shadow_gc = temp; 687 else if (shadow_width == 1)
674 } 688 edge = BDR_RAISEDINNER;
675 #endif 689 else
676 690 edge = EDGE_RAISED;
677 DrawEdge (FRAME_MSWINDOWS_DC(f), &rect, shadow_width==1 ? BDR_RAISEDINNER : 691
678 EDGE_RAISED, BF_RECT); 692 DrawEdge (FRAME_MSWINDOWS_DC(f), &rect, edge, BF_RECT);
679 } 693 }
680 694
681 695
682 /***************************************************************************** 696 /*****************************************************************************
683 #### Display methods 697 #### Display methods
739 753
740 static int 754 static int
741 mswindows_flash (struct device *d) 755 mswindows_flash (struct device *d)
742 { 756 {
743 struct frame *f = device_selected_frame (d); 757 struct frame *f = device_selected_frame (d);
744 758 RECT rc;
745 /* XXX FIXME: Do something more visible here, maybe involving a timer */ 759
746 FlashWindow (FRAME_MSWINDOWS_HANDLE (f), TRUE); 760 GetClientRect (FRAME_MSWINDOWS_HANDLE (f), &rc);
747 FlashWindow (FRAME_MSWINDOWS_HANDLE (f), FALSE); 761 InvertRect (FRAME_MSWINDOWS_DC (f), &rc);
762 GdiFlush ();
763 Sleep (25);
764 InvertRect (FRAME_MSWINDOWS_DC (f), &rc);
765
766 return 1;
748 } 767 }
749 768
750 static void 769 static void
751 mswindows_ring_bell (struct device *d, int volume, int pitch, int duration) 770 mswindows_ring_bell (struct device *d, int volume, int pitch, int duration)
752 { 771 {
980 mswindows_output_vertical_divider (struct window *w, int clear) 999 mswindows_output_vertical_divider (struct window *w, int clear)
981 { 1000 {
982 struct frame *f = XFRAME (w->frame); 1001 struct frame *f = XFRAME (w->frame);
983 Lisp_Object color; 1002 Lisp_Object color;
984 RECT rect; 1003 RECT rect;
985 HBRUSH brush;
986 int shadow_width = MODELINE_SHADOW_THICKNESS (w); 1004 int shadow_width = MODELINE_SHADOW_THICKNESS (w);
987 1005
988 /* We don't use the normal gutter measurements here because the 1006 /* We don't use the normal gutter measurements here because the
989 horizontal scrollbars and toolbars do not stretch completely over 1007 horizontal scrollbars and toolbars do not stretch completely over
990 to the right edge of the window. Only the modeline does. */ 1008 to the right edge of the window. Only the modeline does. */