diff 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
line wrap: on
line diff
--- a/src/device-gtk.c	Sat Dec 26 00:20:27 2009 -0600
+++ b/src/device-gtk.c	Sat Dec 26 21:18:49 2009 -0600
@@ -56,8 +56,8 @@
 #include <bonobo.h>
 #endif
 
-/* Qdisplay in general.c */
-Lisp_Object Qinit_pre_gtk_win, Qinit_post_gtk_win;
+Lisp_Object Qmake_device_early_gtk_entry_point,
+   Qmake_device_late_gtk_entry_point;
 
 /* The application class of Emacs. */
 Lisp_Object Vgtk_emacs_application_class;
@@ -75,11 +75,17 @@
   { XD_END }
 };
 
+#ifdef NEW_GC
+DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("gtk-device", gtk_device,
+				      0, gtk_device_data_description_1,
+				      Lisp_Gtk_Device);
+#else /* not NEW_GC */
 extern const struct sized_memory_description gtk_device_data_description;
 
 const struct sized_memory_description gtk_device_data_description = {
   sizeof (struct gtk_device), gtk_device_data_description_1
 };
+#endif /* not NEW_GC */
 
 
 /************************************************************************/
@@ -108,7 +114,11 @@
 static void
 allocate_gtk_device_struct (struct device *d)
 {
+#ifdef NEW_GC
+  d->device_data = alloc_lrecord_type (struct gtk_device, &lrecord_gtk_device);
+#else /* not NEW_GC */
   d->device_data = xnew_and_zero (struct gtk_device);
+#endif /* not NEW_GC */
   DEVICE_GTK_DATA (d)->x_keysym_map_hashtable = Qnil;
 }
 
@@ -208,6 +218,9 @@
   GdkVisual *visual = NULL;
   GdkColormap *cmap = NULL;
 
+  /* Run the early elisp side of the GTK device initialization. */
+  call0 (Qmake_device_early_gtk_entry_point);
+
   /* gtk_init() and even gtk_check_init() are so brain dead that
      getting an empty argv array causes them to abort. */
   if (NILP (Vgtk_initial_argv_list))
@@ -255,13 +268,6 @@
   gdk_set_use_xshm (FALSE);
 #endif
 
-  /* We attempt to load this file so that the user can set
-  ** gtk-initial-geometry and not need GNOME & session management to
-  ** set their default frame size.  It also avoids the flicker
-  ** associated with setting the frame size in your .emacs file.
-  */
-  call4 (Qload, build_string ("~/.xemacs/gtk-options.el"), Qt, Qt, Qt);
-
 #ifdef HAVE_GDK_IMLIB_INIT
   /* Some themes in Gtk are so lame (most notably the Pixmap theme)
      that they rely on gdk_imlib, but don't call its initialization
@@ -324,15 +330,12 @@
   DEVICE_GTK_GRAY_PIXMAP (d) = NULL;
 
   gtk_init_device_class (d);
-
-  /* Run the elisp side of the X device initialization. */
-  call0 (Qinit_pre_gtk_win);
 }
 
 static void
-gtk_finish_init_device (struct device *UNUSED (d), Lisp_Object UNUSED (props))
+gtk_finish_init_device (struct device *d, Lisp_Object UNUSED (props))
 {
-  call0 (Qinit_post_gtk_win);
+  call1 (Qmake_device_late_gtk_entry_point, wrap_device(d));
 }
 
 static void
@@ -347,11 +350,13 @@
 /*                       closing an X connection	                */
 /************************************************************************/
 
+#ifndef NEW_GC
 static void
 free_gtk_device_struct (struct device *d)
 {
   xfree (d->device_data, void *);
 }
+#endif /* not NEW_GC */
 
 static void
 gtk_delete_device (struct device *d)
@@ -681,6 +686,10 @@
 void
 syms_of_device_gtk (void)
 {
+#ifdef NEW_GC
+  INIT_LISP_OBJECT (gtk_device);
+#endif /* NEW_GC */
+
   DEFSUBR (Fgtk_keysym_on_keyboard_p);
   DEFSUBR (Fgtk_display_visual_class);
   DEFSUBR (Fgtk_display_visual_depth);
@@ -691,8 +700,8 @@
   DEFSUBR (Fgtk_ungrab_keyboard);
   DEFSUBR (Fgtk_init);
 
-  DEFSYMBOL (Qinit_pre_gtk_win);
-  DEFSYMBOL (Qinit_post_gtk_win);
+  DEFSYMBOL (Qmake_device_early_gtk_entry_point);
+  DEFSYMBOL (Qmake_device_late_gtk_entry_point);
 }
 
 void