wdvi

network DVI viewer
Log | Files | Refs

commit a8708ef3b40049fb041865a7172b46c44b6557ad
parent 6aff3948636798995b5755f126654805aa67254f
Author: Kyle Milz <milz@macbook.0x30.net>
Date:   Tue, 18 Aug 2020 16:14:29 -0700

unifdef -DXtSpecificationRelease=7

X specification release has been > 6 since 2001.

Diffstat:
Mevents.c | 17-----------------
Mpopups.c | 9---------
Mxdvi.c | 153-------------------------------------------------------------------------------
Mxdvi.h | 2+-
4 files changed, 1 insertion(+), 180 deletions(-)

diff --git a/events.c b/events.c @@ -42,7 +42,6 @@ NOTE: #include <X11/Shell.h> /* needed for def. of XtNiconX */ -#if XtSpecificationRelease >= 4 # include <X11/Xaw/Viewport.h> # include <X11/cursorfont.h> @@ -53,22 +52,6 @@ NOTE: #define BUTTON_WIDGET_CLASS commandWidgetClass #endif /* BUTTONS */ -#else /* XtSpecificationRelease < 4 */ - -#if NeedFunctionPrototypes -typedef void *XtPointer; -#else -typedef char *XtPointer; -#endif - -#include <X11/Viewport.h> -#ifdef BUTTONS -#include <X11/Command.h> -#define PANEL_WIDGET_CLASS compositeWidgetClass -#define BUTTON_WIDGET_CLASS commandWidgetClass -#endif - -#endif /* XtSpecificationRelease */ #if HAVE_XKB_BELL_EXT diff --git a/popups.c b/popups.c @@ -45,15 +45,6 @@ IN THE SOFTWARE. # include <X11/Xaw/Toggle.h> # include <X11/Xaw/AsciiText.h> # include <X11/Xaw/Viewport.h> -# if XtSpecificationRelease < 5 -# define XawChainLeft XtChainLeft -# define XawChainRight XtChainRight -# define XawChainTop XtChainTop -# define XawChainBottom XtChainBottom -# endif -# if XtSpecificationRelease < 6 -# define XawFmt8Bit FMT8BIT -# endif #if !defined(S_ISDIR) && defined(S_IFDIR) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) diff --git a/xdvi.c b/xdvi.c @@ -140,7 +140,6 @@ extern double atof ARGS((const char *)); #include <X11/Shell.h> /* needed for def. of XtNiconX */ -#if XtSpecificationRelease >= 4 # include <X11/Xaw/Viewport.h> #define VPORT_WIDGET_CLASS viewportWidgetClass @@ -151,27 +150,7 @@ extern double atof ARGS((const char *)); #define FORM_WIDGET_CLASS formWidgetClass #endif /* BUTTONS */ -#else /* XtSpecificationRelease < 4 */ -#if NeedFunctionPrototypes -typedef void *XtPointer; -#else -typedef char *XtPointer; -#endif - -#include <X11/Viewport.h> -#define VPORT_WIDGET_CLASS viewportWidgetClass -#define DRAW_WIDGET_CLASS drawWidgetClass -#ifdef BUTTONS -#include <X11/Command.h> -#define FORM_WIDGET_CLASS formWidgetClass -#endif - -#endif /* XtSpecificationRelease */ - -# if XtSpecificationRelease < 5 -# define XtScreenDatabase(s) (DISP->db) -# endif # if HAVE_X11_INTRINSICI_H # include <X11/IntrinsicI.h> @@ -1040,7 +1019,6 @@ static Arg set_wh_args[] = { * visual and colormap are in use). */ -#if XtSpecificationRelease >= 5 /*ARGSUSED*/ static Boolean @@ -1069,93 +1047,6 @@ XdviCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret); } -#else /* XtSpecificationRelease < 5 */ - -/* - * Copied from the X11R4 source code. - */ - -#define done(type, value) \ - { \ - if (toVal->addr != NULL) { \ - if (toVal->size < sizeof(type)) { \ - toVal->size = sizeof(type); \ - return False; \ - } \ - *(type*)(toVal->addr) = (value); \ - } \ - else { \ - static type static_val; \ - static_val = (value); \ - toVal->addr = (XtPointer)&static_val; \ - } \ - toVal->size = sizeof(type); \ - return True; \ - } - -static Boolean -XdviCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; -{ - String str = (String)fromVal->addr; - XColor screenColor; - XColor exactColor; - Screen *screen; - Colormap colormap; - Status status; - String params[1]; - Cardinal num_params=1; - - if (*num_args != 2) - XtErrorMsg("wrongParameters", "cvtStringToPixel", - "XtToolkitError", - "String to pixel conversion needs screen and colormap arguments", - (String *)NULL, (Cardinal *)NULL); - - screen = *((Screen **) args[0].addr); - colormap = *((Colormap *) args[1].addr); - - if (strcmp(str, XtDefaultBackground) == 0) { - *closure_ret = False; - str = (resource.reverse ? "black" : "white"); - } - else if (strcmp(str, XtDefaultForeground) == 0) { - *closure_ret = False; - str = (resource.reverse ? "white" : "black"); - } - - if (*str == '#') { /* some color rgb definition */ - - status = XParseColor(DisplayOfScreen(screen), colormap, - (char*)str, &screenColor); - - if (status != 0) - status = XAllocColor(DisplayOfScreen(screen), colormap, - &screenColor); - } else /* some color name */ - - status = XAllocNamedColor(DisplayOfScreen(screen), colormap, - (char*)str, &screenColor, &exactColor); - if (status == 0) { - params[0] = str; - XtWarningMsg("noColormap", "cvtStringToPixel", - "XtToolkitError", - "Cannot allocate colormap entry for \"%s\"", - params,&num_params); - return False; - } else { - *closure_ret = (char*)True; - done(Pixel, screenColor.pixel); - } -} -#undef done - -#endif /* XtSpecificationRelease < 5 */ /* * Convert string to yes/no/maybe. Adapted from the X toolkit. @@ -2299,19 +2190,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr); { XrmDatabase db; -#if XtSpecificationRelease < 5 - - db = DISP->db; - - XrmPutStringResource(&db, -# if BUTTONS - "XDvi.form.translations", -# else - "XDvi.vport.translations", -# endif - base_translations); - -#else /* XtSpecificationRelease >= 5 */ db = XtScreenDatabase(SCRN); @@ -2332,7 +2210,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr); # endif resource.main_translations); -#endif /* XtSpecificationRelease */ /* Notwithstanding the ampersand, XrmPutStringResource() does * not change db (X11R6.4 source). */ @@ -2365,36 +2242,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr); vport_widget, draw_args, XtNumber(draw_args)); -#if XtSpecificationRelease < 5 - if (resource.main_translations != NULL) { - XtTranslations xlats; - - xlats = XtParseTranslationTable(resource.main_translations); - - for (;;) { /* not really a loop */ - const char *p1; - const char *p2; - - p1 = resource.main_translations; - while (*p1 == ' ' || *p1 == '\t') ++p1; - if (*p1 == '#') { - ++p1; - p2 = p1; - while (*p2 >= 'a' && *p2 <= 'z') ++p2; - if (p2 - p1 == 7 && memcmp(p1, "augment", 7) == 0) { - XtAugmentTranslations(form_or_vport, xlats); - break; - } - if (p2 - p1 == 8 && memcmp(p1, "override", 8) == 0) { - XtOverrideTranslations(form_or_vport, xlats); - break; - } - } - XtVaSetValues(form_or_vport, XtNtranslations, xlats, NULL); - break; - } - } -#endif /* XtSpecificationRelease */ XtOverrideTranslations( form_or_vport, diff --git a/xdvi.h b/xdvi.h @@ -95,7 +95,7 @@ NOTE: #include <X11/Intrinsic.h> -#if (defined(VMS) && (XtSpecificationRelease <= 4)) || defined(lint) +#if defined(lint) # include <X11/IntrinsicP.h> #endif