Mercurial > hg > xemacs-beta
comparison src/device-gtk.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | e34711681f30 |
children | d1247f3cc363 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
54 | 54 |
55 #ifdef HAVE_BONOBO | 55 #ifdef HAVE_BONOBO |
56 #include <bonobo.h> | 56 #include <bonobo.h> |
57 #endif | 57 #endif |
58 | 58 |
59 /* Qdisplay in general.c */ | 59 Lisp_Object Qmake_device_early_gtk_entry_point, |
60 Lisp_Object Qinit_pre_gtk_win, Qinit_post_gtk_win; | 60 Qmake_device_late_gtk_entry_point; |
61 | 61 |
62 /* The application class of Emacs. */ | 62 /* The application class of Emacs. */ |
63 Lisp_Object Vgtk_emacs_application_class; | 63 Lisp_Object Vgtk_emacs_application_class; |
64 | 64 |
65 Lisp_Object Vgtk_initial_argv_list; /* #### ugh! */ | 65 Lisp_Object Vgtk_initial_argv_list; /* #### ugh! */ |
73 { XD_LISP_OBJECT, offsetof (struct gtk_device, x_keysym_map_hashtable) }, | 73 { XD_LISP_OBJECT, offsetof (struct gtk_device, x_keysym_map_hashtable) }, |
74 { XD_LISP_OBJECT, offsetof (struct gtk_device, WM_COMMAND_frame) }, | 74 { XD_LISP_OBJECT, offsetof (struct gtk_device, WM_COMMAND_frame) }, |
75 { XD_END } | 75 { XD_END } |
76 }; | 76 }; |
77 | 77 |
78 #ifdef NEW_GC | |
79 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("gtk-device", gtk_device, | |
80 0, gtk_device_data_description_1, | |
81 Lisp_Gtk_Device); | |
82 #else /* not NEW_GC */ | |
78 extern const struct sized_memory_description gtk_device_data_description; | 83 extern const struct sized_memory_description gtk_device_data_description; |
79 | 84 |
80 const struct sized_memory_description gtk_device_data_description = { | 85 const struct sized_memory_description gtk_device_data_description = { |
81 sizeof (struct gtk_device), gtk_device_data_description_1 | 86 sizeof (struct gtk_device), gtk_device_data_description_1 |
82 }; | 87 }; |
88 #endif /* not NEW_GC */ | |
83 | 89 |
84 | 90 |
85 /************************************************************************/ | 91 /************************************************************************/ |
86 /* helper functions */ | 92 /* helper functions */ |
87 /************************************************************************/ | 93 /************************************************************************/ |
106 #define convert_font(f) __get_gtk_font_truename (f, 0) | 112 #define convert_font(f) __get_gtk_font_truename (f, 0) |
107 | 113 |
108 static void | 114 static void |
109 allocate_gtk_device_struct (struct device *d) | 115 allocate_gtk_device_struct (struct device *d) |
110 { | 116 { |
117 #ifdef NEW_GC | |
118 d->device_data = alloc_lrecord_type (struct gtk_device, &lrecord_gtk_device); | |
119 #else /* not NEW_GC */ | |
111 d->device_data = xnew_and_zero (struct gtk_device); | 120 d->device_data = xnew_and_zero (struct gtk_device); |
121 #endif /* not NEW_GC */ | |
112 DEVICE_GTK_DATA (d)->x_keysym_map_hashtable = Qnil; | 122 DEVICE_GTK_DATA (d)->x_keysym_map_hashtable = Qnil; |
113 } | 123 } |
114 | 124 |
115 static void | 125 static void |
116 gtk_init_device_class (struct device *d) | 126 gtk_init_device_class (struct device *d) |
206 Lisp_Object display; | 216 Lisp_Object display; |
207 GtkWidget *app_shell = NULL; | 217 GtkWidget *app_shell = NULL; |
208 GdkVisual *visual = NULL; | 218 GdkVisual *visual = NULL; |
209 GdkColormap *cmap = NULL; | 219 GdkColormap *cmap = NULL; |
210 | 220 |
221 /* Run the early elisp side of the GTK device initialization. */ | |
222 call0 (Qmake_device_early_gtk_entry_point); | |
223 | |
211 /* gtk_init() and even gtk_check_init() are so brain dead that | 224 /* gtk_init() and even gtk_check_init() are so brain dead that |
212 getting an empty argv array causes them to abort. */ | 225 getting an empty argv array causes them to abort. */ |
213 if (NILP (Vgtk_initial_argv_list)) | 226 if (NILP (Vgtk_initial_argv_list)) |
214 { | 227 { |
215 invalid_operation ("gtk-initial-argv-list must be set before creating Gtk devices", Vgtk_initial_argv_list); | 228 invalid_operation ("gtk-initial-argv-list must be set before creating Gtk devices", Vgtk_initial_argv_list); |
252 Fgtk_init (Vgtk_initial_argv_list); | 265 Fgtk_init (Vgtk_initial_argv_list); |
253 | 266 |
254 #ifdef __FreeBSD__ | 267 #ifdef __FreeBSD__ |
255 gdk_set_use_xshm (FALSE); | 268 gdk_set_use_xshm (FALSE); |
256 #endif | 269 #endif |
257 | |
258 /* We attempt to load this file so that the user can set | |
259 ** gtk-initial-geometry and not need GNOME & session management to | |
260 ** set their default frame size. It also avoids the flicker | |
261 ** associated with setting the frame size in your .emacs file. | |
262 */ | |
263 call4 (Qload, build_string ("~/.xemacs/gtk-options.el"), Qt, Qt, Qt); | |
264 | 270 |
265 #ifdef HAVE_GDK_IMLIB_INIT | 271 #ifdef HAVE_GDK_IMLIB_INIT |
266 /* Some themes in Gtk are so lame (most notably the Pixmap theme) | 272 /* Some themes in Gtk are so lame (most notably the Pixmap theme) |
267 that they rely on gdk_imlib, but don't call its initialization | 273 that they rely on gdk_imlib, but don't call its initialization |
268 routines. This makes them USELESS for non-gnome applications. | 274 routines. This makes them USELESS for non-gnome applications. |
322 | 328 |
323 DEVICE_GTK_GC_CACHE (d) = make_gc_cache (GTK_WIDGET (app_shell)); | 329 DEVICE_GTK_GC_CACHE (d) = make_gc_cache (GTK_WIDGET (app_shell)); |
324 DEVICE_GTK_GRAY_PIXMAP (d) = NULL; | 330 DEVICE_GTK_GRAY_PIXMAP (d) = NULL; |
325 | 331 |
326 gtk_init_device_class (d); | 332 gtk_init_device_class (d); |
327 | |
328 /* Run the elisp side of the X device initialization. */ | |
329 call0 (Qinit_pre_gtk_win); | |
330 } | 333 } |
331 | 334 |
332 static void | 335 static void |
333 gtk_finish_init_device (struct device *UNUSED (d), Lisp_Object UNUSED (props)) | 336 gtk_finish_init_device (struct device *d, Lisp_Object UNUSED (props)) |
334 { | 337 { |
335 call0 (Qinit_post_gtk_win); | 338 call1 (Qmake_device_late_gtk_entry_point, wrap_device(d)); |
336 } | 339 } |
337 | 340 |
338 static void | 341 static void |
339 gtk_mark_device (struct device *d) | 342 gtk_mark_device (struct device *d) |
340 { | 343 { |
345 | 348 |
346 /************************************************************************/ | 349 /************************************************************************/ |
347 /* closing an X connection */ | 350 /* closing an X connection */ |
348 /************************************************************************/ | 351 /************************************************************************/ |
349 | 352 |
353 #ifndef NEW_GC | |
350 static void | 354 static void |
351 free_gtk_device_struct (struct device *d) | 355 free_gtk_device_struct (struct device *d) |
352 { | 356 { |
353 xfree (d->device_data, void *); | 357 xfree (d->device_data, void *); |
354 } | 358 } |
359 #endif /* not NEW_GC */ | |
355 | 360 |
356 static void | 361 static void |
357 gtk_delete_device (struct device *d) | 362 gtk_delete_device (struct device *d) |
358 { | 363 { |
359 #ifdef FREE_CHECKING | 364 #ifdef FREE_CHECKING |
679 /************************************************************************/ | 684 /************************************************************************/ |
680 | 685 |
681 void | 686 void |
682 syms_of_device_gtk (void) | 687 syms_of_device_gtk (void) |
683 { | 688 { |
689 #ifdef NEW_GC | |
690 INIT_LISP_OBJECT (gtk_device); | |
691 #endif /* NEW_GC */ | |
692 | |
684 DEFSUBR (Fgtk_keysym_on_keyboard_p); | 693 DEFSUBR (Fgtk_keysym_on_keyboard_p); |
685 DEFSUBR (Fgtk_display_visual_class); | 694 DEFSUBR (Fgtk_display_visual_class); |
686 DEFSUBR (Fgtk_display_visual_depth); | 695 DEFSUBR (Fgtk_display_visual_depth); |
687 DEFSUBR (Fgtk_style_info); | 696 DEFSUBR (Fgtk_style_info); |
688 DEFSUBR (Fgtk_grab_pointer); | 697 DEFSUBR (Fgtk_grab_pointer); |
689 DEFSUBR (Fgtk_ungrab_pointer); | 698 DEFSUBR (Fgtk_ungrab_pointer); |
690 DEFSUBR (Fgtk_grab_keyboard); | 699 DEFSUBR (Fgtk_grab_keyboard); |
691 DEFSUBR (Fgtk_ungrab_keyboard); | 700 DEFSUBR (Fgtk_ungrab_keyboard); |
692 DEFSUBR (Fgtk_init); | 701 DEFSUBR (Fgtk_init); |
693 | 702 |
694 DEFSYMBOL (Qinit_pre_gtk_win); | 703 DEFSYMBOL (Qmake_device_early_gtk_entry_point); |
695 DEFSYMBOL (Qinit_post_gtk_win); | 704 DEFSYMBOL (Qmake_device_late_gtk_entry_point); |
696 } | 705 } |
697 | 706 |
698 void | 707 void |
699 console_type_create_device_gtk (void) | 708 console_type_create_device_gtk (void) |
700 { | 709 { |