Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!bloom-beacon!POSEUR.JPL.NASA.GOV!earle From: earle@POSEUR.JPL.NASA.GOV (Greg Earle - Sun JPL on-site Software Support) Newsgroups: comp.windows.x Subject: Re: SunOS 4.1.x diffs for SPARCstation audio version of `oclock' Message-ID: <9012132205.AA22058@poseur.JPL.NASA.GOV> Date: 13 Dec 90 22:05:07 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 84 Someone has pointed out to me that my diffs involve adding dependancies on include files and an audio library that come from the depths of /usr/demo/SOUND under 4.1.x (namely, libaudio.a and multimedia/*.h). In case it is not obvious, one must load the `Demo' software category from the O/S tapes to get these files. If the oclock does not compile, this is the most likely reason. Also, the diff file I placed on `expo' has this additional diff for oclock.c, shamelessly pilferred from xclock's xclock.c, that makes the program go away if sent a WM_DELETE from a window manager (e.g., the `f.delete' function of `twm'). I have a titlebar button to invoke f.delete, and noticed that `xclock' would politely close up shop but the new `oclock' would not. Hack, hack, hack. - Greg Earle Sun Microsystems earle@poseur.JPL.NASA.GOV earle@Sun.COM ------------------------------------------------------------------------------ *** oclock.c.orig Thu Apr 12 09:50:03 1990 --- oclock.c Thu Dec 13 01:38:09 1990 *************** *** 14,17 **** --- 14,18 ---- extern void exit(); + static void quit(); /* Command line options table. Only resources are entered here...there is a *************** *** 20,23 **** --- 21,30 ---- /* Exit with message describing command line format */ + static XtActionsRec xclock_actions[] = { + { "quit", quit }, + }; + + static Atom wm_delete_window; + void usage() { *************** *** 74,77 **** --- 81,93 ---- if (argc != 1) usage(); + XtAddActions (xclock_actions, XtNumber(xclock_actions)); + + /* + * This is a hack so that f.delete will do something useful in this + * single-window application. + */ + XtOverrideTranslations(toplevel, + XtParseTranslationTable ("WM_PROTOCOLS: quit()")); + i = 0; XtSetArg (arg[i], XtNiconPixmap, *************** *** 89,92 **** --- 105,128 ---- clock = XtCreateManagedWidget ("clock", clockWidgetClass, toplevel, NULL, 0); XtRealizeWidget (toplevel); + wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", + False); + (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), + &wm_delete_window, 1); XtMainLoop(); } + + static void quit (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; + { + if (event->type == ClientMessage && + event->xclient.data.l[0] != wm_delete_window) { + XBell (XtDisplay(w), 0); + return; + } + XCloseDisplay (XtDisplay(w)); + exit (0); + } +