--- Imakefile +++ Imakefile 2008-05-23 13:21:22.761816212 +0200 @@ -150,7 +150,7 @@ SYS_LIBRARIES= -lm DEPLIBS = $(LIBJPEG) $(LIBTIFF) -LOCAL_LIBRARIES = $(XLIB) $(DEPLIBS) +LOCAL_LIBRARIES = $(XLIB) $(XTOOLLIB) $(DEPLIBS) DEFINES= $(SCO) $(UNIX) $(NODIRENT) $(VPRINTF) $(TIMERS) \ $(HPUX7) $(JPEG) $(TIFF) $(PDS) $(DXWM) $(RAND) \ --- xv.c +++ xv.c 2008-05-23 13:03:36.000000000 +0200 @@ -153,6 +153,8 @@ double gamval, rgamval, ggamval, bgamval +XtAppContext context; + /*******************************************/ int main(argc, argv) int argc; @@ -167,6 +169,12 @@ int main(argc, argv) Window rootReturn, parentReturn, *children; unsigned int numChildren, rootDEEP; +#ifdef AUTO_EXPAND + signal(SIGHUP, SIG_IGN); +#endif +#ifndef NOSIGNAL + signal(SIGQUIT, SIG_IGN); +#endif #ifdef VMS /* convert VMS-style arguments to unix names and glob */ @@ -1195,6 +1203,10 @@ static void parseResources(argc, argv) exit(1); } + i = 0; + XtToolkitInitialize(); + context = XtCreateApplicationContext(); + XtDisplayInitialize(context, theDisp, NULL, "XV", NULL, 0, &i, argv); if (rd_str ("aspect")) { --- xv.h +++ xv.h 2008-05-23 12:25:12.000000000 +0200 @@ -1995,10 +1995,6 @@ int Rmvdir PARM((char *) int Movevdir PARM((char *, char *)); int Isarchive PARM((char *)); int Isvdir PARM((char *)); -void vd_HUPhandler PARM((void)); -void vd_handler PARM((int)); -int vd_Xhandler PARM((Display *, XErrorEvent *)); -int vd_XIOhandler PARM((Display *)); void vd_handler_setup PARM((void)); /*************************** XVPOPUP.C ***************************/ --- xvevent.c +++ xvevent.c 2008-05-23 12:18:44.000000000 +0200 @@ -51,6 +51,7 @@ static void CropKey PARM((int static void TrackPicValues PARM((int, int)); static int CheckForConfig PARM((void)); static Bool IsConfig PARM((Display *, XEvent *, char *)); +static void QuitOnInterrupt PARM((XtPointer dummy, XtSignalId* Id)); static void onInterrupt PARM((int)); static void Paint PARM((void)); @@ -65,6 +66,11 @@ static void blurPixel PARM((int static void annotatePic PARM((void)); +#ifndef NOSIGNAL +static XtSignalId IdQuit = 0; +extern XtAppContext context; +#endif + /****************/ int EventLoop() /****************/ @@ -81,6 +87,9 @@ int EventLoop() #ifndef NOSIGNAL + if (IdQuit) + XtRemoveSignal(IdQuit); + IdQuit = XtAppAddSignal(context, QuitOnInterrupt, NULL); signal(SIGQUIT, onInterrupt); #endif @@ -124,7 +133,11 @@ int EventLoop() in real-time (polling, flashing the selection, etc.) get next event */ if ((waitsec<0.0 && !polling && !HaveSelection()) || XPending(theDisp)>0) { +#ifndef NOSIGNAL + XtAppNextEvent(context, &event); +#else XNextEvent(theDisp, &event); +#endif retval = HandleEvent(&event,&done); } @@ -2531,8 +2544,7 @@ int xvErrorHandler(disp, err) /************************************************************************/ -static void onInterrupt(i) - int i; +static void QuitOnInterrupt(XtPointer dummy, XtSignalId* Id) { /* but first, if any input-grabbing popups are active, we have to 'cancel' them. */ @@ -2573,6 +2585,10 @@ static void onInterrupt(i) frominterrupt = 1; } +static void onInterrupt(int i) +{ + XtNoticeSignal(IdQuit); +} --- xvvd.c +++ xvvd.c 2008-05-23 13:06:50.000000000 +0200 @@ -26,6 +26,11 @@ static int vd_UncompressFile PARM((ch static int vd_tarc PARM((char *)); static u_int vd_tar_sumchk PARM((char *)); +static XtSignalId IdHup = 0; +static XtSignalId IdInt = 0; +static int UsedSignal = 0; +extern XtAppContext context; + #define VD_VDTABLESIZE 100 #define VD_ERR -2 @@ -1011,7 +1016,15 @@ char *prog, *mode; * If XV end by C-c, there are dust of directory which name is .xvvd???, * made by xvvd. Then, I handle SIGINT, and add good finish. */ -void vd_HUPhandler() +static void vd_HUPhandler(int sig) +{ + XtNoticeSignal(IdHup); +#if defined(SYSV) || defined(SVR4) + signal(SIGHUP, (void (*)PARM((int))) vd_HUPhandler); +#endif +} + +static void HUPhandler(XtPointer dummy, XtSignalId* Id) { #if defined(SYSV) || defined(SVR4) sighold(SIGHUP); @@ -1024,19 +1037,23 @@ void vd_HUPhandler() #if defined(SYSV) || defined(SVR4) sigrelse(SIGHUP); - signal(SIGHUP, (void (*)PARM((int))) vd_HUPhandler); #else sigsetmask(mask); #endif } -void vd_handler(sig) -int sig; +static void vd_handler(int sig) +{ + UsedSignal = sig; + XtNoticeSignal(IdInt); +} + +static void INThandler(XtPointer dummy, XtSignalId* Id) { #if defined(SYSV) || defined(SVR4) - sighold(sig); + sighold(UsedSignal); #else - sigblock(sigmask(sig)); + sigblock(sigmask(UsedSignal)); #endif Quit(1); /*exit(1);*/ @@ -1059,6 +1076,9 @@ Display *disp; void vd_handler_setup() { + IdHup = XtAppAddSignal(context, HUPhandler, NULL); + IdInt = XtAppAddSignal(context, INThandler, NULL); + signal(SIGHUP, (void (*)PARM((int))) vd_HUPhandler); signal(SIGINT, (void (*)PARM((int))) vd_handler); signal(SIGTERM,(void (*)PARM((int))) vd_handler);