… | |
… | |
184 | static int32_t |
184 | static int32_t |
185 | Sin (int32_t arg) |
185 | Sin (int32_t arg) |
186 | { |
186 | { |
187 | int32_t x = (arg - 360) * 16384 / 360; |
187 | int32_t x = (arg - 360) * 16384 / 360; |
188 | |
188 | |
189 | int c, x2, y; |
189 | int c, y; |
190 | static const int qN = 13, qA = 12, B = 19900, C = 3516; |
190 | static const int qN = 13, qA = 12, B = 19900, C = 3516; |
191 | |
191 | |
192 | c = x << (30 - qN); // Semi-circle info into carry. |
192 | c = x << (30 - qN); // Semi-circle info into carry. |
193 | x -= 1 << qN; // sine -> cosine calc |
193 | x -= 1 << qN; // sine -> cosine calc |
194 | |
194 | |
… | |
… | |
304 | 0, 0, /* base size */ |
304 | 0, 0, /* base size */ |
305 | NorthWestGravity /* gravity */ |
305 | NorthWestGravity /* gravity */ |
306 | }; |
306 | }; |
307 | |
307 | |
308 | /* subroutine declarations */ |
308 | /* subroutine declarations */ |
309 | static void geometry2sizehint (mywindow_t * /* win */ , |
309 | static void geometry2sizehint (mywindow_t *win, const char *geom); |
310 | const char * /* geom */ ); |
|
|
311 | static void Create_Windows (int /* argc */ , |
310 | static void Create_Windows (int argc, char *argv[]); |
312 | char * /* argv */ []); |
|
|
313 | static void getXevent (); |
311 | static void getXevent (); |
314 | static void print_error (const char * /* fmt */ , ...); |
312 | static void print_error (const char *fmt, ...); |
315 | |
313 | |
316 | static void Draw_Window (mywindow_t * /* this_win */ , |
314 | static void Draw_Window (mywindow_t *this_win, int full_redraw); |
317 | int /* full_redraw */ ); |
|
|
318 | static void Reminder (); |
315 | static void Reminder (); |
319 | static void Next_Reminder (int /* update_only */ ); |
316 | static void Next_Reminder (int update_only); |
320 | |
317 | |
321 | /* Arguments for Next_Reminder() */ |
318 | /* Arguments for Next_Reminder() */ |
322 | #define REPLACE 0 |
319 | #define REPLACE 0 |
323 | #define UPDATE 1 |
320 | #define UPDATE 1 |
324 | |
321 | |
… | |
… | |
636 | |
633 | |
637 | /* |
634 | /* |
638 | * translate geometry string to appropriate sizehint |
635 | * translate geometry string to appropriate sizehint |
639 | */ |
636 | */ |
640 | static void |
637 | static void |
641 | geometry2sizehint (mywindow_t * win, const char *geom) |
638 | geometry2sizehint (mywindow_t *win, const char *geom) |
642 | { |
639 | { |
643 | int x, y, flags; |
640 | int x, y, flags; |
644 | unsigned int width, height; |
641 | unsigned int width, height; |
645 | |
642 | |
646 | /* copy in values */ |
643 | /* copy in values */ |
… | |
… | |
770 | } |
767 | } |
771 | |
768 | |
772 | static time_t |
769 | static time_t |
773 | mk_time (struct tm *tmval) |
770 | mk_time (struct tm *tmval) |
774 | { |
771 | { |
775 | return (tmval->tm_min + 60 * (tmval->tm_hour + 24 * (tmval->tm_mday + 31 * ((tmval->tm_mon + 1) + 12 * tmval->tm_year)))); |
772 | return (tmval->tm_min |
|
|
773 | + 60 * (tmval->tm_hour |
|
|
774 | + 24 * (tmval->tm_mday |
|
|
775 | + 31 * ((tmval->tm_mon + 1) |
|
|
776 | + 12 * tmval->tm_year)))); |
776 | } |
777 | } |
777 | |
778 | |
778 | #ifdef MAIL |
779 | #ifdef MAIL |
779 | static int |
780 | static int |
780 | MailAvailable () |
781 | MailAvailable () |
… | |
… | |
811 | * Redraw the whole window after an exposure or size change. |
812 | * Redraw the whole window after an exposure or size change. |
812 | * After a timeout, only redraw the hands. |
813 | * After a timeout, only redraw the hands. |
813 | * Provide reminder if needed. |
814 | * Provide reminder if needed. |
814 | *----------------------------------------------------------------------*/ |
815 | *----------------------------------------------------------------------*/ |
815 | static void |
816 | static void |
816 | Draw_Window (mywindow_t * W, int full_redraw) |
817 | Draw_Window (mywindow_t *W, int full_redraw) |
817 | { |
818 | { |
818 | static int savedDay = -1; |
819 | static int savedDay = -1; |
819 | |
820 | |
820 | time_t currentTime; |
821 | time_t currentTime; |
821 | struct tm *tmval; |
822 | struct tm *tmval; |
… | |
… | |
939 | Xgc, |
940 | Xgc, |
940 | (Msg.width - |
941 | (Msg.width - |
941 | XTextWidth (Xfont, beg, (end - beg))) / 2, 10 + Xfont->ascent + FontHeight () * lines, beg, (end - beg)); |
942 | XTextWidth (Xfont, beg, (end - beg))) / 2, 10 + Xfont->ascent + FontHeight () * lines, beg, (end - beg)); |
942 | } |
943 | } |
943 | |
944 | |
944 | XDrawString (Xdisplay, msgButton.Dismiss, Xrvgc, (msgButton.width - XTextWidth (Xfont, "Done", 4)) / 2, Xfont->ascent + 2, "Done", 4); |
945 | XDrawString (Xdisplay, msgButton.Dismiss, Xrvgc, (msgButton.width - XTextWidth (Xfont, "Done" , 4)) / 2, Xfont->ascent + 2, "Done", 4); |
945 | |
946 | |
946 | XDrawString (Xdisplay, msgButton.Defer, Xrvgc, (msgButton.width - XTextWidth (Xfont, "Defer", 5)) / 2, Xfont->ascent + 2, "Defer", 5); |
947 | XDrawString (Xdisplay, msgButton.Defer , Xrvgc, (msgButton.width - XTextWidth (Xfont, "Defer", 5)) / 2, Xfont->ascent + 2, "Defer", 5); |
947 | |
948 | |
948 | # ifndef NO_REMINDER_EXEC |
949 | # ifndef NO_REMINDER_EXEC |
949 | XDrawString (Xdisplay, msgButton.Start, Xrvgc, (msgButton.width - XTextWidth (Xfont, "Start", 5)) / 2, Xfont->ascent + 2, "Start", 5); |
950 | XDrawString (Xdisplay, msgButton.Start , Xrvgc, (msgButton.width - XTextWidth (Xfont, "Start", 5)) / 2, Xfont->ascent + 2, "Start", 5); |
950 | |
951 | |
951 | if (strlen (execPrgm) > 1) |
952 | if (strlen (execPrgm) > 1) |
952 | XMapWindow (Xdisplay, msgButton.Start); |
953 | XMapWindow (Xdisplay, msgButton.Start); |
953 | else |
954 | else |
954 | XUnmapWindow (Xdisplay, msgButton.Start); |
955 | XUnmapWindow (Xdisplay, msgButton.Start); |