Subject: Debian patches up to version 1.0-12
Origin: Debian changes contained in previous diff.gz
Last-Update: 2012-04-01
diff -urN xarclock-1.0.orig//ARClock.c xarclock-1.0//ARClock.c
--- xarclock-1.0.orig//ARClock.c 1995-07-29 21:56:52.000000000 +0200
+++ xarclock-1.0//ARClock.c 2012-04-01 00:21:49.000000000 +0200
@@ -1,11 +1,32 @@
-#ifndef lint
-static char Xrcsid[] = "$XConsortium: Clock.c,v 1.50 89/12/06 15:23:24 kit Exp $";
-#endif /* lint */
-
+/* $XConsortium: Clock.c /main/75 1996/01/14 16:50:48 kaleb $ */
/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+Copyright (c) 1987, 1988 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -13,7 +34,7 @@
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
+supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
@@ -30,12 +51,32 @@
#include <X11/Xlib.h>
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
-#include <X11/Xaw/XawInit.h>
-#include <ClockP.h>
+#include "ClockP.h"
+#include <X11/Xosdefs.h>
+
+#if defined(__STDC__) && !defined(AIXV3) /* AIX is broken */
+#define Const const
+#else
+#define Const /**/
+#endif
+
+#ifdef X_NOT_STDC_ENV
+extern struct tm *localtime();
+#define Time_t long
+extern Time_t time ();
+extern double round();
+#else
+#include <time.h>
+#define Time_t time_t
+#endif
+
+#ifdef XKB
+#include <X11/extensions/XKBbells.h>
+#endif
-/* extern long time(); BUG */
static void clock_tic(), DrawHand(), DrawSecond(), SetSeg(), DrawClockFace();
-static erase_hands(), round();
+static void erase_hands();
+static int iround(double x);
/* Private Definitions */
@@ -49,7 +90,10 @@
#define HAND_WIDTH_FRACT 7
#define SECOND_WIDTH_FRACT 5
#define SECOND_HAND_TIME 30
-#define TEXT_RADIUS_FRACT 65
+
+/* Following line added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
+#define TEXT_RADIUS_FRACT 65
#define ANALOG_SIZE_DEFAULT 164
@@ -60,36 +104,38 @@
/* Initialization of defaults */
-#define offset(field) XtOffset(ClockWidget,clock.field)
-#define goffset(field) XtOffset(Widget,core.field)
+#define offset(field) XtOffsetOf(ClockRec, clock.field)
+#define goffset(field) XtOffsetOf(WidgetRec, core.field)
static XtResource resources[] = {
{XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
- goffset(width), XtRImmediate, (caddr_t) 0},
+ goffset(width), XtRImmediate, (XtPointer) 0},
{XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
- goffset(height), XtRImmediate, (caddr_t) 0},
- {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
- goffset(background_pixel), XtRString, "XtdefaultBackground"},
+ goffset(height), XtRImmediate, (XtPointer) 0},
{XtNupdate, XtCInterval, XtRInt, sizeof(int),
- offset(update), XtRImmediate, (caddr_t) 60 },
+ offset(update), XtRImmediate, (XtPointer) 60 },
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
- offset(fgpixel), XtRString, "XtdefaultForeground"},
+ offset(fgpixel), XtRString, XtDefaultForeground},
{XtNhand, XtCForeground, XtRPixel, sizeof(Pixel),
- offset(Hdpixel), XtRString, "XtdefaultForeground"},
+ offset(Hdpixel), XtRString, XtDefaultForeground},
{XtNhighlight, XtCForeground, XtRPixel, sizeof(Pixel),
- offset(Hipixel), XtRString, "XtdefaultForeground"},
+ offset(Hipixel), XtRString, XtDefaultForeground},
{XtNanalog, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(analog), XtRImmediate, (caddr_t) TRUE},
+ offset(analog), XtRImmediate, (XtPointer) TRUE},
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
{XtNroman, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(roman), XtRImmediate, (caddr_t) TRUE},
+ offset(roman), XtRImmediate, (XtPointer) FALSE},
{XtNnorth, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(north), XtRImmediate, (caddr_t) FALSE},
+ offset(north), XtRImmediate, (XtPointer) FALSE},
+
{XtNchime, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(chime), XtRImmediate, (caddr_t) FALSE },
+ offset(chime), XtRImmediate, (XtPointer) FALSE },
{XtNpadding, XtCMargin, XtRInt, sizeof(int),
- offset(padding), XtRImmediate, (caddr_t) 8},
+ offset(padding), XtRImmediate, (XtPointer) 8},
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- offset(font), XtRString, "fixed"},
+ offset(font), XtRString, XtDefaultFont},
{XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int),
offset (backing_store), XtRString, "default"},
};
@@ -103,7 +149,7 @@
ClockClassRec clockClassRec = {
{ /* core fields */
- /* superclass */ &widgetClassRec,
+ /* superclass */ (WidgetClass) &simpleClassRec,
/* class_name */ "Clock",
/* widget_size */ sizeof(ClockRec),
/* class_initialize */ ClassInitialize,
@@ -116,7 +162,7 @@
/* num_actions */ 0,
/* resources */ resources,
/* resource_count */ XtNumber(resources),
- /* xrm_class */ 0,
+ /* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave */ TRUE,
@@ -135,6 +181,12 @@
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL
+ },
+ { /* simple fields */
+ /* change_sensitive */ XtInheritChangeSensitive
+ },
+ { /* clock fields */
+ /* ignore */ 0
}
};
@@ -148,74 +200,82 @@
static void ClassInitialize()
{
- XawInitializeWidgetSet();
- XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore,
- NULL, 0 );
+ XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore,
+ NULL, 0 );
}
-/* ARGSUSED */
-static void Initialize (request, new)
- Widget request, new;
+static int iround(x)
+double x;
{
- ClockWidget w = (ClockWidget)new;
- XtGCMask valuemask;
- XGCValues myXGCV;
- int min_height, min_width;
-
- valuemask = GCForeground | GCBackground | GCFont | GCLineWidth;
- if (w->clock.font != NULL)
- myXGCV.font = w->clock.font->fid;
- else
- valuemask &= ~GCFont; /* use server default font */
-
- min_width = min_height = ANALOG_SIZE_DEFAULT;
- if(!w->clock.analog) {
- char *str;
- struct tm tm, *localtime();
- long time_value;
- (void) time(&time_value);
- tm = *localtime(&time_value);
- str = asctime(&tm);
- if (w->clock.font == NULL)
- w->clock.font =
- XQueryFont( XtDisplay(w),
- XGContextFromGC(
- DefaultGCOfScreen(XtScreen(w))) );
- min_width = XTextWidth(w->clock.font, str, strlen(str)) +
- 2 * w->clock.padding;
- min_height = w->clock.font->ascent +
- w->clock.font->descent + 2 * w->clock.padding;
- }
- if (w->core.width == 0)
- w->core.width = min_width;
- if (w->core.height == 0)
- w->core.height = min_height;
-
- myXGCV.foreground = w->clock.fgpixel;
- myXGCV.background = w->core.background_pixel;
- if (w->clock.font != NULL)
- myXGCV.font = w->clock.font->fid;
- else
- valuemask &= ~GCFont; /* use server default font */
- myXGCV.line_width = 0;
- w->clock.myGC = XtGetGC((Widget)w, valuemask, &myXGCV);
-
- valuemask = GCForeground | GCLineWidth ;
- myXGCV.foreground = w->core.background_pixel;
- w->clock.EraseGC = XtGetGC((Widget)w, valuemask, &myXGCV);
-
- myXGCV.foreground = w->clock.Hipixel;
- w->clock.HighGC = XtGetGC((Widget)w, valuemask, &myXGCV);
-
- valuemask = GCForeground;
- myXGCV.foreground = w->clock.Hdpixel;
- w->clock.HandGC = XtGetGC((Widget)w, valuemask, &myXGCV);
-
- if (w->clock.update <= 0)
- w->clock.update = 60; /* make invalid update's use a default */
- w->clock.show_second_hand = (w->clock.update <= SECOND_HAND_TIME);
- w->clock.numseg = 0;
- w->clock.interval_id = 0;
+ return(x >= 0.0 ? (int)(x + .5) : (int)(x - .5));
+}
+
+
+/* ARGSUSED */
+static void Initialize (request, new, args, num_args)
+ Widget request, new;
+ ArgList args;
+ Cardinal *num_args;
+{
+ ClockWidget w = (ClockWidget)new;
+ XtGCMask valuemask;
+ XGCValues myXGCV;
+ int min_height, min_width;
+
+ valuemask = GCForeground | GCBackground | GCFont | GCLineWidth;
+ if (w->clock.font != NULL)
+ myXGCV.font = w->clock.font->fid;
+ else
+ valuemask &= ~GCFont; /* use server default font */
+
+ min_width = min_height = ANALOG_SIZE_DEFAULT;
+ if(!w->clock.analog) {
+ char *str;
+ struct tm tm;
+ Time_t time_value;
+
+ (void) time(&time_value);
+ tm = *localtime(&time_value);
+ str = asctime(&tm);
+ if (w->clock.font == NULL)
+ w->clock.font = XQueryFont( XtDisplay(w),
+ XGContextFromGC(
+ DefaultGCOfScreen(XtScreen(w))) );
+ min_width = XTextWidth(w->clock.font, str, strlen(str)) +
+ 2 * w->clock.padding;
+ min_height = w->clock.font->ascent +
+ w->clock.font->descent + 2 * w->clock.padding;
+ }
+ if (w->core.width == 0)
+ w->core.width = min_width;
+ if (w->core.height == 0)
+ w->core.height = min_height;
+
+ myXGCV.foreground = w->clock.fgpixel;
+ myXGCV.background = w->core.background_pixel;
+ if (w->clock.font != NULL)
+ myXGCV.font = w->clock.font->fid;
+ else
+ valuemask &= ~GCFont; /* use server default font */
+ myXGCV.line_width = 0;
+ w->clock.myGC = XtGetGC((Widget)w, valuemask, &myXGCV);
+
+ valuemask = GCForeground | GCLineWidth ;
+ myXGCV.foreground = w->core.background_pixel;
+ w->clock.EraseGC = XtGetGC((Widget)w, valuemask, &myXGCV);
+
+ myXGCV.foreground = w->clock.Hipixel;
+ w->clock.HighGC = XtGetGC((Widget)w, valuemask, &myXGCV);
+
+ valuemask = GCForeground;
+ myXGCV.foreground = w->clock.Hdpixel;
+ w->clock.HandGC = XtGetGC((Widget)w, valuemask, &myXGCV);
+
+ if (w->clock.update <= 0)
+ w->clock.update = 60; /* make invalid update's use a default */
+ w->clock.show_second_hand = (w->clock.update <= SECOND_HAND_TIME);
+ w->clock.numseg = 0;
+ w->clock.interval_id = 0;
}
static void Realize (gw, valueMask, attrs)
@@ -223,91 +283,95 @@
XtValueMask *valueMask;
XSetWindowAttributes *attrs;
{
- ClockWidget w = (ClockWidget) gw;
+ ClockWidget w = (ClockWidget) gw;
#ifdef notdef
- *valueMask |= CWBitGravity;
- attrs->bit_gravity = ForgetGravity;
+ *valueMask |= CWBitGravity;
+ attrs->bit_gravity = ForgetGravity;
#endif
- switch (w->clock.backing_store) {
- case Always:
- case NotUseful:
- case WhenMapped:
- *valueMask |=CWBackingStore;
- attrs->backing_store = w->clock.backing_store;
- break;
- }
- XtCreateWindow( gw, InputOutput, (Visual *)CopyFromParent,
- *valueMask, attrs);
- Resize(gw);
+ switch (w->clock.backing_store) {
+ case Always:
+ case NotUseful:
+ case WhenMapped:
+ *valueMask |=CWBackingStore;
+ attrs->backing_store = w->clock.backing_store;
+ break;
+ }
+ (*clockWidgetClass->core_class.superclass->core_class.realize)
+ (gw, valueMask, attrs);
+ Resize(gw);
}
static void Destroy (gw)
Widget gw;
{
- ClockWidget w = (ClockWidget) gw;
- if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id);
- XtDestroyGC (w->clock.myGC);
- XtDestroyGC (w->clock.HighGC);
- XtDestroyGC (w->clock.HandGC);
- XtDestroyGC (w->clock.EraseGC);
+ ClockWidget w = (ClockWidget) gw;
+ if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id);
+ XtReleaseGC (gw, w->clock.myGC);
+ XtReleaseGC (gw, w->clock.HighGC);
+ XtReleaseGC (gw, w->clock.HandGC);
+ XtReleaseGC (gw, w->clock.EraseGC);
}
static void Resize (gw)
- Widget gw;
+ Widget gw;
{
- ClockWidget w = (ClockWidget) gw;
- /* don't do this computation if window hasn't been realized yet. */
- if (XtIsRealized(gw) && w->clock.analog) {
- /* need signed value since Dimension is unsigned */
- int radius = ((int) min(w->core.width, w->core.height) - (int) (2 * w->clock.padding)) / 2;
- w->clock.radius = (Dimension) max (radius, 1);
-
- w->clock.second_hand_length = ((SECOND_HAND_FRACT * w->clock.radius)/ 100);
- w->clock.minute_hand_length = ((MINUTE_HAND_FRACT * w->clock.radius)/ 100);
- w->clock.hour_hand_length = ((HOUR_HAND_FRACT * w->clock.radius)/ 100);
- w->clock.hand_width = ((HAND_WIDTH_FRACT * w->clock.radius)/ 100);
- w->clock.second_hand_width = ((SECOND_WIDTH_FRACT * w->clock.radius)/ 100);
- w->clock.text_position_radius =((TEXT_RADIUS_FRACT * w->clock.radius)/100);
- w->clock.centerX = w->core.width / 2;
- w->clock.centerY = w->core.height / 2;
- }
+ ClockWidget w = (ClockWidget) gw;
+ /* don't do this computation if window hasn't been realized yet. */
+ if (XtIsRealized(gw) && w->clock.analog) {
+ /* need signed value since Dimension is unsigned */
+ int radius = ((int) min(w->core.width, w->core.height) - (int) (2 * w->clock.padding)) / 2;
+ w->clock.radius = (Dimension) max (radius, 1);
+
+ w->clock.second_hand_length = (int)(SECOND_HAND_FRACT * w->clock.radius) / 100;
+ w->clock.minute_hand_length = (int)(MINUTE_HAND_FRACT * w->clock.radius) / 100;
+ w->clock.hour_hand_length = (int)(HOUR_HAND_FRACT * w->clock.radius) / 100;
+ w->clock.hand_width = (int)(HAND_WIDTH_FRACT * w->clock.radius) / 100;
+ w->clock.second_hand_width = (int)(SECOND_WIDTH_FRACT * w->clock.radius) / 100;
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
+ w->clock.text_position_radius = (int)(TEXT_RADIUS_FRACT * w->clock.radius) / 100;
+
+ w->clock.centerX = w->core.width / 2;
+ w->clock.centerY = w->core.height / 2;
+ }
}
/* ARGSUSED */
static void Redisplay (gw, event, region)
- Widget gw;
- XEvent *event; /* unused */
- Region region; /* unused */
-{
- ClockWidget w = (ClockWidget) gw;
- if (w->clock.analog) {
- if (w->clock.numseg != 0)
- erase_hands (w, (struct tm *) 0);
- DrawClockFace(w);
- } else {
- w->clock.prev_time_string[0] = '\0';
- }
- clock_tic((caddr_t)w, (XtIntervalId)0);
+ Widget gw;
+ XEvent *event; /* unused */
+ Region region; /* unused */
+{
+ ClockWidget w = (ClockWidget) gw;
+ if (w->clock.analog) {
+ if (w->clock.numseg != 0)
+ erase_hands (w, (struct tm *) 0);
+ DrawClockFace(w);
+ } else {
+ w->clock.prev_time_string[0] = '\0';
+ }
+ clock_tic((XtPointer)w, (XtIntervalId)0);
}
/* ARGSUSED */
static void clock_tic(client_data, id)
- caddr_t client_data;
- XtIntervalId *id;
+ XtPointer client_data;
+ XtIntervalId *id;
{
- ClockWidget w = (ClockWidget)client_data;
- struct tm *localtime();
- struct tm tm;
- long time_value;
- char *time_ptr;
- register Display *dpy = XtDisplay(w);
- register Window win = XtWindow(w);
-
+ ClockWidget w = (ClockWidget)client_data;
+ struct tm tm;
+ Time_t time_value;
+ char *time_ptr;
+ register Display *dpy = XtDisplay(w);
+ register Window win = XtWindow(w);
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
register i, j;
double angle, x, y;
double cos();
double sin();
-
static String arabic_roman_numbers[]=
{ "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8",
"3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4",
@@ -316,102 +380,107 @@
"III", "II", "I", "XII", "XI", "X", "IX", "VIII", "VII",
"VI","V", "IIII",
};
-
- if (id || !w->clock.interval_id)
- w->clock.interval_id =
- XtAppAddTimeOut( XtWidgetToApplicationContext( (Widget) w),
- w->clock.update*1000, clock_tic, (caddr_t)w );
- (void) time(&time_value);
- tm = *localtime(&time_value);
- /*
- * Beep on the half hour; double-beep on the hour.
- */
- if (w->clock.chime == TRUE) {
- if (w->clock.beeped && (tm.tm_min != 30) &&
- (tm.tm_min != 0))
- w->clock.beeped = FALSE;
- if (((tm.tm_min == 30) || (tm.tm_min == 0))
- && (!w->clock.beeped)) {
- w->clock.beeped = TRUE;
- XBell(dpy, 50);
- if (tm.tm_min == 0)
- XBell(dpy, 50);
- }
- }
- if( w->clock.analog == FALSE ) {
- int clear_from;
- int i, len, prev_len;
-
- time_ptr = asctime(&tm);
- len = strlen (time_ptr);
- if (time_ptr[len - 1] == '\n') time_ptr[--len] = '\0';
- prev_len = strlen (w->clock.prev_time_string);
- for (i = 0; ((i < len) && (i < prev_len) &&
- (w->clock.prev_time_string[i] == time_ptr[i])); i++);
- strcpy (w->clock.prev_time_string+i, time_ptr+i);
-
- XDrawImageString (dpy, win, w->clock.myGC,
- (2+w->clock.padding +
- XTextWidth (w->clock.font, time_ptr, i)),
- 2+w->clock.font->ascent+w->clock.padding,
- time_ptr + i, len - i);
- /*
- * Clear any left over bits
- */
- clear_from = XTextWidth (w->clock.font, time_ptr, len)
- + 2 + w->clock.padding;
- if (clear_from < w->core.width)
- XFillRectangle (dpy, win, w->clock.EraseGC,
- clear_from, 0,
- w->core.width - clear_from,
- w->core.height);
- } else {
- /*
- * The second (or minute) hand is sec (or min)
- * sixtieths around the clock face. The hour hand is
- * (hour + min/60) twelfths of the way around the
- * clock-face. The derivation is left as an excercise
- * for the reader.
- */
-
- /*
- * 12 hour clock.
- */
- if(tm.tm_hour > 12)
- tm.tm_hour -= 12;
-
- erase_hands (w, &tm);
-
- if (w->clock.numseg == 0 ||
- tm.tm_min != w->clock.otm.tm_min ||
- tm.tm_hour != w->clock.otm.tm_hour) {
- w->clock.segbuffptr = w->clock.segbuff;
- w->clock.numseg = 0;
+ if (id || !w->clock.interval_id)
+ w->clock.interval_id =
+ XtAppAddTimeOut( XtWidgetToApplicationContext( (Widget) w),
+ w->clock.update*1000, clock_tic, (XtPointer)w );
+ (void) time(&time_value);
+ tm = *localtime(&time_value);
+ /*
+ * Beep on the half hour; double-beep on the hour.
+ */
+ if (w->clock.chime == TRUE) {
+ if (w->clock.beeped && (tm.tm_min != 30) &&
+ (tm.tm_min != 0))
+ w->clock.beeped = FALSE;
+ if (((tm.tm_min == 30) || (tm.tm_min == 0))
+ && (!w->clock.beeped)) {
+ w->clock.beeped = TRUE;
+#ifdef XKB
+ if (tm.tm_min==0) {
+ XkbStdBell(dpy,win,50,XkbBI_ClockChimeHour);
+ XkbStdBell(dpy,win,50,XkbBI_RepeatingLastBell);
+ }
+ else {
+ XkbStdBell(dpy,win,50,XkbBI_ClockChimeHalf);
+ }
+#else
+ XBell(dpy, 50);
+ if (tm.tm_min == 0)
+ XBell(dpy, 50);
+#endif
+ }
+ }
+ if( w->clock.analog == FALSE ) {
+ int clear_from;
+ int i, len, prev_len;
+
+ time_ptr = asctime(&tm);
+ len = strlen (time_ptr);
+ if (time_ptr[len - 1] == '\n') time_ptr[--len] = '\0';
+ prev_len = strlen (w->clock.prev_time_string);
+ for (i = 0; ((i < len) && (i < prev_len) &&
+ (w->clock.prev_time_string[i] == time_ptr[i])); i++);
+ strcpy (w->clock.prev_time_string+i, time_ptr+i);
+
+ XDrawImageString (dpy, win, w->clock.myGC,
+ (2+w->clock.padding +
+ XTextWidth (w->clock.font, time_ptr, i)),
+ 2+w->clock.font->ascent+w->clock.padding,
+ time_ptr + i, len - i);
+ /*
+ * Clear any left over bits
+ */
+ clear_from = XTextWidth (w->clock.font, time_ptr, len)
+ + 2 + w->clock.padding;
+ if (clear_from < (int)w->core.width)
+ XFillRectangle (dpy, win, w->clock.EraseGC,
+ clear_from, 0, w->core.width - clear_from, w->core.height);
+ } else {
+ /*
+ * The second (or minute) hand is sec (or min)
+ * sixtieths around the clock face. The hour hand is
+ * (hour + min/60) twelfths of the way around the
+ * clock-face. The derivation is left as an excercise
+ * for the reader.
+ */
+
+ /*
+ * 12 hour clock.
+ */
+ if(tm.tm_hour >= 12)
+ tm.tm_hour -= 12;
+
+ erase_hands (w, &tm);
+
+ if (w->clock.numseg == 0 ||
+ tm.tm_min != w->clock.otm.tm_min ||
+ tm.tm_hour != w->clock.otm.tm_hour) {
+ w->clock.segbuffptr = w->clock.segbuff;
+ w->clock.numseg = 0;
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
/*
* Draw the numbers
*/
for (i = 0; i < 12; i++) {
if (w->clock.north == FALSE) j = i;
- else j = i + 12;
-
+ else j = i + 12;
angle = i * PI / 6;
x = w->clock.text_position_radius * cos(angle);
y = w->clock.text_position_radius * sin(angle);
-
/* Translate for X co-ordinate system */
x = (int) w->clock.centerX + x;
y = (int) w->clock.centerY - y;
-
if (w->clock.roman == FALSE) j = j;
else j = j + 24;
/* Center string */
x = x - XTextWidth(w->clock.font,
arabic_roman_numbers[j],
strlen(arabic_roman_numbers[j]))/2;
-
y = y + (w->clock.font->ascent + w->clock.font->descent)/2;
-
XDrawImageString(XtDisplay(w),
XtWindow(w),
w->clock.myGC,
@@ -420,129 +489,181 @@
arabic_roman_numbers[j],
strlen(arabic_roman_numbers[j]));
}
-
- /*
- * Calculate the hour hand, fill it in with its
- * color and then outline it. Next, do the same
- * with the minute hand. This is a cheap hidden
- * line algorithm.
- */
- DrawHand(w,
- w->clock.minute_hand_length, w->clock.hand_width,
- ((double) tm.tm_min)/60.0
- );
- if(w->clock.Hdpixel != w->core.background_pixel)
- XFillPolygon( dpy,
- win, w->clock.HandGC,
- w->clock.segbuff, VERTICES_IN_HANDS,
- Convex, CoordModeOrigin
- );
- XDrawLines( dpy,
- win, w->clock.HighGC,
- w->clock.segbuff, VERTICES_IN_HANDS,
- CoordModeOrigin);
- w->clock.hour = w->clock.segbuffptr;
- DrawHand(w,
- w->clock.hour_hand_length, w->clock.hand_width,
- ((((double)tm.tm_hour) +
- (((double)tm.tm_min)/60.0)) / 12.0)
- );
- if(w->clock.Hdpixel != w->core.background_pixel) {
- XFillPolygon(dpy,
- win, w->clock.HandGC,
- w->clock.hour,
- VERTICES_IN_HANDS,
- Convex, CoordModeOrigin
- );
- }
- XDrawLines( dpy,
- win, w->clock.HighGC,
- w->clock.hour, VERTICES_IN_HANDS,
- CoordModeOrigin );
-
- w->clock.sec = w->clock.segbuffptr;
- }
- if (w->clock.show_second_hand == TRUE) {
- w->clock.segbuffptr = w->clock.sec;
- DrawSecond(w,
- w->clock.second_hand_length - 2,
- w->clock.second_hand_width,
- w->clock.minute_hand_length + 2,
- ((double) tm.tm_sec)/60.0
- );
- if(w->clock.Hdpixel != w->core.background_pixel)
- XFillPolygon( dpy,
- win, w->clock.HandGC,
- w->clock.sec,
- VERTICES_IN_HANDS -2,
- Convex, CoordModeOrigin
- );
- XDrawLines( dpy,
- win, w->clock.HighGC,
- w->clock.sec,
- VERTICES_IN_HANDS-1,
- CoordModeOrigin
- );
-
+
+ /*
+ * Calculate the hour hand, fill it in with its
+ * color and then outline it. Next, do the same
+ * with the minute hand. This is a cheap hidden
+ * line algorithm.
+ */
+ DrawHand(w,
+ w->clock.minute_hand_length, w->clock.hand_width,
+ tm.tm_min * 12
+ );
+ if(w->clock.Hdpixel != w->core.background_pixel)
+ XFillPolygon( dpy,
+ win, w->clock.HandGC,
+ w->clock.segbuff, VERTICES_IN_HANDS,
+ Convex, CoordModeOrigin
+ );
+ XDrawLines( dpy,
+ win, w->clock.HighGC,
+ w->clock.segbuff, VERTICES_IN_HANDS,
+ CoordModeOrigin);
+ w->clock.hour = w->clock.segbuffptr;
+ DrawHand(w,
+ w->clock.hour_hand_length, w->clock.hand_width,
+ tm.tm_hour * 60 + tm.tm_min
+ );
+ if(w->clock.Hdpixel != w->core.background_pixel) {
+ XFillPolygon(dpy,
+ win, w->clock.HandGC,
+ w->clock.hour,
+ VERTICES_IN_HANDS,
+ Convex, CoordModeOrigin
+ );
+ }
+ XDrawLines( dpy,
+ win, w->clock.HighGC,
+ w->clock.hour, VERTICES_IN_HANDS,
+ CoordModeOrigin );
+
+ w->clock.sec = w->clock.segbuffptr;
+ }
+ if (w->clock.show_second_hand == TRUE) {
+ w->clock.segbuffptr = w->clock.sec;
+ DrawSecond(w,
+ w->clock.second_hand_length - 2,
+ w->clock.second_hand_width,
+ w->clock.minute_hand_length + 2,
+ tm.tm_sec * 12
+ );
+ if(w->clock.Hdpixel != w->core.background_pixel)
+ XFillPolygon( dpy,
+ win, w->clock.HandGC,
+ w->clock.sec,
+ VERTICES_IN_HANDS -2,
+ Convex, CoordModeOrigin
+ );
+ XDrawLines( dpy,
+ win, w->clock.HighGC,
+ w->clock.sec,
+ VERTICES_IN_HANDS-1,
+ CoordModeOrigin
+ );
+
+ }
+ w->clock.otm = tm;
+ }
+}
+
+static void erase_hands (w, tm)
+ClockWidget w;
+struct tm *tm;
+{
+ /*
+ * Erase old hands.
+ */
+ if(w->clock.numseg > 0) {
+ Display *dpy;
+ Window win;
+
+ dpy = XtDisplay (w);
+ win = XtWindow (w);
+ if (w->clock.show_second_hand == TRUE) {
+ XDrawLines(dpy, win,
+ w->clock.EraseGC,
+ w->clock.sec,
+ VERTICES_IN_HANDS-1,
+ CoordModeOrigin);
+ if(w->clock.Hdpixel != w->core.background_pixel) {
+ XFillPolygon(dpy,
+ win, w->clock.EraseGC,
+ w->clock.sec,
+ VERTICES_IN_HANDS-2,
+ Convex, CoordModeOrigin
+ );
+ }
+ }
+ if(!tm || tm->tm_min != w->clock.otm.tm_min ||
+ tm->tm_hour != w->clock.otm.tm_hour)
+ {
+ XDrawLines( dpy, win,
+ w->clock.EraseGC,
+ w->clock.segbuff,
+ VERTICES_IN_HANDS,
+ CoordModeOrigin);
+ XDrawLines( dpy, win,
+ w->clock.EraseGC,
+ w->clock.hour,
+ VERTICES_IN_HANDS,
+ CoordModeOrigin);
+ if(w->clock.Hdpixel != w->core.background_pixel) {
+ XFillPolygon( dpy, win,
+ w->clock.EraseGC,
+ w->clock.segbuff, VERTICES_IN_HANDS,
+ Convex, CoordModeOrigin);
+ XFillPolygon( dpy, win,
+ w->clock.EraseGC,
+ w->clock.hour,
+ VERTICES_IN_HANDS,
+ Convex, CoordModeOrigin);
+ }
+ }
}
- w->clock.otm = tm;
- }
}
-static erase_hands (w, tm)
- ClockWidget w;
- struct tm *tm;
-{
- /*
- * Erase old hands.
- */
- if(w->clock.numseg > 0) {
- Display *dpy;
- Window win;
-
- dpy = XtDisplay (w);
- win = XtWindow (w);
- if (w->clock.show_second_hand == TRUE) {
- XDrawLines(dpy, win,
- w->clock.EraseGC,
- w->clock.sec,
- VERTICES_IN_HANDS-1,
- CoordModeOrigin);
- if(w->clock.Hdpixel != w->core.background_pixel) {
- XFillPolygon(dpy,
- win, w->clock.EraseGC,
- w->clock.sec,
- VERTICES_IN_HANDS-2,
- Convex, CoordModeOrigin
- );
- }
+static float Const Sines[] = {
+.000000, .008727, .017452, .026177, .034899, .043619, .052336, .061049,
+.069756, .078459, .087156, .095846, .104528, .113203, .121869, .130526,
+.139173, .147809, .156434, .165048, .173648, .182236, .190809, .199368,
+.207912, .216440, .224951, .233445, .241922, .250380, .258819, .267238,
+.275637, .284015, .292372, .300706, .309017, .317305, .325568, .333807,
+.342020, .350207, .358368, .366501, .374607, .382683, .390731, .398749,
+.406737, .414693, .422618, .430511, .438371, .446198, .453990, .461749,
+.469472, .477159, .484810, .492424, .500000, .507538, .515038, .522499,
+.529919, .537300, .544639, .551937, .559193, .566406, .573576, .580703,
+.587785, .594823, .601815, .608761, .615661, .622515, .629320, .636078,
+.642788, .649448, .656059, .662620, .669131, .675590, .681998, .688355,
+.694658, .700909, .707107
+};
+
+static float Const Cosines[] = {
+1.00000, .999962, .999848, .999657, .999391, .999048, .998630, .998135,
+.997564, .996917, .996195, .995396, .994522, .993572, .992546, .991445,
+.990268, .989016, .987688, .986286, .984808, .983255, .981627, .979925,
+.978148, .976296, .974370, .972370, .970296, .968148, .965926, .963630,
+.961262, .958820, .956305, .953717, .951057, .948324, .945519, .942641,
+.939693, .936672, .933580, .930418, .927184, .923880, .920505, .917060,
+.913545, .909961, .906308, .902585, .898794, .894934, .891007, .887011,
+.882948, .878817, .874620, .870356, .866025, .861629, .857167, .852640,
+.848048, .843391, .838671, .833886, .829038, .824126, .819152, .814116,
+.809017, .803857, .798636, .793353, .788011, .782608, .777146, .771625,
+.766044, .760406, .754710, .748956, .743145, .737277, .731354, .725374,
+.719340, .713250, .707107
+};
+
+static void ClockAngle(tick_units, sinp, cosp)
+ int tick_units;
+ double *sinp, *cosp;
+{
+ int reduced, upper;
+
+ reduced = tick_units % 90;
+ upper = tick_units / 90;
+ if (upper & 1)
+ reduced = 90 - reduced;
+ if ((upper + 1) & 2) {
+ *sinp = Cosines[reduced];
+ *cosp = Sines[reduced];
+ } else {
+ *sinp = Sines[reduced];
+ *cosp = Cosines[reduced];
}
- if(!tm || tm->tm_min != w->clock.otm.tm_min ||
- tm->tm_hour != w->clock.otm.tm_hour)
- {
- XDrawLines( dpy, win,
- w->clock.EraseGC,
- w->clock.segbuff,
- VERTICES_IN_HANDS,
- CoordModeOrigin);
- XDrawLines( dpy, win,
- w->clock.EraseGC,
- w->clock.hour,
- VERTICES_IN_HANDS,
- CoordModeOrigin);
- if(w->clock.Hdpixel != w->core.background_pixel) {
- XFillPolygon( dpy, win,
- w->clock.EraseGC,
- w->clock.segbuff, VERTICES_IN_HANDS,
- Convex, CoordModeOrigin);
- XFillPolygon( dpy, win,
- w->clock.EraseGC,
- w->clock.hour,
- VERTICES_IN_HANDS,
- Convex, CoordModeOrigin);
- }
- }
- }
+ if (upper >= 2 && upper < 6)
+ *cosp = -*cosp;
+ if (upper >= 4)
+ *sinp = -*sinp;
}
/*
@@ -550,7 +671,7 @@
*
* blank_length is the distance from the center which the line begins.
* length is the maximum length of the hand.
- * Fraction_of_a_circle is a fraction between 0 and 1 (inclusive) indicating
+ * Tick_units is a number between zero and 12*60 indicating
* how far around the circle (clockwise) from high noon.
*
* The blank_length feature is because I wanted to draw tick-marks around the
@@ -558,27 +679,25 @@
* to the perimeter, then erasing all but the outside most pixels doesn't
* work because of round-off error (sigh).
*/
-static void DrawLine(w, blank_length, length, fraction_of_a_circle)
+static void DrawLine(w, blank_length, length, tick_units)
ClockWidget w;
Dimension blank_length;
Dimension length;
-double fraction_of_a_circle;
+int tick_units;
{
double dblank_length = (double)blank_length, dlength = (double)length;
- double angle, cosangle, sinangle;
- double cos();
- double sin();
+ double cosangle, sinangle;
int cx = w->clock.centerX, cy = w->clock.centerY, x1, y1, x2, y2;
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
/*
* Argentinean check
*/
-
if (w->clock.north == FALSE)
- fraction_of_a_circle = 1 - fraction_of_a_circle;
+ tick_units = 12*60 - tick_units;
/*
- * A full circle is 2 PI radians.
* Angles are measured from 12 o'clock, clockwise increasing.
* Since in X, +x is to the right and +y is downward:
*
@@ -586,9 +705,7 @@
* y = y0 - r * cos(theta)
*
*/
- angle = TWOPI * fraction_of_a_circle;
- cosangle = cos(angle);
- sinangle = sin(angle);
+ ClockAngle(tick_units, &sinangle, &cosangle);
/* break this out so that stupid compilers can cope */
x1 = cx + (int)(dblank_length * sinangle);
@@ -603,31 +720,29 @@
*
* length is the maximum length of the hand.
* width is the half-width of the hand.
- * Fraction_of_a_circle is a fraction between 0 and 1 (inclusive) indicating
+ * Tick_units is a number between zero and 12*60 indicating
* how far around the circle (clockwise) from high noon.
*
*/
-static void DrawHand(w, length, width, fraction_of_a_circle)
+static void DrawHand(w, length, width, tick_units)
ClockWidget w;
Dimension length, width;
-double fraction_of_a_circle;
+int tick_units;
{
- register double angle, cosangle, sinangle;
+ double cosangle, sinangle;
register double ws, wc;
Position x, y, x1, y1, x2, y2;
- double cos();
- double sin();
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
/*
* Argentinean check
*/
-
if (w->clock.north == FALSE)
- fraction_of_a_circle = 1 - fraction_of_a_circle;
+ tick_units = 12*60 - tick_units;
/*
- * A full circle is 2 PI radians.
* Angles are measured from 12 o'clock, clockwise increasing.
* Since in X, +x is to the right and +y is downward:
*
@@ -635,9 +750,7 @@
* y = y0 - r * cos(theta)
*
*/
- angle = TWOPI * fraction_of_a_circle;
- cosangle = cos(angle);
- sinangle = sin(angle);
+ ClockAngle(tick_units, &sinangle, &cosangle);
/*
* Order of points when drawing the hand.
*
@@ -650,14 +763,14 @@
wc = width * cosangle;
ws = width * sinangle;
SetSeg(w,
- x = w->clock.centerX + round(length * sinangle),
- y = w->clock.centerY - round(length * cosangle),
- x1 = w->clock.centerX - round(ws + wc),
- y1 = w->clock.centerY + round(wc - ws)); /* 1 ---- 2 */
+ x = w->clock.centerX + iround(length * sinangle),
+ y = w->clock.centerY - iround(length * cosangle),
+ x1 = w->clock.centerX - iround(ws + wc),
+ y1 = w->clock.centerY + iround(wc - ws)); /* 1 ---- 2 */
/* 2 */
SetSeg(w, x1, y1,
- x2 = w->clock.centerX - round(ws - wc),
- y2 = w->clock.centerY + round(wc + ws)); /* 2 ----- 3 */
+ x2 = w->clock.centerX - iround(ws - wc),
+ y2 = w->clock.centerY + iround(wc + ws)); /* 2 ----- 3 */
SetSeg(w, x2, y2, x, y); /* 3 ----- 1(4) */
}
@@ -668,32 +781,30 @@
* length is the maximum length of the hand.
* width is the half-width of the hand.
* offset is direct distance from center to tail end.
- * Fraction_of_a_circle is a fraction between 0 and 1 (inclusive) indicating
+ * Tick_units is a number between zero and 12*60 indicating
* how far around the circle (clockwise) from high noon.
*
*/
-static void DrawSecond(w, length, width, offset, fraction_of_a_circle)
+static void DrawSecond(w, length, width, offset, tick_units)
ClockWidget w;
Dimension length, width, offset;
-double fraction_of_a_circle;
+int tick_units;
{
- register double angle, cosangle, sinangle;
+ double cosangle, sinangle;
register double ms, mc, ws, wc;
register int mid;
Position x, y;
- double cos();
- double sin();
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
/*
* Argentinean check
*/
-
if (w->clock.north == FALSE)
- fraction_of_a_circle = 1 - fraction_of_a_circle;
+ tick_units = 12*60 - tick_units;
/*
- * A full circle is 2 PI radians.
* Angles are measured from 12 o'clock, clockwise increasing.
* Since in X, +x is to the right and +y is downward:
*
@@ -701,9 +812,7 @@
* y = y0 - r * cos(theta)
*
*/
- angle = TWOPI * fraction_of_a_circle;
- cosangle = cos(angle);
- sinangle = sin(angle);
+ ClockAngle(tick_units, &sinangle, &cosangle);
/*
* Order of points when drawing the hand.
*
@@ -724,21 +833,21 @@
* - + center
*/
- mid = (length + offset) / 2;
+ mid = (int) (length + offset) / 2;
mc = mid * cosangle;
ms = mid * sinangle;
wc = width * cosangle;
ws = width * sinangle;
/*1 ---- 2 */
SetSeg(w,
- x = w->clock.centerX + round(length * sinangle),
- y = w->clock.centerY - round(length * cosangle),
- w->clock.centerX + round(ms - wc),
- w->clock.centerY - round(mc + ws) );
- SetSeg(w, w->clock.centerX + round(offset *sinangle),
- w->clock.centerY - round(offset * cosangle), /* 2-----3 */
- w->clock.centerX + round(ms + wc),
- w->clock.centerY - round(mc - ws));
+ x = w->clock.centerX + iround(length * sinangle),
+ y = w->clock.centerY - iround(length * cosangle),
+ w->clock.centerX + iround(ms - wc),
+ w->clock.centerY - iround(mc + ws) );
+ SetSeg(w, w->clock.centerX + iround(offset *sinangle),
+ w->clock.centerY - iround(offset * cosangle), /* 2-----3 */
+ w->clock.centerX + iround(ms + wc),
+ w->clock.centerY - iround(mc - ws));
w->clock.segbuffptr->x = x;
w->clock.segbuffptr++->y = y;
w->clock.numseg ++;
@@ -763,7 +872,7 @@
ClockWidget w;
{
register int i;
- register int delta = (w->clock.radius - w->clock.second_hand_length) / 3;
+ register int delta = (int)(w->clock.radius - w->clock.second_hand_length) / 3;
w->clock.segbuffptr = w->clock.segbuff;
w->clock.numseg = 0;
@@ -771,7 +880,7 @@
DrawLine(w, ( (i % 5) == 0 ?
w->clock.second_hand_length :
(w->clock.radius - delta) ),
- w->clock.radius, ((double) i)/60.);
+ w->clock.radius, i * 12);
/*
* Go ahead and draw it.
*/
@@ -783,15 +892,11 @@
w->clock.numseg = 0;
}
-static int round(x)
-double x;
-{
- return(x >= 0.0 ? (int)(x + .5) : (int)(x - .5));
-}
-
/* ARGSUSED */
-static Boolean SetValues (gcurrent, grequest, gnew)
+static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
Widget gcurrent, grequest, gnew;
+ ArgList args;
+ Cardinal *num_args;
{
ClockWidget current = (ClockWidget) gcurrent;
ClockWidget new = (ClockWidget) gnew;
@@ -805,11 +910,11 @@
if (new->clock.update != current->clock.update) {
if (current->clock.interval_id)
XtRemoveTimeOut (current->clock.interval_id);
- if (XtIsRealized(new))
+ if (XtIsRealized( (Widget) new))
new->clock.interval_id = XtAppAddTimeOut(
XtWidgetToApplicationContext(gnew),
new->clock.update*1000,
- clock_tic, (caddr_t)gnew);
+ clock_tic, (XtPointer)gnew);
new->clock.show_second_hand =(new->clock.update <= SECOND_HAND_TIME);
}
@@ -830,25 +935,25 @@
myXGCV.background = new->core.background_pixel;
myXGCV.font = new->clock.font->fid;
myXGCV.line_width = 0;
- XtDestroyGC (current->clock.myGC);
+ XtReleaseGC (gcurrent, current->clock.myGC);
new->clock.myGC = XtGetGC(gcurrent, valuemask, &myXGCV);
redisplay = TRUE;
}
if (new->clock.Hipixel != current->clock.Hipixel) {
valuemask = GCForeground | GCLineWidth;
- myXGCV.foreground = new->clock.fgpixel;
+ myXGCV.foreground = new->clock.Hipixel;
myXGCV.font = new->clock.font->fid;
myXGCV.line_width = 0;
- XtDestroyGC (current->clock.HighGC);
+ XtReleaseGC (gcurrent, current->clock.HighGC);
new->clock.HighGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV);
redisplay = TRUE;
}
if (new->clock.Hdpixel != current->clock.Hdpixel) {
valuemask = GCForeground;
- myXGCV.foreground = new->clock.fgpixel;
- XtDestroyGC (current->clock.HandGC);
+ myXGCV.foreground = new->clock.Hdpixel;
+ XtReleaseGC (gcurrent, current->clock.HandGC);
new->clock.HandGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV);
redisplay = TRUE;
}
@@ -857,7 +962,7 @@
valuemask = GCForeground | GCLineWidth;
myXGCV.foreground = new->core.background_pixel;
myXGCV.line_width = 0;
- XtDestroyGC (current->clock.EraseGC);
+ XtReleaseGC (gcurrent, current->clock.EraseGC);
new->clock.EraseGC = XtGetGC((Widget)gcurrent, valuemask, &myXGCV);
redisplay = TRUE;
}
diff -urN xarclock-1.0.orig//clmask.bit xarclock-1.0//clmask.bit
--- xarclock-1.0.orig//clmask.bit 1995-07-10 07:07:11.000000000 +0200
+++ xarclock-1.0//clmask.bit 2012-04-01 00:21:49.000000000 +0200
@@ -1,6 +1,6 @@
#define clock_mask_width 48
#define clock_mask_height 48
-static char clock_mask_bits[] = {
+static unsigned char clock_mask_bits[] = {
0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00,
0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00,
diff -urN xarclock-1.0.orig//clock.bit xarclock-1.0//clock.bit
--- xarclock-1.0.orig//clock.bit 1995-07-10 07:07:11.000000000 +0200
+++ xarclock-1.0//clock.bit 2012-04-01 00:21:49.000000000 +0200
@@ -2,7 +2,7 @@
#define clock_height 48
#define clock_x_hot -1
#define clock_y_hot -1
-static char clock_bits[] = {
+static unsigned char clock_bits[] = {
0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00,
0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x00,
diff -urN xarclock-1.0.orig//Clock.h xarclock-1.0//Clock.h
--- xarclock-1.0.orig//Clock.h 1995-07-10 07:07:11.000000000 +0200
+++ xarclock-1.0//Clock.h 2012-04-01 00:21:49.000000000 +0200
@@ -1,36 +1,35 @@
/*
- * *****************************************************************
- * * *
- * * Copyright (c) Digital Equipment Corporation, 1991, 1994 *
- * * *
- * * All Rights Reserved. Unpublished rights reserved under *
- * * the copyright laws of the United States. *
- * * *
- * * The software contained on this media is proprietary to *
- * * and embodies the confidential technology of Digital *
- * * Equipment Corporation. Possession, use, duplication or *
- * * dissemination of the software and media is authorized only *
- * * pursuant to a valid written license from Digital Equipment *
- * * Corporation. *
- * * *
- * * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
- * * by the U.S. Government is subject to restrictions as set *
- * * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
- * * or in FAR 52.227-19, as applicable. *
- * * *
- * *****************************************************************
- */
-/*
- * HISTORY
- */
-/*
-* $XConsortium: Clock.h,v 1.29 90/10/22 14:43:12 converse Exp $
+* $XConsortium: Clock.h,v 1.30 94/04/17 20:23:51 converse Exp $
*/
/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+Copyright (c) 1987, 1988 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -38,7 +37,7 @@
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
+supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
@@ -68,8 +67,12 @@
Name Class RepType Default Value
---- ----- ------- -------------
analog Boolean Boolean True
- roman Boolean Boolean True
- north Boolean Boolean False
+
+Following lines added by Andreas Franzen using source code by
+Jaime Garcia Ghirelli:
+ roman Boolean Boolean True
+ north Boolean Boolean False
+
background Background Pixel white
backingStore BackingStore BackingStore default
border BorderColor Pixel Black
@@ -95,12 +98,14 @@
/* color of hands */
#define XtNhand "hands"
+
/* Boolean: digital if FALSE */
#define XtNanalog "analog"
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
/* Boolean: arabic if FALSE */
#define XtNroman "roman"
-
/* Boolean: clockwise if FALSE */
#define XtNnorth "north"
diff -urN xarclock-1.0.orig//ClockP.h xarclock-1.0//ClockP.h
--- xarclock-1.0.orig//ClockP.h 1995-07-29 21:10:23.000000000 +0200
+++ xarclock-1.0//ClockP.h 2012-04-01 00:21:49.000000000 +0200
@@ -1,36 +1,35 @@
/*
- * *****************************************************************
- * * *
- * * Copyright (c) Digital Equipment Corporation, 1991, 1994 *
- * * *
- * * All Rights Reserved. Unpublished rights reserved under *
- * * the copyright laws of the United States. *
- * * *
- * * The software contained on this media is proprietary to *
- * * and embodies the confidential technology of Digital *
- * * Equipment Corporation. Possession, use, duplication or *
- * * dissemination of the software and media is authorized only *
- * * pursuant to a valid written license from Digital Equipment *
- * * Corporation. *
- * * *
- * * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
- * * by the U.S. Government is subject to restrictions as set *
- * * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
- * * or in FAR 52.227-19, as applicable. *
- * * *
- * *****************************************************************
- */
-/*
- * HISTORY
- */
-/*
-* $XConsortium: ClockP.h,v 1.21 90/10/22 14:43:22 converse Exp $
+* $XConsortium: ClockP.h,v 1.23 94/04/17 20:23:53 rws Exp $
*/
/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+Copyright (c) 1987, 1988 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -38,7 +37,7 @@
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
+supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
@@ -55,8 +54,9 @@
#ifndef _XawClockP_h
#define _XawClockP_h
-#include <X11/Xos.h> /* Needed for struct tm. */
-#include <Clock.h>
+#include <time.h> /* needed for struct tm. */
+#include <X11/Xos.h> /* was Needed for struct tm (unneeded now?) */
+#include "Clock.h"
#include <X11/Xaw/SimpleP.h>
#define SEG_BUFF_SIZE 128
@@ -74,20 +74,28 @@
GC HighGC; /* Highlighting GC */
/* start of graph stuff */
int update; /* update frequence */
- Dimension radius; /* radius factor */
+ Dimension radius; /* radius factor */
int backing_store; /* backing store type */
Boolean chime;
Boolean beeped;
Boolean analog;
- Boolean roman;
- Boolean north;
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
+ Boolean roman;
+ Boolean north;
+
Boolean show_second_hand;
Dimension second_hand_length;
Dimension minute_hand_length;
Dimension hour_hand_length;
Dimension hand_width;
Dimension second_hand_width;
- Dimension text_position_radius;
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
+ Dimension text_position_radius;
+
Position centerX;
Position centerY;
int numseg;
diff -urN xarclock-1.0.orig//Imakefile xarclock-1.0//Imakefile
--- xarclock-1.0.orig//Imakefile 1995-07-10 07:07:11.000000000 +0200
+++ xarclock-1.0//Imakefile 2012-04-01 00:21:49.000000000 +0200
@@ -1,14 +1,11 @@
-DEFINES = -I. -I/usr/include
-CCOPTIONS =
-SYS_LIBRARIES = -lXmu -lXt -lm -lXaw
-LOCAL_LIBRARIES = $(XLIB)
-DEPLIB =
-SRCS = ARClock.c xarclock.c
-OBJS = ARClock.o xarclock.o
-
-ComplexProgramTarget(xarclock)
-
-
-
-
+XCOMM $XConsortium: Imakefile /main/17 1996/01/14 16:50:54 kaleb $
+# modified by Andreas Franzen, 13 Dez 1997
+ CCOPTIONS = -O2 -g -Wall
+ DEPLIBS = XkbClientDepLibs XawClientDepLibs
+LOCAL_LIBRARIES = XkbClientLibs XawClientLibs -lm
+ SRCS = xarclock.c ARClock.c
+ OBJS = xarclock.o ARClock.o
+ HEADERS = ClockP.h Clock.h
+ DEFINES = XkbClientDefines
+ComplexProgramTargetNoMan(xarclock)
diff -urN xarclock-1.0.orig//Makefile xarclock-1.0//Makefile
--- xarclock-1.0.orig//Makefile 1970-01-01 01:00:00.000000000 +0100
+++ xarclock-1.0//Makefile 2012-04-01 00:21:49.000000000 +0200
@@ -0,0 +1,697 @@
+# Makefile generated by imake - do not edit!
+# $TOG: imake.c /main/97 1997/06/20 20:23:51 kaleb $
+
+# ----------------------------------------------------------------------
+# Makefile generated from "Imake.tmpl" and </tmp/IIf.a14494>
+# $TOG: Imake.tmpl /main/245 1997/05/20 10:05:47 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/config/cf/Imake.tmpl,v 3.32.2.5 1997/07/06 07:27:59 dawes Exp $
+# ----------------------------------------------------------------------
+
+all::
+
+.SUFFIXES: .i
+
+# $TOG: Imake.cf /main/28 1997/06/25 08:31:36 barstow $
+# $XFree86: xc/config/cf/Imake.cf,v 3.34.2.3 1997/07/27 02:41:02 dawes Exp $
+
+# -----------------------------------------------------------------------
+# site-specific configuration parameters that need to come before
+# the platform-specific parameters - edit site.def to change
+
+# site: $XConsortium: site.def /main/revisionist/4 1996/12/31 08:02:07 kaleb $
+# site: $XFree86: xc/config/cf/site.def,v 3.17.2.1 1997/06/22 10:32:21 dawes Exp $
+
+# $XFree86: xc/config/cf/xf86site.def,v 3.101.2.11 1997/06/22 10:32:22 dawes Exp $
+
+# ----------------------------------------------------------------------
+# platform-specific configuration parameters - edit linux.cf to change
+
+# platform: $TOG: linux.cf /main/36 1997/06/16 22:21:03 kaleb $
+# platform: $XFree86: xc/config/cf/linux.cf,v 3.57.2.10 1997/07/28 14:17:25 dawes Exp $
+
+# operating system: Linux 2.0.29 i586 [ELF] (2.0.29)
+# libc: (6.4.0)
+# binutils: (28)
+
+# $XConsortium: lnxLib.rules /main/13 1996/09/28 16:11:01 rws $
+# $XFree86: xc/config/cf/lnxLib.rules,v 3.28.2.3 1997/06/22 10:32:20 dawes Exp $
+
+# $XFree86: xc/config/cf/xfree86.cf,v 3.129.2.14 1997/07/06 07:28:00 dawes Exp $
+
+# $XConsortium: xfree86.cf /main/34 1996/12/06 11:45:18 rws $
+
+LINKKITDIR = $(USRLIBDIR)/Server
+XF98LINKKITDIR = $(USRLIBDIR)/Server
+
+ XF86SRC = $(SERVERSRC)/hw/xfree86
+ XF86ACCELSRC = $(XF86SRC)/accel
+ XF86COMSRC = $(XF86SRC)/common
+ XF86CONFIGSRC = $(XF86COMSRC)
+ XF86HWSRC = $(XF86SRC)/common_hw
+ XF86OSSRC = $(XF86SRC)/os-support
+ VGADRIVERSRC = $(XF86SRC)/vga256/drivers
+VGA16DRIVERSRC = $(XF86SRC)/vga16/drivers
+ VGA2DRIVERSRC = $(XF86SRC)/vga2/drivers
+ MONODRIVERSRC = $(XF86SRC)/mono/drivers
+ S3DRIVERSRC = $(XF86SRC)/accel/s3/drivers
+ S3VDRIVERSRC = $(XF86SRC)/accel/s3_virge/drivers
+
+ XF68SRC = $(SERVERSRC)/hw/xfree68
+ XF68COMSRC = $(XF68SRC)/common
+ XF68CONFIGSRC = $(XF68COMSRC)
+ XF68OSSRC = $(XF68SRC)/os-support
+
+ XF98SRC = $(SERVERSRC)/hw/xfree98
+ XF98ACCELSRC = $(XF98SRC)/accel
+ XF98COMSRC = $(XF98SRC)/common
+ XF98CONFIGSRC = $(XF98COMSRC)
+ XF98HWSRC = $(XF98SRC)/common_hw/generic
+ XF98HWNECSRC = $(XF98SRC)/common_hw/nec
+ XF98HWPWSKBSRC = $(XF98SRC)/common_hw/pwskb
+ XF98HWPWLBSRC = $(XF98SRC)/common_hw/pwlb
+ XF98HWGA968SRC = $(XF98SRC)/common_hw/ga968
+ XF98OSSRC = $(XF98SRC)/os-support
+ XF98VGADRIVERSRC = $(XF98SRC)/vga256/drivers
+XF98VGA16DRIVERSRC = $(XF98SRC)/vga16/drivers
+ XF98VGA2DRIVERSRC = $(XF98SRC)/vga2/drivers
+ XF98MONODRIVERSRC = $(XF98SRC)/mono/drivers
+XF98NECS3DRIVERSRC = $(XF98SRC)/accel/s3nec/drivers
+XF98PWSKBDRIVERSRC = $(XF98SRC)/accel/s3pwskb/drivers
+ XF98PWLBDRIVERSRC = $(XF98SRC)/accel/s3pwlb/drivers
+XF98GA968DRIVERSRC = $(XF98SRC)/accel/s3ga968/drivers
+
+ XFREE86DOCDIR = $(LIBDIR)/doc
+ XFREE86PSDOCDIR = $(XFREE86DOCDIR)/PostScript
+ XFREE86HTMLDOCDIR = $(XFREE86DOCDIR)/html
+XFREE86JAPANESEDOCDIR = $(XFREE86DOCDIR)/Japanese
+
+# $XConsortium: xf86.rules /main/9 1996/10/31 14:54:26 kaleb $
+# $XFree86: xc/config/cf/xf86.rules,v 3.16.2.1 1997/05/18 12:00:01 dawes Exp $
+
+# ----------------------------------------------------------------------
+# site-specific configuration parameters that go after
+# the platform-specific parameters - edit site.def to change
+
+# site: $XConsortium: site.def /main/revisionist/4 1996/12/31 08:02:07 kaleb $
+# site: $XFree86: xc/config/cf/site.def,v 3.17.2.1 1997/06/22 10:32:21 dawes Exp $
+
+# ---------------------------------------------------------------------
+# Imake rules for building libraries, programs, scripts, and data files
+# rules: $TOG: Imake.rules /main/222 1997/07/17 20:04:40 kaleb $
+# rules: $XFree86: xc/config/cf/Imake.rules,v 3.33.2.5 1997/07/19 04:59:07 dawes Exp $
+
+ _NULLCMD_ = @ echo -n
+
+TKLIBNAME = tk4.2
+
+TKLIBDIR = /usr/lib
+
+TCLLIBNAME = tcl7.6
+
+TCLIBDIR = /usr/lib
+
+ PATHSEP = /
+ SHELL = /bin/sh
+
+ TOP = .
+ CURRENT_DIR = .
+
+ IMAKE = imake
+ DEPEND = gccmakedep
+ MKDIRHIER = mkdir -p
+ EXPORTLISTGEN =
+ CONFIGSRC = $(TOP)/config
+ IMAKESRC = $(CONFIGSRC)/imake
+ DEPENDSRC = $(CONFIGSRC)/util
+
+ INCROOT = /usr/X11R6/include
+ USRLIBDIR = /usr/X11R6/lib
+ VARLIBDIR = /var/lib
+ SHLIBDIR = /usr/X11R6/lib
+ LINTLIBDIR = $(USRLIBDIR)/lint
+ MANPATH = /usr/X11R6/man
+ MANSOURCEPATH = $(MANPATH)/man
+ MANDIR = $(MANSOURCEPATH)1
+ LIBMANDIR = $(MANSOURCEPATH)3
+ FILEMANDIR = $(MANSOURCEPATH)5
+
+ AR = ar clq
+ BOOTSTRAPCFLAGS =
+ CC = gcc
+ AS = as
+
+.SUFFIXES: .cc
+
+ CXX = c++
+ CXXFILT = c++filt
+ CXXLIB =
+ CXXDEBUGFLAGS = -O2 -fno-strength-reduce
+CXXDEPENDINCLUDES =
+ CXXEXTRA_DEFINES =
+CXXEXTRA_INCLUDES =
+ CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_REENTRANT $(CXXPROJECT_DEFINES)
+ CXXOPTIONS =
+ CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES)
+ CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(CXXEXTRA_DEFINES) $(DEFINES)
+ CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES)
+
+ COMPRESS = compress
+ GZIPCMD = gzip
+ CPP = /lib/cpp $(STD_CPP_DEFINES)
+ PREPROCESSCMD = gcc -E $(STD_CPP_DEFINES)
+ INSTALL = install
+ INSTALLFLAGS = -c
+ LD = ld
+ LEX = flex -l
+ LEXLIB = -lfl
+ YACC = bison -y
+ CCYACC = bison -y
+ LINT = lint
+ LINTLIBFLAG = -C
+ LINTOPTS = -axz
+ LN = ln -s
+ MAKE = make
+ MV = mv -f
+ CP = cp
+
+ RANLIB = ranlib
+ RANLIBINSTFLAGS =
+
+ RM = rm -f
+ MANSUFFIX = 1x
+ LIBMANSUFFIX = 3x
+ FILEMANSUFFIX = 5x
+ TROFF = psroff
+ NROFF = nroff
+ MSMACROS = -ms
+ MANMACROS = -man
+ TBL = tbl
+ EQN = eqn
+ NEQN = neqn
+ COL = col
+
+ DVIPS = dvips
+ LATEX = latex
+
+ STD_INCLUDES =
+ STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_REENTRANT $(PROJECT_DEFINES)
+ STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_REENTRANT $(PROJECT_DEFINES)
+ EXTRA_LOAD_FLAGS =
+ EXTRA_LDOPTIONS =
+ EXTRA_LIBRARIES =
+ TAGS = ctags
+
+ PARALLELMFLAGS =
+
+ SHAREDCODEDEF =
+ SHLIBDEF =
+
+ SHLIBLDFLAGS = -shared
+
+ PICFLAGS = -fPIC
+
+ CXXPICFLAGS = -fPIC
+
+ PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO
+
+ INSTPGMFLAGS = -s
+
+ INSTBINFLAGS = -m 0755
+ INSTUIDFLAGS = -m 4711
+ INSTLIBFLAGS = -m 0644
+ INSTINCFLAGS = -m 0444
+ INSTMANFLAGS = -m 0444
+ INSTDATFLAGS = -m 0444
+ INSTKMEMFLAGS = -m 4711
+
+ PROJECTROOT = /usr/X11R6
+
+ CDEBUGFLAGS = -O2 -fno-strength-reduce
+ CCOPTIONS =
+
+ ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
+ ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES)
+ CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES)
+ LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES)
+ LDPRELIB = -L$(USRLIBDIR)
+ LDPOSTLIB =
+ LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)
+ CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)
+
+ LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
+
+ CCLINK = $(CC)
+
+ CXXLINK = $(CXX)
+
+ LDSTRIPFLAGS = -x
+ LDCOMBINEFLAGS = -r
+ DEPENDFLAGS =
+
+# Not sure this belongs here
+ TKLIBDIR = /usr/lib
+ TKINCDIR = /usr/include/tk
+ TKLIBNAME = tk4.2
+ TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME)
+ TCLLIBDIR = /usr/lib
+ TCLINCDIR = /usr/include/tcl
+ TCLLIBNAME = tcl7.6
+ TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME)
+
+ MACROFILE = linux.cf
+ RM_CMD = $(RM)
+
+ IMAKE_DEFINES =
+
+ IRULESRC = $(CONFIGDIR)
+ IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
+
+ ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES)
+
+# $TOG: X11.rules /main/4 1997/04/30 15:23:24 kaleb $
+
+# ----------------------------------------------------------------------
+# X Window System Build Parameters and Rules
+# $TOG: X11.tmpl /main/292 1997/05/20 10:05:59 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/config/cf/X11.tmpl,v 1.8.2.3 1997/05/21 15:02:13 dawes Exp $
+
+# -----------------------------------------------------------------------
+# X Window System make variables; these need to be coordinated with rules
+
+ XTOP = $(TOP)
+ BINDIR = /usr/X11R6/bin
+ BUILDINCROOT = $(TOP)/exports
+ BUILDINCDIR = $(BUILDINCROOT)/include
+ BUILDINCTOP = ../..
+ BUILDLIBDIR = $(TOP)/exports/lib
+ BUILDLIBTOP = ../..
+ BUILDBINDIR = $(TOP)/exports/bin
+ BUILDBINTOP = ../..
+ XBUILDINCROOT = $(XTOP)/exports
+ XBUILDINCDIR = $(XBUILDINCROOT)/include/X11
+ XBUILDINCTOP = ../../..
+ XBUILDBINDIR = $(XBUILDINCROOT)/bin
+ INCDIR = $(INCROOT)
+ ADMDIR = /usr/adm
+ LIBDIR = $(USRLIBDIR)/X11
+ TOP_X_INCLUDES = -I$(XPROJECTROOT)/include
+
+ FONTDIR = $(LIBDIR)/fonts
+ XINITDIR = $(LIBDIR)/xinit
+ XDMDIR = $(LIBDIR)/xdm
+ XDMVARDIR = $(VARLIBDIR)/xdm
+ TWMDIR = $(LIBDIR)/twm
+ XSMDIR = $(LIBDIR)/xsm
+ NLSDIR = $(LIBDIR)/nls
+ XLOCALEDIR = $(LIBDIR)/locale
+ PEXAPIDIR = $(LIBDIR)/PEX
+ LBXPROXYDIR = $(LIBDIR)/lbxproxy
+ PROXYMANAGERDIR = $(LIBDIR)/proxymngr
+ XPRINTDIR = $(LIBDIR)
+ XAPPLOADDIR = $(LIBDIR)/app-defaults
+ FONTCFLAGS = -t
+
+ INSTAPPFLAGS = $(INSTDATFLAGS)
+
+ RGB = rgb
+ FONTC = bdftopcf
+ MKFONTDIR = mkfontdir
+
+ DOCUTILSRC = $(XTOP)/doc/util
+ CLIENTSRC = $(TOP)/clients
+ DEMOSRC = $(TOP)/demos
+ XDOCMACROS = $(DOCUTILSRC)/macros.t
+ XIDXMACROS = $(DOCUTILSRC)/indexmacros.t
+ PROGRAMSRC = $(TOP)/programs
+ LIBSRC = $(XTOP)/lib
+ FONTSRC = $(XTOP)/fonts
+ INCLUDESRC = $(BUILDINCROOT)/include
+ XINCLUDESRC = $(INCLUDESRC)/X11
+ SERVERSRC = $(XTOP)/programs/Xserver
+ CONTRIBSRC = $(XTOP)/../contrib
+ UNSUPPORTEDSRC = $(XTOP)/unsupported
+ DOCSRC = $(XTOP)/doc
+ RGBSRC = $(XTOP)/programs/rgb
+ BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf
+ MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir
+ FONTSERVERSRC = $(PROGRAMSRC)/xfs
+ FONTINCSRC = $(XTOP)/include/fonts
+ EXTINCSRC = $(XTOP)/include/extensions
+ TRANSCOMMSRC = $(LIBSRC)/xtrans
+ TRANS_INCLUDES = -I$(TRANSCOMMSRC)
+
+ XENVLIBDIR = $(USRLIBDIR)
+ CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR)
+
+# $XConsortium: lnxLib.tmpl,v 1.5 95/01/11 21:44:44 kaleb Exp $
+# $XFree86: xc/config/cf/lnxLib.tmpl,v 3.9 1996/02/24 04:32:52 dawes Exp $
+
+ XLIBSRC = $(LIBSRC)/X11
+
+SOXLIBREV = 6.1
+DEPXONLYLIB =
+XONLYLIB = -lX11
+
+LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln
+
+ XLIBONLY = $(XONLYLIB)
+
+ XEXTLIBSRC = $(LIBSRC)/Xext
+
+SOXEXTREV = 6.3
+DEPEXTENSIONLIB =
+EXTENSIONLIB = -lXext
+
+LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln
+
+LINTEXTENSIONLIB = $(LINTEXTENSION)
+ DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB)
+ XLIB = $(EXTENSIONLIB) $(XONLYLIB)
+ LINTXLIB = $(LINTXONLYLIB)
+
+ XSSLIBSRC = $(LIBSRC)/Xss
+
+DEPXSSLIB = $(USRLIBDIR)/libXss.a
+XSSLIB = -lXss
+
+LINTXSS = $(LINTLIBDIR)/llib-lXss.ln
+
+ XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc
+
+DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a
+XXF86MISCLIB = -lXxf86misc
+
+LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln
+
+ XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm
+
+DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a
+XXF86VMLIB = -lXxf86vm
+
+LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln
+
+ XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga
+
+DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a
+XXF86DGALIB = -lXxf86dga
+
+LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln
+
+ XDPMSLIBSRC = $(LIBSRC)/Xdpms
+
+DEPXDPMSLIB = $(USRLIBDIR)/libXdpms.a
+XDPMSLIB = -lXdpms
+
+LINTXDPMS = $(LINTLIBDIR)/llib-lXdpms.ln
+
+ XAUTHSRC = $(LIBSRC)/Xau
+
+DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
+XAUTHLIB = -lXau
+
+LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln
+
+ XDMCPLIBSRC = $(LIBSRC)/Xdmcp
+
+DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
+XDMCPLIB = -lXdmcp
+
+LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln
+
+ XMUSRC = $(LIBSRC)/Xmu
+
+SOXMUREV = 6.0
+DEPXMULIB =
+XMULIB = -lXmu
+
+LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
+
+ OLDXLIBSRC = $(LIBSRC)/oldX
+
+DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
+OLDXLIB = -loldX
+
+LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln
+
+ XPLIBSRC = $(LIBSRC)/Xp
+
+SOXPREV = 6.2
+DEPXPLIB =
+XPLIB = -lXp
+
+LINTXP = $(LINTLIBDIR)/llib-lXp.ln
+
+ TOOLKITSRC = $(LIBSRC)/Xt
+
+SOXTREV = 6.0
+DEPXTOOLONLYLIB =
+XTOOLONLYLIB = -lXt
+
+LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln
+
+ DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB)
+ XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB)
+ LINTXTOOLLIB = $(LINTXTOOLONLYLIB)
+
+ XALIBSRC = $(LIBSRC)/Xa
+
+SOXAREV = 1.0
+DEPXALIB =
+XALIB = -lXa
+
+LINTXA = $(LINTLIBDIR)/llib-lXa.ln
+
+ AWIDGETSRC = $(LIBSRC)/Xaw
+
+SOXAWREV = 6.1
+DEPXAWLIB =
+XAWLIB = -lXaw
+
+LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
+
+ XILIBSRC = $(LIBSRC)/Xi
+
+SOXINPUTREV = 6.0
+DEPXILIB =
+XILIB = -lXi
+
+LINTXI = $(LINTLIBDIR)/llib-lXi.ln
+
+ XTESTLIBSRC = $(LIBSRC)/Xtst
+
+SOXTESTREV = 6.1
+DEPXTESTLIB =
+XTESTLIB = -lXtst
+
+LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln
+
+ PEXLIBSRC = $(LIBSRC)/PEX5
+
+SOPEXREV = 6.0
+DEPPEXLIB =
+PEXLIB = -lPEX5
+
+LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln
+
+ XIELIBSRC = $(LIBSRC)/XIE
+
+SOXIEREV = 6.0
+DEPXIELIB =
+XIELIB = -lXIE
+
+LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln
+
+ PHIGSLIBSRC = $(LIBSRC)/PHIGS
+
+DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
+PHIGSLIB = -lphigs
+
+LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
+
+DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
+XBSDLIB = -lXbsd
+
+LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln
+
+ ICESRC = $(LIBSRC)/ICE
+
+SOICEREV = 6.3
+DEPICELIB =
+ICELIB = -lICE
+
+LINTICE = $(LINTLIBDIR)/llib-lICE.ln
+
+ SMSRC = $(LIBSRC)/SM
+
+SOSMREV = 6.0
+DEPSMLIB =
+SMLIB = -lSM
+
+LINTSM = $(LINTLIBDIR)/llib-lSM.ln
+
+ XKEYSRC = $(LIBSRC)/Xkey
+
+SOXKEYREV = 6.0
+DEPXKEYLIB =
+XKEYLIB = -lXkey
+
+LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln
+
+ FSLIBSRC = $(LIBSRC)/FS
+
+DEPFSLIB = $(USRLIBDIR)/libFS.a
+FSLIB = -lFS
+
+LINTFS = $(LINTLIBDIR)/llib-lFS.ln
+
+ FONTLIBSRC = $(LIBSRC)/font
+
+DEPFONTLIB = $(USRLIBDIR)/libfont.a
+FONTLIB = -lfont
+
+LINTFONT = $(LINTLIBDIR)/llib-lfont.ln
+
+ XPMLIBSRC = $(LIBSRC)/Xpm
+
+DEPXPMLIB = $(USRLIBDIR)/libXpm.a
+XPMLIB = -lXpm
+
+LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln
+
+ XKBFILELIBSRC = $(LIBSRC)/xkbfile
+
+DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a
+XKBFILELIB = -lxkbfile
+
+LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln
+
+ XKBCOMPCMD = xkbcomp
+
+ XKBUILIBSRC = $(LIBSRC)/xkbui
+
+DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a
+XKBUILIB = -lxkbui
+
+LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln
+
+ DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
+
+ DEPLIBS1 = $(DEPLIBS)
+ DEPLIBS2 = $(DEPLIBS)
+ DEPLIBS3 = $(DEPLIBS)
+ DEPLIBS4 = $(DEPLIBS)
+ DEPLIBS5 = $(DEPLIBS)
+ DEPLIBS6 = $(DEPLIBS)
+ DEPLIBS7 = $(DEPLIBS)
+ DEPLIBS8 = $(DEPLIBS)
+ DEPLIBS9 = $(DEPLIBS)
+ DEPLIBS10 = $(DEPLIBS)
+
+XMULIBONLY = -lXmu
+XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB)
+
+ CONFIGDIR = $(LIBDIR)/config
+
+ USRLIBDIRPATH = $(USRLIBDIR)
+ LDPRELIBS = -L$(USRLIBDIR)
+ LDPOSTLIBS =
+ TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES)
+ PROJECT_DEFINES =
+
+CXXPROJECT_DEFINES =
+
+# ----------------------------------------------------------------------
+# start of Imakefile
+
+# $XConsortium: Imakefile /main/17 1996/01/14 16:50:54 kaleb $
+# modified by Andreas Franzen, 13 Dez 1997
+ CCOPTIONS = -O2 -g -Wall
+ DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
+LOCAL_LIBRARIES = $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB) -lm
+ SRCS = xarclock.c ARClock.c
+ OBJS = xarclock.o ARClock.o
+ HEADERS = ClockP.h Clock.h
+ DEFINES =
+
+ PROGRAM = xarclock
+
+all:: xarclock
+
+xarclock: $(OBJS) $(DEPLIBS)
+ $(RM) $@
+ $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
+
+install:: xarclock
+ @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
+ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
+ $(INSTALL) $(INSTALLFLAGS) $(INSTPGMFLAGS) xarclock $(DESTDIR)$(BINDIR)/xarclock
+
+install.man:: xarclock.man
+ @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
+ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
+ $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) xarclock.man $(DESTDIR)$(MANDIR)/xarclock.$(MANSUFFIX)
+
+depend::
+ $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)
+
+lint:
+ $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
+lint1:
+ $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
+
+clean::
+ $(RM) xarclock
+
+# ----------------------------------------------------------------------
+# common rules for all Makefiles - do not edit
+
+.c.i:
+ $(RM) $@
+ $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@
+
+emptyrule::
+
+clean::
+ $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
+
+Makefile::
+ -@if [ -f Makefile ]; then set -x; \
+ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
+ else exit 0; fi
+ $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
+
+tags::
+ $(TAGS) -w *.[ch]
+ $(TAGS) -xw *.[ch] > TAGS
+
+man_keywords::
+
+# ----------------------------------------------------------------------
+# empty rules for directories that do not have SUBDIRS - do not edit
+
+install::
+ @echo "install in $(CURRENT_DIR) done"
+
+install.man::
+ @echo "install.man in $(CURRENT_DIR) done"
+
+install.linkkit::
+ @echo "install.linkkit in $(CURRENT_DIR) done"
+
+Makefiles::
+
+includes::
+
+depend::
+
+# ----------------------------------------------------------------------
+# dependencies generated by makedepend
+
diff -urN xarclock-1.0.orig//xarclock.c xarclock-1.0//xarclock.c
--- xarclock-1.0.orig//xarclock.c 1995-07-29 21:05:53.000000000 +0200
+++ xarclock-1.0//xarclock.c 2012-04-01 00:21:49.000000000 +0200
@@ -1,73 +1,81 @@
-#ifndef lint
-static char rcsid[] = "$XConsortium: xclock.c,v 1.28 89/12/11 15:51:32 kit Exp $";
-#endif /* lint */
+/* $XConsortium: xclock.c /main/40 1996/02/02 14:27:04 kaleb $ */
/*
- * Copyright 1989 Massachusetts Institute of Technology
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. M.I.T. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * xclock -- Hacked from Tony Della Fera's much hacked clock program.
*/
/*
- * xclock -- Hacked from Tony Della Fera.
+ * xarclock -- Hacked by using source code by Jaime Garcia Ghirelli.
*/
/*
- * xarclock -- By Jaime Garcia Ghirelli.
- */
+Copyright (c) 1989 X Consortium
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+ */
+#include <stdio.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
-
+#include "Clock.h"
#include <X11/Xaw/Cardinals.h>
-#include <Clock.h>
#include "clock.bit"
#include "clmask.bit"
+#ifdef XKB
+#include <X11/extensions/XKBbells.h>
+#endif
+
extern void exit();
-static void quit();
/* Command line options table. Only resources are entered here...there is a
pass over the remaining options after XtParseCommand is let loose. */
static XrmOptionDescRec options[] = {
- {"-chime", "*clock.chime", XrmoptionNoArg, "TRUE"},
- {"-hd", "*clock.hands", XrmoptionSepArg, NULL},
- {"-hands", "*clock.hands", XrmoptionSepArg, NULL},
- {"-hl", "*clock.highlight", XrmoptionSepArg, NULL},
- {"-highlight", "*clock.highlight", XrmoptionSepArg, NULL},
- {"-update", "*clock.update", XrmoptionSepArg, NULL},
- {"-padding", "*clock.padding", XrmoptionSepArg, NULL},
- {"-d", "*clock.analog", XrmoptionNoArg, "FALSE"},
- {"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"},
- {"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"},
- {"-arabic", "*clock.roman", XrmoptionNoArg, "FALSE"},
- {"-roman", "*clock.roman", XrmoptionNoArg, "TRUE"},
- {"-south", "*clock.north", XrmoptionNoArg, "FALSE"},
- {"-north", "*clock.north", XrmoptionNoArg, "TRUE"},
-};
+{"-chime", "*clock.chime", XrmoptionNoArg, "TRUE"},
+{"-hd", "*clock.hands", XrmoptionSepArg, NULL},
+{"-hands", "*clock.hands", XrmoptionSepArg, NULL},
+{"-hl", "*clock.highlight", XrmoptionSepArg, NULL},
+{"-highlight", "*clock.highlight", XrmoptionSepArg, NULL},
+{"-update", "*clock.update", XrmoptionSepArg, NULL},
+{"-padding", "*clock.padding", XrmoptionSepArg, NULL},
+{"-d", "*clock.analog", XrmoptionNoArg, "FALSE"},
+{"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"},
+{"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"},
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
+{"-arabic", "*clock.roman", XrmoptionNoArg, "FALSE"},
+{"-roman", "*clock.roman", XrmoptionNoArg, "TRUE"},
+{"-south", "*clock.north", XrmoptionNoArg, "FALSE"},
+{"-north", "*clock.north", XrmoptionNoArg, "TRUE"},
+};
+static void quit();
static XtActionsRec xclock_actions[] = {
- { "quit", quit },
+ { "quit", quit },
};
static Atom wm_delete_window;
@@ -75,84 +83,117 @@
/*
* Report the syntax for calling xarclock.
*/
-Syntax(call)
- char *call;
+int Syntax(call)
+ char *call;
{
- (void) printf ("Usage: %s \n", call);
- (void) printf ("[-roman] [-arabic] [-south] [-north] \n");
- (void) printf ("[-analog] [-digital] [-bw <pixels>] \n");
- (void) printf ("[-fg <color>] [-bg <color>] [-hd <color>] \n");
- (void) printf ("[-hl <color>] [-bd <color>] \n");
- (void) printf ("[-fn <font_name>] [-help] [-padding <pixels>] \n");
- (void) printf ("[-rv] [-update <seconds>] [-display displayname] \n");
- (void) printf ("[-geometry geom] \n\n");
- exit(1);
+
+/* Following lines added by Andreas Franzen using source code by
+ * Jaime Garcia Ghirelli: */
+ (void) printf ("Usage: %s \n", call);
+ (void) printf ("[-roman] [-arabic] [-south] [-north] \n");
+
+/* Following line added by Andreas Franzen using a patch from
+ * Martin Schulze. */
+ (void) printf ("[-analog] [-digital] [-chime]\n");
+
+ (void) printf (" [-fg <color>] [-bg <color>] [-hd <color>]\n");
+ (void) printf (" [-hl <color>] [-bd <color>]\n");
+ (void) printf (" [-fn <font_name>] [-help] [-padding <pixels>]\n");
+ (void) printf (" [-rv] [-update <seconds>] [-display displayname]\n");
+ (void) printf (" [-geometry geom]\n\n");
+ exit(1);
}
-void main(argc, argv)
- int argc;
- char **argv;
+static void die(w, client_data, call_data)
+ Widget w;
+ XtPointer client_data;
+ XtPointer call_data;
{
- Widget toplevel;
- Arg arg;
- Pixmap icon_pixmap = None;
- XtAppContext app_con;
-
- toplevel = XtAppInitialize (&app_con, "XClock", options, XtNumber(options),
- &argc, argv, NULL, NULL, ZERO);
- if (argc != 1) Syntax(argv[0]);
-
- XtAppAddActions (app_con, 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 ("<Message>WM_PROTOCOLS: quit()"));
-
- XtSetArg(arg, XtNiconPixmap, &icon_pixmap);
- XtGetValues(toplevel, &arg, ONE);
- if (icon_pixmap == None) {
- arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel),
- XtScreen(toplevel)->root,
- clock_bits, clock_width,
- clock_height);
- XtSetValues (toplevel, &arg, ONE);
- }
- XtSetArg(arg, XtNiconMask, &icon_pixmap);
- XtGetValues(toplevel, &arg, ONE);
- if (icon_pixmap == None) {
- arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel),
- XtScreen(toplevel)->root,
- clock_mask_bits,
- clock_mask_width,
- clock_mask_height);
- XtSetValues (toplevel, &arg, ONE);
- }
-
- XtCreateManagedWidget ("clock", clockWidgetClass, toplevel, NULL, ZERO);
- XtRealizeWidget (toplevel);
- wm_delete_window = XInternAtom (XtDisplay(toplevel),
- "WM_DELETE_WINDOW",
- False);
- (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
- &wm_delete_window, 1);
- XtAppMainLoop (app_con);
+ XCloseDisplay(XtDisplayOfObject(w));
+ exit(0);
}
-
static void quit (w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+ Widget w; /* ApplicationShellWidget */
+ XEvent *event;
+ String *params;
+ Cardinal *num_params;
+{
+ Arg arg;
+
+ if (event->type == ClientMessage &&
+ event->xclient.data.l[0] != wm_delete_window) {
+#ifdef XKB
+ XkbStdBell(XtDisplay(w), XtWindow(w), 0, XkbBI_MinorError);
+#else
+ XBell (XtDisplay(w), 0);
+#endif
+ } else {
+ /* resign from the session */
+ XtSetArg(arg, XtNjoinSession, False);
+ XtSetValues(w, &arg, ONE);
+ die(w, NULL, NULL);
+ }
+}
+
+static void save(w, client_data, call_data)
+ Widget w;
+ XtPointer client_data, call_data;
+{
+ XtCheckpointToken token = (XtCheckpointToken) call_data;
+ /* we have nothing to save */
+ token->save_success = True;
+}
+
+int main(argc, argv)
+ int argc;
+ char **argv;
{
- if (event->type == ClientMessage &&
- event->xclient.data.l[0] != wm_delete_window) {
- XBell (XtDisplay(w), 0);
- return;
- }
- XCloseDisplay (XtDisplay(w));
- exit (0);
+ Widget toplevel;
+ Arg arg;
+ Pixmap icon_pixmap = None;
+ XtAppContext app_con;
+
+ toplevel = XtOpenApplication(&app_con, "XClock",
+ options, XtNumber(options), &argc, argv, NULL,
+ sessionShellWidgetClass, NULL, ZERO);
+ if (argc != 1) Syntax(argv[0]);
+ XtAddCallback(toplevel, XtNdieCallback, die, NULL);
+ XtAddCallback(toplevel, XtNsaveCallback, save, NULL);
+
+ XtAppAddActions (app_con, xclock_actions, XtNumber(xclock_actions));
+
+ /*
+ * This is a hack so that wm_delete_window will do something useful
+ * in this single-window application.
+ */
+ XtOverrideTranslations(toplevel,
+ XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));
+
+ XtSetArg(arg, XtNiconPixmap, &icon_pixmap);
+ XtGetValues(toplevel, &arg, ONE);
+ if (icon_pixmap == None) {
+ arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel),
+ XtScreen(toplevel)->root,
+ (char *)clock_bits, clock_width, clock_height);
+ XtSetValues (toplevel, &arg, ONE);
+ }
+ XtSetArg(arg, XtNiconMask, &icon_pixmap);
+ XtGetValues(toplevel, &arg, ONE);
+ if (icon_pixmap == None) {
+ arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel),
+ XtScreen(toplevel)->root,
+ (char *)clock_mask_bits, clock_mask_width,
+ clock_mask_height);
+ XtSetValues (toplevel, &arg, ONE);
+ }
+
+ XtCreateManagedWidget ("clock", clockWidgetClass, toplevel, NULL, ZERO);
+ XtRealizeWidget (toplevel);
+ wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW",
+ False);
+ (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
+ &wm_delete_window, 1);
+ XtAppMainLoop (app_con);
+ return 0;
}