Mercurial > hg > xemacs-beta
comparison src/redisplay-x.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 | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
383:6a50c6a581a5 | 384:bbff43aa5eb7 |
---|---|
72 struct rune *rb); | 72 struct rune *rb); |
73 static void x_redraw_exposed_window (struct window *w, int x, int y, | 73 static void x_redraw_exposed_window (struct window *w, int x, int y, |
74 int width, int height); | 74 int width, int height); |
75 static void x_redraw_exposed_windows (Lisp_Object window, int x, int y, | 75 static void x_redraw_exposed_windows (Lisp_Object window, int x, int y, |
76 int width, int height); | 76 int width, int height); |
77 static void x_clear_region (Lisp_Object window, face_index findex, int x, | |
78 int y, int width, int height); | |
79 static void x_output_eol_cursor (struct window *w, struct display_line *dl, | 77 static void x_output_eol_cursor (struct window *w, struct display_line *dl, |
80 int xpos, face_index findex); | 78 int xpos, face_index findex); |
81 static void x_clear_frame (struct frame *f); | 79 static void x_clear_frame (struct frame *f); |
82 static void x_clear_frame_windows (Lisp_Object window); | 80 static void x_clear_frame_windows (Lisp_Object window); |
83 static void x_bevel_modeline (struct window *w, struct display_line *dl); | 81 static void x_bevel_modeline (struct window *w, struct display_line *dl); |
414 else if (rb->object.chr.ch == '\n') | 412 else if (rb->object.chr.ch == '\n') |
415 { | 413 { |
416 /* Clear in case a cursor was formerly here. */ | 414 /* Clear in case a cursor was formerly here. */ |
417 int height = dl->ascent + dl->descent - dl->clip; | 415 int height = dl->ascent + dl->descent - dl->clip; |
418 | 416 |
419 x_clear_region (window, findex, xpos, dl->ypos - dl->ascent, | 417 redisplay_clear_region (window, findex, xpos, dl->ypos - dl->ascent, |
420 rb->width, height); | 418 rb->width, height); |
421 elt++; | 419 elt++; |
422 } | 420 } |
423 } | 421 } |
424 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) | 422 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) |
488 break; | 486 break; |
489 | 487 |
490 case IMAGE_POINTER: | 488 case IMAGE_POINTER: |
491 abort (); | 489 abort (); |
492 | 490 |
491 case IMAGE_WIDGET: | |
493 case IMAGE_SUBWINDOW: | 492 case IMAGE_SUBWINDOW: |
494 /* #### implement me */ | 493 redisplay_output_subwindow (w, dl, instance, xpos, |
495 break; | 494 rb->object.dglyph.xoffset, start_pixpos, |
495 rb->width, findex, cursor_start, | |
496 cursor_width, cursor_height); | |
496 | 497 |
497 case IMAGE_NOTHING: | 498 case IMAGE_NOTHING: |
498 /* nothing is as nothing does */ | 499 /* nothing is as nothing does */ |
499 break; | 500 break; |
500 | 501 |
900 if (ypos2_string > ypos2_line) | 901 if (ypos2_string > ypos2_line) |
901 ypos2_string = ypos2_line; | 902 ypos2_string = ypos2_line; |
902 | 903 |
903 if (ypos1_line < ypos1_string) | 904 if (ypos1_line < ypos1_string) |
904 { | 905 { |
905 x_clear_region (window, findex, clear_start, ypos1_line, | 906 redisplay_clear_region (window, findex, clear_start, ypos1_line, |
906 clear_end - clear_start, | 907 clear_end - clear_start, |
907 ypos1_string - ypos1_line); | 908 ypos1_string - ypos1_line); |
908 } | 909 } |
909 | 910 |
910 if (ypos2_line > ypos2_string) | 911 if (ypos2_line > ypos2_string) |
911 { | 912 { |
912 x_clear_region (window, findex, clear_start, ypos2_string, | 913 redisplay_clear_region (window, findex, clear_start, ypos2_string, |
913 clear_end - clear_start, | 914 clear_end - clear_start, |
914 ypos2_line - ypos2_string); | 915 ypos2_line - ypos2_string); |
915 } | 916 } |
916 } | 917 } |
917 else | 918 else |
918 { | 919 { |
919 x_clear_region (window, findex, clear_start, | 920 redisplay_clear_region (window, findex, clear_start, |
920 dl->ypos - dl->ascent, clear_end - clear_start, | 921 dl->ypos - dl->ascent, clear_end - clear_start, |
921 height); | 922 height); |
922 } | 923 } |
923 } | 924 } |
924 | 925 |
1332 { | 1333 { |
1333 clear_x = xpos; | 1334 clear_x = xpos; |
1334 clear_width = width; | 1335 clear_width = width; |
1335 } | 1336 } |
1336 | 1337 |
1337 x_clear_region (window, findex, clear_x, clear_y, | 1338 redisplay_clear_region (window, findex, clear_x, clear_y, |
1338 clear_width, clear_height); | 1339 clear_width, clear_height); |
1339 } | 1340 } |
1340 | 1341 |
1341 /* Output the pixmap. */ | 1342 /* Output the pixmap. */ |
1342 { | 1343 { |
1834 | 1835 |
1835 bounds = calculate_display_line_boundaries (w, bflag); | 1836 bounds = calculate_display_line_boundaries (w, bflag); |
1836 XSETWINDOW (window, w); | 1837 XSETWINDOW (window, w); |
1837 | 1838 |
1838 if (window_is_leftmost (w)) | 1839 if (window_is_leftmost (w)) |
1839 x_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f), | 1840 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f), |
1840 ypos1, FRAME_BORDER_WIDTH (f), height); | 1841 ypos1, FRAME_BORDER_WIDTH (f), height); |
1841 | 1842 |
1842 if (bounds.left_in - bounds.left_out > 0) | 1843 if (bounds.left_in - bounds.left_out > 0) |
1843 x_clear_region (window, | 1844 redisplay_clear_region (window, |
1844 get_builtin_face_cache_index (w, Vleft_margin_face), | 1845 get_builtin_face_cache_index (w, Vleft_margin_face), |
1845 bounds.left_out, ypos1, | 1846 bounds.left_out, ypos1, |
1846 bounds.left_in - bounds.left_out, height); | 1847 bounds.left_in - bounds.left_out, height); |
1847 | 1848 |
1848 if (bounds.right_in - bounds.left_in > 0) | 1849 if (bounds.right_in - bounds.left_in > 0) |
1849 x_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1, | 1850 redisplay_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1, |
1850 bounds.right_in - bounds.left_in, height); | 1851 bounds.right_in - bounds.left_in, height); |
1851 | 1852 |
1852 if (bounds.right_out - bounds.right_in > 0) | 1853 if (bounds.right_out - bounds.right_in > 0) |
1853 x_clear_region (window, | 1854 redisplay_clear_region (window, |
1854 get_builtin_face_cache_index (w, Vright_margin_face), | 1855 get_builtin_face_cache_index (w, Vright_margin_face), |
1855 bounds.right_in, ypos1, | 1856 bounds.right_in, ypos1, |
1856 bounds.right_out - bounds.right_in, height); | 1857 bounds.right_out - bounds.right_in, height); |
1857 | 1858 |
1858 if (window_is_rightmost (w)) | 1859 if (window_is_rightmost (w)) |
1859 x_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), | 1860 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), |
1860 ypos1, FRAME_BORDER_WIDTH (f), height); | 1861 ypos1, FRAME_BORDER_WIDTH (f), height); |
1861 } | 1862 } |
1862 } | 1863 } |
1863 | 1864 |
1864 /***************************************************************************** | 1865 /***************************************************************************** |
1994 | 1995 |
1995 Clear the area in the box defined by the given parameters using the | 1996 Clear the area in the box defined by the given parameters using the |
1996 given face. | 1997 given face. |
1997 ****************************************************************************/ | 1998 ****************************************************************************/ |
1998 static void | 1999 static void |
1999 x_clear_region (Lisp_Object locale, face_index findex, int x, int y, | 2000 x_clear_region (Lisp_Object locale, struct device* d, struct frame* f, face_index findex, |
2000 int width, int height) | 2001 int x, int y, |
2001 { | 2002 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, |
2002 struct window *w = NULL; | 2003 Lisp_Object background_pixmap) |
2003 struct frame *f = NULL; | 2004 { |
2004 struct device *d; | |
2005 Lisp_Object background_pixmap; | |
2006 | |
2007 Display *dpy; | 2005 Display *dpy; |
2008 Window x_win; | 2006 Window x_win; |
2009 | 2007 GC gc = NULL; |
2010 if (WINDOWP (locale)) | 2008 |
2011 { | |
2012 w = XWINDOW (locale); | |
2013 f = XFRAME (w->frame); | |
2014 } | |
2015 else if (FRAMEP (locale)) | |
2016 { | |
2017 w = NULL; | |
2018 f = XFRAME (locale); | |
2019 } | |
2020 else | |
2021 abort (); | |
2022 | |
2023 d = XDEVICE (f->device); | |
2024 dpy = DEVICE_X_DISPLAY (d); | 2009 dpy = DEVICE_X_DISPLAY (d); |
2025 x_win = XtWindow (FRAME_X_TEXT_WIDGET (f)); | 2010 x_win = XtWindow (FRAME_X_TEXT_WIDGET (f)); |
2026 | 2011 |
2027 /* #### This function is going to have to be made cursor aware. */ | 2012 if (!UNBOUNDP (background_pixmap)) |
2028 if (width && height) | 2013 { |
2029 { | 2014 gc = x_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil); |
2030 GC gc = NULL; | 2015 } |
2031 | 2016 |
2032 /* #### This isn't quite right for when this function is called | 2017 if (gc) |
2033 from the toolbar code. */ | 2018 XFillRectangle (dpy, x_win, gc, x, y, width, height); |
2034 background_pixmap = Qunbound; | 2019 else |
2035 | 2020 XClearArea (dpy, x_win, x, y, width, height, False); |
2036 /* Don't use a backing pixmap in the border area */ | |
2037 if (x >= FRAME_LEFT_BORDER_END (f) | |
2038 && x < FRAME_RIGHT_BORDER_START (f) | |
2039 && y >= FRAME_TOP_BORDER_END (f) | |
2040 && y < FRAME_BOTTOM_BORDER_START (f)) | |
2041 { | |
2042 Lisp_Object temp; | |
2043 | |
2044 if (w) | |
2045 { | |
2046 temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex); | |
2047 | |
2048 if (IMAGE_INSTANCEP (temp) | |
2049 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp))) | |
2050 { | |
2051 /* #### maybe we could implement such that a string | |
2052 can be a background pixmap? */ | |
2053 background_pixmap = temp; | |
2054 } | |
2055 } | |
2056 else | |
2057 { | |
2058 temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale); | |
2059 | |
2060 if (IMAGE_INSTANCEP (temp) | |
2061 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp))) | |
2062 { | |
2063 background_pixmap = temp; | |
2064 } | |
2065 } | |
2066 | |
2067 if (!UNBOUNDP (background_pixmap) && | |
2068 XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0) | |
2069 { | |
2070 Lisp_Object fcolor, bcolor; | |
2071 | |
2072 if (w) | |
2073 { | |
2074 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); | |
2075 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); | |
2076 } | |
2077 else | |
2078 { | |
2079 fcolor = FACE_FOREGROUND (Vdefault_face, locale); | |
2080 bcolor = FACE_BACKGROUND (Vdefault_face, locale); | |
2081 } | |
2082 | |
2083 gc = x_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil); | |
2084 } | |
2085 else | |
2086 { | |
2087 Lisp_Object color = (w ? | |
2088 WINDOW_FACE_CACHEL_BACKGROUND (w, findex) : | |
2089 FACE_BACKGROUND (Vdefault_face, locale)); | |
2090 | |
2091 if (UNBOUNDP (background_pixmap)) | |
2092 background_pixmap = Qnil; | |
2093 | |
2094 gc = x_get_gc (d, Qnil, color, Qnil, background_pixmap, Qnil); | |
2095 } | |
2096 } | |
2097 | |
2098 if (gc) | |
2099 XFillRectangle (dpy, x_win, gc, x, y, width, height); | |
2100 else | |
2101 XClearArea (dpy, x_win, x, y, width, height, False); | |
2102 } | |
2103 } | 2021 } |
2104 | 2022 |
2105 /***************************************************************************** | 2023 /***************************************************************************** |
2106 x_output_eol_cursor | 2024 x_output_eol_cursor |
2107 | 2025 |
2132 int height = dl->ascent + dl->descent - dl->clip; | 2050 int height = dl->ascent + dl->descent - dl->clip; |
2133 int cursor_height, cursor_y; | 2051 int cursor_height, cursor_y; |
2134 int defheight, defascent; | 2052 int defheight, defascent; |
2135 | 2053 |
2136 XSETWINDOW (window, w); | 2054 XSETWINDOW (window, w); |
2137 x_clear_region (window, findex, x, y, width, height); | 2055 redisplay_clear_region (window, findex, x, y, width, height); |
2138 | 2056 |
2139 if (NILP (w->text_cursor_visible_p)) | 2057 if (NILP (w->text_cursor_visible_p)) |
2140 return; | 2058 return; |
2141 | 2059 |
2142 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); | 2060 gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); |