X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fdevice-x.c;h=540e407c6aa098e52bfdd59a38f08356ed044480;hp=a0586b6f9737ed27b04494533ee20a15835cc0db;hb=414b512c0774e67ba8e160b605447d862d3be166;hpb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb diff --git a/src/device-x.c b/src/device-x.c index a0586b6..540e407 100644 --- a/src/device-x.c +++ b/src/device-x.c @@ -141,7 +141,7 @@ get_device_from_display (Display *dpy) (STRINGP (Vinvocation_name) ? (char *) XSTRING_DATA (Vinvocation_name) : FALLBACK_RESOURCE_NAME), DisplayString (dpy) ? DisplayString (dpy) : "???"); - abort(); + ABORT(); } #undef FALLBACK_RESOURCE_NAME @@ -168,6 +168,8 @@ get_x_display (Lisp_Object device) /* initializing an X connection */ /************************************************************************/ +static struct device *device_being_initialized = NULL; + static void allocate_x_device_struct (struct device *d) { @@ -418,7 +420,7 @@ x_get_visual_depth (Display *dpy, Visual *visual) vi_in.visualid = XVisualIDFromVisual (visual); vi_out = XGetVisualInfo (dpy, /*VisualScreenMask|*/VisualIDMask, &vi_in, &out_count); - if (! vi_out) abort (); + if (! vi_out) ABORT (); d = vi_out [0].depth; XFree ((char *) vi_out); return d; @@ -562,7 +564,9 @@ x_init_device (struct device *d, Lisp_Object props) */ slow_down_interrupts (); /* May not be needed but XtOpenDisplay could not deal with signals here. */ + device_being_initialized = d; dpy = DEVICE_X_DISPLAY (d) = XOpenDisplay (disp_name); + device_being_initialized = NULL; speed_up_interrupts (); if (dpy == 0) @@ -1053,10 +1057,14 @@ x_error_handler (Display *disp, XErrorEvent *event) } #endif /* EXTERNAL_WIDGET */ +#if 0 + /* This ends up calling X, which isn't allowed in an X error handler + */ stderr_out ("\n%s: ", (STRINGP (Vinvocation_name) ? (char *) XSTRING_DATA (Vinvocation_name) : "xemacs")); +#endif XmuPrintDefaultErrorMessage (disp, event, stderr); } return 0; @@ -1116,6 +1124,9 @@ x_IO_error_handler (Display *disp) Lisp_Object dev; struct device *d = get_device_from_display_1 (disp); + if (!d) + d = device_being_initialized; + assert (d != NULL); XSETDEVICE (dev, d); @@ -1150,8 +1161,10 @@ x_IO_error_handler (Display *disp) Xlib might just decide to exit(). So we mark the offending console for deletion and throw to top level. */ if (d) - enqueue_magic_eval_event (io_error_delete_device, dev); - DEVICE_X_BEING_DELETED (d) = 1; + { + enqueue_magic_eval_event (io_error_delete_device, dev); + DEVICE_X_BEING_DELETED (d) = 1; + } Fthrow (Qtop_level, Qnil); return 0; /* not reached */ @@ -1434,13 +1447,13 @@ found. If the third arg is `string', a string is returned, and if it is returned value is the list (t) for true, (nil) for false, and is nil to mean ``unspecified''. */ - (name, class, type, locale, device, no_error)) + (name, class, type, locale, device, noerror)) { char* name_string, *class_string; char *raw_result; XrmDatabase db; Display *display; - Error_behavior errb = decode_error_behavior_flag (no_error); + Error_behavior errb = decode_error_behavior_flag (noerror); CHECK_STRING (name); CHECK_STRING (class);