diff src/frame.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 3742ea8250b5 bc4f2511bbea
children d1247f3cc363
line wrap: on
line diff
--- a/src/frame.c	Sat Dec 26 00:20:27 2009 -0600
+++ b/src/frame.c	Sat Dec 26 21:18:49 2009 -0600
@@ -139,11 +139,24 @@
 
 
 
+#ifndef NEW_GC
 extern const struct sized_memory_description gtk_frame_data_description;
 extern const struct sized_memory_description mswindows_frame_data_description;
 extern const struct sized_memory_description x_frame_data_description;
+#endif /* not NEW_GC */
 
 static const struct memory_description frame_data_description_1 []= {
+#ifdef NEW_GC
+#ifdef HAVE_GTK
+  { XD_LISP_OBJECT, gtk_console },
+#endif
+#ifdef HAVE_MS_WINDOWS
+  { XD_LISP_OBJECT, mswindows_console },
+#endif
+#ifdef HAVE_X_WINDOWS
+  { XD_LISP_OBJECT, x_console },
+#endif
+#else /* not NEW_GC */
 #ifdef HAVE_GTK
   { XD_BLOCK_PTR, gtk_console, 1, { &gtk_frame_data_description} },
 #endif
@@ -153,6 +166,7 @@
 #ifdef HAVE_X_WINDOWS
   { XD_BLOCK_PTR, x_console, 1, { &x_frame_data_description} },
 #endif
+#endif /* not NEW_GC */
   { XD_END }
 };
 
@@ -160,6 +174,16 @@
   sizeof (void *), frame_data_description_1
 };
 
+#ifdef NEW_GC
+static const struct memory_description expose_ignore_description_1 [] = {
+  { XD_LISP_OBJECT, offsetof (struct expose_ignore, next) },
+  { XD_END }
+};
+
+DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("expose-ignore", expose_ignore,
+				      0, expose_ignore_description_1,
+				      struct expose_ignore);
+#else /* not NEW_GC */
 extern const struct sized_memory_description expose_ignore_description;
 
 static const struct memory_description expose_ignore_description_1 [] = {
@@ -172,6 +196,7 @@
   sizeof (struct expose_ignore),
   expose_ignore_description_1
 };
+#endif /* not NEW_GC */
 
 static const struct memory_description display_line_dynarr_pointer_description_1 []= {
   { XD_BLOCK_PTR, 0, 1, { &display_line_dynarr_description} },
@@ -189,10 +214,15 @@
   { XD_LISP_OBJECT_ARRAY, offsetof (struct frame, slot), size },
 #include "frameslots.h"
 
+#ifdef NEW_GC
+  { XD_LISP_OBJECT, offsetof (struct frame, subwindow_exposures) },
+  { XD_LISP_OBJECT, offsetof (struct frame, subwindow_exposures_tail) },
+#else /* not NEW_GC */
   { XD_BLOCK_PTR, offsetof (struct frame, subwindow_exposures),
     1, { &expose_ignore_description } },
   { XD_BLOCK_PTR, offsetof (struct frame, subwindow_exposures_tail),
     1, { &expose_ignore_description } },
+#endif /* not NEW_GC */
 
 #ifdef HAVE_SCROLLBARS
   { XD_LISP_OBJECT, offsetof (struct frame, sb_vcache) },
@@ -206,7 +236,7 @@
 
   { XD_BLOCK_PTR, offsetof (struct frame, framemeths), 1,
     { &console_methods_description } },
-  { XD_UNION, offsetof (struct frame, frame_data), 
+  { XD_UNION, offsetof (struct frame, frame_data),
     XD_INDIRECT (0, 0), { &frame_data_description } },
   { XD_END }
 };
@@ -250,10 +280,10 @@
   write_fmt_string (printcharfun, " 0x%x>", frm->header.uid);
 }
 
-DEFINE_NONDUMPABLE_LISP_OBJECT ("frame", frame,
-					   mark_frame, print_frame, 0, 0, 0,
-					   frame_description,
-					   struct frame);
+DEFINE_NODUMP_LISP_OBJECT ("frame", frame,
+			       mark_frame, print_frame, 0, 0, 0,
+			       frame_description,
+			       struct frame);
 
 static void
 nuke_all_frame_slots (struct frame *f)
@@ -443,7 +473,7 @@
   if (!EQ (lissed, Qunbound))
     DEVICE_FRAME_LIST (XDEVICE (XCAR (kawnz))) = lissed;
   return Qnil;
-}    
+}
 
 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /*
 Create and return a new frame, displaying the current buffer.
@@ -497,15 +527,15 @@
 	 in the dumped executable, and we can choose it at runtime. */
       name = build_string("XEmacs");
     }
