Mercurial > hg > xemacs-beta
comparison src/glyphs-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 | 0784d089fdc9 |
children | 4d7fdf497470 |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
678 fclose (tmpfil); | 678 fclose (tmpfil); |
679 unlink (filename_out); | 679 unlink (filename_out); |
680 errno = old_errno; | 680 errno = old_errno; |
681 } | 681 } |
682 report_file_error ("Creating temp file", | 682 report_file_error ("Creating temp file", |
683 list1 (build_string (filename_out))); | 683 build_string (filename_out)); |
684 } | 684 } |
685 | 685 |
686 CHECK_STRING (string); | 686 CHECK_STRING (string); |
687 get_string_range_byte (string, Qnil, Qnil, &bstart, &bend, | 687 get_string_range_byte (string, Qnil, Qnil, &bstart, &bend, |
688 GB_HISTORICAL_STRING_BEHAVIOR); | 688 GB_HISTORICAL_STRING_BEHAVIOR); |
739 Lstream_delete (costr); | 739 Lstream_delete (costr); |
740 #endif | 740 #endif |
741 | 741 |
742 if (fubar) | 742 if (fubar) |
743 report_file_error ("Writing temp file", | 743 report_file_error ("Writing temp file", |
744 list1 (build_string (filename_out))); | 744 build_string (filename_out)); |
745 } | 745 } |
746 #endif /* 0 */ | 746 #endif /* 0 */ |
747 | 747 |
748 | 748 |
749 /************************************************************************/ | 749 /************************************************************************/ |
761 unsigned int best_width, best_height; | 761 unsigned int best_width, best_height; |
762 if (! XQueryBestCursor (DisplayOfScreen (xs), RootWindowOfScreen (xs), | 762 if (! XQueryBestCursor (DisplayOfScreen (xs), RootWindowOfScreen (xs), |
763 width, height, &best_width, &best_height)) | 763 width, height, &best_width, &best_height)) |
764 /* this means that an X error of some sort occurred (we trap | 764 /* this means that an X error of some sort occurred (we trap |
765 these so they're not fatal). */ | 765 these so they're not fatal). */ |
766 signal_simple_error ("XQueryBestCursor() failed?", instantiator); | 766 gui_error ("XQueryBestCursor() failed?", instantiator); |
767 | 767 |
768 if (width > best_width || height > best_height) | 768 if (width > best_width || height > best_height) |
769 error_with_frob (instantiator, | 769 signal_ferror_with_frob (Qgui_error, instantiator, |
770 "pointer too large (%dx%d): " | 770 "pointer too large (%dx%d): " |
771 "server requires %dx%d or smaller", | 771 "server requires %dx%d or smaller", |
772 width, height, best_width, best_height); | 772 width, height, best_width, best_height); |
773 } | 773 } |
774 | 774 |
775 | 775 |
776 static void | 776 static void |
777 generate_cursor_fg_bg (Lisp_Object device, Lisp_Object *foreground, | 777 generate_cursor_fg_bg (Lisp_Object device, Lisp_Object *foreground, |
860 GC gc; | 860 GC gc; |
861 Drawable d; | 861 Drawable d; |
862 Pixmap pixmap; | 862 Pixmap pixmap; |
863 | 863 |
864 if (!DEVICE_X_P (XDEVICE (device))) | 864 if (!DEVICE_X_P (XDEVICE (device))) |
865 signal_simple_error ("Not an X device", device); | 865 gui_error ("Not an X device", device); |
866 | 866 |
867 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); | 867 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); |
868 d = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device))); | 868 d = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device))); |
869 | 869 |
870 if (!(dest_mask & IMAGE_COLOR_PIXMAP_MASK)) | 870 if (!(dest_mask & IMAGE_COLOR_PIXMAP_MASK)) |
872 IMAGE_COLOR_PIXMAP_MASK); | 872 IMAGE_COLOR_PIXMAP_MASK); |
873 | 873 |
874 pixmap = XCreatePixmap (dpy, d, ximage->width, | 874 pixmap = XCreatePixmap (dpy, d, ximage->width, |
875 ximage->height, ximage->depth); | 875 ximage->height, ximage->depth); |
876 if (!pixmap) | 876 if (!pixmap) |
877 signal_simple_error ("Unable to create pixmap", instantiator); | 877 gui_error ("Unable to create pixmap", instantiator); |
878 | 878 |
879 gc = XCreateGC (dpy, pixmap, 0, NULL); | 879 gc = XCreateGC (dpy, pixmap, 0, NULL); |
880 if (!gc) | 880 if (!gc) |
881 { | 881 { |
882 XFreePixmap (dpy, pixmap); | 882 XFreePixmap (dpy, pixmap); |
883 signal_simple_error ("Unable to create GC", instantiator); | 883 gui_error ("Unable to create GC", instantiator); |
884 } | 884 } |
885 | 885 |
886 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0, | 886 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0, |
887 ximage->width, ximage->height); | 887 ximage->width, ximage->height); |
888 | 888 |
921 d = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device))); | 921 d = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device))); |
922 | 922 |
923 pixmap = XCreatePixmap (dpy, d, ximage->width, | 923 pixmap = XCreatePixmap (dpy, d, ximage->width, |
924 ximage->height, ximage->depth); | 924 ximage->height, ximage->depth); |
925 if (!pixmap) | 925 if (!pixmap) |
926 signal_simple_error ("Unable to create pixmap", instantiator); | 926 gui_error ("Unable to create pixmap", instantiator); |
927 | 927 |
928 gc = XCreateGC (dpy, pixmap, 0, NULL); | 928 gc = XCreateGC (dpy, pixmap, 0, NULL); |
929 if (!gc) | 929 if (!gc) |
930 { | 930 { |
931 XFreePixmap (dpy, pixmap); | 931 XFreePixmap (dpy, pixmap); |
932 signal_simple_error ("Unable to create GC", instantiator); | 932 gui_error ("Unable to create GC", instantiator); |
933 } | 933 } |
934 | 934 |
935 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0, | 935 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0, |
936 ximage->width, ximage->height); | 936 ximage->width, ximage->height); |
937 | 937 |
1033 Screen *scr; | 1033 Screen *scr; |
1034 Drawable draw; | 1034 Drawable draw; |
1035 enum image_instance_type type; | 1035 enum image_instance_type type; |
1036 | 1036 |
1037 if (!DEVICE_X_P (XDEVICE (device))) | 1037 if (!DEVICE_X_P (XDEVICE (device))) |
1038 signal_simple_error ("Not an X device", device); | 1038 gui_error ("Not an X device", device); |
1039 | 1039 |
1040 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); | 1040 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); |
1041 draw = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device))); | 1041 draw = XtWindow(DEVICE_XT_APP_SHELL (XDEVICE (device))); |
1042 scr = DefaultScreenOfDisplay (dpy); | 1042 scr = DefaultScreenOfDisplay (dpy); |
1043 | 1043 |
1321 enum image_instance_type type; | 1321 enum image_instance_type type; |
1322 int force_mono; | 1322 int force_mono; |
1323 unsigned int w, h; | 1323 unsigned int w, h; |
1324 | 1324 |
1325 if (!DEVICE_X_P (XDEVICE (device))) | 1325 if (!DEVICE_X_P (XDEVICE (device))) |
1326 signal_simple_error ("Not an X device", device); | 1326 gui_error ("Not an X device", device); |
1327 | 1327 |
1328 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); | 1328 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); |
1329 xs = DefaultScreenOfDisplay (dpy); | 1329 xs = DefaultScreenOfDisplay (dpy); |
1330 | 1330 |
1331 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) | 1331 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) |
1420 { | 1420 { |
1421 xpm_free (&xpmattrs); | 1421 xpm_free (&xpmattrs); |
1422 if (force_mono) | 1422 if (force_mono) |
1423 { | 1423 { |
1424 /* second time; blow out. */ | 1424 /* second time; blow out. */ |
1425 signal_double_file_error ("Reading pixmap data", | 1425 gui_error ("XPM color allocation failed", data); |
1426 "color allocation failed", | |
1427 data); | |
1428 } | 1426 } |
1429 else | 1427 else |
1430 { | 1428 { |
1429 /* second time; blow out. */ | |
1431 if (! (dest_mask & IMAGE_MONO_PIXMAP_MASK)) | 1430 if (! (dest_mask & IMAGE_MONO_PIXMAP_MASK)) |
1432 { | 1431 gui_error ("XPM color allocation failed", data); |
1433 /* second time; blow out. */ | |
1434 signal_double_file_error ("Reading pixmap data", | |
1435 "color allocation failed", | |
1436 data); | |
1437 } | |
1438 force_mono = 1; | 1432 force_mono = 1; |
1439 IMAGE_INSTANCE_TYPE (ii) = IMAGE_MONO_PIXMAP; | 1433 IMAGE_INSTANCE_TYPE (ii) = IMAGE_MONO_PIXMAP; |
1440 goto retry; | 1434 goto retry; |
1441 } | 1435 } |
1442 } | 1436 } |
1443 case XpmNoMemory: | 1437 case XpmNoMemory: |
1444 { | 1438 { |
1445 xpm_free (&xpmattrs); | 1439 xpm_free (&xpmattrs); |
1446 signal_double_file_error ("Parsing pixmap data", | 1440 out_of_memory ("Parsing pixmap data", data); |
1447 "out of memory", data); | |
1448 } | 1441 } |
1449 default: | 1442 default: |
1450 { | 1443 { |
1451 xpm_free (&xpmattrs); | 1444 xpm_free (&xpmattrs); |
1452 signal_double_file_error_2 ("Parsing pixmap data", | 1445 signal_error_2 (Qgui_error, |
1453 "unknown error code", | 1446 "Parsing pixmap data: unknown error code", |
1454 make_int (result), data); | 1447 make_int (result), data); |
1455 } | 1448 } |
1456 } | 1449 } |
1457 | 1450 |
1458 w = xpmattrs.width; | 1451 w = xpmattrs.width; |
1459 h = xpmattrs.height; | 1452 h = xpmattrs.height; |
1703 emsg = "uncompface: excess data ignored"; | 1696 emsg = "uncompface: excess data ignored"; |
1704 break; | 1697 break; |
1705 } | 1698 } |
1706 | 1699 |
1707 if (emsg) | 1700 if (emsg) |
1708 signal_simple_error_2 (emsg, data, Qimage); | 1701 gui_error_2 (emsg, data, Qimage); |
1709 | 1702 |
1710 bp = bits = (char *) alloca (PIXELS / 8); | 1703 bp = bits = (char *) alloca (PIXELS / 8); |
1711 | 1704 |
1712 /* the compface library exports char F[], which uses a single byte per | 1705 /* the compface library exports char F[], which uses a single byte per |
1713 pixel to represent a 48x48 bitmap. Yuck. */ | 1706 pixel to represent a 48x48 bitmap. Yuck. */ |
1946 int source_char, mask_char; | 1939 int source_char, mask_char; |
1947 int count; | 1940 int count; |
1948 Lisp_Object foreground, background; | 1941 Lisp_Object foreground, background; |
1949 | 1942 |
1950 if (!DEVICE_X_P (XDEVICE (device))) | 1943 if (!DEVICE_X_P (XDEVICE (device))) |
1951 signal_simple_error ("Not an X device", device); | 1944 gui_error ("Not an X device", device); |
1952 | 1945 |
1953 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); | 1946 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); |
1954 | 1947 |
1955 if (!STRINGP (data) || | 1948 if (!STRINGP (data) || |
1956 strncmp ("FONT ", (char *) XSTRING_DATA (data), 5)) | 1949 strncmp ("FONT ", (char *) XSTRING_DATA (data), 5)) |
1957 signal_simple_error ("Invalid font-glyph instantiator", | 1950 invalid_argument ("Invalid font-glyph instantiator", |
1958 instantiator); | 1951 instantiator); |
1959 | 1952 |
1960 if (!(dest_mask & IMAGE_POINTER_MASK)) | 1953 if (!(dest_mask & IMAGE_POINTER_MASK)) |
1961 incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); | 1954 incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); |
1962 | 1955 |
1976 /* Allow "%s %d %d" as well... */ | 1969 /* Allow "%s %d %d" as well... */ |
1977 if (count == 3 && (1 == sscanf (mask_name, "%d %c", &mask_char, &dummy))) | 1970 if (count == 3 && (1 == sscanf (mask_name, "%d %c", &mask_char, &dummy))) |
1978 count = 4, mask_name[0] = 0; | 1971 count = 4, mask_name[0] = 0; |
1979 | 1972 |
1980 if (count != 2 && count != 4) | 1973 if (count != 2 && count != 4) |
1981 signal_simple_error ("invalid cursor specification", data); | 1974 syntax_error ("invalid cursor specification", data); |
1982 source = safe_XLoadFont (dpy, source_name); | 1975 source = safe_XLoadFont (dpy, source_name); |
1983 if (! source) | 1976 if (! source) |
1984 signal_simple_error_2 ("couldn't load font", | 1977 signal_error_2 (Qgui_error, |
1985 build_string (source_name), | 1978 "couldn't load font", build_string (source_name), data); |
1986 data); | |
1987 if (count == 2) | 1979 if (count == 2) |
1988 mask = 0; | 1980 mask = 0; |
1989 else if (!mask_name[0]) | 1981 else if (!mask_name[0]) |
1990 mask = source; | 1982 mask = source; |
1991 else | 1983 else |
1992 { | 1984 { |
1993 mask = safe_XLoadFont (dpy, mask_name); | 1985 mask = safe_XLoadFont (dpy, mask_name); |
1994 if (!mask) | 1986 if (!mask) |
1995 /* continuable */ | 1987 signal_continuable_error_2 (Qgui_error, |
1996 Fsignal (Qerror, list3 (build_string ("couldn't load font"), | 1988 "couldn't load font", |
1997 build_string (mask_name), data)); | 1989 build_string (mask_name), data); |
1998 } | 1990 } |
1999 if (!mask) | 1991 if (!mask) |
2000 mask_char = 0; | 1992 mask_char = 0; |
2001 | 1993 |
2002 /* #### call XQueryTextExtents() and check_pointer_sizes() here. */ | 1994 /* #### call XQueryTextExtents() and check_pointer_sizes() here. */ |
2041 int i; | 2033 int i; |
2042 const char *name_ext; | 2034 const char *name_ext; |
2043 Lisp_Object foreground, background; | 2035 Lisp_Object foreground, background; |
2044 | 2036 |
2045 if (!DEVICE_X_P (XDEVICE (device))) | 2037 if (!DEVICE_X_P (XDEVICE (device))) |
2046 signal_simple_error ("Not an X device", device); | 2038 gui_error ("Not an X device", device); |
2047 | 2039 |
2048 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); | 2040 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); |
2049 | 2041 |
2050 if (!(dest_mask & IMAGE_POINTER_MASK)) | 2042 if (!(dest_mask & IMAGE_POINTER_MASK)) |
2051 incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); | 2043 incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); |
2052 | 2044 |
2053 LISP_STRING_TO_EXTERNAL (data, name_ext, Qfile_name); | 2045 LISP_STRING_TO_EXTERNAL (data, name_ext, Qfile_name); |
2054 if ((i = XmuCursorNameToIndex (name_ext)) == -1) | 2046 if ((i = XmuCursorNameToIndex (name_ext)) == -1) |
2055 signal_simple_error ("Unrecognized cursor-font name", data); | 2047 invalid_argument ("Unrecognized cursor-font name", data); |
2056 | 2048 |
2057 x_initialize_pixmap_image_instance (ii, 1, IMAGE_POINTER); | 2049 x_initialize_pixmap_image_instance (ii, 1, IMAGE_POINTER); |
2058 IMAGE_INSTANCE_X_CURSOR (ii) = XCreateFontCursor (dpy, i); | 2050 IMAGE_INSTANCE_X_CURSOR (ii) = XCreateFontCursor (dpy, i); |
2059 foreground = find_keyword_in_vector (instantiator, Q_foreground); | 2051 foreground = find_keyword_in_vector (instantiator, Q_foreground); |
2060 if (NILP (foreground)) | 2052 if (NILP (foreground)) |
2263 if (IMAGE_INSTANCE_X_WIDGET_ID (p)->core.being_destroyed | 2255 if (IMAGE_INSTANCE_X_WIDGET_ID (p)->core.being_destroyed |
2264 || !XtIsManaged(IMAGE_INSTANCE_X_WIDGET_ID (p))) | 2256 || !XtIsManaged(IMAGE_INSTANCE_X_WIDGET_ID (p))) |
2265 { | 2257 { |
2266 Lisp_Object sw; | 2258 Lisp_Object sw; |
2267 XSETIMAGE_INSTANCE (sw, p); | 2259 XSETIMAGE_INSTANCE (sw, p); |
2268 signal_simple_error ("XEmacs bug: subwindow is deleted", sw); | 2260 signal_error (Qinternal_error, |
2261 "XEmacs bug: subwindow is deleted", sw); | |
2269 } | 2262 } |
2270 | 2263 |
2271 lw_add_widget_value_arg (wv, XtNwidth, | 2264 lw_add_widget_value_arg (wv, XtNwidth, |
2272 (Dimension)IMAGE_INSTANCE_WIDTH (p)); | 2265 (Dimension)IMAGE_INSTANCE_WIDTH (p)); |
2273 lw_add_widget_value_arg (wv, XtNheight, | 2266 lw_add_widget_value_arg (wv, XtNheight, |
2309 Mask valueMask = 0; | 2302 Mask valueMask = 0; |
2310 unsigned int w = IMAGE_INSTANCE_WIDTH (ii), | 2303 unsigned int w = IMAGE_INSTANCE_WIDTH (ii), |
2311 h = IMAGE_INSTANCE_HEIGHT (ii); | 2304 h = IMAGE_INSTANCE_HEIGHT (ii); |
2312 | 2305 |
2313 if (!DEVICE_X_P (XDEVICE (device))) | 2306 if (!DEVICE_X_P (XDEVICE (device))) |
2314 signal_simple_error ("Not an X device", device); | 2307 gui_error ("Not an X device", device); |
2315 | 2308 |
2316 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); | 2309 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); |
2317 xs = DefaultScreenOfDisplay (dpy); | 2310 xs = DefaultScreenOfDisplay (dpy); |
2318 | 2311 |
2319 IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW; | 2312 IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW; |
2470 int id = new_lwlib_id (); | 2463 int id = new_lwlib_id (); |
2471 widget_value* clip_wv; | 2464 widget_value* clip_wv; |
2472 XColor fcolor, bcolor; | 2465 XColor fcolor, bcolor; |
2473 | 2466 |
2474 if (!DEVICE_X_P (d)) | 2467 if (!DEVICE_X_P (d)) |
2475 signal_simple_error ("Not an X device", device); | 2468 gui_error ("Not an X device", device); |
2476 | 2469 |
2477 /* have to set the type this late in case there is no device | 2470 /* have to set the type this late in case there is no device |
2478 instantiation for a widget. But we can go ahead and do it without | 2471 instantiation for a widget. But we can go ahead and do it without |
2479 checking because there is always a generic instantiator. */ | 2472 checking because there is always a generic instantiator. */ |
2480 IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET; | 2473 IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET; |