diff -Naur xbiff.orig/Mailbox.c xbiff/Mailbox.c --- xbiff.orig/Mailbox.c Fri Feb 2 21:50:28 2001 +++ xbiff/Mailbox.c Fri Feb 2 23:27:44 2001 @@ -136,6 +136,10 @@ offset (check_command), XtRString, NULL}, { XtNvolume, XtCVolume, XtRInt, sizeof(int), offset (volume), XtRString, "33"}, + { XtNpitch, XtCPitch, XtRInt, sizeof(int), + offset (pitch), XtRString, "-1"}, + { XtNduration, XtCDuration, XtRInt, sizeof(int), + offset (duration), XtRString, "-1"}, { XtNonceOnly, XtCBoolean, XtRBoolean, sizeof(Boolean), offset (once_only), XtRImmediate, (XtPointer)False }, { XtNfullPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), @@ -674,6 +678,29 @@ static void beep (w) MailboxWidget w; { + XKeyboardControl kc; + XKeyboardState ks; + unsigned long vm = 0; + + if (w->mailbox.pitch != -1) + vm |= KBBellPitch; + if (w->mailbox.duration) + vm |= KBBellDuration; + + if (vm) { + XGetKeyboardControl (XtDisplay (w), &ks); + kc.bell_pitch = w->mailbox.pitch; + kc.bell_duration = w->mailbox.duration; + XChangeKeyboardControl (XtDisplay (w), vm, &kc); + } + XBell (XtDisplay (w), w->mailbox.volume); + + if (vm) { + kc.bell_pitch = ks.bell_pitch; + kc.bell_duration = ks.bell_duration; + XChangeKeyboardControl (XtDisplay (w), vm, &kc); + } + return; } diff -Naur xbiff.orig/Mailbox.h xbiff/Mailbox.h --- xbiff.orig/Mailbox.h Fri Feb 2 21:50:28 2001 +++ xbiff/Mailbox.h Fri Feb 2 22:08:08 2001 @@ -48,6 +48,8 @@ /* Int: volume for bell */ #define XtNvolume "volume" +#define XtNpitch "pitch" +#define XtNduration "duration" #define XtNfullPixmap "fullPixmap" #define XtNfullPixmapMask "fullPixmapMask" #define XtNemptyPixmap "emptyPixmap" @@ -57,6 +59,8 @@ #define XtCCheckCommand "CheckCommand" #define XtCVolume "Volume" +#define XtCPitch "Pitch" +#define XtCDuration "Duration" #define XtCPixmapMask "PixmapMask" #define XtCFlip "Flip" #define XtCShapeWindow "ShapeWindow" diff -Naur xbiff.orig/MailboxP.h xbiff/MailboxP.h --- xbiff.orig/MailboxP.h Fri Feb 2 21:50:28 2001 +++ xbiff/MailboxP.h Fri Feb 2 22:05:35 2001 @@ -61,6 +61,8 @@ String check_command; /* command to exec for mail check */ Boolean flipit; /* do flip of full pixmap */ int volume; /* bell volume */ + int pitch; /* bell pitch */ + int duration; /* bell duration */ Boolean once_only; /* ring bell only once on new mail */ /* local state */ GC gc; /* normal GC to use */ diff -Naur xbiff.orig/xbiff.c xbiff/xbiff.c --- xbiff.orig/xbiff.c Fri Feb 2 21:50:28 2001 +++ xbiff/xbiff.c Fri Feb 2 21:59:24 2001 @@ -42,10 +42,12 @@ char *ProgramName; static XrmOptionDescRec options[] = { -{ "-update", "*mailbox.update", XrmoptionSepArg, (caddr_t) NULL }, -{ "-file", "*mailbox.file", XrmoptionSepArg, (caddr_t) NULL }, -{ "-volume", "*mailbox.volume", XrmoptionSepArg, (caddr_t) NULL }, -{ "-shape", "*mailbox.shapeWindow", XrmoptionNoArg, (caddr_t) "on" }, +{ "-update", "*mailbox.update", XrmoptionSepArg, (caddr_t) NULL }, +{ "-file", "*mailbox.file", XrmoptionSepArg, (caddr_t) NULL }, +{ "-volume", "*mailbox.volume", XrmoptionSepArg, (caddr_t) NULL }, +{ "-pitch", "*mailbox.pitch", XrmoptionSepArg, (caddr_t) NULL }, +{ "-duration", "*mailbox.duration", XrmoptionSepArg, (caddr_t) NULL }, +{ "-shape", "*mailbox.shapeWindow", XrmoptionNoArg, (caddr_t) "on" }, }; static XtActionsRec xbiff_actions[] = { @@ -62,6 +64,8 @@ " -file file file to watch", " -update seconds how often to check for mail", " -volume percentage how loud to ring the bell", +" -pitch hertz pitch of the bell", +" -duration milliseconds how long to ring the bell", " -bg color background color", " -fg color foreground color", " -rv reverse video", diff -Naur xbiff.orig/xbiff.man xbiff/xbiff.man --- xbiff.orig/xbiff.man Fri Feb 2 21:50:28 2001 +++ xbiff/xbiff.man Fri Feb 2 23:19:46 2001 @@ -61,6 +61,14 @@ .B \-volume \fIpercentage\fP This option specifies how loud the bell should be rung when new mail comes in. .TP 8 +.B \-pitch \fIhertz\fP +This option specifies the pitch in hertz at which the bell should be +rung. +.TP 8 +.B \-duration \fImilliseconds\fP +This option specifies how long in milliseconds the bell should be rung +for. +.TP 8 .B \-shape This option indicates that the mailbox window should be shaped if masks for the empty or full images are given. @@ -199,7 +207,24 @@ stat(2) .SH BUGS The mailbox bitmaps are ugly. + +Setting the +.B -pitch +or +.B -duration +options will causes +.I xbiff +to set the X server's global bell pitch or duration for the display +while the bell is rung. If any other program rings the bell before +.I xbiff +restores the pitch and duration, it will use these values. If two +.I xbiffs +try to ring the bell with different pitches or durations at the same +time, it is possible that the defaults will not be correctly restored. +If this happens, you can restore them by running +.B xset \-b on. .SH AUTHOR Jim Fulton, MIT X Consortium -.br -Additional hacks by Ralph Swick, DEC/MIT Project Athena + +Additional hacks by Ralph Swick, DEC/MIT Project Athena and David +Richerby