XFree86 4.3.0.1

parent 7fa20e08
This diff is collapsed.
......@@ -49,6 +49,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $XFree86: xc/programs/xclock/Clock.h,v 1.12 2002/10/21 13:33:07 alanh Exp $ */
#ifndef _XawClock_h
#define _XawClock_h
......@@ -65,6 +66,7 @@ SOFTWARE.
Name Class RepType Default Value
---- ----- ------- -------------
twentyfour Boolean Boolean True
analog Boolean Boolean True
background Background Pixel white
backingStore BackingStore BackingStore default
......@@ -79,6 +81,7 @@ SOFTWARE.
highlight Foreground Pixel black
mappedWhenManaged MappedWhenManaged Boolean True
padding Margin int 8
utime Boolean Boolean False
update Interval int 60 (seconds)
width Width Dimension 164
x Position Position 0
......@@ -92,15 +95,51 @@ SOFTWARE.
#define XtNhand "hands"
/* Boolean: 24-hour if TRUE */
#define XtNtwentyfour "twentyfour"
/* Boolean: digital if FALSE */
#define XtNanalog "analog"
/* Boolean: only hour/minute if TRUE */
#define XtNbrief "brief"
/* String: will be used as format arg to
"strftime" if not empty string */
#define XtNstrftime "strftime"
/* Boolean: show seconds since Epoch if TRUE */
#define XtNutime "utime"
/* Boolean: */
#define XtNchime "chime"
/* Int: amount of space around outside of clock */
#define XtNpadding "padding"
/* Boolean: use Render extension if TRUE */
#define XtNrender "render"
/* Boolean: use backing pixmap for double buffering */
#define XtNbuffer "buffer"
/* RenderColor: colors for various clock elements */
#define XtNhourColor "hourColor"
#define XtNminuteColor "minuteColor"
#define XtNsecondColor "secondColor"
#define XtNmajorColor "majorColor"
#define XtNminorColor "minorColor"
#define XtRXftColor "XftColor"
#define XtNface "face"
#define XtCFace "Face"
#define XtRXftFont "XftFont"
/* Boolean: use sharp rendering for Render polygons */
#define XtNsharp "sharp"
#define XtCSharp "Sharp"
typedef struct _ClockRec *ClockWidget; /* completely defined in ClockPrivate.h */
typedef struct _ClockClassRec *ClockWidgetClass; /* completely defined in ClockPrivate.h */
......
......@@ -49,6 +49,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $XFree86: xc/programs/xclock/ClockP.h,v 1.12 2002/10/21 13:33:08 alanh Exp $ */
#ifndef _XawClockP_h
#define _XawClockP_h
......@@ -56,13 +57,21 @@ SOFTWARE.
#include <X11/Xos.h> /* Needed for struct tm. */
#include "Clock.h"
#include <X11/Xaw/SimpleP.h>
#ifdef XRENDER
#include <X11/Xft/Xft.h>
#include <X11/extensions/Xrender.h>
#endif
#define SEG_BUFF_SIZE 128
#define ASCII_TIME_BUFLEN 32 /* big enough for 26 plus slop */
#define STRFTIME_BUFF_SIZE 100 /* buffer for "strftime" option */
/* New fields for the clock widget instance record */
typedef struct {
#ifndef RENDER
Pixel fgpixel; /* color index for text */
#endif
Pixel Hipixel; /* color index for Highlighting */
Pixel Hdpixel; /* color index for hands */
XFontStruct *font; /* font for text */
......@@ -77,6 +86,10 @@ typedef struct {
Boolean chime;
Boolean beeped;
Boolean analog;
Boolean brief;
Boolean twentyfour;
Boolean utime;
String strftime;
Boolean show_second_hand;
Dimension second_hand_length;
Dimension minute_hand_length;
......@@ -93,8 +106,38 @@ typedef struct {
struct tm otm ;
XtIntervalId interval_id;
char prev_time_string[ASCII_TIME_BUFLEN];
#ifdef XRENDER
XftColor fg_color;
XftColor hour_color;
XftColor min_color;
XftColor sec_color;
XftColor major_color;
XftColor minor_color;
XftFont *face;
XRenderPictFormat *mask_format;
Boolean render;
Boolean sharp;
Boolean can_polygon;
Boolean buffer;
XftDraw *draw;
Picture picture;
Picture fill_picture;
Pixmap pixmap;
XRectangle damage;
XDouble x_scale;
XDouble x_off;
XDouble y_scale;
XDouble y_off;
#endif
} ClockPart;
#ifdef XRENDER
#define ClockFgPixel(c) ((c)->clock.fg_color.pixel)
#else
#define ClockFgPixel(c) ((c)->clock.fgpixel)
#endif
/* Full instance record declaration */
typedef struct _ClockRec {
CorePart core;
......
......@@ -2,6 +2,8 @@
/*
* xclock -- Hacked from Tony Della Fera's much hacked clock program.
*
* "-strftime" option added by George Belotsky, Open Light Software Inc.
*/
/*
......@@ -27,7 +29,10 @@ Except as contained in this notice, the name of The Open Group 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 Open Group.
*/
/* $XFree86: xc/programs/xclock/xclock.c,v 1.16 2002/10/21 13:33:08 alanh Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
......@@ -41,7 +46,6 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/XKBbells.h>
#endif
extern void exit();
/* Command line options table. Only resources are entered here...there is a
pass over the remaining options after XtParseCommand is let loose. */
......@@ -57,9 +61,22 @@ static XrmOptionDescRec options[] = {
{"-d", "*clock.analog", XrmoptionNoArg, "FALSE"},
{"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"},
{"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"},
{"-twelve", "*clock.twentyfour", XrmoptionNoArg, "FALSE"},
{"-twentyfour", "*clock.twentyfour", XrmoptionNoArg, "TRUE"},
{"-brief", "*clock.brief", XrmoptionNoArg, "TRUE"},
{"-utime", "*clock.utime", XrmoptionNoArg, "TRUE"},
{"-strftime", "*clock.strftime", XrmoptionSepArg, NULL},
#ifdef XRENDER
{"-face", "*clock.face", XrmoptionSepArg, NULL},
{"-render", "*clock.render", XrmoptionNoArg, "TRUE"},
{"-norender", "*clock.render", XrmoptionNoArg, "FALSE"},
{"-sharp", "*clock.sharp", XrmoptionNoArg, "TRUE"},
#endif
};
static void quit();
static void quit ( Widget w, XEvent *event, String *params,
Cardinal *num_params );
static XtActionsRec xclock_actions[] = {
{ "quit", quit },
};
......@@ -69,32 +86,30 @@ static Atom wm_delete_window;
/*
* Report the syntax for calling xclock.
*/
Syntax(call)
char *call;
static void
Syntax(char *call)
{
(void) printf ("Usage: %s [-analog] [-bw <pixels>] [-digital]\n", call);
(void) printf ("Usage: %s [-analog] [-bw <pixels>] [-digital] [-brief] [-utime] [-strftime <fmt-str>]\n", call);
(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");
#ifdef XRENDER
(void) printf (" [-render] [-face <face name>] [-sharp]\n");
#endif
(void) printf (" [-geometry geom] [-twelve] [-twentyfour]\n\n");
exit(1);
}
static void die(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
static void
die(Widget w, XtPointer client_data, XtPointer call_data)
{
XCloseDisplay(XtDisplayOfObject(w));
exit(0);
}
static void quit (w, event, params, num_params)
Widget w; /* ApplicationShellWidget */
XEvent *event;
String *params;
Cardinal *num_params;
static void
quit(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Arg arg;
......@@ -113,18 +128,16 @@ static void quit (w, event, params, num_params)
}
}
static void save(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
static void
save(Widget w, XtPointer client_data, XtPointer call_data)
{
XtCheckpointToken token = (XtCheckpointToken) call_data;
/* we have nothing to save */
token->save_success = True;
}
void main(argc, argv)
int argc;
char **argv;
int
main(int argc, char *argv[])
{
Widget toplevel;
Arg arg;
......@@ -137,7 +150,6 @@ void main(argc, argv)
if (argc != 1) Syntax(argv[0]);
XtAddCallback(toplevel, XtNdieCallback, die, NULL);
XtAddCallback(toplevel, XtNsaveCallback, save, NULL);
XtAppAddActions (app_con, xclock_actions, XtNumber(xclock_actions));
/*
......@@ -149,12 +161,14 @@ void main(argc, argv)
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) {
......@@ -172,4 +186,5 @@ void main(argc, argv)
(void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
&wm_delete_window, 1);
XtAppMainLoop (app_con);
exit(0);
}
......@@ -22,14 +22,18 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.TH XCLOCK 1 "Release 6.4" "X Version 11"
.\"
.\" $XFree86: xc/programs/xclock/xclock.man,v 1.13 2002/10/21 13:33:08 alanh Exp $
.\"
.TH XCLOCK 1 __xorgversion__
.SH NAME
xclock \- analog / digital clock for X
.SH SYNOPSIS
.ta 8n
\fBxclock\fP [ \fB\-help\fP ] [ \fB\-analog\fP ] [ \fB\-digital\fP ]
[ \fB\-chime\fP ] [ \fB\-hd\fP \fIcolor\fP ]
[ \fB\-brief\fP ] [ \fB\-chime\fP ] [ \fB\-hd\fP \fIcolor\fP ]
[ \fB\-hl\fP \fIcolor\fP ] [ \fB\-update\fP \fIseconds\fP ]
[ \fB\-strftime\fP \fIformat\fP ]
[ \fB\-padding\fP \fInumber\fP ]
.SH DESCRIPTION
The
......@@ -52,6 +56,27 @@ and hands should be used. This is the default.
\fB\-digital\fP or \fB\-d\fP
This option indicates that a 24 hour digital clock should be used.
.TP 8
\fB\-brief\fP
This option indicates that the digital clock should only display the hours
and minutes fields. The default is to show the full time and date information.
.TP 8
\fB\-utime\fP or \fB\-d\fP
This option indicates that a digital clock should display seconds since
the Epoch (in format '970012340 seconds since Epoch' instead of a standard
24-hour time.
.TP 8
.B \-strftime \fIformat\fP
This option allows an strftime(3) format string to be specified for the
digital clock's display.
.TP 8
.B \-twelve
This option indicates that a digital clock should display the time in
twelve hour format.
.TP 8
.B \-twentyfour
This option indicates that a digital clock should display the time in
twenty-four hour format. This is the default when a digital clock is used.
.TP 8
.B \-chime
This option indicates that the clock should chime
once on the half hour and twice on the hour.
......@@ -115,6 +140,10 @@ the default is \fIlwhite\fP, otherwise the default is \fIblack\fP.
Specifies whether or not an analog clock should be used instead of a digital
one. The default is True.
.TP 8
.B twentyfour (\fPclass\fB Boolean)
Specifies whether or not a digital clock should display the time in
twenty-four hour format. The default is True.
.TP 8
.B chime (\fPclass\fB Boolean)
Specifies whether or not a bell should be rung on the hour and half hour.
.TP 8
......@@ -148,9 +177,11 @@ to get the default host and display number.
to get the name of a resource file that overrides the global resources
stored in the RESOURCE_MANAGER property.
.SH FILES
<XRoot>/lib/X11/app-defaults/XClock - specifies required resources
.TP
.I __apploaddir__/XClock
specifies required resources
.SH "SEE ALSO"
X(1), xrdb(1), time(3C)
X(__miscmansuffix__), xrdb(1), time(3C)
.SH BUGS
.I Xclock
believes the system clock.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment