Kodama's home / tips.
僕のマシンでは,
.fvwmrc で Style "oclock" StaysOnTop, Sticky, WindowListSkip .xinitrc で oclock -transparent -geometry 80x80+300+0 &として, いつもいつも見えるようになってます.
X のソ−スの programs 以下は X のプログラミングのサンプル的な意味もあるので, 改造して遊びましょう.
oclock.patch oclock from xc/programs/oclock in X11R6 sample source K.Kodama 1999.12.11 *** ClockP.h.orig Sat Dec 11 19:45:01 1999 --- ClockP.h Sat Dec 11 19:47:14 1999 *************** *** 63,68 **** --- 63,69 ---- int shape_height; /* window height when shape last made */ double hour_angle; /* hour hand position */ double minute_angle; /* minute hand position */ + double second_angle; /* second hand position */ int polys_valid; /* polygons contain good data */ TPoint minute_poly[POLY_SIZE]; /* polygon for minute hand */ TPoint hour_poly[POLY_SIZE]; /* polygon for hour hand */ *** Clock.c.orig Sat Dec 11 19:45:11 1999 --- Clock.c Sat Dec 11 19:59:15 1999 *************** *** 446,452 **** w->clock.hour_angle = clock_to_angle ((((double) tm->tm_hour) + ((double) tm->tm_min) / 60.0) / 12.0); w->clock.minute_angle = ! clock_to_angle (((double) tm->tm_min) / 60.0); /* * add the timeout before painting the hands, that may * take a while and we'd like the clock to keep up --- 446,457 ---- w->clock.hour_angle = clock_to_angle ((((double) tm->tm_hour) + ((double) tm->tm_min) / 60.0) / 12.0); w->clock.minute_angle = ! /* clock_to_angle (((double) tm->tm_min) / 60.0); */ ! clock_to_angle (( ! ((double) tm->tm_min) + ((double)tm->tm_sec)/60.0 ! )/ 60.0); ! w->clock.second_angle = ! clock_to_angle (((double) tm->tm_sec) / 60.0); /* * add the timeout before painting the hands, that may * take a while and we'd like the clock to keep up *************** *** 454,460 **** */ w->clock.interval_id = XtAppAddTimeOut (XtWidgetToApplicationContext((Widget) w), ! (60 - tm->tm_sec) * 1000, new_time, client_data); compute_hands (w); if (w->clock.transparent) Resize (w); --- 459,465 ---- */ w->clock.interval_id = XtAppAddTimeOut (XtWidgetToApplicationContext((Widget) w), ! /*(60 - tm->tm_sec)*/ 1 * 1000, new_time, client_data); compute_hands (w); if (w->clock.transparent) Resize (w); *************** *** 467,478 **** --- 472,534 ---- Drawable d; GC gc; { + double s,c; if (JEWEL_SIZE(w) > 0.0) { TFillArc (XtDisplay (w), d, gc, &w->clock.t, JEWEL_X(w) - JEWEL_SIZE(w) / 2.0, JEWEL_Y(w) - JEWEL_SIZE(w) / 2.0, JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + /* */ + c=JEWEL_Y(w)*0.8660254; + s=JEWEL_Y(w)*0.5; + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + JEWEL_X(w) - JEWEL_SIZE(w) / 2.0, + -JEWEL_Y(w) - JEWEL_SIZE(w) / 2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + JEWEL_Y(w) - JEWEL_SIZE(w) / 2.0, + JEWEL_X(w) - JEWEL_SIZE(w) / 2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + -JEWEL_Y(w) - JEWEL_SIZE(w) / 2.0, + JEWEL_X(w) - JEWEL_SIZE(w) / 2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + c- JEWEL_SIZE(w)/2.0, + s- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + s- JEWEL_SIZE(w)/2.0, + c- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + -c- JEWEL_SIZE(w)/2.0, + s- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + -s- JEWEL_SIZE(w)/2.0, + c- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + -c- JEWEL_SIZE(w)/2.0, + -s- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + -s- JEWEL_SIZE(w)/2.0, + -c- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + c- JEWEL_SIZE(w)/2.0, + -s- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + TFillArc (XtDisplay (w), d, gc, &w->clock.t, + s- JEWEL_SIZE(w)/2.0, + -c- JEWEL_SIZE(w)/2.0, + JEWEL_SIZE(w), JEWEL_SIZE(w), 0, 360 * 64); + + } } *************** *** 584,591 **** --- 640,657 ---- Drawable d; GC minute_gc, hour_gc; { + double s,c; if (w->clock.polys_valid) { paint_hand (w, d, hour_gc, w->clock.hour_poly); paint_hand (w, d, minute_gc, w->clock.minute_poly); + + s=sin(w->clock.second_angle)*(JEWEL_Y(w)-JEWEL_SIZE(w)*2.0); + c=cos(w->clock.second_angle)*(JEWEL_Y(w)-JEWEL_SIZE(w)*2.0); + TFillArc (XtDisplay (w), d, minute_gc, &w->clock.t, + c- JEWEL_SIZE(w), + s- JEWEL_SIZE(w), + JEWEL_SIZE(w)*2.0, JEWEL_SIZE(w)*2.0, 0, 360 * 64); + + } }
Kodama's home / tips.