comparison src/device-x.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents 576fb035e263
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
209 "the Xt or Xm libraries will probably crash, which is a very bad thing.)\n" 209 "the Xt or Xm libraries will probably crash, which is a very bad thing.)\n"
210 "You should always use \".geometry\" or \"*EmacsFrame.geometry\" instead.\n", 210 "You should always use \".geometry\" or \"*EmacsFrame.geometry\" instead.\n",
211 app_name, (char *) value.addr, 211 app_name, (char *) value.addr,
212 app_class, (char *) value.addr); 212 app_class, (char *) value.addr);
213 suppress_early_error_handler_backtrace = 1; 213 suppress_early_error_handler_backtrace = 1;
214 error ("Invalid geometry resource"); 214 syntax_error ("Invalid geometry resource", Qunbound);
215 } 215 }
216 } 216 }
217 217
218 static void 218 static void
219 x_init_device_class (struct device *d) 219 x_init_device_class (struct device *d)
566 speed_up_interrupts (); 566 speed_up_interrupts ();
567 567
568 if (dpy == 0) 568 if (dpy == 0)
569 { 569 {
570 suppress_early_error_handler_backtrace = 1; 570 suppress_early_error_handler_backtrace = 1;
571 signal_simple_error ("X server not responding\n", display); 571 gui_error ("X server not responding\n", display);
572 } 572 }
573 573
574 if (STRINGP (Vx_emacs_application_class) && 574 if (STRINGP (Vx_emacs_application_class) &&
575 XSTRING_LENGTH (Vx_emacs_application_class) > 0) 575 XSTRING_LENGTH (Vx_emacs_application_class) > 0)
576 LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, app_class, Qctext); 576 LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, app_class, Qctext);
1283 char_dynarr *class) 1283 char_dynarr *class)
1284 { 1284 {
1285 if (NILP (locale)) 1285 if (NILP (locale))
1286 locale = Qglobal; 1286 locale = Qglobal;
1287 if (NILP (Fvalid_specifier_locale_p (locale))) 1287 if (NILP (Fvalid_specifier_locale_p (locale)))
1288 signal_simple_error ("Invalid locale", locale); 1288 invalid_argument ("Invalid locale", locale);
1289 if (WINDOWP (locale)) 1289 if (WINDOWP (locale))
1290 /* #### I can't come up with any coherent way of naming windows. 1290 /* #### I can't come up with any coherent way of naming windows.
1291 By relative position? That seems tricky because windows 1291 By relative position? That seems tricky because windows
1292 can change position, be split, etc. By order of creation? 1292 can change position, be split, etc. By order of creation?
1293 That seems less than useful. */ 1293 That seems less than useful. */
1294 signal_simple_error ("Windows currently can't be resourced", locale); 1294 signal_error (Qunimplemented,
1295 "Windows currently can't be resourced", locale);
1295 1296
1296 if (!NILP (device) && !DEVICEP (device)) 1297 if (!NILP (device) && !DEVICEP (device))
1297 CHECK_DEVICE (device); 1298 CHECK_DEVICE (device);
1298 if (DEVICEP (device) && !DEVICE_X_P (XDEVICE (device))) 1299 if (DEVICEP (device) && !DEVICE_X_P (XDEVICE (device)))
1299 device = Qnil; 1300 device = Qnil;
1481 1482
1482 /* ensure that they have the same length */ 1483 /* ensure that they have the same length */
1483 while (namerest[0] && classrest[0]) 1484 while (namerest[0] && classrest[0])
1484 namerest++, classrest++; 1485 namerest++, classrest++;
1485 if (namerest[0] || classrest[0]) 1486 if (namerest[0] || classrest[0])
1486 signal_simple_error_2 1487 {
1487 ("class list and name list must be the same length", name, class); 1488 maybe_signal_error_2
1489 (Qstructure_formation_error,
1490 "class list and name list must be the same length", name, class,
1491 Qresource, errb);
1492 return Qnil;
1493 }
1488 result = XrmQGetResource (db, namelist, classlist, &xrm_type, &xrm_value); 1494 result = XrmQGetResource (db, namelist, classlist, &xrm_type, &xrm_value);
1489 1495
1490 if (result != True || xrm_type != string_quark) 1496 if (result != True || xrm_type != string_quark)
1491 return Qnil; 1497 return Qnil;
1492 raw_result = (char *) xrm_value.addr; 1498 raw_result = (char *) xrm_value.addr;
1502 return Fcons (Qnil, Qnil); 1508 return Fcons (Qnil, Qnil);
1503 if (!ascii_strcasecmp (raw_result, "on") || 1509 if (!ascii_strcasecmp (raw_result, "on") ||
1504 !ascii_strcasecmp (raw_result, "true") || 1510 !ascii_strcasecmp (raw_result, "true") ||
1505 !ascii_strcasecmp (raw_result, "yes")) 1511 !ascii_strcasecmp (raw_result, "yes"))
1506 return Fcons (Qt, Qnil); 1512 return Fcons (Qt, Qnil);
1507 return maybe_continuable_error 1513 return maybe_signal_continuable_error_2
1508 (Qresource, errb, 1514 (Qinvalid_operation, "Can't convert to a Boolean",
1509 "can't convert %s: %s to a Boolean", name_string, raw_result); 1515 build_string (name_string), build_string (raw_result), Qresource,
1516 errb);
1510 } 1517 }
1511 else if (EQ (type, Qinteger) || EQ (type, Qnatnum)) 1518 else if (EQ (type, Qinteger) || EQ (type, Qnatnum))
1512 { 1519 {
1513 int i; 1520 int i;
1514 char c; 1521 char c;
1515 if (1 != sscanf (raw_result, "%d%c", &i, &c)) 1522 if (1 != sscanf (raw_result, "%d%c", &i, &c))
1516 return maybe_continuable_error 1523 return maybe_signal_continuable_error_2
1517 (Qresource, errb, 1524 (Qinvalid_operation, "Can't convert to an integer",
1518 "can't convert %s: %s to an integer", name_string, raw_result); 1525 build_string (name_string), build_string (raw_result), Qresource,
1526 errb);
1519 else if (EQ (type, Qnatnum) && i < 0) 1527 else if (EQ (type, Qnatnum) && i < 0)
1520 return maybe_continuable_error 1528 return maybe_signal_continuable_error_2
1521 (Qresource, errb, 1529 (Qinvalid_argument, "Invalid numerical value for resource",
1522 "invalid numerical value %d for resource %s", i, name_string); 1530 make_int (i), build_string (name_string), Qresource, errb);
1523 else 1531 else
1524 return make_int (i); 1532 return make_int (i);
1525 } 1533 }
1526 else 1534 else
1527 { 1535 {
1528 return maybe_signal_continuable_error 1536 return maybe_signal_continuable_error
1529 (Qwrong_type_argument, 1537 (Qwrong_type_argument, "Should be string, integer, natnum or boolean",
1530 list2 (build_translated_string 1538 type, Qresource, errb);
1531 ("should be string, integer, natnum or boolean"),
1532 type),
1533 Qresource, errb);
1534 } 1539 }
1535 } 1540 }
1536 1541
1537 DEFUN ("x-get-resource-prefix", Fx_get_resource_prefix, 1, 2, 0, /* 1542 DEFUN ("x-get-resource-prefix", Fx_get_resource_prefix, 1, 2, 0, /*
1538 Return the resource prefix for LOCALE on DEVICE. 1543 Return the resource prefix for LOCALE on DEVICE.
1574 1579
1575 CHECK_STRING (resource_line); 1580 CHECK_STRING (resource_line);
1576 str = (char *) XSTRING_DATA (resource_line); 1581 str = (char *) XSTRING_DATA (resource_line);
1577 if (!(colon_pos = strchr (str, ':')) || strchr (str, '\n')) 1582 if (!(colon_pos = strchr (str, ':')) || strchr (str, '\n'))
1578 invalid: 1583 invalid:
1579 signal_simple_error ("Invalid resource line", resource_line); 1584 syntax_error ("Invalid resource line", resource_line);
1580 if (strspn (str, 1585 if (strspn (str,
1581 /* Only the following chars are allowed before the colon */ 1586 /* Only the following chars are allowed before the colon */
1582 " \t.*?abcdefghijklmnopqrstuvwxyz" 1587 " \t.*?abcdefghijklmnopqrstuvwxyz"
1583 "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-") 1588 "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-")
1584 != (size_t) (colon_pos - str)) 1589 != (size_t) (colon_pos - str))
1623 case StaticColor: return intern ("static-color"); 1628 case StaticColor: return intern ("static-color");
1624 case PseudoColor: return intern ("pseudo-color"); 1629 case PseudoColor: return intern ("pseudo-color");
1625 case TrueColor: return intern ("true-color"); 1630 case TrueColor: return intern ("true-color");
1626 case DirectColor: return intern ("direct-color"); 1631 case DirectColor: return intern ("direct-color");
1627 default: 1632 default:
1628 error ("display has an unknown visual class"); 1633 invalid_state ("display has an unknown visual class", Qunbound);
1629 return Qnil; /* suppress compiler warning */ 1634 return Qnil; /* suppress compiler warning */
1630 } 1635 }
1631 } 1636 }
1632 1637
1633 DEFUN ("x-display-visual-depth", Fx_display_visual_depth, 0, 1, 0, /* 1638 DEFUN ("x-display-visual-depth", Fx_display_visual_depth, 0, 1, 0, /*
1709 */ 1714 */
1710 (device)) 1715 (device))
1711 { 1716 {
1712 struct device *d = decode_device (device); 1717 struct device *d = decode_device (device);
1713 if (!DEVICE_X_P (d)) 1718 if (!DEVICE_X_P (d))
1714 signal_simple_error ("Not an X device", device); 1719 gui_error ("Not an X device", device);
1715 1720
1716 return DEVICE_X_DATA (d)->x_keysym_map_hash_table; 1721 return DEVICE_X_DATA (d)->x_keysym_map_hash_table;
1717 } 1722 }
1718 1723
1719 DEFUN ("x-keysym-on-keyboard-sans-modifiers-p", Fx_keysym_on_keyboard_sans_modifiers_p, 1724 DEFUN ("x-keysym-on-keyboard-sans-modifiers-p", Fx_keysym_on_keyboard_sans_modifiers_p,
1730 */ 1735 */
1731 (keysym, device)) 1736 (keysym, device))
1732 { 1737 {
1733 struct device *d = decode_device (device); 1738 struct device *d = decode_device (device);
1734 if (!DEVICE_X_P (d)) 1739 if (!DEVICE_X_P (d))
1735 signal_simple_error ("Not an X device", device); 1740 gui_error ("Not an X device", device);
1736 1741
1737 return (EQ (Qsans_modifiers, 1742 return (EQ (Qsans_modifiers,
1738 Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)) ? 1743 Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)) ?
1739 Qt : Qnil); 1744 Qt : Qnil);
1740 } 1745 }
1753 */ 1758 */
1754 (keysym, device)) 1759 (keysym, device))
1755 { 1760 {
1756 struct device *d = decode_device (device); 1761 struct device *d = decode_device (device);
1757 if (!DEVICE_X_P (d)) 1762 if (!DEVICE_X_P (d))
1758 signal_simple_error ("Not an X device", device); 1763 gui_error ("Not an X device", device);
1759 1764
1760 return (NILP (Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)) ? 1765 return (NILP (Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)) ?
1761 Qnil : Qt); 1766 Qnil : Qt);
1762 } 1767 }
1763 1768
1901 int ndirs_return; 1906 int ndirs_return;
1902 const char **directories = (const char **) XGetFontPath (dpy, &ndirs_return); 1907 const char **directories = (const char **) XGetFontPath (dpy, &ndirs_return);
1903 Lisp_Object font_path = Qnil; 1908 Lisp_Object font_path = Qnil;
1904 1909
1905 if (!directories) 1910 if (!directories)
1906 signal_simple_error ("Can't get X font path", device); 1911 gui_error ("Can't get X font path", device);
1907 1912
1908 while (ndirs_return--) 1913 while (ndirs_return--)
1909 font_path = Fcons (build_ext_string (directories[ndirs_return], 1914 font_path = Fcons (build_ext_string (directories[ndirs_return],
1910 Qfile_name), 1915 Qfile_name),
1911 font_path); 1916 font_path);
1983 DEFSUBR (Fx_ungrab_keyboard); 1988 DEFSUBR (Fx_ungrab_keyboard);
1984 1989
1985 DEFSUBR (Fx_get_font_path); 1990 DEFSUBR (Fx_get_font_path);
1986 DEFSUBR (Fx_set_font_path); 1991 DEFSUBR (Fx_set_font_path);
1987 1992
1988 defsymbol (&Qx_error, "x-error"); 1993 DEFSYMBOL (Qx_error);
1989 defsymbol (&Qinit_pre_x_win, "init-pre-x-win"); 1994 DEFSYMBOL (Qinit_pre_x_win);
1990 defsymbol (&Qinit_post_x_win, "init-post-x-win"); 1995 DEFSYMBOL (Qinit_post_x_win);
1991 } 1996 }
1992 1997
1993 void 1998 void
1994 reinit_console_type_create_device_x (void) 1999 reinit_console_type_create_device_x (void)
1995 { 2000 {