diff options
author | Pavel Janík <Pavel@Janik.cz> | 2002-04-28 13:38:13 +0000 |
---|---|---|
committer | Pavel Janík <Pavel@Janik.cz> | 2002-04-28 13:38:13 +0000 |
commit | 2bad4ee209b4a7b1770f9777ef74b554a5f606bf (patch) | |
tree | 011b4e1828663e05ee899d28bbe68b94444eff84 /lwlib | |
parent | 9d5ebed11bf0de17bcf7441fa97297417dcb95f4 (diff) | |
download | emacs-2bad4ee209b4a7b1770f9777ef74b554a5f606bf.tar.gz |
Remove unused file.
Diffstat (limited to 'lwlib')
-rw-r--r-- | lwlib/ChangeLog | 3 | ||||
-rw-r--r-- | lwlib/Imakefile | 244 | ||||
-rw-r--r-- | lwlib/dispatch.c | 275 | ||||
-rw-r--r-- | lwlib/dispatch.h | 2 | ||||
-rw-r--r-- | lwlib/xrdb-cpp.c | 188 | ||||
-rw-r--r-- | lwlib/xrdb.c | 74 |
6 files changed, 2 insertions, 784 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 31805423a89..28626ddc255 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -4,7 +4,8 @@ (xrdb-cpp.o): Remove target. Remove unused defines. - * xrdb.c, xrdb-cpp.c, Imakefile: Remove unused file. + * xrdb.c, xrdb-cpp.c, Imakefile, dispatch.c, dispatch.h: + Remove unused file. * lwlib.c (instantiate_widget_instance): Remove duplicated prototype. diff --git a/lwlib/Imakefile b/lwlib/Imakefile deleted file mode 100644 index 86f2bc15f89..00000000000 --- a/lwlib/Imakefile +++ /dev/null @@ -1,244 +0,0 @@ -/**/# Imakefile file for liblw.a, Copyright (c) 1992-1993 Lucid, Inc. - -/* - * If you have Motif and want to provide support for Motif widgets in lwlib, - * then define USE_MOTIF. - * - * If you have OpenLook and want to provide support for OpenLook widgets in - * lwlib, then define USE_OLIT. - * - * Otherwise, define USE_LUCID to use Lucid's own Motif-lookalike widgets, - * which are included in this directory. - * - * You cannot define USE_MOTIF and USE_OLIT at the same time, but USE_LUCID - * may be defined along with either of the other two. - * - * The OLIT menubar is slow, and possibly buggy. We recommend against using - * it unless you'd like to try to improve it (which we encourage.) - * - * The Lucid menubar is much faster than the Motif menubar, but is missing - * a few features (most notably stay-up menus and keyboard traversal.) But - * since it has the Motif look-and-feel, we recommend using it even if you - * have Motif. - * - * Currently, only the Motif widgets provide support for dialog boxes. If - * you don't have Motif, you will not be able to pop up dialog boxes from - * emacs. If you define both USE_LUCID and USE_MOTIF, then the menus will - * be implemented with Lucid widgets, and the dialog boxes will be - * implemented with Motif widgets. - * - * It shouldn't take much work to add support for non-Motif dialog boxes; - * all that one need do is add code that implements Athena versions of the - * xm_create_dialog(), xm_update_one_widget(), and xm_update_one_value() - * routines in lwlib-Xm.c. If you do this, please send us the code. - * - * If you have your X11 source tree online, then you should define - * INCLUDE_EXTENSIONS to cause this library to contain some useful functions - * which Xt should provide but doesn't. You can only do this if you have - * the source tree online, because these functions require access to internal - * Xt data structures that are not defined in the exported header files. - * If you define INCLUDE_EXTENSIONS, then the variable $TOP must point at the - * root of the X11 source tree. - * - * To build a "shared" version of lwlib as well, define BUILD_SHARED_LIB. - * If INCLUDE_EXTENSIONS is defined, and you want to link with a dynamic - * version of Xt, it may be necessary to build a shared version of lwlib as - * well, as the X libraries sometimes put *different code* in the dynamic - * and shared versions of their libraries, for some reason I don't understand. - * - * Remember, if you build and install a shared version of lwlib, you may need - * to run ldconfig(8) before anything will realize that it exists. - * - * To compile with support for Lucid's Energize Programming System, you must - * define all of ENERGIZE, USE_LUCID, USE_MOTIF, and INCLUDE_EXTENSIONS. - */ - -#define USE_LUCID -/* #define USE_MOTIF */ -/* #define USE_OLIT */ -/* #define BUILD_SHARED_LIB */ -/* #define ENERGIZE */ - -/* #define INCLUDE_EXTENSIONS */ - - -#ifdef INCLUDE_EXTENSIONS /* this is where it is at our site */ - TOP = /$(WHICH_X)/mit -#endif - -/* - * - * You shouldn't need to edit anything below this point. - * - */ - -#ifdef ENERGIZE -# if !defined(USE_LUCID) || !defined(USE_MOTIF) || !defined(INCLUDE_EXTENSIONS) -ERROR! Energize requires Lucid widgets, Motif, and X Extensions. -# endif -#endif /* ENERGIZE */ - - -#ifdef BUILD_SHARED_LIB -SOLWREV=1.0 -#endif - -#if (ProjectX == 4) - STD_DEFINES = LibraryDefines - CDEBUGFLAGS = LibraryCDebugFlags - EXT_DEFINES = -DTHIS_IS_X11R4 - WHICH_X = x11r4 -#define SpecialLibObjectRule SpecialObjectRule -#else /* !4 */ -#if (ProjectX == 5) -#ifdef BUILD_SHARED_LIB -# define DoSharedLib YES -# define DoNormalLib YES -#endif -#include <Library.tmpl> - EXT_DEFINES = -DTHIS_IS_X11R5 -DINCLUDE_ALLOCA_H - WHICH_X = x11r5 -#else /* !5 */ - EXT_DEFINES = "ERROR! Imakefile was unable to determine whether this is X11r4 or X11r5." -#endif /* !5 */ -#endif /* !4 */ - - LUCID_SRCS = lwlib-Xlw.c xlwmenu.c - LUCID_OBJS = lwlib-Xlw.o xlwmenu.o - MOTIF_SRCS = lwlib-Xm.c - MOTIF_OBJS = lwlib-Xm.o - OLIT_SRCS = lwlib-Xol.c lwlib-Xol-mb.c - OLIT_OBJS = lwlib-Xol.o lwlib-Xol-mb.o - -#ifdef INCLUDE_EXTENSIONS - EXT_SRCS = dispatch.c xrdb-cpp.c xrdb.c - EXT_OBJS = dispatch.o xrdb-cpp.o xrdb.o -#endif - -#if (defined(USE_MOTIF) && defined(USE_OLIT)) -TOOLKIT_DEFINES = "ERROR! You cannot define both USE_MOTIF and USE_OLIT at the same time (in Imakefile)." -#else -# if (defined(USE_MOTIF) && defined(USE_LUCID)) -TOOLKIT_DEFINES = -DUSE_MOTIF -DUSE_LUCID - TOOLKIT_SRCS = $(MOTIF_SRC) $(LUCID_SRCS) - TOOLKIT_OBJS = $(MOTIF_OBJS) $(LUCID_OBJS) -# else -# if (defined(USE_OLIT) && defined(USE_LUCID)) - DEFINES = -DUSE_OLIT -DUSE_LUCID - TOOLKIT_SRCS = $(OLIT_SRC) $(LUCID_SRCS) - TOOLKIT_OBJS = $(OLIT_OBJS) $(LUCID_OBJS) -# else -# if defined(USE_OLIT) -TOOLKIT_DEFINES = -DUSE_OLIT - TOOLKIT_SRCS = $(OLIT_SRC) - TOOLKIT_OBJS = $(OLIT_OBJS) -# else -# if defined(USE_MOTIF) -TOOLKIT_DEFINES = -DUSE_MOTIF - TOOLKIT_SRCS = $(MOTIF_SRC) - TOOLKIT_OBJS = $(MOTIF_OBJS) -# else -# if defined(USE_LUCID) -TOOLKIT_DEFINES = -DUSE_LUCID - TOOLKIT_SRCS = $(LUCID_SRC) - TOOLKIT_OBJS = $(LUCID_OBJS) -# else -TOOLKIT_DEFINES = "ERROR! At least one of USE_MOTIF, USE_LUCID or USE_OLIT must be defined in Imakefile." -# endif -# endif -# endif -# endif -# endif -#endif - -#ifdef ENERGIZE -# ifndef USE_MOTIF - EZ_OBJS = "ERROR! ENERGIZE requires USE_MOTIF to be defined in Imakefile." -# else - EZ_OBJS = energize/blpsheet.o energize/build.o energize/classbr_ps.o \ - energize/ctreebr_ps.o energize/debuggerps.o \ - energize/editmode.o energize/leb_psheet.o \ - energize/projectdisp.o energize/projectps.o \ - energize/search.o energize/target.o - ENERGIZEP = -DENERGIZE -# endif -#endif - - SRCS = lwlib.c $(TOOLKIT_SRCS) lwlib-utils.c $(EXT_SRCS) - OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o $(EXT_OBJS) $(EZ_OBJS) - EXT_FLAGS = -I$(TOOLKITSRC) $(EXT_DEFINES) - LIBNAME = liblw.a - - -#if defined(ENERGIZE) && defined(BUILD_SHARED_LIB) -all:: - @if [ ! -d shared ]; then mkdir shared; else exit 0; fi - @if [ ! -d energize/shared ]; then mkdir energize/shared; \ - else exit 0; fi - @if [ ! -h shared/energize ]; \ - then cd shared ; ln -s ../energize/shared energize ; \ - else exit 0; fi - -clean:: - $(RM) shared/energize -#endif - - -#ifdef BUILD_SHARED_LIB -# if (ProjectX == 4) -SharedLibraryObjectRule () -NormalSharedLibraryTarget(lw,$(SOLWREV),$(OBJS)) -# else /* X != 4 */ -LibraryObjectRule () -SharedLibraryTarget(lw,$(SOLWREV),$(OBJS),shared,..) -# endif /* X != 4 */ -#else /* !BUILD_SHARED_LIB */ -NormalLibraryObjectRule () -#endif /* !BUILD_SHARED_LIB */ - -NormalLibraryTarget (lw,$(OBJS)) -MakefileSubdirs (energize) -DependTarget () - -#ifdef ENERGIZE - -energize/Imakefile: - -mkdir energize - -(cd energize ; sh -c "ln -s ../$(VPATH)/energize/* .") - -/* #### we should automatically edit BUILD_SHARED_LIB into/out of the energize - Imakefile, since that's the only thing down there that changes */ -energize/Makefile: energize/Imakefile Imakefile - $(MAKE) $(MFLAGS) Makefiles - -Makefile:: - $(RM) energize/Makefile - -$(EZ_OBJS): energize/Makefile - ${RM} $@ ; cd energize ; $(MAKE) $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" - -clean:: - cd energize ; $(MAKE) $(MFLAGS) clean - -#endif - -#if defined(BUILD_SHARED_LIB) && (ProjectX == 4) -# define LWObjectRule SpecialSharedObjectRule -#else -# define LWObjectRule SpecialLibObjectRule -#endif - -CPPDEFS=-DCPP_PROGRAM=\"CppCmd\" - -LWObjectRule (lwlib.o, lwlib.c, $(TOOLKIT_DEFINES)) -LWObjectRule (dispatch.o, dispatch.c, $(EXT_FLAGS)) -LWObjectRule (xrdb-cpp.o, xrdb-cpp.c, $(EXT_FLAGS) "$(CPPDEFS)") -LWObjectRule (xrdb.o, xrdb.c, $(EXT_FLAGS)) -LWObjectRule (lwlib-Xm.o, lwlib-Xm.c, $(ENERGIZEP)) - -lwlib-utils.o: lwlib-utils.h -lwlib.o: lwlib.h lwlib-internal.h -lwlib-Xlw.o: lwlib.h lwlib-internal.h -lwlib-Xm.o: lwlib.h lwlib-internal.h lwlib-utils.h -lwlib-Xol.o: lwlib.h lwlib-internal.h -lwlib-Xol-mb.o: lwlib-Xol-mb.h lwlib-Xol-mbP.h diff --git a/lwlib/dispatch.c b/lwlib/dispatch.c deleted file mode 100644 index 7e70a43105b..00000000000 --- a/lwlib/dispatch.c +++ /dev/null @@ -1,275 +0,0 @@ -/* Defines a function to find the Widget that XtDispatchEvent() would use. - Copyright (C) 1992 Lucid, Inc. - -This file is part of the Lucid Widget Library. - -The Lucid Widget Library is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -The Lucid Widget Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* - * The function XtWidgetToDispatchTo(), given an XEvent, returns the - * widget that XtDispatchEvent() would send that event to if called now. - * This file copies much code from the X11r4 Xt source, and is thus a - * portability problem. It also requires data structures defined in - * IntrinsicI.h, which is a non-exported Xt header file, so you can't - * compile this file unless you have the Xt sources online. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <IntrinsicI.h> /* Don't change this: see comments in Imakefile. */ -#include <X11/Xatom.h> -#include "dispatch.h" - -#include <X11/Xlib.h> -#include <X11/cursorfont.h> -#include <X11/Xutil.h> - -#ifdef XlibSpecificationRelease -#if XlibSpecificationRelease >= 5 -#define HAVE_X11R5 -#endif -#endif - -/* ## All of the code on this page was copied from the X11R5 lib/Xt/Event.c, - ## but is compatible with X11R4; the code in Event.c is different, but - ## functionally equivalent for our purposes. - */ - -#if __STDC__ -#define Const const -#else -#define Const /**/ -#endif - -#define NonMaskableMask ((EventMask)0x80000000L) - -#define COMP_EXPOSE (widget->core.widget_class->core_class.compress_exposure) -#define COMP_EXPOSE_TYPE (COMP_EXPOSE & 0x0f) -#define GRAPHICS_EXPOSE ((XtExposeGraphicsExpose & COMP_EXPOSE) || \ - (XtExposeGraphicsExposeMerged & COMP_EXPOSE)) -#define NO_EXPOSE (XtExposeNoExpose & COMP_EXPOSE) - - -/* -- lots of stuff we don't need to copy, omitted -- */ - - -static EventMask Const masks[] = { - 0, /* Error, should never see */ - 0, /* Reply, should never see */ - KeyPressMask, /* KeyPress */ - KeyReleaseMask, /* KeyRelease */ - ButtonPressMask, /* ButtonPress */ - ButtonReleaseMask, /* ButtonRelease */ - PointerMotionMask /* MotionNotify */ - | ButtonMotionMask, - EnterWindowMask, /* EnterNotify */ - LeaveWindowMask, /* LeaveNotify */ - FocusChangeMask, /* FocusIn */ - FocusChangeMask, /* FocusOut */ - KeymapStateMask, /* KeymapNotify */ - ExposureMask, /* Expose */ - NonMaskableMask, /* GraphicsExpose, in GC */ - NonMaskableMask, /* NoExpose, in GC */ - VisibilityChangeMask, /* VisibilityNotify */ - SubstructureNotifyMask, /* CreateNotify */ - StructureNotifyMask /* DestroyNotify */ - | SubstructureNotifyMask, - StructureNotifyMask /* UnmapNotify */ - | SubstructureNotifyMask, - StructureNotifyMask /* MapNotify */ - | SubstructureNotifyMask, - SubstructureRedirectMask, /* MapRequest */ - StructureNotifyMask /* ReparentNotify */ - | SubstructureNotifyMask, - StructureNotifyMask /* ConfigureNotify */ - | SubstructureNotifyMask, - SubstructureRedirectMask, /* ConfigureRequest */ - StructureNotifyMask /* GravityNotify */ - | SubstructureNotifyMask, - ResizeRedirectMask, /* ResizeRequest */ - StructureNotifyMask /* CirculateNotify */ - | SubstructureNotifyMask, - SubstructureRedirectMask, /* CirculateRequest */ - PropertyChangeMask, /* PropertyNotify */ - NonMaskableMask, /* SelectionClear */ - NonMaskableMask, /* SelectionRequest */ - NonMaskableMask, /* SelectionNotify */ - ColormapChangeMask, /* ColormapNotify */ - NonMaskableMask, /* ClientMessage */ - NonMaskableMask /* MappingNotify */ -}; - -#ifndef HAVE_X11R5 - -static /* in R5, this is not static, so we don't need to define it at all */ -EventMask _XtConvertTypeToMask (eventType) - int eventType; -{ - eventType &= 0x7f; /* Events sent with XSendEvent have high bit set. */ - if (eventType < XtNumber(masks)) - return masks[eventType]; - else - return 0; -} - -#endif /* not HAVE_X11R5 */ - -/* -- _XtOnGrabList() omitted -- */ - - -static Widget LookupSpringLoaded(grabList) - XtGrabList grabList; -{ - XtGrabList gl; - - for (gl = grabList; gl != NULL; gl = gl->next) { - if (gl->spring_loaded) - if (XtIsSensitive(gl->widget)) - return gl->widget; - else - return NULL; - if (gl->exclusive) break; - } - return NULL; -} - - - -/* This function is new. */ - -static Boolean WouldDispatchEvent(event, widget, mask, pd) - register XEvent *event; - Widget widget; - EventMask mask; - XtPerDisplay pd; -{ - XtEventRec *p; - Boolean would_dispatched = False; - - if ((mask == ExposureMask) || - ((event->type == NoExpose) && NO_EXPOSE) || - ((event->type == GraphicsExpose) && GRAPHICS_EXPOSE) ) - if (widget->core.widget_class->core_class.expose != NULL ) - return True; - - - if ((mask == VisibilityChangeMask) && - XtClass(widget)->core_class.visible_interest) - return True; - - for (p=widget->core.event_table; p != NULL; p = p->next) - if ((mask & p->mask) != 0 -#ifndef HAVE_X11R5 - || (mask == 0 && p->non_filter) -#endif - ) - return True; - - return False; -} - - -/* #### This function is mostly copied from DecideToDispatch(). - */ - -typedef enum _GrabType {pass, ignore, remap} GrabType; - -Widget -XtWidgetToDispatchTo (XEvent* event) -{ - register Widget widget; - EventMask mask; - GrabType grabType; - Widget dspWidget; - Time time = 0; - XtPerDisplay pd; - XtPerDisplayInput pdi; - XtGrabList grabList; - - widget = XtWindowToWidget (event->xany.display, event->xany.window); - pd = _XtGetPerDisplay(event->xany.display); - pdi = _XtGetPerDisplayInput(event->xany.display); - grabList = *_XtGetGrabList(pdi); - - mask = _XtConvertTypeToMask(event->xany.type); - grabType = pass; - switch (event->xany.type & 0x7f) { - case KeyPress: - case KeyRelease: grabType = remap; break; - case ButtonPress: - case ButtonRelease: grabType = remap; break; - case MotionNotify: grabType = ignore; -#define XKnownButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ - Button4MotionMask|Button5MotionMask) - mask |= (event->xmotion.state & XKnownButtons); -#undef XKnownButtons - break; - case EnterNotify: grabType = ignore; break; - } - - if (widget == NULL) { - if (grabType != remap) return False; - /* event occurred in a non-widget window, but we've promised also - to dispatch it to the nearest accessible spring_loaded widget */ - else if ((widget = LookupSpringLoaded(grabList)) != NULL) - return widget; - return False; - } - - switch(grabType) { - case pass: - return widget; - - case ignore: - if ((grabList == NULL || _XtOnGrabList(widget,grabList)) - && XtIsSensitive(widget)) { - return widget; - } - return NULL; - - case remap: - - { - Widget was_dispatched_to= NULL; - extern Widget _XtFindRemapWidget(); - extern void _XtUngrabBadGrabs(); - - dspWidget = _XtFindRemapWidget(event, widget, mask, pdi); - - if ((grabList == NULL || - _XtOnGrabList(dspWidget, grabList)) && - XtIsSensitive(dspWidget)) { - if (WouldDispatchEvent (event, dspWidget, mask, pd)) - was_dispatched_to = dspWidget; - } - - /* Also dispatch to nearest accessible spring_loaded. */ - /* Fetch this afterward to reflect modal list changes */ - grabList = *_XtGetGrabList(pdi); - widget = LookupSpringLoaded(grabList); - if (widget != NULL && widget != dspWidget) { - if (!was_dispatched_to) - was_dispatched_to = widget; - } - - return was_dispatched_to; - } - } - /* should never reach here */ - return NULL; -} diff --git a/lwlib/dispatch.h b/lwlib/dispatch.h deleted file mode 100644 index 175284508f4..00000000000 --- a/lwlib/dispatch.h +++ /dev/null @@ -1,2 +0,0 @@ - -Widget XtWidgetToDispatchTo (XEvent *); diff --git a/lwlib/xrdb-cpp.c b/lwlib/xrdb-cpp.c deleted file mode 100644 index b6a167c0517..00000000000 --- a/lwlib/xrdb-cpp.c +++ /dev/null @@ -1,188 +0,0 @@ -/* A general interface to the widgets of different toolkits. - Copyright (C) 1992, 1993 Lucid, Inc. - -This file is part of the Lucid Widget Library. - -The Lucid Widget Library is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -The Lucid Widget Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This code reads a resource database file and filters it through cpp - with the same set of preprocessor defines that `xrdb' uses. - Call lwlib_xrdb_initialize(dpy) once, and then call the function - lwlib_GetFileDatabase() instead of XrmGetFileDatabase(), - and lwlib_CombineFileDatabase() instead of XrmCombineFileDatabase(). - */ - -#ifndef __STDC_EXTENDED__ -#define __STDC_EXTENDED__ -#endif - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <ctype.h> -#include <X11/Xlib.h> -#include <X11/Xos.h> -#include <X11/Intrinsic.h> -#include <X11/Xmu/SysUtil.h> -#include <sys/stat.h> - -extern char *index (); - -static int -file_p (path) - char *path; -{ - struct stat status; - - return (access (path, R_OK) == 0 /* exists and is readable */ - && stat (path, &status) == 0 /* get the status */ - && (status.st_mode & S_IFDIR) == 0); /* not a directory */ -} - -#ifndef CPP_PROGRAM -#define CPP_PROGRAM "/lib/cpp" -#endif - -static char cpp_string [BUFSIZ]; -static char *cpp_file = 0; - -#define Resolution(pixels, mm) ((((pixels) * 100000 / (mm)) + 50) / 100) - -void -lwlib_xrdb_initialize (display) - Display *display; -{ - Screen *screen; - Visual *visual; - char server [255]; - char *colon, *s; - -#define Push(str) \ - (strncpy (s, str, sizeof(str)), s += (sizeof(str)-1)) - -#define Print(str, thing) \ - (sprintf (s, str, thing), s = index (s, 0)) - - s = cpp_string; - Push (CPP_PROGRAM); - - Push (" -DCLIENTHOST="); - XmuGetHostname (s, sizeof (cpp_string) - (s - cpp_string)); - s = index (s, 0); - Push (" -DSERVERHOST="); - strcpy (s, XDisplayName (DisplayString (display))); - colon = index (s, ':'); - if (colon == s) - { - XmuGetHostname (s, sizeof (cpp_string) - (s - cpp_string)); - s = index (s, 0); - } - else if (colon) - s = colon; - else - s = index (s, 0); - - Print (" -DVERSION=%d", ProtocolVersion(display)); - Print (" -DREVISION=%d", ProtocolRevision(display)); - Print (" -DVENDOR=\"%s\"", ServerVendor(display)); - Print (" -DRELEASE=%d", VendorRelease(display)); - screen = DefaultScreenOfDisplay(display); - visual = DefaultVisualOfScreen(screen); - Print (" -DWIDTH=%d", screen->width); - Print (" -DHEIGHT=%d", screen->height); - Print (" -DX_RESOLUTION=%d", Resolution(screen->width,screen->mwidth)); - Print (" -DY_RESOLUTION=%d", Resolution(screen->height,screen->mheight)); - Print (" -DPLANES=%d", DisplayPlanes(display, DefaultScreen(display))); - Print (" -DBITS_PER_RGB=%d", visual->bits_per_rgb); - switch(visual->class) { - case StaticGray: Print (" -DCLASS=%s", "StaticGray"); break; - case GrayScale: Print (" -DCLASS=%s", "GrayScale"); break; - case StaticColor: Print (" -DCLASS=%s", "StaticColor"); - Print (" -DCOLOR", 0); break; - case PseudoColor: Print (" -DCLASS=%s", "PseudoColor"); - Print (" -DCOLOR", 0); break; - case TrueColor: Print (" -DCLASS=%s", "TrueColor"); - Print (" -DCOLOR", 0); break; - case DirectColor: Print (" -DCLASS=%s", "DirectColor"); - Print (" -DCOLOR", 0); break; - default: - fprintf (stderr, "unexpected visual class=%d\n", visual->class); - exit (-1); - } - *s++ = ' '; - *s = 0; - cpp_file = s; -} - -XrmDatabase -lwlib_GetFileDatabase (path) - char *path; -{ - XrmDatabase db = 0; - char line [BUFSIZ]; - char *s; - FILE *file; - - if (! file_p (path)) - return 0; - - strcpy (cpp_file, path); - if (! (file = popen (cpp_string, "r"))) - { - fprintf (stderr, - "couldn't execute %s; resource file %s file not munged.\n", - CPP_PROGRAM, path); - return XrmGetFileDatabase (path); - } - while (s = fgets (line, sizeof (line), file)) - { - char ch, *tail; - if (*s == '!') continue; - for (; ((ch = *s) != '\n') && isspace(ch); s++); - if ((ch == '\0') || (ch == '\n') || (ch == '#')) continue; - tail = s + strlen (s); - if (tail - s < 3) continue; /* this would be syntactically incorrect */ - while (*(tail-1) == '\n' && /* handle \ at end of line */ - *(tail-2) == '\\') - { - if (! fgets (tail, sizeof (line) - (tail - line), file)) - continue; - tail += strlen (tail); - } - XrmPutLineResource (&db, s); - } - pclose (file); - return db; -} - -#ifdef THIS_IS_X11R5 - -int -lwlib_CombineFileDatabase (path, target_db, override) - char *path; - XrmDatabase *target_db; - Bool override; -{ - XrmDatabase source_db = lwlib_GetFileDatabase (path); - if (! source_db) - return (! file_p (path)); - XrmCombineDatabase (source_db, target_db, override); - return 1; -} - -#endif /* r5 */ diff --git a/lwlib/xrdb.c b/lwlib/xrdb.c deleted file mode 100644 index d777c303d61..00000000000 --- a/lwlib/xrdb.c +++ /dev/null @@ -1,74 +0,0 @@ -/* This file overrides the R4 or R5 mit/lib/Xt/Initialize.c, except that - the functions lwlib_GetFileDatabase(), lwlib_CombineFileDatabase(), and - lwlib_xrdb_initialize() are called. By doing this silly cpp hack, we - avoid version skew problems. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <X11/Xlib.h> -#include <X11/cursorfont.h> -#include <X11/Xutil.h> - -#ifdef XlibSpecificationRelease -#if XlibSpecificationRelease >= 5 -#define HAVE_X11R5 -#endif -#endif - -extern struct _XrmHashBucketRec *lwlib_GetFileDatabase (); -extern void lwlib_xrdb_initialize (); - -/* Replace all calls to XrmGetFileDatabase() with lwlib_GetFileDatabase(), - calls to XrmCombineFileDatabase() with lwlib_CombineFileDatabase(), and - rename the defined _XtDisplayInitialize() function. - */ -#define XrmGetFileDatabase lwlib_GetFileDatabase -#define XrmCombineFileDatabase lwlib_CombineFileDatabase -#define _XtDisplayInitialize _orig_XtDisplayInitialize - -/* Suck in the original code. Don't change this: see comments in Imakefile. */ -#include "Initialize.c" - -#undef XrmGetFileDatabase -#undef XrmCombineFileDatabase -#undef _XtDisplayInitialize - -/* Now provide a definition of _XtDisplayInitialize() which invokes the - original code after calling our initialization hook. Note that the R4 - and R5 versions of _XtDisplayInitialize() take different arguments. - */ - -#ifndef HAVE_X11R5 - -void _XtDisplayInitialize(dpy, pd, name, class, urlist, num_urs, argc, argv) - Display *dpy; - XtPerDisplay pd; - String name, class; - XrmOptionDescRec *urlist; - Cardinal num_urs; - Cardinal *argc; - char *argv[]; -{ - lwlib_xrdb_initialize(dpy); - _orig_XtDisplayInitialize(dpy, pd, name, class, urlist, num_urs, argc, argv); -} - -#else /* HAVE_X11R5 */ - -void _XtDisplayInitialize(dpy, pd, name, urlist, num_urs, argc, argv) - Display *dpy; - XtPerDisplay pd; - String name; - XrmOptionDescRec *urlist; - Cardinal num_urs; - int *argc; - char **argv; -{ - lwlib_xrdb_initialize(dpy); - _orig_XtDisplayInitialize(dpy, pd, name, urlist, num_urs, argc, argv); -} - -#endif /* HAVE_X11R5 */ |