-  else if (NILP (Vdefault_frame_name)) 
-    { 
+  else if (NILP (Vdefault_frame_name))
+    {
       if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS"))
 	{
-	  Vdefault_frame_name = build_string ("emacs"); 
+	  Vdefault_frame_name = build_string ("emacs");
 	}
-      else  
+      else
 	{
-	  Vdefault_frame_name = build_string ("XEmacs"); 
+	  Vdefault_frame_name = build_string ("XEmacs");
 	}
     }
 
@@ -554,7 +584,7 @@
   if (initialized && !DEVICE_STREAM_P (d))
     {
       if (!NILP (f->minibuffer_window))
-        reset_face_cachels (XWINDOW (f->minibuffer_window));
+	reset_face_cachels (XWINDOW (f->minibuffer_window));
       reset_face_cachels (XWINDOW (f->root_window));
     }
 
@@ -650,10 +680,10 @@
   if (!DEVICE_STREAM_P (d))
     {
       /* Now initialise the gutters. This won't change the frame size,
-         but is needed as input to the layout that change_frame_size
-         will eventually do. Unfortunately gutter sizing code relies
-         on the frame in question being visible so we can't do this
-         earlier. */
+	 but is needed as input to the layout that change_frame_size
+	 will eventually do. Unfortunately gutter sizing code relies
+	 on the frame in question being visible so we can't do this
+	 earlier. */
       init_frame_gutters (f);
 
       change_frame_size (f, f->height, f->width, 0);
@@ -1295,7 +1325,7 @@
 `visible'                 Consider only frames that are visible.
 `iconic'                  Consider only frames that are iconic.
 `invisible'               Consider only frames that are invisible
-                          (this is different from iconic).
+			  (this is different from iconic).
 `visible-iconic'          Consider frames that are visible or iconic.
 `invisible-iconic'        Consider frames that are invisible or iconic.
 `nomini'                  Consider all frames except minibuffer-only ones.
@@ -1303,9 +1333,9 @@
 `iconic-nomini'           Like `iconic' but omits minibuffer-only frames.
 `invisible-nomini'        Like `invisible' but omits minibuffer-only frames.
 `visible-iconic-nomini'   Like `visible-iconic' but omits minibuffer-only
-                          frames.
+			  frames.
 `invisible-iconic-nomini' Like `invisible-iconic' but omits minibuffer-only
-                          frames.
+			  frames.
 any other value           Consider all frames.
 
 If WHICH-FRAMES is omitted, `nomini' is used.  A value for WHICH-FRAMES
@@ -1573,7 +1603,7 @@
 
       /* If this is a popup frame, select its parent if possible.
 	 Otherwise, find another visible frame; if none, just take any frame.
-         First try the same device, then the same console. */
+	 First try the same device, then the same console. */
 
       next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil);
       if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next)))
@@ -2482,10 +2512,10 @@
 	 frame after it has been created, because the old name was used
 	 for resource lookup. */
       if (EQ (prop, Qname))
-        {
-          CHECK_STRING (val);
-          f->name = val;
-        }
+	{
+	  CHECK_STRING (val);
+	  f->name = val;
+	}
 #endif /* 0 */
       if (EQ (prop, Qminibuffer))
 	store_minibuf_frame_prop (f, val);
@@ -2702,14 +2732,14 @@
   int height, pheight;
   frame = wrap_frame (f);
 
-  if (!window_system_pixelated_geometry (frame)) 
+  if (!window_system_pixelated_geometry (frame))
     {
       height = FRAME_HEIGHT (f);
 
       frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL,
 				 0, &pheight, 0, &height, 0);
     }
-  else 
+  else
     pheight = FRAME_PIXHEIGHT (f);
 
   return make_int (pheight);
@@ -2732,14 +2762,14 @@
   int width, pwidth;
   frame = wrap_frame (f);
 
-  if (!window_system_pixelated_geometry (frame)) 
+  if (!window_system_pixelated_geometry (frame))
     {
       width = FRAME_WIDTH (f);
 
       frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL,
 				 &pwidth, 0, &width, 0, 0);
     }
-  else 
+  else
     pwidth = FRAME_PIXWIDTH (f);
 
   return make_int (pwidth);
@@ -2822,14 +2852,14 @@
   frame = wrap_frame (f);
   CHECK_INT (height);
 
-  if (!window_system_pixelated_geometry (frame)) 
+  if (!window_system_pixelated_geometry (frame))
     {
       int h = XINT (height);
       width = FRAME_WIDTH (f);
 
       frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0);
     }
-  else 
+  else
     {
       width = FRAME_PIXWIDTH (f);
       pheight = XINT (height);
@@ -2852,13 +2882,13 @@
   frame = wrap_frame (f);
   CHECK_INT (height);
 
-  if (!window_system_pixelated_geometry (frame)) 
+  if (!window_system_pixelated_geometry (frame))
     {
       int h = XINT (height);
       width = FRAME_WIDTH (f);
       frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0);
     }
-  else 
+  else
     {
       width = FRAME_PIXWIDTH (f);
       pheight = XINT (height);
@@ -2995,7 +3025,7 @@
   CHECK_INT (width);
   CHECK_INT (height);
 
-  if (!window_system_pixelated_geometry (frame)) 
+  if (!window_system_pixelated_geometry (frame))
     {
       int w = XINT (width);
       int h = XINT (height);
@@ -3025,7 +3055,7 @@
   CHECK_INT (width);
   CHECK_INT (height);
 
-  if (!window_system_pixelated_geometry (frame)) 
+  if (!window_system_pixelated_geometry (frame))
     {
       int w = XINT (width);
       int h = XINT (height);
@@ -3238,6 +3268,7 @@
   default_face_height_and_width_1 (frame, &font_height, &font_width);
 
   /* This size-change overrides any pending one for this frame.  */
+  f->size_change_pending = 0;
   FRAME_NEW_HEIGHT (f) = 0;
   FRAME_NEW_WIDTH (f) = 0;
 
@@ -3302,7 +3333,7 @@
   if (new_pixheight)
     {
       /* Adjust for gutters here so that we always get set
-         properly. */
+	 properly. */
       new_pixheight -=
 	(FRAME_TOP_GUTTER_BOUNDS (f)
 	 + FRAME_BOTTOM_GUTTER_BOUNDS (f));
@@ -3353,7 +3384,7 @@
   if (new_pixwidth)
     {
       /* Adjust for gutters here so that we always get set
-         properly. */
+	 properly. */
       new_pixwidth -=
 	(FRAME_LEFT_GUTTER_BOUNDS (f)
 	 + FRAME_RIGHT_GUTTER_BOUNDS (f));
@@ -3404,14 +3435,17 @@
      --andy. */
   MARK_FRAME_SIZE_CHANGED (f);
 
+#ifdef NEW_GC
+  if (delay || hold_frame_size_changes)
+#else /* not NEW_GC */
   if (delay || hold_frame_size_changes || gc_in_progress)
+#endif /* not NEW_GC */
     {
       f->new_width = newwidth;
       f->new_height = newheight;
       return;
     }
 
-  f->size_change_pending = 0;
   /* For TTY frames, it's like one, like all ...
      Can't have two TTY frames of different sizes on the same device. */
   if (FRAME_TTY_P (f))
@@ -3440,7 +3474,7 @@
   Dynarr_reset (db->runes);
 
   generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0,
-                                -1, type);
+				-1, type);
 
   Dynarr_reset (title_string_ichar_dynarr);
   while (elt < Dynarr_length (db->runes))
@@ -3566,7 +3600,7 @@
 #endif
     {
       title_string_ichar_dynarr = Dynarr_new (Ichar);
-      xzero (title_string_display_line);
+      DISPLAY_LINE_INIT (title_string_display_line);
     }
 }
 
@@ -3574,6 +3608,9 @@
 syms_of_frame (void)
 {
   INIT_LISP_OBJECT (frame);
+#ifdef NEW_GC
+  INIT_LISP_OBJECT (expose_ignore);
+#endif /* NEW_GC */
 
   DEFSYMBOL (Qdelete_frame_hook);
   DEFSYMBOL (Qselect_frame_hook);
@@ -3709,10 +3746,6 @@
   Fprovide (intern ("cde"));
 #endif
 
-#ifdef HAVE_OFFIX_DND
-  Fprovide (intern ("offix"));
-#endif
-
 #if 0 /* FSFmacs stupidity */
   xxDEFVAR_LISP ("emacs-iconified", &Vemacs_iconified /*
 Non-nil if all of emacs is iconified and frame updates are not needed.
@@ -3796,8 +3829,17 @@
   Vadjust_frame_function = Qnil;
 
   DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /*
-Handler for motion events.  One arg, the event.
+Handler for motion events.  Must be a function taking one argument, the event.
 For most applications, you should use `mode-motion-hook' instead of this.
+The default value is `default-mouse-motion-handler'.
+
+Note that this is NOT a hook variable, so there is no standard way to remove
+actions from it.  Instead, when adding a new kind of action, a hook variable
+should be defined and initialized to the current value of this variable, then
+this variable set to a function that runs the new hook.  To disable the new
+actions, use `remove-hook' rather than setting `mouse-motion-handler'.
+
+`mouse-motion-hook' in the balloon-help library exemplifies this pattern.
 */ );
   Vmouse_motion_handler = Qnil;