mirror of
https://github.com/morgant/mlclock.git
synced 2025-08-10 19:25:19 +00:00
Imported mlclock 1.1 release
This commit is contained in:
21
Imakefile
Normal file
21
Imakefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# mlclock is macintosh like clock
|
||||
|
||||
RCFILE = .mlclockrc
|
||||
CC = gcc
|
||||
OPTION =
|
||||
|
||||
# If function dosen't find , add -lsocket or whatever you need .
|
||||
# This is example .
|
||||
#ADD_LIBRARIES = -lxpg4 -lsocket -lnsl
|
||||
ADD_LIBRARIES = -lxpg4
|
||||
|
||||
#---You shouldn't have to change anything below this line.---
|
||||
|
||||
LOCAL_LIBRARIES = $(XLIB) $(ADD_LIBRARIES)
|
||||
|
||||
SRCS = mlclock.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
DEFINES = $(OPTION) -DRCFILE=\"${RCFILE}\"
|
||||
|
||||
ComplexProgramTarget( mlclock )
|
11
Makefile.std
Normal file
11
Makefile.std
Normal file
@@ -0,0 +1,11 @@
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD>ѥ<EFBFBD><D1A5><EFBFBD>
|
||||
|
||||
a:: mlclock
|
||||
|
||||
mlclock :mlclock.c
|
||||
gcc -O2 -Wall mlclock.c -o mlclock -I/usr/X11R6/include \
|
||||
-L/usr/X11R6/lib -lX11 -lxpg4 -DRCFILE=\".mlclockrc\"
|
||||
|
||||
clean::
|
||||
rm -f *.o core *~ *.core "#"* mlclock
|
||||
|
15
README
Normal file
15
README
Normal file
@@ -0,0 +1,15 @@
|
||||
MLCLOCK is "Macintosh like clock"
|
||||
|
||||
HOW TO COMPILE
|
||||
|
||||
1) xmkmf
|
||||
2) make
|
||||
|
||||
HOW TO USE
|
||||
|
||||
Copy mlclockrc file to your home directory as ".mlclockrc" or specifyed name.
|
||||
Run mlclock.
|
||||
|
||||
ABOUT BUGS
|
||||
|
||||
Send mail to hideki@hry.info.gifu-u.ac.jp
|
42
README.EUC
Normal file
42
README.EUC
Normal file
@@ -0,0 +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Ǥ<D4A4><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
||||
|
||||
<EFBFBD>ʥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʻȤ<EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .mlvwmrc <20><>
|
||||
Swallow "MLClock" Action Exec "mlclock" exec mlclock
|
||||
<20>ΰ<EFBFBD><CEB0>Ԥ<EFBFBD><D4A4>ä<EFBFBD><C3A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4>٤Ƥ<D9A4><C6A4>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
EVENT <20>ˤĤ<CBA4><C4A4><EFBFBD>
|
||||
|
||||
<20>Ϥ<EFBFBD><CFA4>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD>ϡ<EFBFBD>mlvwm <20>Υ<EFBFBD><CEA5>˥塼<CBA5><E5A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD> CLICK <20><><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD>ΤǤ<CEA4><C7A4><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20>Ƕ<EFBFBD><C7B6>Ϥʤ<CAA4><F3A4ABA5>٥<EFBFBD><D9A5>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><><EFBFBD>ä<EFBFBD> EVENT <20>ˤ<EFBFBD> FOCUS <20><><EFBFBD>ȤäƲ<C3A4><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>
|
||||
<20><><EFBFBD>̤ˡ<CCA4><CBA1>Ȥ<EFBFBD><C8A4>֤<EFBFBD><D6A4>ˤϤɤ<CFA4><C9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
||||
|
||||
<EFBFBD>Х<EFBFBD><EFBFBD>ˤĤ<EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뤫<EFBFBD>Ȥϻפ<CFBB><D7A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ť<EFBFBD><C5A4><EFBFBD><EFBFBD><EFBFBD>
|
||||
hideki@hry.info.gifu-u.ac.jp
|
||||
<20>ޤǡ<DEA4><C7A1><EFBFBD>뤷<EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
MLCLOCK <20>Υڡ<CEA5><DAA1><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD>
|
||||
|
||||
http://www.hry.info.gifu-u.ac.jp/~hideki/index.html
|
||||
<20>˥<EFBFBD><CBA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƤߤƲ<DFA4><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MLCLOCK<43>κǿ<CEBA><C7BF><EFBFBD>¾<EFBFBD><C2BE>X window <20>ѤΥ<D1A4><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤɤ<CAA4><C9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
449
mlclock.c
Normal file
449
mlclock.c
Normal file
@@ -0,0 +1,449 @@
|
||||
/*
|
||||
* Mlclock is "Macintsh like clock" .
|
||||
* Written by Hideki Kimata.
|
||||
* Send Email to hideki@hry.info.gifu-u.ac.jp.
|
||||
* Access to http://www.hry.info.gifu-u.ac.jp/~hideki/index.html
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlocale.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define VERSION "1.1"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define NONE -1
|
||||
#define MAX_FORM 1000
|
||||
|
||||
#ifndef RCFILE
|
||||
#define RCFILE ".mlclockrc"
|
||||
#endif
|
||||
|
||||
#define FOCUS 0
|
||||
#define CLICK 1
|
||||
#define DEFAULTFONT "-*-*-medium-r-normal--14-*"
|
||||
#define NEAR 10
|
||||
#define FORM1 "(%a)%p%l:%M:%S"
|
||||
#define FORM2 "(%a)%Y.%b.%d"
|
||||
#define DEFAULTLANG "C"
|
||||
|
||||
int Mode ; /* timing of change form */
|
||||
int Near ; /* the distance of activity */
|
||||
int Head ; /* space of window head */
|
||||
char *Form1 ; /* display form of main */
|
||||
char *Form2 ; /* display form of second */
|
||||
char *LocaleName ; /* locale name */
|
||||
char *FSName ; /* font set name */
|
||||
char *RCFile ; /* path of config file */
|
||||
int Color[2][3] ; /* the color for font and background */
|
||||
int Bold = False ; /* software bold font */
|
||||
|
||||
void SetFont( char *localename , Display *dpy , char *fsname ) ;
|
||||
void readrc() ;
|
||||
void getRGB( char *color , int *store ) ;
|
||||
void usage( char *name ) ;
|
||||
|
||||
Display *dpy ;
|
||||
Window win ;
|
||||
XEvent eve ;
|
||||
XRectangle ink, log;
|
||||
GC gc ;
|
||||
XFontSet fs ;
|
||||
Colormap cmap ;
|
||||
|
||||
struct timeval wait ;
|
||||
|
||||
void main( int argc , char **argv ){
|
||||
char str[MAX_FORM] , str2[MAX_FORM] , *form = NULL ;
|
||||
int screen , sw = False , lsec = 0 , uhead , width , height , i ;
|
||||
struct tm *tmm ;
|
||||
time_t tmt ;
|
||||
|
||||
Window root , child ;
|
||||
int rootx , rooty , wx , wy ;
|
||||
unsigned int key ;
|
||||
XColor xcol ;
|
||||
XSizeHints hint ;
|
||||
int iro[2] ;
|
||||
|
||||
wait.tv_usec = 200000 ;
|
||||
wait.tv_sec = 0 ;
|
||||
|
||||
str[0] = '\0' ;
|
||||
i = 1 ;
|
||||
while( i < argc ){
|
||||
if ( !strcmp( "-display" , argv[i] )){
|
||||
i++ ;
|
||||
if ( argc >= argc )
|
||||
usage( argv[0]) ;
|
||||
strcpy( str , argv[i] ) ;
|
||||
break ;
|
||||
}
|
||||
usage(argv[0]) ;
|
||||
}
|
||||
|
||||
dpy = XOpenDisplay(NULL);
|
||||
|
||||
if ( dpy == NULL ){
|
||||
fprintf( stderr , "Can't open display.\n" ) ;
|
||||
exit(0) ;
|
||||
}
|
||||
|
||||
screen = DefaultScreen( dpy ) ;
|
||||
gc = DefaultGC( dpy , screen ) ;
|
||||
cmap = DefaultColormap( dpy , screen ) ;
|
||||
|
||||
readrc() ;
|
||||
|
||||
if (XSupportsLocale() == False)
|
||||
fprintf(stderr,"X does not support the locale\n");
|
||||
SetFont( LocaleName , dpy , FSName ) ;
|
||||
|
||||
XSetForeground( dpy , gc , BlackPixel( dpy , screen )) ;
|
||||
setlocale(LC_TIME, LocaleName );
|
||||
|
||||
time( &tmt ) ;
|
||||
tmm = localtime( &tmt ) ;
|
||||
tmm->tm_sec = 59;
|
||||
tmm->tm_min = 59;
|
||||
tmm->tm_hour = 23;
|
||||
tmm->tm_mday = 30;
|
||||
tmm->tm_yday = 365;
|
||||
|
||||
strftime(str, MAX_FORM, Form1 , tmm);
|
||||
XmbTextExtents( fs , str , strlen(str) , &ink, &log);
|
||||
width=log.width ;
|
||||
uhead = log.y ;
|
||||
height = log.height ;
|
||||
|
||||
strftime(str, MAX_FORM, Form2 , tmm);
|
||||
XmbTextExtents( fs , str , strlen(str) , &ink, &log);
|
||||
if ( width < log.width )
|
||||
width = log.width ;
|
||||
if ( uhead < log.y )
|
||||
uhead = log.y ;
|
||||
if ( height < log.height )
|
||||
height = log.height ;
|
||||
|
||||
xcol.flags = DoRed|DoGreen|DoBlue ;
|
||||
for ( i = 0 ; i < 2 ; i ++ ){
|
||||
xcol.red = Color[i][0] ;
|
||||
xcol.green = Color[i][1] ;
|
||||
xcol.blue = Color[i][2] ;
|
||||
if ( XAllocColor( dpy , cmap , &xcol ))
|
||||
iro[i] = xcol.pixel ;
|
||||
else fprintf(stderr,"Can't allocate Color \n" ) ;
|
||||
}
|
||||
|
||||
win = XCreateSimpleWindow( dpy , DefaultRootWindow( dpy ) ,
|
||||
0 , 0 , width + 3 , height + Head + 2 , 0 ,
|
||||
iro[0] ,iro[1] ) ;
|
||||
|
||||
hint.max_width = hint.min_width = width + 3 ;
|
||||
hint.max_height = hint.min_height = height + Head + 2 ;
|
||||
hint.flags = PMinSize | PMaxSize;
|
||||
XSetNormalHints(dpy , win , &hint);
|
||||
|
||||
XSelectInput( dpy , win , ButtonReleaseMask ) ;
|
||||
XStoreName( dpy , win , "mlclock" ) ;
|
||||
XSetForeground( dpy , gc , iro[0] ) ;
|
||||
XSync( dpy , 0 );
|
||||
XMapWindow( dpy ,win ) ;
|
||||
XSync( dpy , 0 );
|
||||
|
||||
str2[0] = '\0' ;
|
||||
form = Form1 ;
|
||||
while(1){
|
||||
select( 0 , (fd_set *)0 , (fd_set *)0 , (fd_set *)0 , &wait) ;
|
||||
|
||||
time( &tmt ) ;
|
||||
tmm = localtime( &tmt ) ;
|
||||
|
||||
if ( Mode == FOCUS ){
|
||||
XQueryPointer( dpy , win , &root , &child , &rootx,&rooty , &wx,&wy,&key);
|
||||
if (( -Near < wx ) && ( wx < width + Near ) &&
|
||||
( -Near < wy ) && ( wy < height + Near + Head ))
|
||||
form = Form2 ;
|
||||
else
|
||||
form = Form1 ; }
|
||||
else
|
||||
if ( Mode == CLICK ){
|
||||
if( XEventsQueued( dpy, QueuedAfterFlush ) ){
|
||||
XNextEvent( dpy , &eve ) ;
|
||||
if ( eve.type == ButtonRelease ){
|
||||
if ( !sw ){
|
||||
sw = True ;
|
||||
lsec = tmm->tm_sec ;
|
||||
form = Form2 ;
|
||||
}
|
||||
else {
|
||||
sw = False ;
|
||||
form = Form1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( sw ){
|
||||
if ( tmm->tm_sec < lsec )
|
||||
tmm->tm_sec += 60 ;
|
||||
if ( tmm->tm_sec > lsec + 2 ){
|
||||
sw = False ;
|
||||
form = Form1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
strftime(str, sizeof(str),form , tmm);
|
||||
if ( strcmp( str , str2 )){
|
||||
XClearWindow( dpy , win ) ;
|
||||
XmbDrawString( dpy , win , fs , gc, 1 , - uhead + Head + 1 , str, strlen(str));
|
||||
if ( Bold )
|
||||
XmbDrawString( dpy , win , fs , gc, 2 , - uhead + Head + 1 , str, strlen(str));
|
||||
XSync( dpy , 0 ) ;
|
||||
strcpy( str2 , str ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetFont( char *localename , Display *dpy , char *fsname )
|
||||
{
|
||||
char **miss, *def;
|
||||
int nMiss;
|
||||
|
||||
if (setlocale(LC_ALL, localename) == NULL)
|
||||
fprintf(stderr,"Can't set the locale\n");
|
||||
|
||||
fs = XCreateFontSet( dpy , fsname , &miss, &nMiss, &def);
|
||||
if (fs == NULL)
|
||||
fprintf(stderr,"Can't get fontset.\n" ) ;
|
||||
}
|
||||
|
||||
void readrc(){
|
||||
int i , end , len , sw1 , cn = 0 ;
|
||||
char string[501] , work[201] , code[100] , data[100] , *ptr ;
|
||||
char *fore , *back ;
|
||||
struct _name {
|
||||
char name[10] ;
|
||||
int sw ;
|
||||
} ;
|
||||
|
||||
FILE *file ;
|
||||
|
||||
struct _name N[] ={
|
||||
{ "FORM1" , 1 } ,
|
||||
{ "FORM2" , 2 } ,
|
||||
{ "NEAR" , 3 } ,
|
||||
{ "EVENT" , 4 } ,
|
||||
{ "LOCALE" , 5 } ,
|
||||
{ "FONTSET" , 6 } ,
|
||||
{ "HEAD" , 7 } ,
|
||||
{ "FONTCOLOR" , 8 } ,
|
||||
{ "BACKCOLOR" , 9 } ,
|
||||
{ "BOLD" , 10 } ,
|
||||
{ "" , 0 }} ;
|
||||
|
||||
|
||||
Mode = Near = Head = NONE ;
|
||||
Form1 = Form2 = LocaleName = FSName = NULL ;
|
||||
|
||||
for ( i = 0 ; i < 3 ; i ++ ){
|
||||
Color[0][i] = 0 ;
|
||||
Color[1][i] = 0xffff ;
|
||||
}
|
||||
|
||||
RCFile = malloc ( sizeof( RCFILE ) + strlen( getenv("HOME")) + 3 ) ;
|
||||
sprintf( RCFile , "%s/%s",getenv("HOME"),RCFILE ) ;
|
||||
|
||||
if ( ( file = fopen( RCFile , "r" )) == NULL ){
|
||||
fprintf( stderr , "Can't open \"%s\" file.\n" , RCFile ) ;
|
||||
fprintf( stderr , "Now making rc file.\n" , RCFile ) ;
|
||||
|
||||
if ((file = fopen( RCFile , "a" )) == NULL )
|
||||
fprintf( stderr , "You can't make rc file in your own dirctory.\n" ) ;
|
||||
else{
|
||||
fprintf( file , "FORM1 = \"(%%a)%%l:%%M:%%S%%p\"\n") ;
|
||||
fprintf( file , "FORM2 = \"(%%a)%%b-%%d\"\n") ;
|
||||
fprintf( file , "EVENT = FOCUS ; FOCUS or CLICK\n") ;
|
||||
fprintf( file , "NEAR = 10\n" ) ;
|
||||
fprintf( file , "LOCALE = \"C\"\n") ;
|
||||
fprintf( file , "FONTSET = \"-*-*-medium-r-normal--12-*\"\n") ;
|
||||
fprintf( file , "HEAD = 5\n") ;
|
||||
fprintf( file , "FONTCOLOR = \"blue\"\n" ) ;
|
||||
fprintf( file , "BACKCOLOR = \"white\"\n" ) ;
|
||||
fprintf( file , "BOLD = FALSE ; TRUE or FALSE\n" ) ;
|
||||
fclose ( file ) ;
|
||||
fprintf( stderr , "Created %s file.\n" , RCFile ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
while( fgets( string , 500 , file )){
|
||||
end = FALSE ;
|
||||
i = 0 ;
|
||||
sw1 = False ;
|
||||
while( string[i] != ';' && string[i] != '\0' && string[i] != '\n' ){
|
||||
if ( string[i] == '=' && sw1 == False ){
|
||||
string[i] = ' ' ;
|
||||
sw1 = True ;
|
||||
}
|
||||
work[i] = string[i++] ;
|
||||
}
|
||||
work[i] = '\0' ;
|
||||
|
||||
if ( sw1 == False )
|
||||
continue ;
|
||||
|
||||
code[0] = '\0' ;
|
||||
data[0] = '\0' ;
|
||||
|
||||
sscanf( work , "%s %s", code , data) ;
|
||||
if ( code[0] == '\0' )
|
||||
continue ;
|
||||
|
||||
i = 0 ;
|
||||
while( True ){
|
||||
if ( N[i].name[0] == '\0' ){
|
||||
cn = 0 ;
|
||||
break ;
|
||||
}
|
||||
if ( !strcmp( N[i].name , code )){
|
||||
cn = N[i].sw ;
|
||||
break ;
|
||||
}
|
||||
i ++ ;
|
||||
}
|
||||
|
||||
switch( cn ){
|
||||
case 1:
|
||||
len = strlen( data ) ;
|
||||
Form1 = malloc( len ) ;
|
||||
strcpy( Form1 , &data[1] ) ;
|
||||
Form1[len-2] = '\0' ;
|
||||
break ;
|
||||
case 2:
|
||||
len = strlen( data ) ;
|
||||
Form2 = malloc( len ) ;
|
||||
strcpy( Form2 , &data[1] ) ;
|
||||
Form2[len-2] = '\0' ;
|
||||
break ;
|
||||
case 3:
|
||||
Near = atoi( data ) ;
|
||||
break;
|
||||
case 4:
|
||||
if ( !strcmp( data , "FOCUS" )){
|
||||
Mode = FOCUS ;
|
||||
break ;
|
||||
}
|
||||
if ( !strcmp( data , "CLICK" )){
|
||||
Mode = CLICK ;
|
||||
break ;
|
||||
}
|
||||
break ;
|
||||
case 5:
|
||||
len = strlen( data ) ;
|
||||
LocaleName = malloc( len ) ;
|
||||
strcpy( LocaleName , &data[1] ) ;
|
||||
LocaleName[len-2] = '\0' ;
|
||||
break ;
|
||||
case 6:
|
||||
len = strlen( data ) ;
|
||||
FSName = malloc( len ) ;
|
||||
strcpy( FSName , &data[1] ) ;
|
||||
FSName[len-2] = '\0' ;
|
||||
break ;
|
||||
case 7:
|
||||
Head = atoi( data ) ;
|
||||
break;
|
||||
case 8:
|
||||
len = strlen( data ) ;
|
||||
fore = malloc( len ) ;
|
||||
strcpy( fore , &data[1] ) ;
|
||||
fore[len-2] = '\0' ;
|
||||
getRGB( fore , Color[0] ) ;
|
||||
break ;
|
||||
case 9:
|
||||
len = strlen( data ) ;
|
||||
back = malloc( len ) ;
|
||||
strcpy( back , &data[1] ) ;
|
||||
back[len-2] = '\0' ;
|
||||
getRGB( back , Color[1] ) ;
|
||||
break ;
|
||||
case 10:
|
||||
if ( !strcmp( data , "TRUE" )){
|
||||
Bold = True ;
|
||||
break ;
|
||||
}
|
||||
if ( !strcmp( data , "FALSE" )){
|
||||
Bold = False ;
|
||||
break ;
|
||||
}
|
||||
break ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Mode == NONE )
|
||||
Mode = FOCUS ;
|
||||
if ( Near == NONE )
|
||||
Near = NEAR ;
|
||||
if ( Head == NONE )
|
||||
Head = 0 ;
|
||||
if ( Form1 == NULL ){
|
||||
Form1 = malloc( strlen( FORM1 ) + 1) ;
|
||||
strcpy( Form1 , FORM1 ) ;
|
||||
}
|
||||
if ( Form2 == NULL ){
|
||||
Form2 = malloc( strlen( FORM2 ) + 1) ;
|
||||
strcpy( Form2 , FORM2 ) ;
|
||||
}
|
||||
if ( FSName == NULL ){
|
||||
FSName = malloc( strlen( DEFAULTFONT ) + 1) ;
|
||||
strcpy( FSName , DEFAULTFONT ) ;
|
||||
}
|
||||
if ( LocaleName == NULL ){
|
||||
ptr = getenv( "LANG" ) ;
|
||||
if ( ptr == NULL )
|
||||
ptr = DEFAULTLANG ;
|
||||
LocaleName = malloc( strlen( ptr ) + 1) ;
|
||||
strcpy( LocaleName , ptr ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void getRGB( char *color , int *store ){
|
||||
int i ;
|
||||
char tmpcolor[3] ;
|
||||
XColor rgb , hard ;
|
||||
|
||||
if ( color[0] == '#' ){
|
||||
color ++ ;
|
||||
for ( i = 0 ; i < 3 ; i ++ ){
|
||||
strncpy( tmpcolor , color , 2 ) ;
|
||||
sscanf( tmpcolor , "%x" , store ) ;
|
||||
(*store) *= 256 ;
|
||||
color += 2 ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
XLookupColor( dpy , cmap , color , &rgb , &hard ) ;
|
||||
store[0] = hard.red ;
|
||||
store[1] = hard.green ;
|
||||
store[2] = hard.blue ;
|
||||
}
|
||||
}
|
||||
|
||||
void usage( char *name ){
|
||||
printf("%s: usage\n" , name ) ;
|
||||
printf(" -display display name\n\n" ) ;
|
||||
printf(" Version %s\n" , VERSION );
|
||||
printf(" Written by Hideki Kimata\n") ;
|
||||
printf(" EMail hideki@hry.info.gifu-u.ac.jp\n" ) ;
|
||||
printf(" Access to http://www.hry.info.gifu-u.ac.jp/~hideki/index.html\n" ) ;
|
||||
exit(0) ;
|
||||
}
|
28
rcfile/mlclockrc
Normal file
28
rcfile/mlclockrc
Normal file
@@ -0,0 +1,28 @@
|
||||
; mlclock setting file ( $HOME/.mlclockrc )
|
||||
|
||||
; see strftime .
|
||||
; DON'T USE SPACE.
|
||||
|
||||
FORM1 = "(%a)%l:%M:%S%p" ; form1
|
||||
FORM2 = "(%a)%b<><62>%d<><64>" ; form2
|
||||
|
||||
; samples
|
||||
;FORM1 = "%H:%M:%S" ; 23:22:33
|
||||
;FORM2 = "%Y/%b/%d" ; 1998/7/12
|
||||
|
||||
EVENT = FOCUS ; FOCUS or CLICK
|
||||
NEAR = 10 ; the distance of change form event
|
||||
|
||||
LOCALE = "C" ; locale name( Do you use it ? )
|
||||
FONTSET = "-*-*-medium-r-normal--12-*" ; font set
|
||||
|
||||
HEAD = 5 ; head space
|
||||
|
||||
; specify color name or color value as "#rrggbb#.
|
||||
|
||||
FONTCOLOR = "blue" ; font color
|
||||
BACKCOLOR = "white" ; backgorung color
|
||||
;FONTCOLOR = "#0000ff"
|
||||
;BACKCOLOR = "white"
|
||||
|
||||
BOLD = FALSE ; Bold font ? ( TRUE or FALSE )
|
42
rcfile/mlclockrc-kanji
Normal file
42
rcfile/mlclockrc-kanji
Normal file
@@ -0,0 +1,42 @@
|
||||
; mlclock <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD> ( $HOME/.mlclockrc )
|
||||
|
||||
; ɽ<><C9BD><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˤĤ<CBA4><C4A4>Ƥ<EFBFBD> strftime <20><> man <20>Ǹ<EFBFBD><C7B8>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <20>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ब<EFBFBD><E0A4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τǡ<CEA4><C7A1><EFBFBD><EFBFBD>ڡ<EFBFBD><DAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ʤ<EFBFBD><CAA4>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(^_^;
|
||||
FORM1 = "(%a)%l:%M:%S%p" ; <20><><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD>
|
||||
FORM2 = "(%a)%b<><62>%d<><64>" ; <20><><EFBFBD>ؤ<EFBFBD><D8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υե<CEA5><D5A5><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
;FORM1 = "(%A)%l<><6C>%Mʬ%S<><53>%p" ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>11<31><31>22<32><32>33<33>ø<EFBFBD><C3B8><EFBFBD>
|
||||
;FORM1 = "%H:%M:%S%Z" ; 23:22:33
|
||||
;FORM1 = "%T%Z" ; 23:22:33 JST
|
||||
|
||||
;FORM2 = "%Yǯ%b<><62>%d<><64>" ; 1998ǯ 7<><37>12<31><32>
|
||||
|
||||
; LOCALE <20><> ja_JP.EUC <20>ʤ<EFBFBD>
|
||||
; /usr/share/locale/ja_JP.EUC/LC_TIME <20>ʣƣ<CAA3><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£ӣĤξ<C4A4><CEBE><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <20><EFBFBD><F2A4A4A4><EFBFBD><EFBFBD>в<EFBFBD><D0B2>ä<EFBFBD><C3A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
||||
|
||||
|
||||
; EVENT <20><> CLICK <20><> FOCUS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
||||
;
|
||||
; CLICK <20>ϥ<EFBFBD><CFA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD><F2A5AFA5>å<EFBFBD><C3A5><EFBFBD><EFBFBD>뤳<EFBFBD>Ȥǥե<C7A5><D5A5><EFBFBD><EFBFBD>ࣱ<EFBFBD>ȥե<C8A5><D5A5><EFBFBD><EFBFBD>ࣲ<EFBFBD><E0A3B2><EFBFBD><EFBFBD><EFBFBD>ؤ<EFBFBD><D8A4><EFBFBD><EF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ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>뤫(FOCUS <20><>)
|
||||
|
||||
LOCALE = "ja_JP.EUC" ; <20><><EFBFBD>Υե<CEA5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FONTSET = "-*-*-medium-r-normal--12-*" ; ɽ<><C9BD><EFBFBD>ѥե<D1A5><D5A5><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>å<EFBFBD>
|
||||
|
||||
HEAD = 5 ; <20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4>礭<EFBFBD><E7A4AD>(mlvwm<77><6D>)
|
||||
|
||||
; <20><><EFBFBD><EFBFBD> rgb.txt <20>뤫 showrgb <20><><EFBFBD>¹Ԥ<C2B9><D4A4>뤫<EFBFBD><EBA4AB><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>ǻ<EFBFBD><C7BB>ꤹ<EFBFBD>뤫<EFBFBD><EBA4AB>
|
||||
; #rrggbb <20>ǻ<EFBFBD><C7BB>ꤷ<EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
||||
|
||||
FONTCOLOR = "blue" ; <20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD>Ȥο<C8A4>
|
||||
BACKCOLOR = "white" ; <20>طʿ<D8B7>
|
||||
;FONTCOLOR = "#0000ff"
|
||||
;BACKCOLOR = "white"
|
||||
|
||||
BOLD = FALSE ; <20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4>뤫<EFBFBD>ɤ<EFBFBD><C9A4><EFBFBD> ( TRUE or FALSE )
|
Reference in New Issue
Block a user