comparison 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
comparison
equal deleted inserted replaced
39:06f275776fba 40:7e54bd776075
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 {
576 int 590 int
577 x_IO_error_handler (Display *disp) 591 x_IO_error_handler (Display *disp)
578 { 592 {
579 /* This function can GC */ 593 /* This function can GC */
580 Lisp_Object dev; 594 Lisp_Object dev;
581 struct device *d = get_device_from_display (disp); 595 struct device *d = get_device_from_display_1 (disp);
582 XSETDEVICE (dev, d); 596
597 if (d)
598 XSETDEVICE (dev, d);
599 else
600 dev = Qnil;
583 601
584 if (NILP (find_nonminibuffer_frame_not_on_device (dev))) 602 if (NILP (find_nonminibuffer_frame_not_on_device (dev)))
585 { 603 {
586 /* We're going down. */ 604 /* We're going down. */
587 stderr_out 605 stderr_out
605 errno, strerror (errno), DisplayString (disp), 623 errno, strerror (errno), DisplayString (disp),
606 NextRequest (disp) - 1, LastKnownRequestProcessed (disp), 624 NextRequest (disp) - 1, LastKnownRequestProcessed (disp),
607 QLength (disp)); 625 QLength (disp));
608 } 626 }
609 627
610 enqueue_magic_eval_event (io_error_delete_device, dev); 628 if (d)
629 enqueue_magic_eval_event (io_error_delete_device, dev);
611 630
612 return 0; 631 return 0;
613 } 632 }
614 633
615 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /* 634 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /*