diff src/device-x.c @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents 54cc21c15cbb
children 538048ae2ab8
line wrap: on
line diff
--- a/src/device-x.c	Mon Aug 13 09:20:50 2007 +0200
+++ b/src/device-x.c	Mon Aug 13 09:21:54 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 *
@@ -600,8 +614,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)))
     {
@@ -629,7 +647,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;
 }