From b9522ee69f560f9cc406b7e00b028d9190242091 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 6 Jul 2005 02:30:19 +0000 Subject: [PATCH] Removed unused autoconf macro hv-debug Cleaned-up header files --- Makefile.am | 1 - NEWS | 5 +++-- config/.gitignore | 0 config/hv-debug.m4 | 18 ------------------ configure.in | 11 ----------- doc/hvclock.man | 5 +++++ src/calendar.c | 19 +++++++++++++++++++ src/calendar.h | 22 ---------------------- src/clock.c | 6 ++++++ src/clock.h | 9 --------- src/dockapp.c | 10 ++++++++++ src/dockapp.h | 10 ---------- src/hvclock.c | 27 ++++++++++++++++----------- src/hvclock.h | 5 +---- src/options.c | 7 +++++++ src/xevents.c | 4 ++++ src/xevents.h | 4 ---- 17 files changed, 71 insertions(+), 92 deletions(-) create mode 100644 config/.gitignore delete mode 100644 config/hv-debug.m4 diff --git a/Makefile.am b/Makefile.am index 8c6d287..ba93f8f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,6 @@ SUBDIRS = src doc ## 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) diff --git a/NEWS b/NEWS index 3cf473c..f65454b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ -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 + diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/config/hv-debug.m4 b/config/hv-debug.m4 deleted file mode 100644 index f8fc330..0000000 --- a/config/hv-debug.m4 +++ /dev/null @@ -1,18 +0,0 @@ -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 ) -]) - diff --git a/configure.in b/configure.in index 535a595..5c06b3c 100644 --- a/configure.in +++ b/configure.in @@ -23,9 +23,6 @@ AC_C_CONST 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" @@ -86,13 +83,5 @@ echo " Install path: ${prefix}" 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." diff --git a/doc/hvclock.man b/doc/hvclock.man index 73f9f12..b8d7842 100644 --- a/doc/hvclock.man +++ b/doc/hvclock.man @@ -15,6 +15,11 @@ The interface is kept very simple. To switch between calendar view and 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 diff --git a/src/calendar.c b/src/calendar.c index b9603d9..f2a1ca1 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -29,6 +29,25 @@ #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 */ diff --git a/src/calendar.h b/src/calendar.h index 591710a..eb2ecc7 100644 --- a/src/calendar.h +++ b/src/calendar.h @@ -4,28 +4,6 @@ #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 ); diff --git a/src/clock.c b/src/clock.c index c7efda8..89fc62a 100644 --- a/src/clock.c +++ b/src/clock.c @@ -32,6 +32,12 @@ #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 " diff --git a/src/clock.h b/src/clock.h index 7265271..1643555 100644 --- a/src/clock.h +++ b/src/clock.h @@ -4,15 +4,6 @@ #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 ); diff --git a/src/dockapp.c b/src/dockapp.c index 351637f..71d5f61 100644 --- a/src/dockapp.c +++ b/src/dockapp.c @@ -21,6 +21,16 @@ #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[] ) { diff --git a/src/dockapp.h b/src/dockapp.h index 996f6c1..39fde8c 100644 --- a/src/dockapp.h +++ b/src/dockapp.h @@ -7,16 +7,6 @@ #include -#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; diff --git a/src/hvclock.c b/src/hvclock.c index f0ecc80..910c5c3 100644 --- a/src/hvclock.c +++ b/src/hvclock.c @@ -41,6 +41,11 @@ #include "hvclock.h" +/* Constants */ +#define CLOCK_MODE 0 +#define CALENDAR_MODE 1 + + /* Thread ID */ static pthread_t timer_thread; @@ -74,9 +79,9 @@ xmalloc( size_t size, const char *filename, int line_number ) static void CatchTimerSignal( /*@unused@*/ int signal ) { -#if defined(DEBUG) + if( hvclock_infos.debug ) { printf( "%s: Catching signal SIGUSR1.\n", PACKAGE ); -#endif + } } @@ -85,9 +90,9 @@ SingleClick( void ) { 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 ) @@ -103,9 +108,9 @@ SingleClick( void ) exit( EXIT_FAILURE ); } -#if defined(DEBUG) - printf( "%s: SingleClick() Exit\n", PACKAGE ); -#endif + if( hvclock_infos.debug ) { + printf( "%s: SingleClick() Exit\n", PACKAGE ); + } } @@ -136,9 +141,9 @@ TimerThread( /*@unused@*/ void *arg ) (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 ); + } } } diff --git a/src/hvclock.h b/src/hvclock.h index cb02f70..c910a8e 100644 --- a/src/hvclock.h +++ b/src/hvclock.h @@ -4,13 +4,10 @@ #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; diff --git a/src/options.c b/src/options.c index 263d5bf..9b7b575 100644 --- a/src/options.c +++ b/src/options.c @@ -29,6 +29,7 @@ DisplayUsage( void ) { printf( "Usage: %s [OPTIONS]...\n", PACKAGE ); printf( "Dockable analog clock and calendar.\n\n" ); + printf( " -d Display debugging messages.\n" ); printf( " -display X display name\n" ); printf( " -geometry +XPOS+YPOS initial window position\n" ); printf( " -h display this help and exit\n" ); @@ -74,6 +75,9 @@ ParseCommandLineOptions( int argc, char *argv[] ) 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] ) { @@ -84,6 +88,9 @@ ParseCommandLineOptions( int argc, char *argv[] ) 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] ) ) { diff --git a/src/xevents.c b/src/xevents.c index eafe36f..ea23e05 100644 --- a/src/xevents.c +++ b/src/xevents.c @@ -22,6 +22,10 @@ #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; diff --git a/src/xevents.h b/src/xevents.h index 1d1e362..c3d8a39 100644 --- a/src/xevents.h +++ b/src/xevents.h @@ -4,10 +4,6 @@ #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 ) ); -- 2.20.1