diff src/device-x.c @ 40:7e54bd776075 r19-15b103

Import from CVS: tag r19-15b103
author cvs
date Mon, 13 Aug 2007 08:54:25 +0200
parents 859a2309aef8
children 56c54cf7c5b6
line wrap: on
line diff
--- a/src/device-x.c	Mon Aug 13 08:54:02 2007 +0200
+++ b/src/device-x.c	Mon Aug 13 08:54:25 2007 +0200
@@ -99,8 +99,8 @@
 /*                          helper functions                            */
 /************************************************************************/
 
-struct device *
-get_device_from_display (Display *dpy)
+static struct device *
+get_device_from_display_1 (Display *dpy)
 {
   Lisp_Object devcons, concons;
 
@@ -111,11 +111,25 @@
 	return d;
     }
 
-  /* Only devices we are actually managing should ever be used as an
-     argument to this function. */
-  abort ();
+  return 0;
+}
+
+struct device *
+get_device_from_display (Display *dpy)
+{
+  struct device *d = get_device_from_display_1 (dpy);
 
-  return 0; /* suppress compiler warning */
+  if (!d) {
+    /* This isn't one of our displays.  Let's crash? */
+    stderr_out
+      ("\n%s: Fatal X Condition.  Asked about display we don't own: \"%s\"\n",
+       (STRINGP (Vinvocation_name) ?
+	(char *) XSTRING_DATA (Vinvocation_name) : "xemacs"),
+       DisplayString (dpy) ? DisplayString (dpy) : "???");
+    abort();
+  }
+
+  return d;
 }
 
 struct device *
@@ -578,8 +592,12 @@
 {
   /* This function can GC */
   Lisp_Object dev;
-  struct device *d = get_device_from_display (disp);
-  XSETDEVICE (dev, d);
+  struct device *d = get_device_from_display_1 (disp);
+
+  if (d)
+    XSETDEVICE (dev, d);
+  else
+    dev = Qnil;
 
   if (NILP (find_nonminibuffer_frame_not_on_device (dev)))
     {
@@ -607,7 +625,8 @@
          QLength (disp));
     }
 
-  enqueue_magic_eval_event (io_error_delete_device, dev);
+  if (d)
+    enqueue_magic_eval_event (io_error_delete_device, dev);
 
   return 0;
 }