Mercurial > hg > xemacs-beta
comparison src/redisplay-xlike-inc.c @ 5074:8af6a32b170d
Modify XLIKE_get_gc's prototype
src/ChangeLog addition:
2010-02-24 Didier Verna <didier@xemacs.org>
Modify XLIKE_get_gc's prototype.
* redisplay-xlike-inc.c (XLIKE_get_gc): Take a frame instead of a
device as first argument.
* redisplay-xlike-inc.c (XLIKE_output_string): Update caller.
* redisplay-xlike-inc.c (XLIKE_output_pixmap): Ditto.
* redisplay-xlike-inc.c (XLIKE_output_blank): Ditto.
* redisplay-xlike-inc.c (XLIKE_output_horizontal_line): Ditto.
* redisplay-xlike-inc.c (XLIKE_clear_region): Ditto.
* redisplay-xlike-inc.c (XLIKE_output_eol_cursor): Ditto.
* console-gtk.h (gtk_get_gc): Take a frame instead of a device as
first argument.
* gtk-glue.c (face_to_gc): Update caller.
author | Didier Verna <didier@lrde.epita.fr> |
---|---|
date | Wed, 24 Feb 2010 15:45:20 +0100 |
parents | 07dcc7000bbf |
children | 5502045ec510 |
comparison
equal
deleted
inserted
replaced
5073:78a3c171a427 | 5074:8af6a32b170d |
---|---|
810 Dynarr_free (buf); | 810 Dynarr_free (buf); |
811 } | 811 } |
812 | 812 |
813 /* Called as gtk_get_gc from gtk-glue.c */ | 813 /* Called as gtk_get_gc from gtk-glue.c */ |
814 | 814 |
815 XLIKE_GC XLIKE_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, | 815 XLIKE_GC XLIKE_get_gc (struct frame *f, Lisp_Object font, Lisp_Object fg, |
816 Lisp_Object bg, Lisp_Object bg_pmap, | 816 Lisp_Object bg, Lisp_Object bg_pmap, |
817 Lisp_Object lwidth); | 817 Lisp_Object lwidth); |
818 | 818 |
819 /***************************************************************************** | 819 /***************************************************************************** |
820 XLIKE_get_gc | 820 XLIKE_get_gc |
821 | 821 |
822 Given a number of parameters return a GC with those properties. | 822 Given a number of parameters return a GC with those properties. |
823 ****************************************************************************/ | 823 ****************************************************************************/ |
824 XLIKE_GC | 824 XLIKE_GC |
825 XLIKE_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, | 825 XLIKE_get_gc (struct frame *f, Lisp_Object font, Lisp_Object fg, |
826 Lisp_Object bg, Lisp_Object bg_pmap, Lisp_Object lwidth) | 826 Lisp_Object bg, Lisp_Object bg_pmap, Lisp_Object lwidth) |
827 { | 827 { |
828 struct device *d = XDEVICE (f->device); | |
828 XLIKE_GCVALUES gcv; | 829 XLIKE_GCVALUES gcv; |
829 unsigned long mask; | 830 unsigned long mask; |
830 | 831 |
831 memset (&gcv, ~0, sizeof (gcv)); | 832 memset (&gcv, ~0, sizeof (gcv)); |
832 gcv.graphics_exposures = XLIKE_FALSE; | 833 gcv.graphics_exposures = XLIKE_FALSE; |
1074 | 1075 |
1075 if ((cursor && focus && NILP (bar_cursor_value) | 1076 if ((cursor && focus && NILP (bar_cursor_value) |
1076 && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap)) | 1077 && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap)) |
1077 bgc = 0; | 1078 bgc = 0; |
1078 else | 1079 else |
1079 bgc = XLIKE_get_gc (d, Qnil, cachel->foreground, cachel->background, | 1080 bgc = XLIKE_get_gc (f, Qnil, cachel->foreground, cachel->background, |
1080 bg_pmap, Qnil); | 1081 bg_pmap, Qnil); |
1081 | 1082 |
1082 if (bgc) | 1083 if (bgc) |
1083 { | 1084 { |
1084 XLIKE_FILL_RECTANGLE (dpy, x_win, bgc, clip_start, | 1085 XLIKE_FILL_RECTANGLE (dpy, x_win, bgc, clip_start, |
1155 { | 1156 { |
1156 #ifdef USE_XFT | 1157 #ifdef USE_XFT |
1157 fg = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0); | 1158 fg = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0); |
1158 bg = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0); | 1159 bg = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0); |
1159 #endif | 1160 #endif |
1160 gc = XLIKE_get_gc (d, font, cursor_cachel->foreground, | 1161 gc = XLIKE_get_gc (f, font, cursor_cachel->foreground, |
1161 cursor_cachel->background, Qnil, Qnil); | 1162 cursor_cachel->background, Qnil, Qnil); |
1162 } | 1163 } |
1163 else if (cachel->dim) | 1164 else if (cachel->dim) |
1164 { | 1165 { |
1165 /* Ensure the gray bitmap exists */ | 1166 /* Ensure the gray bitmap exists */ |
1177 /* Request a GC with the gray stipple pixmap to draw dimmed text */ | 1178 /* Request a GC with the gray stipple pixmap to draw dimmed text */ |
1178 #ifdef USE_XFT | 1179 #ifdef USE_XFT |
1179 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 1); | 1180 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 1); |
1180 bg = XFT_FROB_LISP_COLOR (cachel->background, 0); | 1181 bg = XFT_FROB_LISP_COLOR (cachel->background, 0); |
1181 #endif | 1182 #endif |
1182 gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background, | 1183 gc = XLIKE_get_gc (f, font, cachel->foreground, cachel->background, |
1183 Qdim, Qnil); | 1184 Qdim, Qnil); |
1184 } | 1185 } |
1185 else | 1186 else |
1186 { | 1187 { |
1187 #ifdef USE_XFT | 1188 #ifdef USE_XFT |
1188 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 0); | 1189 fg = XFT_FROB_LISP_COLOR (cachel->foreground, 0); |
1189 bg = XFT_FROB_LISP_COLOR (cachel->background, 0); | 1190 bg = XFT_FROB_LISP_COLOR (cachel->background, 0); |
1190 #endif | 1191 #endif |
1191 gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background, | 1192 gc = XLIKE_get_gc (f, font, cachel->foreground, cachel->background, |
1192 Qnil, Qnil); | 1193 Qnil, Qnil); |
1193 } | 1194 } |
1194 #ifdef USE_XFT | 1195 #ifdef USE_XFT |
1195 { | 1196 { |
1196 XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi); | 1197 XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi); |
1460 else /* core font, not Xft */ | 1461 else /* core font, not Xft */ |
1461 #endif /* USE_XFT */ | 1462 #endif /* USE_XFT */ |
1462 { | 1463 { |
1463 XLIKE_RECTANGLE clip_box; | 1464 XLIKE_RECTANGLE clip_box; |
1464 XLIKE_GC cgc; | 1465 XLIKE_GC cgc; |
1465 cgc = XLIKE_get_gc (d, font, cursor_cachel->foreground, | 1466 cgc = XLIKE_get_gc (f, font, cursor_cachel->foreground, |
1466 cursor_cachel->background, Qnil, Qnil); | 1467 cursor_cachel->background, Qnil, Qnil); |
1467 | 1468 |
1468 clip_box.x = 0; | 1469 clip_box.x = 0; |
1469 clip_box.y = 0; | 1470 clip_box.y = 0; |
1470 clip_box.width = cursor_width; | 1471 clip_box.width = cursor_width; |
1532 int bogusly_obtained_ascent_value = | 1533 int bogusly_obtained_ascent_value = |
1533 XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent; | 1534 XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent; |
1534 | 1535 |
1535 if (!NILP (bar_cursor_value)) | 1536 if (!NILP (bar_cursor_value)) |
1536 { | 1537 { |
1537 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, | 1538 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, Qnil, Qnil, |
1538 make_int (bar_width)); | 1539 make_int (bar_width)); |
1539 } | 1540 } |
1540 else | 1541 else |
1541 { | 1542 { |
1542 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, | 1543 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, |
1543 Qnil, Qnil, Qnil); | 1544 Qnil, Qnil, Qnil); |
1544 } | 1545 } |
1545 | 1546 |
1546 tmp_y = dl->ypos - bogusly_obtained_ascent_value; | 1547 tmp_y = dl->ypos - bogusly_obtained_ascent_value; |
1547 tmp_height = cursor_height; | 1548 tmp_height = cursor_height; |
1726 struct face_cachel *cursor_cachel = | 1727 struct face_cachel *cursor_cachel = |
1727 WINDOW_FACE_CACHEL (w, | 1728 WINDOW_FACE_CACHEL (w, |
1728 get_builtin_face_cache_index | 1729 get_builtin_face_cache_index |
1729 (w, Vtext_cursor_face)); | 1730 (w, Vtext_cursor_face)); |
1730 | 1731 |
1731 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); | 1732 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); |
1732 | 1733 |
1733 if (cursor_width > db->xpos + dga->width - cursor_start) | 1734 if (cursor_width > db->xpos + dga->width - cursor_start) |
1734 cursor_width = db->xpos + dga->width - cursor_start; | 1735 cursor_width = db->xpos + dga->width - cursor_start; |
1735 | 1736 |
1736 if (focus) | 1737 if (focus) |
1870 if (!IMAGE_INSTANCEP (bg_pmap) | 1871 if (!IMAGE_INSTANCEP (bg_pmap) |
1871 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) | 1872 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) |
1872 bg_pmap = Qnil; | 1873 bg_pmap = Qnil; |
1873 | 1874 |
1874 if (NILP (bg_pmap)) | 1875 if (NILP (bg_pmap)) |
1875 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), | 1876 gc = XLIKE_get_gc (f, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), |
1876 Qnil, Qnil, Qnil); | 1877 Qnil, Qnil, Qnil); |
1877 else | 1878 else |
1878 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex), | 1879 gc = XLIKE_get_gc (f, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex), |
1879 WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap, | 1880 WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap, |
1880 Qnil); | 1881 Qnil); |
1881 | 1882 |
1882 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height); | 1883 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height); |
1883 | 1884 |
1895 | 1896 |
1896 fi = XFONT_INSTANCE (FACE_CACHEL_FONT | 1897 fi = XFONT_INSTANCE (FACE_CACHEL_FONT |
1897 (WINDOW_FACE_CACHEL (w, rb->findex), | 1898 (WINDOW_FACE_CACHEL (w, rb->findex), |
1898 Vcharset_ascii)); | 1899 Vcharset_ascii)); |
1899 | 1900 |
1900 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); | 1901 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); |
1901 | 1902 |
1902 cursor_y = dl->ypos - fi->ascent; | 1903 cursor_y = dl->ypos - fi->ascent; |
1903 cursor_height = fi->height; | 1904 cursor_height = fi->height; |
1904 if (cursor_y + cursor_height > y + height) | 1905 if (cursor_y + cursor_height > y + height) |
1905 cursor_height = y + height - cursor_y; | 1906 cursor_height = y + height - cursor_y; |
1913 } | 1914 } |
1914 else | 1915 else |
1915 { | 1916 { |
1916 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2; | 1917 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2; |
1917 | 1918 |
1918 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, | 1919 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, |
1919 Qnil, Qnil, make_int (bar_width)); | 1920 Qnil, Qnil, make_int (bar_width)); |
1920 XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1, | 1921 XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1, |
1921 cursor_y, cursor_start + bar_width - 1, | 1922 cursor_y, cursor_start + bar_width - 1, |
1922 cursor_y + cursor_height - 1); | 1923 cursor_y + cursor_height - 1); |
1923 } | 1924 } |
1957 ypos4 = dl->ypos + dl->descent - dl->clip; | 1958 ypos4 = dl->ypos + dl->descent - dl->clip; |
1958 | 1959 |
1959 /* First clear the area not covered by the line. */ | 1960 /* First clear the area not covered by the line. */ |
1960 if (height - rb->object.hline.thickness > 0) | 1961 if (height - rb->object.hline.thickness > 0) |
1961 { | 1962 { |
1962 gc = XLIKE_get_gc (d, Qnil, | 1963 gc = XLIKE_get_gc (f, Qnil, |
1963 WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex), | 1964 WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex), |
1964 Qnil, Qnil, Qnil); | 1965 Qnil, Qnil, Qnil); |
1965 | 1966 |
1966 if (ypos2 - ypos1 > 0) | 1967 if (ypos2 - ypos1 > 0) |
1967 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1); | 1968 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1); |
1975 gtk_paint_hline (style, x_win, GTK_STATE_NORMAL, NULL, | 1976 gtk_paint_hline (style, x_win, GTK_STATE_NORMAL, NULL, |
1976 FRAME_GTK_TEXT_WIDGET (f), "hline", x, x + width, ypos2); | 1977 FRAME_GTK_TEXT_WIDGET (f), "hline", x, x + width, ypos2); |
1977 } | 1978 } |
1978 #else /* THIS_IS_X */ | 1979 #else /* THIS_IS_X */ |
1979 /* Now draw the line. */ | 1980 /* Now draw the line. */ |
1980 gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), | 1981 gc = XLIKE_get_gc (f, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), |
1981 Qnil, Qnil, Qnil); | 1982 Qnil, Qnil, Qnil); |
1982 | 1983 |
1983 if (ypos2 < ypos1) | 1984 if (ypos2 < ypos1) |
1984 ypos2 = ypos1; | 1985 ypos2 = ypos1; |
1985 if (ypos3 > ypos4) | 1986 if (ypos3 > ypos4) |
2006 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f); | 2007 XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f); |
2007 XLIKE_GC gc = NULL; | 2008 XLIKE_GC gc = NULL; |
2008 | 2009 |
2009 if (!UNBOUNDP (background_pixmap)) | 2010 if (!UNBOUNDP (background_pixmap)) |
2010 { | 2011 { |
2011 gc = XLIKE_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil); | 2012 gc = XLIKE_get_gc (f, Qnil, fcolor, bcolor, background_pixmap, Qnil); |
2012 } | 2013 } |
2013 | 2014 |
2014 if (gc) | 2015 if (gc) |
2015 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height); | 2016 XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height); |
2016 else | 2017 else |
2052 redisplay_clear_region (window, findex, x, y, width, height); | 2053 redisplay_clear_region (window, findex, x, y, width, height); |
2053 | 2054 |
2054 if (NILP (w->text_cursor_visible_p)) | 2055 if (NILP (w->text_cursor_visible_p)) |
2055 return; | 2056 return; |
2056 | 2057 |
2057 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); | 2058 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); |
2058 | 2059 |
2059 default_face_font_info (window, &defascent, 0, 0, &defheight, 0); | 2060 default_face_font_info (window, &defascent, 0, 0, &defheight, 0); |
2060 | 2061 |
2061 /* make sure the cursor is entirely contained between y and y+height */ | 2062 /* make sure the cursor is entirely contained between y and y+height */ |
2062 cursor_height = min (defheight, height); | 2063 cursor_height = min (defheight, height); |
2076 } | 2077 } |
2077 else | 2078 else |
2078 { | 2079 { |
2079 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2; | 2080 int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2; |
2080 | 2081 |
2081 gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, | 2082 gc = XLIKE_get_gc (f, Qnil, cursor_cachel->background, Qnil, Qnil, |
2082 make_int (bar_width)); | 2083 make_int (bar_width)); |
2083 XLIKE_DRAW_LINE (dpy, x_win, gc, x + bar_width - 1, cursor_y, | 2084 XLIKE_DRAW_LINE (dpy, x_win, gc, x + bar_width - 1, cursor_y, |
2084 x + bar_width - 1, cursor_y + cursor_height - 1); | 2085 x + bar_width - 1, cursor_y + cursor_height - 1); |
2085 } | 2086 } |
2086 } | 2087 } |