Mercurial > hg > xemacs-beta
diff src/device-x.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 56c54cf7c5b6 |
children | 54cc21c15cbb |
line wrap: on
line diff
--- a/src/device-x.c Mon Aug 13 09:00:04 2007 +0200 +++ b/src/device-x.c Mon Aug 13 09:02:59 2007 +0200 @@ -99,8 +99,8 @@ /* helper functions */ /************************************************************************/ -static struct device * -get_device_from_display_1 (Display *dpy) +struct device * +get_device_from_display (Display *dpy) { Lisp_Object devcons, concons; @@ -111,25 +111,11 @@ return d; } - return 0; -} - -struct device * -get_device_from_display (Display *dpy) -{ - struct device *d = get_device_from_display_1 (dpy); + /* Only devices we are actually managing should ever be used as an + argument to this function. */ + abort (); - 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; + return 0; /* suppress compiler warning */ } struct device * @@ -238,6 +224,9 @@ allocate_x_device_struct (d); + if (NILP (Vdefault_x_device)) + Vdefault_x_device = device; + make_argc_argv (Vx_initial_argv_list, &argc, &argv); if (STRINGP (Vx_emacs_application_class) && @@ -261,8 +250,24 @@ signal_simple_error ("X server not responding\n", display); } - if (NILP (Vdefault_x_device)) - Vdefault_x_device = device; +#ifdef MULE + { + /* Read in locale-specific resources from + data-directory/app-defaults/$LANG/emacs-application-class. + This is in addition to the standard app-defaults files, and + does not override resources defined elsewhere */ + CONST char *data_dir; + char path[MAXPATHLEN]; + XrmDatabase db = XtDatabase (dpy); /* ### XtScreenDatabase(dpy) ? */ + CONST char *locale = XrmLocaleOfDatabase (db); + + if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) + GET_C_STRING_FILENAME_DATA_ALLOCA (Vdata_directory, data_dir); + sprintf (path, "%sapp-defaults/%s/%s", data_dir, locale, app_class); + if (!access (path, R_OK)) + XrmCombineFileDatabase (path, &db, False); + } +#endif if (NILP (DEVICE_NAME (d))) DEVICE_NAME (d) = display; @@ -276,6 +281,9 @@ applicationShellWidgetClass, dpy, NULL, 0); +#ifdef HAVE_XIM + XIM_init_device(d); +#endif /* HAVE_XIM */ Vx_initial_argv_list = make_arg_list (argc, argv); free_argc_argv (argv); @@ -370,8 +378,7 @@ Vdefault_x_device = Qnil; DEVICE_LOOP_NO_BREAK (devcons, concons) { - if (DEVICE_X_P (XDEVICE (XCAR (devcons))) && - !EQ (device, XCAR (devcons))) + if (DEVICE_X_P (XDEVICE (XCAR (devcons)))) { Vdefault_x_device = XCAR (devcons); goto double_break; @@ -593,12 +600,8 @@ { /* This function can GC */ Lisp_Object dev; - struct device *d = get_device_from_display_1 (disp); - - if (d) - XSETDEVICE (dev, d); - else - dev = Qnil; + struct device *d = get_device_from_display (disp); + XSETDEVICE (dev, d); if (NILP (find_nonminibuffer_frame_not_on_device (dev))) { @@ -626,8 +629,7 @@ QLength (disp)); } - if (d) - enqueue_magic_eval_event (io_error_delete_device, dev); + enqueue_magic_eval_event (io_error_delete_device, dev); return 0; }