… | |
… | |
39 | #include <X11/Xlib.h> |
39 | #include <X11/Xlib.h> |
40 | #include <X11/Xutil.h> |
40 | #include <X11/Xutil.h> |
41 | |
41 | |
42 | #include "ecb.h" |
42 | #include "ecb.h" |
43 | |
43 | |
|
|
44 | #include "version.h" |
|
|
45 | |
44 | #define APL_CLASS "Clock" |
46 | #define APL_CLASS "Clock" |
45 | #define APL_NAME "rclock" |
47 | #define APL_NAME "rclock" |
46 | #define MSG_CLASS "Appointment" |
48 | #define MSG_CLASS "Appointment" |
47 | #define MSG_NAME "Appointment" |
49 | #define MSG_NAME "Appointment" |
48 | #define CONFIG_FILE ".rclock" |
50 | #define CONFIG_FILE ".rclock" |
49 | |
51 | |
50 | #ifndef EXIT_SUCCESS /* missed from <stdlib.h> ? */ |
52 | #ifndef EXIT_SUCCESS /* missed from <stdlib.h> ? */ |
51 | # define EXIT_SUCCESS 0 |
53 | # define EXIT_SUCCESS 0 |
52 | # define EXIT_FAILURE 1 |
54 | # define EXIT_FAILURE 1 |
53 | #endif |
55 | #endif |
54 | |
|
|
55 | #define VERSION "TODO: fetch from urxvt somehow" |
|
|
56 | |
56 | |
57 | /*--------------------------------*-C-*---------------------------------* |
57 | /*--------------------------------*-C-*---------------------------------* |
58 | * Compile-time configuration. |
58 | * Compile-time configuration. |
59 | *----------------------------------------------------------------------* |
59 | *----------------------------------------------------------------------* |
60 | * Copyright (C) 1997 1998 mj olesen <olesen@me.QueensU.CA> |
60 | * Copyright (C) 1997 1998 mj olesen <olesen@me.QueensU.CA> |
… | |
… | |
356 | # endif |
356 | # endif |
357 | #endif |
357 | #endif |
358 | {"#geom", "icon window geometry"} |
358 | {"#geom", "icon window geometry"} |
359 | }; |
359 | }; |
360 | |
360 | |
361 | fprintf (stderr, "\nUsage v" VERSION ":\n " APL_NAME " [options]\n\n" "where options include:\n"); |
361 | fprintf (stderr, "\nUsage for urclock version " VERSION "\n\n urclock [options]\n\n" "where options include:\n"); |
362 | |
362 | |
363 | for (i = 0; i < (int)optList_size (); i++) |
363 | for (i = 0; i < (int)optList_size (); i++) |
364 | fprintf (stderr, " %-29s%s\n", optList[i].opt, optList[i].desc); |
364 | fprintf (stderr, " %-29s%s\n", optList[i].opt, optList[i].desc); |
365 | } |
365 | } |
366 | |
366 | |
… | |
… | |
837 | #ifdef ICONWIN |
837 | #ifdef ICONWIN |
838 | static hands_t HandsOld_icon = { -1 }; |
838 | static hands_t HandsOld_icon = { -1 }; |
839 | #endif |
839 | #endif |
840 | #ifdef REMINDERS |
840 | #ifdef REMINDERS |
841 | static int lastUpdateTime = -10; |
841 | static int lastUpdateTime = -10; |
|
|
842 | #endif |
|
|
843 | #ifdef DATE_ON_CLOCK_FACE |
|
|
844 | static char clockdate[10]; |
842 | #endif |
845 | #endif |
843 | |
846 | |
844 | #ifdef MAIL |
847 | #ifdef MAIL |
845 | static time_t mailTime = 0; |
848 | static time_t mailTime = 0; |
846 | static int MailUp = 0, MailUp_rvideo = 0; |
849 | static int MailUp = 0, MailUp_rvideo = 0; |
… | |
… | |
908 | |
911 | |
909 | savedDay = tmval->tm_yday; |
912 | savedDay = tmval->tm_yday; |
910 | strftime (str, sizeof (str), "%a %h %d", tmval); |
913 | strftime (str, sizeof (str), "%a %h %d", tmval); |
911 | XStoreName (Xdisplay, Clock.win, str); |
914 | XStoreName (Xdisplay, Clock.win, str); |
912 | XSetIconName (Xdisplay, Clock.win, str); |
915 | XSetIconName (Xdisplay, Clock.win, str); |
913 | } |
|
|
914 | |
916 | |
|
|
917 | #if defined(REMINDERS) && defined(DATE_ON_CLOCK_FACE) |
|
|
918 | if (show_date) |
|
|
919 | { |
|
|
920 | strftime (clockdate, sizeof (clockdate), "%d", tmval); |
|
|
921 | full_redraw = 1; |
|
|
922 | } |
|
|
923 | } |
|
|
924 | |
|
|
925 | #endif |
915 | if (full_redraw) |
926 | if (full_redraw) |
916 | XClearWindow (Xdisplay, W->win); |
927 | XClearWindow (Xdisplay, W->win); |
917 | |
928 | |
918 | #ifdef REMINDERS |
929 | #ifdef REMINDERS |
919 | /* for a message window, just re-draw the message */ |
930 | /* for a message window, just re-draw the message */ |
… | |
… | |
1031 | |
1042 | |
1032 | /* |
1043 | /* |
1033 | * Draw the date in the lower half of the clock window. |
1044 | * Draw the date in the lower half of the clock window. |
1034 | * The code is enclosed in REMINDERS because it uses the same |
1045 | * The code is enclosed in REMINDERS because it uses the same |
1035 | * font as the reminders code. |
1046 | * font as the reminders code. |
1036 | * I believe this should be drawn always so it does not get |
|
|
1037 | * "swept away" by the minute hand. |
|
|
1038 | */ |
1047 | */ |
1039 | #if defined(REMINDERS) && defined(DATE_ON_CLOCK_FACE) |
1048 | #if defined(REMINDERS) && defined(DATE_ON_CLOCK_FACE) |
1040 | if (show_date) |
1049 | if (show_date) |
1041 | { |
|
|
1042 | char date[10]; |
|
|
1043 | |
|
|
1044 | currentTime = time (NULL) + adjustTime; /* get the current time */ |
|
|
1045 | tmval = localtime (¤tTime); |
|
|
1046 | strftime (date, sizeof (date), "%d", tmval); |
|
|
1047 | XDrawString (Xdisplay, W->win, X_gc, |
1050 | XDrawString (Xdisplay, W->win, X_gc, |
1048 | ctr_x - XTextWidth (Xfont, date, strlen (date)) / 2, |
1051 | ctr_x - XTextWidth (Xfont, clockdate, strlen (clockdate)) / 2, |
1049 | ctr_y + FontHeight () + (ctr_y - FontHeight ()) / 2, date, strlen (date)); |
1052 | ctr_y + FontHeight () + (ctr_y - FontHeight ()) / 2, clockdate, strlen (clockdate)); |
1050 | } |
|
|
1051 | #endif |
1053 | #endif |
1052 | |
1054 | |
1053 | if (full_redraw) |
1055 | if (full_redraw) |
1054 | { |
1056 | { |
1055 | int mintick; |
1057 | int mintick; |