## we want these in the dist tarball
EXTRA_DIST = autogen.sh \
$(ac_aux_dir)/acx_pthread.m4 \
- $(ac_aux_dir)/hv-debug.m4 \
pixmaps
ACLOCAL = aclocal -I $(ac_aux_dir)
-2003-04-02: hvclock-0.1.0 has been released.
- See the file 'ChangeLog' to see what has changed since last version.
+2005-07-05: hvclock-0.1.0 has been released.
+ This is the initial release
+
+++ /dev/null
-dnl
-dnl Macro for adding an option to 'configure' for enabling debugging messages
-dnl
-AC_DEFUN([HV_CHECK_FOR_DEBUG],[
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
- [enable debugging messages on console
- (default is NO)]),[
- if test x"${enableval}" = xyes; then
- debug_messages=1
- AC_DEFINE([DEBUG],1,[Set to 1 to enable debugging messages.])
- elif test x"${enableval}" = xno; then
- debug_messages=0
- else
- AC_MSG_ERROR(bad value for --enable-debug option)
- fi
-], debug_messages=0 )
-])
-
AC_TYPE_PID_T
AC_TYPE_SIZE_T
-dnl Checks for '--enable-debug' option
-HV_CHECK_FOR_DEBUG
-
dnl Basic CFLAGS values
CFLAGS="${CFLAGS} -Wall"
echo " Compiler: ${CC}"
echo " Compiler flags: ${CFLAGS}"
echo " Linker flags: ${LIBS}"
-echo
-echo -n " Debugging: "
-if test x"${debug_messages}" = x1; then
- echo "yes"
-else
- echo "no"
-fi
-
echo
echo "Configure finished. Type 'make' to build."
clock view, single-click on the clock or calendar image.
.SH "OPTIONS"
+
+.TP
+\fB\-d\fR
+Display debugging messages.
+
.TP
.BI \-display " host" : display
Specifies the host and screen to be used by \fBhvclock\fR. By default this
#include "calendar.h"
+#define CALENDAR_BACKGROUND_SRC_X 64
+#define CALENDAR_BACKGROUND_SRC_Y 64
+
+#define WEEKDAYS_BASE_X 3
+#define WEEKDAYS_BASE_Y 65
+#define WEEKDAYS_HEIGHT 10
+#define WEEKDAYS_DELTA_Y 12
+
+#define MONTHS_BASE_X 130
+#define MONTHS_BASE_Y 1
+#define MONTHS_HEIGHT 10
+#define MONTHS_DELTA_Y 11
+
+#define NUMBERS_SRC_X 184
+#define NUMBERS_SRC_Y 0
+#define NUMBERS_DELTA_X 20
+#define NUMBERS_DELTA_Y 27
+
+
static const int number_widths[]={
18, /* 0 */
12, /* 1 */
#ifndef CALENDAR_H
#define CALENDAR_H 1
-/* Constants */
-
-#define CALENDAR_BACKGROUND_SRC_X 64
-#define CALENDAR_BACKGROUND_SRC_Y 64
-
-#define WEEKDAYS_BASE_X 3
-#define WEEKDAYS_BASE_Y 65
-#define WEEKDAYS_HEIGHT 10
-#define WEEKDAYS_DELTA_Y 12
-
-#define MONTHS_BASE_X 130
-#define MONTHS_BASE_Y 1
-#define MONTHS_HEIGHT 10
-#define MONTHS_DELTA_Y 11
-
-#define NUMBERS_SRC_X 184
-#define NUMBERS_SRC_Y 0
-#define NUMBERS_DELTA_X 20
-#define NUMBERS_DELTA_Y 27
-
-
-/* Functions */
void
UpdateCalendar( void );
#include "clock.h"
+#define SIZE 64
+#define HAND_WIDTH 2
+#define HOUR_HAND_LENGTH 16
+#define MINUTE_HAND_LENGTH 25
+
+
static const char *clock_cfg =
"bg_image gfx/2.png "
"second_hand "
#ifndef CLOCK_H
#define CLOCK_H 1
-/* Constants */
-
-#define SIZE 64
-#define HAND_WIDTH 2
-#define HOUR_HAND_LENGTH 16
-#define MINUTE_HAND_LENGTH 25
-
-
-/* Functions */
void
UpdateClock( void );
#include "dockapp.h"
+#define XLIB_FAILURE 0
+#define XLIB_SUCCESS 1
+
+/* Specifies the border width */
+#define BWIDTH 1
+
+/* Width and height in pixels of Window Maker icons. */
+#define ICON_SIZE 64
+
+
static void
CreateIconFromXpmData( char *pixmap_data[] )
{
#include <X11/xpm.h>
-#define XLIB_FAILURE 0
-#define XLIB_SUCCESS 1
-
-/* Specifies the border width */
-#define BWIDTH 1
-
-/* Width and height in pixels of Window Maker icons. */
-#define ICON_SIZE 64
-
-
typedef struct XpmIcon
{
XpmAttributes attributes;
#include "hvclock.h"
+/* Constants */
+#define CLOCK_MODE 0
+#define CALENDAR_MODE 1
+
+
/* Thread ID */
static pthread_t timer_thread;
static void
CatchTimerSignal( /*@unused@*/ int signal )
{
-#if defined(DEBUG)
+ if( hvclock_infos.debug ) {
printf( "%s: Catching signal SIGUSR1.\n", PACKAGE );
-#endif
+ }
}
{
int status;
-#if defined(DEBUG)
- printf( "%s: SingleClick() Entry\n", PACKAGE );
-#endif
+ if( hvclock_infos.debug ) {
+ printf( "%s: SingleClick() Entry\n", PACKAGE );
+ }
/* single-click --> changing viewing mode */
if( mode == CLOCK_MODE )
exit( EXIT_FAILURE );
}
-#if defined(DEBUG)
- printf( "%s: SingleClick() Exit\n", PACKAGE );
-#endif
+ if( hvclock_infos.debug ) {
+ printf( "%s: SingleClick() Exit\n", PACKAGE );
+ }
}
(the requested time minus the time actually slept) in seconds. */
time_remaining = sleep( thread_sleep_time );
if( time_remaining != 0 ) {
-#if defined(DEBUG)
- printf( "%s: TimerThread() interrupted by signal\n", PACKAGE );
-#endif
+ if( hvclock_infos.debug ) {
+ printf( "%s: TimerThread() interrupted by signal\n", PACKAGE );
+ }
}
}
#ifndef HVCLOCK_H
#define HVCLOCK_H 1
-/* Constants */
-#define CLOCK_MODE 0
-#define CALENDAR_MODE 1
-
typedef struct hvclock_t
{
+ bool debug;
char *display_arg;
char *geometry_arg;
} hvclock_t;
{
printf( "Usage: %s [OPTIONS]...\n", PACKAGE );
printf( "Dockable analog clock and calendar.\n\n" );
+ printf( " -d Display debugging messages.\n" );
printf( " -display <host:display> X display name\n" );
printf( " -geometry +XPOS+YPOS initial window position\n" );
printf( " -h display this help and exit\n" );
bool display_on = FALSE;
bool geometry_on = FALSE;
+ /* Default values. */
+ hvclock_infos.debug = FALSE;
+
for( i = 1; i < argc; i++ ) {
token = argv[i];
switch( token[0] ) {
if( STREQ( "display", &token[1] ) ) {
display_on = TRUE;
}
+ else if( strlen( &token[1] ) == 1 ) {
+ hvclock_infos.debug = TRUE;
+ }
break;
case 'g':
if( STREQ( "geometry", &token[1] ) ) {
#include "xevents.h"
+/* Maximum time between mouse double-clicks, in milliseconds */
+#define DOUBLE_CLICK_MAX_INTERVAL_MS 250
+
+
/* Function pointers to handle single and double mouse click events. */
void (*SingleClickCallback)( void ) = NULL;
#define XEVENTS_H 1
-/* Maximum time between mouse double-clicks, in milliseconds */
-#define DOUBLE_CLICK_MAX_INTERVAL_MS 250
-
-
void
ProcessXlibEventsInit( void (*single_click_callback)( void ),
void (*double_click_callback)( void ) );