Mercurial > hg > xemacs-beta
comparison src/redisplay-gtk.c @ 714:02339d4ebed4
[xemacs-hg @ 2001-12-23 20:28:19 by wmperry]
2001-12-22 William M. Perry <wmperry@gnu.org>
* glyphs-gtk.c (gtk_xpm_instantiate): Don't bother doing the
xpm-color-symbols checks, they are impossible to implement with
GTK's XPM implementation. :(
2001-12-13 William M. Perry <wmperry@gnu.org>
* select-gtk.c (gtk_own_selection): Update to follow the new
method signature. Ignore owned_p as it appears to only be used
for motif hacks.
* redisplay-gtk.c (gtk_output_string): Fixed some warnings about
signed/unsigned comparison.
(gtk_output_gdk_pixmap): Remove clipping code as per change by
andy@xemacs.org to the X11 code.
(gtk_output_pixmap): Make this follow the output_pixmap method
conventions and expose it.
(gtk_output_horizontal_line): Renamed from output_hline, and
expose it in our method structure.
(gtk_ring_bell): Don't ring the bell if volume <= 0
* toolbar-gtk.c (gtk_output_toolbar_button):
(gtk_output_frame_toolbars):
(gtk_redraw_exposed_toolbars):
(gtk_redraw_frame_toolbars): These are now just aliases for the
common_XXX() routines in toolbar-common.c
* toolbar-common.c: New common toolbar implementation. This file
uses only the redisplay_XXX() functions and device methods to draw
the toolbar, and so should be portable across all windowing
systems (other than tty, and even then I imagine text-based stuff
would work if you had a way to select it).
author | wmperry |
---|---|
date | Sun, 23 Dec 2001 20:28:22 +0000 |
parents | fdefd0186b75 |
children | 2923009caf47 |
comparison
equal
deleted
inserted
replaced
713:c2c346111c9a | 714:02339d4ebed4 |
---|---|
1 /* X output and frame manipulation routines. | 1 /* GTK output and frame manipulation routines. |
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. |
3 Copyright (C) 1994 Lucid, Inc. | 3 Copyright (C) 1994 Lucid, Inc. |
4 Copyright (C) 1995 Sun Microsystems, Inc. | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 | 5 |
6 This file is part of XEmacs. | 6 This file is part of XEmacs. |
53 | 53 |
54 #define CONST const | 54 #define CONST const |
55 | 55 |
56 #define EOL_CURSOR_WIDTH 5 | 56 #define EOL_CURSOR_WIDTH 5 |
57 | 57 |
58 static void gtk_output_pixmap (struct window *w, struct display_line *dl, | 58 static void gtk_output_pixmap (struct window *w, |
59 Lisp_Object image_instance, int xpos, | 59 Lisp_Object image_instance, |
60 int xoffset, | 60 struct display_box *db, |
61 int start_pixpos, int width, face_index findex, | 61 struct display_glyph_area *dga, |
62 int cursor_start, int cursor_width, | 62 face_index findex, |
63 int cursor_height); | 63 int cursor_start, |
64 int cursor_width, | |
65 int cursor_height, | |
66 int bgpixmap); | |
64 static void gtk_output_vertical_divider (struct window *w, int clear); | 67 static void gtk_output_vertical_divider (struct window *w, int clear); |
65 static void gtk_output_blank (struct window *w, struct display_line *dl, | 68 static void gtk_output_blank (struct window *w, struct display_line *dl, |
66 struct rune *rb, int start_pixpos, | 69 struct rune *rb, int start_pixpos, |
67 int cursor_start, int cursor_width); | 70 int cursor_start, int cursor_width); |
68 static void gtk_output_hline (struct window *w, struct display_line *dl, | 71 static void gtk_output_horizontal_line (struct window *w, |
69 struct rune *rb); | 72 struct display_line *dl, |
73 struct rune *rb); | |
70 static void gtk_redraw_exposed_window (struct window *w, int x, int y, | 74 static void gtk_redraw_exposed_window (struct window *w, int x, int y, |
71 int width, int height); | 75 int width, int height); |
72 static void gtk_redraw_exposed_windows (Lisp_Object window, int x, int y, | 76 static void gtk_redraw_exposed_windows (Lisp_Object window, int x, int y, |
73 int width, int height); | 77 int width, int height); |
74 static void gtk_clear_region (Lisp_Object locale, struct device* d, struct frame* f, | 78 static void gtk_clear_region (Lisp_Object locale, struct device* d, struct frame* f, |
397 that if it gets redrawn then we should also | 401 that if it gets redrawn then we should also |
398 redraw the shadows. This won't be true forever. | 402 redraw the shadows. This won't be true forever. |
399 We borrow the shadow_thickness_changed flag for | 403 We borrow the shadow_thickness_changed flag for |
400 now. */ | 404 now. */ |
401 w->shadow_thickness_changed = 1; | 405 w->shadow_thickness_changed = 1; |
402 gtk_output_hline (w, dl, rb); | 406 gtk_output_horizontal_line (w, dl, rb); |
403 } | 407 } |
404 | 408 |
405 elt++; | 409 elt++; |
406 if (elt < end) | 410 if (elt < end) |
407 { | 411 { |
447 } | 451 } |
448 break; | 452 break; |
449 | 453 |
450 case IMAGE_MONO_PIXMAP: | 454 case IMAGE_MONO_PIXMAP: |
451 case IMAGE_COLOR_PIXMAP: | 455 case IMAGE_COLOR_PIXMAP: |
452 gtk_output_pixmap (w, dl, instance, xpos, | 456 redisplay_output_pixmap (w, instance, &dbox, &dga, |
453 rb->object.dglyph.xoffset, start_pixpos, | 457 findex,cursor_start, |
454 rb->width, findex, cursor_start, | 458 cursor_width, cursor_height, 0); |
455 cursor_width, cursor_height); | |
456 break; | 459 break; |
457 | 460 |
458 case IMAGE_POINTER: | 461 case IMAGE_POINTER: |
459 abort (); | 462 abort (); |
460 | 463 |
641 CURSOR_HEIGHT Height of cursor in pixels. | 644 CURSOR_HEIGHT Height of cursor in pixels. |
642 | 645 |
643 Starting Y position of cursor is the top of the text line. | 646 Starting Y position of cursor is the top of the text line. |
644 The cursor is drawn sometimes whether or not CURSOR is set. ??? | 647 The cursor is drawn sometimes whether or not CURSOR is set. ??? |
645 ****************************************************************************/ | 648 ****************************************************************************/ |
646 void | 649 static |
647 gdk_draw_text_image (GdkDrawable *drawable, | 650 void gdk_draw_text_image (GdkDrawable *drawable, |
648 GdkFont *font, | 651 GdkFont *font, |
649 GdkGC *gc, | 652 GdkGC *gc, |
650 gint x, | 653 gint x, |
651 gint y, | 654 gint y, |
652 const gchar *text, | 655 const gchar *text, |
653 gint text_length); | 656 gint text_length); |
654 | 657 |
655 void | 658 void |
656 gtk_output_string (struct window *w, struct display_line *dl, | 659 gtk_output_string (struct window *w, struct display_line *dl, |
657 Emchar_dynarr *buf, int xpos, int xoffset, int clip_start, | 660 Emchar_dynarr *buf, int xpos, int xoffset, int clip_start, |
658 int width, face_index findex, int cursor, | 661 int width, face_index findex, int cursor, |
1043 gint xdest, | 1046 gint xdest, |
1044 gint ydest, | 1047 gint ydest, |
1045 gint width, | 1048 gint width, |
1046 gint height); | 1049 gint height); |
1047 | 1050 |
1048 void | 1051 static void |
1049 gtk_output_gdk_pixmap (struct frame *f, struct Lisp_Image_Instance *p, int x, | 1052 gtk_output_gdk_pixmap (struct frame *f, struct Lisp_Image_Instance *p, int x, |
1050 int y, int clip_x, int clip_y, int clip_width, | 1053 int y, int xoffset, int yoffset, |
1051 int clip_height, int width, int height, int pixmap_offset, | 1054 int width, int height, |
1052 GdkColor *fg, GdkColor *bg, GdkGC *override_gc) | 1055 GdkColor *fg, GdkColor *bg, GdkGC *override_gc) |
1053 { | 1056 { |
1054 struct device *d = XDEVICE (f->device); | 1057 struct device *d = XDEVICE (f->device); |
1055 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)); | 1058 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)); |
1056 | 1059 |
1057 GdkGC *gc; | 1060 GdkGC *gc; |
1058 GdkGCValues gcv; | 1061 GdkGCValues gcv; |
1059 unsigned long pixmap_mask; | 1062 unsigned long pixmap_mask; |
1060 int need_clipping = (clip_x || clip_y); | |
1061 | 1063 |
1062 if (!override_gc) | 1064 if (!override_gc) |
1063 { | 1065 { |
1064 memset (&gcv, ~0, sizeof (gcv)); | 1066 memset (&gcv, ~0, sizeof (gcv)); |
1065 gcv.graphics_exposures = FALSE; | 1067 gcv.graphics_exposures = FALSE; |
1069 | 1071 |
1070 if (IMAGE_INSTANCE_GTK_MASK (p)) | 1072 if (IMAGE_INSTANCE_GTK_MASK (p)) |
1071 { | 1073 { |
1072 gcv.function = GDK_COPY; | 1074 gcv.function = GDK_COPY; |
1073 gcv.clip_mask = IMAGE_INSTANCE_GTK_MASK (p); | 1075 gcv.clip_mask = IMAGE_INSTANCE_GTK_MASK (p); |
1074 gcv.clip_x_origin = x; | 1076 gcv.clip_x_origin = x - xoffset; |
1075 gcv.clip_y_origin = y - pixmap_offset; | 1077 gcv.clip_y_origin = y - yoffset; |
1076 pixmap_mask |= (GDK_GC_FUNCTION | GDK_GC_CLIP_MASK | GDK_GC_CLIP_X_ORIGIN | | 1078 pixmap_mask |= (GDK_GC_FUNCTION | GDK_GC_CLIP_MASK | GDK_GC_CLIP_X_ORIGIN | |
1077 GDK_GC_CLIP_Y_ORIGIN); | 1079 GDK_GC_CLIP_Y_ORIGIN); |
1078 /* Can't set a clip rectangle below because we already have a mask. | 1080 /* Can't set a clip rectangle below because we already have a mask. |
1079 We could conceivably create a new clipmask by zeroing out | 1081 We could conceivably create a new clipmask by zeroing out |
1080 everything outside the clip region. Is it worth it? | 1082 everything outside the clip region. Is it worth it? |
1081 Is it possible to get an equivalent effect by changing the | 1083 Is it possible to get an equivalent effect by changing the |
1082 args to XCopyArea below rather than messing with a clip box? | 1084 args to XCopyArea below rather than messing with a clip box? |
1083 - dkindred@cs.cmu.edu */ | 1085 - dkindred@cs.cmu.edu |
1084 need_clipping = 0; | 1086 Yes. We don't clip at all now - andy@xemacs.org |
1087 */ | |
1085 } | 1088 } |
1086 | 1089 |
1087 gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, pixmap_mask); | 1090 gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, pixmap_mask); |
1088 } | 1091 } |
1089 else | 1092 else |
1090 { | 1093 { |
1091 gc = override_gc; | 1094 gc = override_gc; |
1092 /* override_gc might have a mask already--we don't want to nuke it. | 1095 /* override_gc might have a mask already--we don't want to nuke it. |
1093 Maybe we can insist that override_gc have no mask, or use | 1096 Maybe we can insist that override_gc have no mask, or use |
1094 one of the suggestions above. */ | 1097 one of the suggestions above. */ |
1095 need_clipping = 0; | |
1096 } | |
1097 | |
1098 if (need_clipping) | |
1099 { | |
1100 GdkRectangle clip_box; | |
1101 | |
1102 clip_box.x = clip_x; | |
1103 clip_box.y = clip_y; | |
1104 clip_box.width = clip_width; | |
1105 clip_box.height = clip_height; | |
1106 | |
1107 gdk_gc_set_clip_rectangle (gc, &clip_box); | |
1108 gdk_gc_set_clip_origin (gc, x, y); | |
1109 } | 1098 } |
1110 | 1099 |
1111 if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0) | 1100 if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0) |
1112 { | 1101 { |
1113 gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc, | 1102 gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc, |
1114 IMAGE_INSTANCE_GTK_PIXMAP (p), | 1103 IMAGE_INSTANCE_GTK_PIXMAP (p), |
1115 0, pixmap_offset, x, y, width, height); | 1104 xoffset, yoffset, x, y, width, height); |
1116 } | 1105 } |
1117 else | 1106 else |
1118 { | 1107 { |
1119 our_draw_bitmap (GDK_DRAWABLE (x_win), gc, | 1108 our_draw_bitmap (GDK_DRAWABLE (x_win), gc, |
1120 IMAGE_INSTANCE_GTK_PIXMAP (p), | 1109 IMAGE_INSTANCE_GTK_PIXMAP (p), |
1121 0, pixmap_offset, x, y, width, height); | 1110 xoffset, yoffset, x, y, width, height); |
1122 } | 1111 } |
1123 | |
1124 if (need_clipping) | |
1125 { | |
1126 gdk_gc_set_clip_rectangle (gc, NULL); | |
1127 gdk_gc_set_clip_origin (gc, 0, 0); | |
1128 } | |
1129 } | 1112 } |
1130 | 1113 |
1131 static void | 1114 static void |
1132 gtk_output_pixmap (struct window *w, struct display_line *dl, | 1115 gtk_output_pixmap (struct window *w, |
1133 Lisp_Object image_instance, int xpos, int xoffset, | 1116 Lisp_Object image_instance, |
1134 int start_pixpos, int width, face_index findex, | 1117 struct display_box *db, |
1135 int cursor_start, int cursor_width, int cursor_height) | 1118 struct display_glyph_area *dga, |
1119 face_index findex, | |
1120 int cursor_start, | |
1121 int cursor_width, | |
1122 int cursor_height, | |
1123 int bg_pixmap) | |
1136 { | 1124 { |
1137 struct frame *f = XFRAME (w->frame); | 1125 struct frame *f = XFRAME (w->frame); |
1138 struct device *d = XDEVICE (f->device); | 1126 struct device *d = XDEVICE (f->device); |
1139 struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); | 1127 struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); |
1140 Lisp_Object window; | 1128 Lisp_Object window; |
1141 | 1129 |
1142 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)); | 1130 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)); |
1143 int lheight = dl->ascent + dl->descent - dl->clip; | |
1144 int pheight = ((int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p) > lheight ? lheight : | |
1145 IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); | |
1146 int pwidth = min (width + xoffset, (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p)); | |
1147 int clip_x, clip_y, clip_width, clip_height; | |
1148 | |
1149 /* The pixmap_offset is used to center the pixmap on lines which are | |
1150 shorter than it is. This results in odd effects when scrolling | |
1151 pixmaps off of the bottom. Let's try not using it. */ | |
1152 #if 0 | |
1153 int pixmap_offset = (int) (IMAGE_INSTANCE_PIXMAP_HEIGHT (p) - lheight) / 2; | |
1154 #else | |
1155 int pixmap_offset = 0; | |
1156 #endif | |
1157 | 1131 |
1158 XSETWINDOW (window, w); | 1132 XSETWINDOW (window, w); |
1159 | |
1160 if ((start_pixpos >= 0 && start_pixpos > xpos) || xoffset) | |
1161 { | |
1162 if (start_pixpos > xpos && start_pixpos > xpos + width) | |
1163 return; | |
1164 | |
1165 clip_x = xoffset; | |
1166 clip_width = width; | |
1167 if (start_pixpos > xpos) | |
1168 { | |
1169 clip_x += (start_pixpos - xpos); | |
1170 clip_width -= (start_pixpos - xpos); | |
1171 } | |
1172 } | |
1173 else | |
1174 { | |
1175 clip_x = 0; | |
1176 clip_width = 0; | |
1177 } | |
1178 | |
1179 /* Place markers for possible future functionality (clipping the top | |
1180 half instead of the bottom half; think pixel scrolling). */ | |
1181 clip_y = 0; | |
1182 clip_height = pheight; | |
1183 | |
1184 /* Clear the area the pixmap is going into. The pixmap itself will | |
1185 always take care of the full width. We don't want to clear where | |
1186 it is going to go in order to avoid flicker. So, all we have to | |
1187 take care of is any area above or below the pixmap. */ | |
1188 /* #### We take a shortcut for now. We know that since we have | |
1189 pixmap_offset hardwired to 0 that the pixmap is against the top | |
1190 edge so all we have to worry about is below it. */ | |
1191 /* #### Unless the pixmap has a mask in which case we have to clear | |
1192 the whole damn thing since we can't yet clear just the area not | |
1193 included in the mask. */ | |
1194 if (((int) (dl->ypos - dl->ascent + pheight) < | |
1195 (int) (dl->ypos + dl->descent - dl->clip)) | |
1196 || IMAGE_INSTANCE_GTK_MASK (p)) | |
1197 { | |
1198 int clear_x, clear_y, clear_width, clear_height; | |
1199 | |
1200 if (IMAGE_INSTANCE_GTK_MASK (p)) | |
1201 { | |
1202 clear_y = dl->ypos - dl->ascent; | |
1203 clear_height = lheight; | |
1204 } | |
1205 else | |
1206 { | |
1207 clear_y = dl->ypos - dl->ascent + pheight; | |
1208 clear_height = lheight - pheight; | |
1209 } | |
1210 | |
1211 if (start_pixpos >= 0 && start_pixpos > xpos) | |
1212 { | |
1213 clear_x = start_pixpos; | |
1214 clear_width = xpos + width - start_pixpos; | |
1215 } | |
1216 else | |
1217 { | |
1218 clear_x = xpos; | |
1219 clear_width = width; | |
1220 } | |
1221 | |
1222 redisplay_clear_region (window, findex, clear_x, clear_y, | |
1223 clear_width, clear_height); | |
1224 } | |
1225 | 1133 |
1226 /* Output the pixmap. */ | 1134 /* Output the pixmap. */ |
1227 { | 1135 { |
1228 Lisp_Object tmp_pixel; | 1136 Lisp_Object tmp_pixel; |
1229 GdkColor *tmp_bcolor, *tmp_fcolor; | 1137 GdkColor *tmp_bcolor, *tmp_fcolor; |
1231 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); | 1139 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); |
1232 tmp_fcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)); | 1140 tmp_fcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)); |
1233 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); | 1141 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); |
1234 tmp_bcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)); | 1142 tmp_bcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)); |
1235 | 1143 |
1236 gtk_output_gdk_pixmap (f, p, xpos - xoffset, dl->ypos - dl->ascent, clip_x, | 1144 gtk_output_gdk_pixmap (f, p, db->xpos, db->ypos, |
1237 clip_y, clip_width, clip_height, | 1145 dga->xoffset, dga->yoffset, |
1238 pwidth, pheight, pixmap_offset, | 1146 dga->width, dga->height, |
1239 tmp_fcolor, tmp_bcolor, 0); | 1147 tmp_fcolor, tmp_bcolor, NULL); |
1240 } | 1148 } |
1241 | 1149 |
1242 /* Draw a cursor over top of the pixmap. */ | 1150 /* Draw a cursor over top of the pixmap. */ |
1243 if (cursor_width && cursor_height && (cursor_start >= xpos) | 1151 if (cursor_width && cursor_height && (cursor_start >= db->xpos) |
1244 && !NILP (w->text_cursor_visible_p) | 1152 && !NILP (w->text_cursor_visible_p) |
1245 && (cursor_start < xpos + pwidth)) | 1153 && (cursor_start < (db->xpos + dga->width))) |
1246 { | 1154 { |
1247 GdkGC *gc; | 1155 GdkGC *gc; |
1248 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)); | 1156 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)); |
1249 int y = dl->ypos - dl->ascent; | |
1250 struct face_cachel *cursor_cachel = | 1157 struct face_cachel *cursor_cachel = |
1251 WINDOW_FACE_CACHEL (w, | 1158 WINDOW_FACE_CACHEL (w, |
1252 get_builtin_face_cache_index | 1159 get_builtin_face_cache_index |
1253 (w, Vtext_cursor_face)); | 1160 (w, Vtext_cursor_face)); |
1254 | 1161 |
1255 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); | 1162 gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil); |
1256 | 1163 |
1257 if (cursor_width > xpos + pwidth - cursor_start) | 1164 if (cursor_width > db->xpos + dga->width - cursor_start) |
1258 cursor_width = xpos + pwidth - cursor_start; | 1165 cursor_width = db->xpos + dga->width - cursor_start; |
1259 | 1166 |
1260 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, focus ? TRUE : FALSE, | 1167 gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, focus ? TRUE : FALSE, |
1261 cursor_start, y, cursor_width, | 1168 cursor_start, db->ypos, cursor_width, |
1262 cursor_height); | 1169 cursor_height); |
1263 } | 1170 } |
1264 } | 1171 } |
1265 | 1172 |
1266 /***************************************************************************** | 1173 /***************************************************************************** |
1424 } | 1331 } |
1425 } | 1332 } |
1426 } | 1333 } |
1427 | 1334 |
1428 /***************************************************************************** | 1335 /***************************************************************************** |
1429 gtk_output_hline | 1336 gtk_output_horizontal_line |
1430 | 1337 |
1431 Output a horizontal line in the foreground of its face. | 1338 Output a horizontal line in the foreground of its face. |
1432 ****************************************************************************/ | 1339 ****************************************************************************/ |
1433 static void | 1340 static void |
1434 gtk_output_hline (struct window *w, struct display_line *dl, struct rune *rb) | 1341 gtk_output_horizontal_line (struct window *w, |
1342 struct display_line *dl, | |
1343 struct rune *rb) | |
1435 { | 1344 { |
1436 struct frame *f = XFRAME (w->frame); | 1345 struct frame *f = XFRAME (w->frame); |
1437 struct device *d = XDEVICE (f->device); | 1346 struct device *d = XDEVICE (f->device); |
1438 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style; | 1347 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style; |
1439 | 1348 |
1917 | 1826 |
1918 /* Make audible bell. */ | 1827 /* Make audible bell. */ |
1919 static void | 1828 static void |
1920 gtk_ring_bell (struct device *d, int volume, int pitch, int duration) | 1829 gtk_ring_bell (struct device *d, int volume, int pitch, int duration) |
1921 { | 1830 { |
1922 /* Gdk does not allow us to control the duration / pitch / volume */ | 1831 /* Gdk does not allow us to control the duration / pitch / volume */ |
1923 gdk_beep (); | 1832 if (volume > 0) |
1833 { | |
1834 gdk_beep (); | |
1835 } | |
1924 } | 1836 } |
1925 | 1837 |
1926 | 1838 |
1927 /************************************************************************/ | 1839 /************************************************************************/ |
1928 /* initialization */ | 1840 /* initialization */ |
1942 CONSOLE_HAS_METHOD (gtk, clear_frame); | 1854 CONSOLE_HAS_METHOD (gtk, clear_frame); |
1943 CONSOLE_HAS_METHOD (gtk, flash); | 1855 CONSOLE_HAS_METHOD (gtk, flash); |
1944 CONSOLE_HAS_METHOD (gtk, ring_bell); | 1856 CONSOLE_HAS_METHOD (gtk, ring_bell); |
1945 CONSOLE_HAS_METHOD (gtk, bevel_area); | 1857 CONSOLE_HAS_METHOD (gtk, bevel_area); |
1946 CONSOLE_HAS_METHOD (gtk, output_string); | 1858 CONSOLE_HAS_METHOD (gtk, output_string); |
1947 /* CONSOLE_HAS_METHOD (gtk, output_pixmap); */ | 1859 CONSOLE_HAS_METHOD (gtk, output_pixmap); |
1948 } | 1860 } |
1949 | 1861 |
1950 /* This makes me feel incredibly dirty... but there is no other way to | 1862 /* This makes me feel incredibly dirty... but there is no other way to |
1951 get this done right other than calling clear_area before every | 1863 get this done right other than calling clear_area before every |
1952 single $#!%@ing piece of text, which I do NOT want to do. */ | 1864 single $#!%@ing piece of text, which I do NOT want to do. */ |
1953 #define USE_X_SPECIFIC_DRAW_ROUTINES 1 | 1865 #define USE_X_SPECIFIC_DRAW_ROUTINES 1 |
1954 | 1866 |
1955 #include <gdk/gdkx.h> | 1867 #include <gdk/gdkx.h> |
1956 | 1868 |
1957 void | 1869 static |
1958 gdk_draw_text_image (GdkDrawable *drawable, | 1870 void gdk_draw_text_image (GdkDrawable *drawable, |
1959 GdkFont *font, | 1871 GdkFont *font, |
1960 GdkGC *gc, | 1872 GdkGC *gc, |
1961 gint x, | 1873 gint x, |
1962 gint y, | 1874 gint y, |
1963 const gchar *text, | 1875 const gchar *text, |
1964 gint text_length) | 1876 gint text_length) |
1965 { | 1877 { |
1966 #if !USE_X_SPECIFIC_DRAW_ROUTINES | 1878 #if !USE_X_SPECIFIC_DRAW_ROUTINES |
1967 int width = gdk_text_measure (font, text, text_length); | 1879 int width = gdk_text_measure (font, text, text_length); |
1968 int height = gdk_text_height (font, text, text_length); | 1880 int height = gdk_text_height (font, text, text_length); |
1969 | 1881 |