Mercurial > hg > xemacs-beta
comparison src/gtk-glue.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 | db7068430402 |
children | e813cf16c015 |
comparison
equal
deleted
inserted
replaced
4907:9e7f5a77cc84 | 4908:b3ce27ca7647 |
---|---|
23 GtkType GTK_TYPE_LISTOF = 0; | 23 GtkType GTK_TYPE_LISTOF = 0; |
24 GtkType GTK_TYPE_STRING_LIST = 0; | 24 GtkType GTK_TYPE_STRING_LIST = 0; |
25 GtkType GTK_TYPE_OBJECT_LIST = 0; | 25 GtkType GTK_TYPE_OBJECT_LIST = 0; |
26 GtkType GTK_TYPE_GDK_GC = 0; | 26 GtkType GTK_TYPE_GDK_GC = 0; |
27 | 27 |
28 #include "console-gtk.h" | |
28 #include "objects-gtk-impl.h" | 29 #include "objects-gtk-impl.h" |
29 | 30 |
30 static GtkType | 31 static GtkType |
31 xemacs_type_register (gchar *name, GtkType parent) | 32 xemacs_type_register (gchar *name, GtkType parent) |
32 { | 33 { |
84 { | 85 { |
85 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp))); | 86 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp))); |
86 temp = XCDR (temp); | 87 temp = XCDR (temp); |
87 } | 88 } |
88 | 89 |
89 GTK_VALUE_POINTER(*arg) = strings; | 90 GTK_VALUE_POINTER (*arg) = strings; |
90 } | 91 } |
91 else if (arg->type == GTK_TYPE_OBJECT_LIST) | 92 else if (arg->type == GTK_TYPE_OBJECT_LIST) |
92 { | 93 { |
93 Lisp_Object temp = obj; | 94 Lisp_Object temp = obj; |
94 GList *objects = NULL; | 95 GList *objects = NULL; |
105 { | 106 { |
106 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object); | 107 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object); |
107 temp = XCDR (temp); | 108 temp = XCDR (temp); |
108 } | 109 } |
109 | 110 |
110 GTK_VALUE_POINTER(*arg) = objects; | 111 GTK_VALUE_POINTER (*arg) = objects; |
111 } | 112 } |
112 else | 113 else |
113 { | 114 { |
114 ABORT(); | 115 ABORT (); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 static void | 119 static void |
119 __make_gtk_object_mapper (gpointer data, gpointer user_data) | 120 __make_gtk_object_mapper (gpointer data, gpointer user_data) |
146 { | 147 { |
147 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_gtk_object_mapper, &rval); | 148 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_gtk_object_mapper, &rval); |
148 } | 149 } |
149 else | 150 else |
150 { | 151 { |
151 ABORT(); | 152 ABORT (); |
152 } | 153 } |
153 } | 154 } |
154 return (rval); | 155 return (rval); |
155 } | 156 } |
156 | 157 |
180 { \ | 181 { \ |
181 array[length++] = extract_fn (XCAR (temp)); \ | 182 array[length++] = extract_fn (XCAR (temp)); \ |
182 temp = XCDR (temp); \ | 183 temp = XCDR (temp); \ |
183 } \ | 184 } \ |
184 \ | 185 \ |
185 GTK_VALUE_POINTER(*arg) = array; \ | 186 GTK_VALUE_POINTER (*arg) = array; \ |
186 } while (0); | 187 } while (0); |
187 | 188 |
188 if (arg->type == GTK_TYPE_STRING_ARRAY) | 189 if (arg->type == GTK_TYPE_STRING_ARRAY) |
189 { | 190 { |
190 FROB(gchar *, CHECK_STRING, (gchar*) XSTRING_DATA); | 191 FROB (gchar *, CHECK_STRING, (gchar*) XSTRING_DATA); |
191 } | 192 } |
192 else if (arg->type == GTK_TYPE_FLOAT_ARRAY) | 193 else if (arg->type == GTK_TYPE_FLOAT_ARRAY) |
193 { | 194 { |
194 FROB(gfloat, CHECK_FLOAT, extract_float); | 195 FROB (gfloat, CHECK_FLOAT, extract_float); |
195 } | 196 } |
196 else if (arg->type == GTK_TYPE_INT_ARRAY) | 197 else if (arg->type == GTK_TYPE_INT_ARRAY) |
197 { | 198 { |
198 FROB(gint, CHECK_INT, XINT); | 199 FROB (gint, CHECK_INT, XINT); |
199 } | 200 } |
200 else | 201 else |
201 { | 202 { |
202 ABORT(); | 203 ABORT (); |
203 } | 204 } |
204 #undef FROB | 205 #undef FROB |
205 } | 206 } |
206 | |
207 extern GdkGC *gtk_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, Lisp_Object bg, | |
208 Lisp_Object bg_pmap, Lisp_Object lwidth); | |
209 | 207 |
210 static GdkGC * | 208 static GdkGC * |
211 face_to_gc (Lisp_Object face) | 209 face_to_gc (Lisp_Object face) |
212 { | 210 { |
213 Lisp_Object device = Fselected_device (Qnil); | 211 Lisp_Object device = Fselected_device (Qnil); |
214 | 212 |
215 return (gtk_get_gc (XDEVICE (device), | 213 return (gtk_get_gc (XDEVICE (device), |
216 Fspecifier_instance (Fget (face, Qfont, Qnil), device, Qnil, Qnil), | 214 Fspecifier_instance (Fget (face, Qfont, Qnil), |
217 Fspecifier_instance (Fget (face, Qforeground, Qnil), device, Qnil, Qnil), | 215 device, Qnil, Qnil), |
218 Fspecifier_instance (Fget (face, Qbackground, Qnil), device, Qnil, Qnil), | 216 Fspecifier_instance (Fget (face, Qforeground, Qnil), |
219 Fspecifier_instance (Fget (face, Qbackground_pixmap, Qnil), device, Qnil, Qnil), | 217 device, Qnil, Qnil), |
218 Fspecifier_instance (Fget (face, Qbackground, Qnil), | |
219 device, Qnil, Qnil), | |
220 Fspecifier_instance (Fget (face, Qbackground_pixmap, | |
221 Qnil), device, Qnil, Qnil), | |
220 Qnil)); | 222 Qnil)); |
221 } | 223 } |
222 | 224 |
223 static GtkStyle * | 225 static GtkStyle * |
224 face_to_style (Lisp_Object face) | 226 face_to_style (Lisp_Object face) |
225 { | 227 { |
226 Lisp_Object device = Fselected_device (Qnil); | 228 Lisp_Object device = Fselected_device (Qnil); |
227 GtkStyle *style = gtk_style_new (); | 229 GtkStyle *style = gtk_style_new (); |
228 int i; | 230 int i; |
229 | 231 |
230 Lisp_Object font = Fspecifier_instance (Fget (face, Qfont, Qnil), device, Qnil, Qnil); | 232 Lisp_Object font = Fspecifier_instance (Fget (face, Qfont, Qnil), |
231 Lisp_Object fg = Fspecifier_instance (Fget (face, Qforeground, Qnil), device, Qnil, Qnil); | 233 device, Qnil, Qnil); |
232 Lisp_Object bg = Fspecifier_instance (Fget (face, Qbackground, Qnil), device, Qnil, Qnil); | 234 Lisp_Object fg = Fspecifier_instance (Fget (face, Qforeground, Qnil), |
233 Lisp_Object pm = Fspecifier_instance (Fget (face, Qbackground_pixmap, Qnil), device, Qnil, Qnil); | 235 device, Qnil, Qnil); |
234 | 236 Lisp_Object bg = Fspecifier_instance (Fget (face, Qbackground, Qnil), |
235 for (i = 0; i < 5; i++) style->fg[i] = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg)); | 237 device, Qnil, Qnil); |
236 for (i = 0; i < 5; i++) style->bg[i] = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg)); | 238 Lisp_Object pm = Fspecifier_instance (Fget (face, Qbackground_pixmap, |
239 Qnil), device, Qnil, Qnil); | |
240 | |
241 for (i = 0; i < 5; i++) | |
242 style->fg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg)); | |
243 for (i = 0; i < 5; i++) | |
244 style->bg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg)); | |
237 | 245 |
238 if (IMAGE_INSTANCEP (pm)) | 246 if (IMAGE_INSTANCEP (pm)) |
239 { | 247 { |
240 for (i = 0; i < 5; i++) style->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm); | 248 for (i = 0; i < 5; i++) |
249 style->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm); | |
241 } | 250 } |
242 | 251 |
243 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font)); | 252 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font)); |
244 | 253 |
245 return (style); | 254 return (style); |
246 } | 255 } |
247 | 256 |
248 static Lisp_Object | 257 static Lisp_Object |
249 gdk_event_to_emacs_event(GdkEvent *ev) | 258 gdk_event_to_emacs_event (GdkEvent *ev) |
250 { | 259 { |
251 Lisp_Object event = Qnil; | 260 Lisp_Object event = Qnil; |
252 | 261 |
253 if (ev) | 262 if (ev) |
254 { | 263 { |