comparison src/redisplay-gtk.c @ 4908:b3ce27ca7647

various fixes related to gtk, redisplay-xlike-inc.c -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-01 Ben Wing <ben@xemacs.org> * compiler.h: Create a USED() macro to force unused-var warnings to go away, in certain cases where it's inconvenient to do otherwise (e.g. when THIS_IS_GTK in redisplay-xlike-inc.c). * console-x.h: Remove unneeded decls, make some static. * redisplay-xlike-inc.c: * console-xlike-inc.h: New file. Include defns from redisplay-xlike-inc.c that may be useful in other XLIKE files. Correct the handling of colors and font-style setting functions in the xlike defns. Lots of fixes in the GTK-specific defns. * depend: Regenerate. * event-xlike-inc.c: * event-xlike-inc.c (USE_UNICODE_MAP): * event-xlike-inc.c (endif): * gccache-gtk.c: * gtk-glue.c (xemacs_list_to_gtklist): * gtk-glue.c (xemacs_gtklist_to_list): * gtk-glue.c (FROB): * gtk-glue.c (face_to_gc): * gtk-glue.c (face_to_style): * gtk-glue.c (gdk_event_to_emacs_event): * gtk-xemacs.h (struct _GtkXEmacs): * gtk-xemacs.h (struct _GtkXEmacsClass): * objects-xlike-inc.c: Cosmetic, comment fixes. * glyphs.c (pixmap_to_lisp_data): Unused var fixes. * gtk-glue.c: * gccache-gtk.c: * gtk-xemacs.c: * gtk-xemacs.h: * objects-xlike-inc.c: * ui-gtk.c: * ui-gtk.h: * xgccache.c: * xgccache.c (GC_CACHE_SIZE): * xgccache.h: Misc include-file fixes. * objects-xlike-inc.c (XFUN): * objects-xlike-inc.c (xlistfonts_checking_charset): Combine some ifdeffed stuff using defs in console-xlike-inc.h. * redisplay-gtk.c: * redisplay-gtk.c (THIS_IS_GTK): * redisplay-gtk.c (XLIKE_bevel_area): * redisplay-gtk.c (XLIKE_ring_bell): * redisplay-gtk.c (gdk_draw_text_image): Fix numerous compile problems. Delete gtk_output_shadows(), which mostly duplicates generic bevel_modeline(). Fix up gtk_bevel_modeline() into XLIKE_bevel_area() and make use of the style var properly to set the appropriate GTK constant. * redisplay-x.c: * redisplay-x.c (XLIKE_window_output_begin): * redisplay-x.c (XLIKE_window_output_end): * redisplay-x.c (XLIKE_bevel_area): * redisplay-x.c (x_output_shadows): * redisplay-x.c (XLIKE_ring_bell): Make x_output_shadows be static. Change the defn of various functions to look like XLIKE_foo() so it matches the calling convention elsewhere. * redisplay-xlike-inc.c: * redisplay-xlike-inc.c (NEED_GCCACHE_H): * redisplay-xlike-inc.c (XLIKE_text_width): * redisplay-xlike-inc.c (XLIKE_get_gc): * redisplay-xlike-inc.c (XLIKE_text_width_single_run): * redisplay-xlike-inc.c (XFT_FROB_LISP_COLOR): * redisplay-xlike-inc.c (XLIKE_output_xlike_pixmap): * redisplay-xlike-inc.c (XLIKE_output_pixmap): * redisplay-xlike-inc.c (XLIKE_output_vertical_divider): * redisplay-xlike-inc.c (XLIKE_flash): Lots of header fixes. Lots of stuff moved to console-xlike-inc.h. Use XFUN() to generate function names instead of directly calling XLIKE_PASTE(). Remove unnecessary prototypes. Unify calls to text_width funs. Make XLIKE_get_gc non-static since it's called from gtk. Change the color-function calls and fill-style-setting calls to match the changes in console-xlike-inc.h. Use USED() to avoid some warnings. * symsinit.h: Sort the prototypes, and add a fun `sort-symsinit' in a comment that does the sorting (using sort-regexp-fields). * symsinit.h (init_number): * sysgtk.h: New file, wraps the various GTK headers. * sysgdkx.h: New file, wraps <gtk/gdkx.h>. Keep this separate to * event-gtk.h: Delete. Combine stuff into console-gtk.h. help isolate X-specific code from GTK. * device-gtk.c: * event-gtk.c: * console-gtk.h: * frame-gtk.c: * gccache-gtk.c: * gccache-gtk.h: * glyphs-gtk.c (gtk_colorize_image_instance): * glyphs-gtk.h: * gtk-xemacs.h: * objects-gtk.c: * objects-gtk.c (MAX_FONT_COUNT): * ui-gtk.h: Use sysgtk.h or sysgdkx.h instead of directly including GTK headers. Don't include event-gtk.h.
author Ben Wing <ben@xemacs.org>
date Mon, 01 Feb 2010 02:15:28 -0600
parents eab9498ecc0e
children 308d34e9f07d
comparison
equal deleted inserted replaced
4907:9e7f5a77cc84 4908:b3ce27ca7647
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */ 22 Boston, MA 02111-1307, USA. */
23 23
24 /* Synched up with: Not in FSF. */ 24 /* Synched up with: Not in FSF. */
25 25
26 #define THIS_IS_GTK
26 #include "redisplay-xlike-inc.c" 27 #include "redisplay-xlike-inc.c"
27 28
28 /***************************************************************************** 29 /*****************************************************************************
29 gtk_bevel_modeline 30 Draw a shadow around the given area using the standard theme engine routines.
31 ****************************************************************************/
30 32
31 Draw a 3d border around the modeline on window W.
32 ****************************************************************************/
33 static void 33 static void
34 gtk_bevel_modeline (struct window *w, struct display_line *dl) 34 XLIKE_bevel_area (struct window *w, face_index UNUSED (findex),
35 int x, int y, int width, int height,
36 int shadow_thickness, int UNUSED (edges),
37 enum edge_style style)
35 { 38 {
36 struct frame *f = XFRAME (w->frame); 39 struct frame *f = XFRAME (w->frame);
37 int shadow_thickness = MODELINE_SHADOW_THICKNESS (w); 40 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
38 int x,y, width, height; 41 GtkStyle *gstyle = FRAME_GTK_TEXT_WIDGET (f)->style;
42 GtkShadowType stype;
39 43
40 x = WINDOW_MODELINE_LEFT (w); 44 if (shadow_thickness == 0)
41 width = WINDOW_MODELINE_RIGHT (w) - x; 45 stype = GTK_SHADOW_NONE;
42 y = dl->ypos - dl->ascent - shadow_thickness; 46 else
43 height = dl->ascent + dl->descent + 2 * shadow_thickness; 47 switch (style)
44 48 {
45 gtk_output_shadows (f, x, y, width, height, shadow_thickness); 49 case EDGE_BEVEL_IN: style = GTK_SHADOW_IN; break;
46 } 50 case EDGE_BEVEL_OUT: style = GTK_SHADOW_OUT; break;
47 51 case EDGE_ETCHED_IN: style = GTK_SHADOW_ETCHED_IN; break;
48 /***************************************************************************** 52 case EDGE_ETCHED_OUT: style = GTK_SHADOW_ETCHED_OUT; break;
49 gtk_output_shadows 53 default: ABORT (); style = GTK_SHADOW_OUT;
50 54 }
51 Draw a shadow around the given area using the standard theme engine routines.
52 ****************************************************************************/
53 void
54 gtk_output_shadows (struct frame *f, int x, int y, int width, int height,
55 int shadow_thickness)
56 {
57 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
58 GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
59 GtkShadowType stype = GTK_SHADOW_OUT;
60
61 if (shadow_thickness < 0)
62 {
63 stype = GTK_SHADOW_IN;
64 }
65 else if (shadow_thickness == 0)
66 {
67 stype = GTK_SHADOW_NONE;
68 }
69 55
70 /* Do we want to have some magic constants to set 56 /* Do we want to have some magic constants to set
71 GTK_SHADOW_ETCHED_IN or GTK_SHADOW_ETCHED_OUT? */ 57 GTK_SHADOW_ETCHED_IN or GTK_SHADOW_ETCHED_OUT? */
72 58
73 gtk_paint_shadow (style, x_win, GTK_STATE_NORMAL, stype, NULL, 59 gtk_paint_shadow (gstyle, x_win, GTK_STATE_NORMAL, stype, NULL,
74 FRAME_GTK_TEXT_WIDGET (f), "modeline", 60 FRAME_GTK_TEXT_WIDGET (f), "modeline",
75 x, y, width, height); 61 x, y, width, height);
76 }
77
78 static void
79 gtk_bevel_area (struct window *w, face_index UNUSED (findex),
80 int x, int y, int width, int height,
81 int shadow_thickness, int UNUSED (edges),
82 enum edge_style UNUSED (style))
83 {
84 struct frame *f = XFRAME (w->frame);
85
86 gtk_output_shadows (f, x, y, width, height, shadow_thickness);
87 } 62 }
88 63
89 64
90 65
91 /* Make audible bell. */ 66 /* Make audible bell. */
92 static void 67 static void
93 gtk_ring_bell (struct device *UNUSED (d), int volume, int UNUSED (pitch), 68 XLIKE_ring_bell (struct device *UNUSED (d), int volume, int UNUSED (pitch),
94 int UNUSED (duration)) 69 int UNUSED (duration))
95 { 70 {
96 /* Gdk does not allow us to control the duration / pitch / volume */ 71 /* Gdk does not allow us to control the duration / pitch / volume */
97 if (volume > 0) 72 if (volume > 0)
98 { 73 {
99 gdk_beep (); 74 gdk_beep ();
104 /* This makes me feel incredibly dirty... but there is no other way to 79 /* This makes me feel incredibly dirty... but there is no other way to
105 get this done right other than calling clear_area before every 80 get this done right other than calling clear_area before every
106 single $#!%@ing piece of text, which I do NOT want to do. */ 81 single $#!%@ing piece of text, which I do NOT want to do. */
107 #define USE_X_SPECIFIC_DRAW_ROUTINES 1 82 #define USE_X_SPECIFIC_DRAW_ROUTINES 1
108 83
109 #include <gdk/gdkx.h> 84 #include "sysgdkx.h"
110 85
111 static 86 static void
112 void gdk_draw_text_image (GdkDrawable *drawable, 87 gdk_draw_text_image (GdkDrawable *drawable,
113 GdkFont *font, 88 GdkFont *font,
114 GdkGC *gc, 89 GdkGC *gc,
115 gint x, 90 gint x,
116 gint y, 91 gint y,
117 const gchar *text, 92 const gchar *text,
118 gint text_length) 93 gint text_length)
119 { 94 {
120 #if !USE_X_SPECIFIC_DRAW_ROUTINES 95 #if !USE_X_SPECIFIC_DRAW_ROUTINES
121 int width = gdk_text_measure (font, text, text_length); 96 int width = gdk_text_measure (font, text, text_length);
122 int height = gdk_text_height (font, text, text_length); 97 int height = gdk_text_height (font, text, text_length);
123 98