comparison src/redisplay-x.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
121 Returns the number of runs actually used. */ 121 Returns the number of runs actually used. */
122 122
123 static int 123 static int
124 separate_textual_runs (unsigned char *text_storage, 124 separate_textual_runs (unsigned char *text_storage,
125 struct textual_run *run_storage, 125 struct textual_run *run_storage,
126 CONST Emchar *str, Charcount len) 126 const Emchar *str, Charcount len)
127 { 127 {
128 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a 128 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
129 possible valid charset when 129 possible valid charset when
130 MULE is not defined */ 130 MULE is not defined */
131 int runs_so_far = 0; 131 int runs_so_far = 0;
239 Given a string and a face, return the string's length in pixels when 239 Given a string and a face, return the string's length in pixels when
240 displayed in the font associated with the face. 240 displayed in the font associated with the face.
241 */ 241 */
242 242
243 static int 243 static int
244 x_text_width (struct frame *f, struct face_cachel *cachel, CONST Emchar *str, 244 x_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str,
245 Charcount len) 245 Charcount len)
246 { 246 {
247 int width_so_far = 0; 247 int width_so_far = 0;
248 unsigned char *text_storage = (unsigned char *) alloca (2 * len); 248 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
249 struct textual_run *runs = alloca_array (struct textual_run, len); 249 struct textual_run *runs = alloca_array (struct textual_run, len);
284 { 284 {
285 return EOL_CURSOR_WIDTH; 285 return EOL_CURSOR_WIDTH;
286 } 286 }
287 287
288 /***************************************************************************** 288 /*****************************************************************************
289 x_output_begin 289 x_window_output_begin
290 290
291 Perform any necessary initialization prior to an update. 291 Perform any necessary initialization prior to an update.
292 ****************************************************************************/ 292 ****************************************************************************/
293 static void 293 static void
294 x_output_begin (struct device *d) 294 x_window_output_begin (struct window *w)
295 { 295 {
296 } 296 }
297 297
298 /***************************************************************************** 298 /*****************************************************************************
299 x_output_end 299 x_window_output_end
300 300
301 Perform any necessary flushing of queues when an update has completed. 301 Perform any necessary flushing of queues when an update has completed.
302 ****************************************************************************/ 302 ****************************************************************************/
303 static void 303 static void
304 x_output_end (struct device *d) 304 x_window_output_end (struct window *w)
305 { 305 {
306 XFlush (DEVICE_X_DISPLAY (d)); 306 XFlush (DEVICE_X_DISPLAY (WINDOW_XDEVICE (w)));
307 } 307 }
308 308
309 /***************************************************************************** 309 /*****************************************************************************
310 x_output_display_block 310 x_output_display_block
311 311
447 instance = glyph_image_instance (rb->object.dglyph.glyph, 447 instance = glyph_image_instance (rb->object.dglyph.glyph,
448 window, ERROR_ME_NOT, 1); 448 window, ERROR_ME_NOT, 1);
449 findex = rb->findex; 449 findex = rb->findex;
450 450
451 if (IMAGE_INSTANCEP (instance)) 451 if (IMAGE_INSTANCEP (instance))
452 switch (XIMAGE_INSTANCE_TYPE (instance)) 452 {
453 { 453 switch (XIMAGE_INSTANCE_TYPE (instance))
454 case IMAGE_TEXT:
455 { 454 {
456 /* #### This is way losing. See the comment in 455 case IMAGE_MONO_PIXMAP:
457 add_glyph_rune(). */ 456 case IMAGE_COLOR_PIXMAP:
458 Lisp_Object string = 457 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
459 XIMAGE_INSTANCE_TEXT_STRING (instance); 458 cursor_start, cursor_width,
460 convert_bufbyte_string_into_emchar_dynarr 459 cursor_height, 0);
461 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); 460 break;
462 461
463 x_output_string (w, dl, buf, xpos, 462 case IMAGE_WIDGET:
464 rb->object.dglyph.xoffset, 463 if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
465 start_pixpos, -1, findex, 464 Qlayout))
466 (rb->cursor_type == CURSOR_ON), 465 {
467 cursor_start, cursor_width, 466 redisplay_output_layout (window, instance, &dbox, &dga, findex,
468 cursor_height); 467 cursor_start, cursor_width,
469 Dynarr_reset (buf); 468 cursor_height);
469 break;
470 }
471 case IMAGE_SUBWINDOW:
472 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
473 cursor_start, cursor_width,
474 cursor_height);
475 break;
476
477 case IMAGE_NOTHING:
478 /* nothing is as nothing does */
479 break;
480
481 case IMAGE_TEXT:
482 case IMAGE_POINTER:
483 default:
484 abort ();
470 } 485 }
471 break; 486 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
472 487 (XIMAGE_INSTANCE (instance)) = 0;
473 case IMAGE_MONO_PIXMAP: 488 }
474 case IMAGE_COLOR_PIXMAP:
475 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
476 cursor_start, cursor_width,
477 cursor_height, 0);
478 break;
479
480 case IMAGE_WIDGET:
481 case IMAGE_SUBWINDOW:
482 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
483 cursor_start, cursor_width,
484 cursor_height);
485 break;
486
487 case IMAGE_LAYOUT:
488 redisplay_output_layout (w, instance, &dbox, &dga, findex,
489 cursor_start, cursor_width,
490 cursor_height);
491 break;
492
493 case IMAGE_NOTHING:
494 /* nothing is as nothing does */
495 break;
496
497 case IMAGE_POINTER:
498 default:
499 abort ();
500 }
501 489
502 xpos += rb->width; 490 xpos += rb->width;
503 elt++; 491 elt++;
504 } 492 }
505 else 493 else
680 /* evil kludge! */ 668 /* evil kludge! */
681 if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg)) 669 if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
682 { 670 {
683 /* #### I fixed once case where this was getting it. It was a 671 /* #### I fixed once case where this was getting it. It was a
684 bad macro expansion (compiler bug). */ 672 bad macro expansion (compiler bug). */
685 fprintf (stderr, "Help! x_get_gc got a bogus fg value! fg = "); 673 stderr_out ("Help! x_get_gc got a bogus fg value! fg = ");
686 debug_print (fg); 674 debug_print (fg);
687 fg = Qnil; 675 fg = Qnil;
688 } 676 }
689 677
690 if (!NILP (fg)) 678 if (!NILP (fg))
1318 width = window_divider_width (w); 1306 width = window_divider_width (w);
1319 shadow_thickness = XINT (w->vertical_divider_shadow_thickness); 1307 shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
1320 spacing = XINT (w->vertical_divider_spacing); 1308 spacing = XINT (w->vertical_divider_spacing);
1321 line_width = XINT (w->vertical_divider_line_width); 1309 line_width = XINT (w->vertical_divider_line_width);
1322 x = WINDOW_RIGHT (w) - width; 1310 x = WINDOW_RIGHT (w) - width;
1323 y1 = WINDOW_TOP (w) + FRAME_TOP_GUTTER_BOUNDS (f); 1311 y1 = WINDOW_TOP (w);
1324 y2 = WINDOW_BOTTOM (w) + FRAME_BOTTOM_GUTTER_BOUNDS (f); 1312 y2 = WINDOW_BOTTOM (w);
1325 1313
1326 memset (&gcv, ~0, sizeof (XGCValues)); 1314 memset (&gcv, ~0, sizeof (XGCValues));
1327 1315
1328 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face); 1316 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
1329 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel)); 1317 tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
1981 XColor tmp_fcolor, tmp_bcolor; 1969 XColor tmp_fcolor, tmp_bcolor;
1982 Lisp_Object tmp_pixel, frame; 1970 Lisp_Object tmp_pixel, frame;
1983 struct frame *f = device_selected_frame (d); 1971 struct frame *f = device_selected_frame (d);
1984 struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f)); 1972 struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
1985 Widget shell = FRAME_X_SHELL_WIDGET (f); 1973 Widget shell = FRAME_X_SHELL_WIDGET (f);
1974 int flash_height;
1986 1975
1987 XSETFRAME (frame, f); 1976 XSETFRAME (frame, f);
1988 1977
1989 tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame); 1978 tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
1990 tmp_fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel)); 1979 tmp_fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
1997 gcv.foreground = (tmp_fcolor.pixel ^ tmp_bcolor.pixel); 1986 gcv.foreground = (tmp_fcolor.pixel ^ tmp_bcolor.pixel);
1998 gcv.function = GXxor; 1987 gcv.function = GXxor;
1999 gcv.graphics_exposures = False; 1988 gcv.graphics_exposures = False;
2000 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (XDEVICE (f->device)), &gcv, 1989 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (XDEVICE (f->device)), &gcv,
2001 (GCForeground | GCFunction | GCGraphicsExposures)); 1990 (GCForeground | GCFunction | GCGraphicsExposures));
2002 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top, 1991 default_face_height_and_width (frame, &flash_height, 0);
2003 w->pixel_width, w->pixel_height); 1992
1993 /* If window is tall, flash top and bottom line. */
1994 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
1995 {
1996 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
1997 w->pixel_width, flash_height);
1998 XFillRectangle (dpy, win, gc, w->pixel_left,
1999 w->pixel_top + w->pixel_height - flash_height,
2000 w->pixel_width, flash_height);
2001 }
2002 else
2003 /* If it is short, flash it all. */
2004 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2005 w->pixel_width, w->pixel_height);
2006
2004 XSync (dpy, False); 2007 XSync (dpy, False);
2005 2008
2006 #ifdef HAVE_SELECT 2009 #ifdef HAVE_SELECT
2007 { 2010 {
2008 int usecs = 100000; 2011 int usecs = 100000;
2018 #else /* !HAVE_POLL */ 2021 #else /* !HAVE_POLL */
2019 bite me 2022 bite me
2020 #endif /* HAVE_POLL */ 2023 #endif /* HAVE_POLL */
2021 #endif /* HAVE_SELECT */ 2024 #endif /* HAVE_SELECT */
2022 2025
2023 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top, 2026 /* If window is tall, flash top and bottom line. */
2024 w->pixel_width, w->pixel_height); 2027 if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
2028 {
2029 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2030 w->pixel_width, flash_height);
2031 XFillRectangle (dpy, win, gc, w->pixel_left,
2032 w->pixel_top + w->pixel_height - flash_height,
2033 w->pixel_width, flash_height);
2034 }
2035 else
2036 /* If it is short, flash it all. */
2037 XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
2038 w->pixel_width, w->pixel_height);
2039
2025 XSync (dpy, False); 2040 XSync (dpy, False);
2026 2041
2027 return 1; 2042 return 1;
2028 } 2043 }
2029 2044
2078 CONSOLE_HAS_METHOD (x, divider_height); 2093 CONSOLE_HAS_METHOD (x, divider_height);
2079 CONSOLE_HAS_METHOD (x, eol_cursor_width); 2094 CONSOLE_HAS_METHOD (x, eol_cursor_width);
2080 CONSOLE_HAS_METHOD (x, output_vertical_divider); 2095 CONSOLE_HAS_METHOD (x, output_vertical_divider);
2081 CONSOLE_HAS_METHOD (x, clear_region); 2096 CONSOLE_HAS_METHOD (x, clear_region);
2082 CONSOLE_HAS_METHOD (x, clear_frame); 2097 CONSOLE_HAS_METHOD (x, clear_frame);
2083 CONSOLE_HAS_METHOD (x, output_begin); 2098 CONSOLE_HAS_METHOD (x, window_output_begin);
2084 CONSOLE_HAS_METHOD (x, output_end); 2099 CONSOLE_HAS_METHOD (x, window_output_end);
2085 CONSOLE_HAS_METHOD (x, flash); 2100 CONSOLE_HAS_METHOD (x, flash);
2086 CONSOLE_HAS_METHOD (x, ring_bell); 2101 CONSOLE_HAS_METHOD (x, ring_bell);
2087 CONSOLE_HAS_METHOD (x, bevel_area); 2102 CONSOLE_HAS_METHOD (x, bevel_area);
2088 CONSOLE_HAS_METHOD (x, output_string); 2103 CONSOLE_HAS_METHOD (x, output_string);
2089 CONSOLE_HAS_METHOD (x, output_pixmap); 2104 CONSOLE_HAS_METHOD (x, output_pixmap);