comparison 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
comparison
equal deleted inserted replaced
113:2ec2fe4a4c89 114:8619ce7e4c50
97 97
98 /************************************************************************/ 98 /************************************************************************/
99 /* helper functions */ 99 /* helper functions */
100 /************************************************************************/ 100 /************************************************************************/
101 101
102 struct device * 102 static struct device *
103 get_device_from_display (Display *dpy) 103 get_device_from_display_1 (Display *dpy)
104 { 104 {
105 Lisp_Object devcons, concons; 105 Lisp_Object devcons, concons;
106 106
107 DEVICE_LOOP_NO_BREAK (devcons, concons) 107 DEVICE_LOOP_NO_BREAK (devcons, concons)
108 { 108 {
109 struct device *d = XDEVICE (XCAR (devcons)); 109 struct device *d = XDEVICE (XCAR (devcons));
110 if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d) == dpy) 110 if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d) == dpy)
111 return d; 111 return d;
112 } 112 }
113 113
114 /* Only devices we are actually managing should ever be used as an 114 return 0;
115 argument to this function. */ 115 }
116 abort (); 116
117 117 struct device *
118 return 0; /* suppress compiler warning */ 118 get_device_from_display (Display *dpy)
119 {
120 struct device *d = get_device_from_display_1 (dpy);
121
122 if (!d) {
123 /* This isn't one of our displays. Let's crash? */
124 stderr_out
125 ("\n%s: Fatal X Condition. Asked about display we don't own: \"%s\"\n",
126 (STRINGP (Vinvocation_name) ?
127 (char *) XSTRING_DATA (Vinvocation_name) : "xemacs"),
128 DisplayString (dpy) ? DisplayString (dpy) : "???");
129 abort();
130 }
131
132 return d;
119 } 133 }
120 134
121 struct device * 135 struct device *
122 decode_x_device (Lisp_Object device) 136 decode_x_device (Lisp_Object device)
123 { 137 {
598 int 612 int
599 x_IO_error_handler (Display *disp) 613 x_IO_error_handler (Display *disp)
600 { 614 {
601 /* This function can GC */ 615 /* This function can GC */
602 Lisp_Object dev; 616 Lisp_Object dev;
603 struct device *d = get_device_from_display (disp); 617 struct device *d = get_device_from_display_1 (disp);
604 XSETDEVICE (dev, d); 618
619 if (d)
620 XSETDEVICE (dev, d);
621 else
622 dev = Qnil;
605 623
606 if (NILP (find_nonminibuffer_frame_not_on_device (dev))) 624 if (NILP (find_nonminibuffer_frame_not_on_device (dev)))
607 { 625 {
608 /* We're going down. */ 626 /* We're going down. */
609 stderr_out 627 stderr_out
627 errno, strerror (errno), DisplayString (disp), 645 errno, strerror (errno), DisplayString (disp),
628 NextRequest (disp) - 1, LastKnownRequestProcessed (disp), 646 NextRequest (disp) - 1, LastKnownRequestProcessed (disp),
629 QLength (disp)); 647 QLength (disp));
630 } 648 }
631 649
632 enqueue_magic_eval_event (io_error_delete_device, dev); 650 if (d)
651 enqueue_magic_eval_event (io_error_delete_device, dev);
633 652
634 return 0; 653 return 0;
635 } 654 }
636 655
637 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /* 656 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /*