*** ButtonArray.c.old Mon Jul 21 14:38:23 1997 --- ButtonArray.c Thu Jul 17 21:43:03 1997 *************** *** 77,83 **** ------------------------------------------------------------------------- */ Button *ButtonNew(char *title, Picture *p, int state, int count) { - int updateneeded = 0; Button *new; new = (Button *)safemalloc(sizeof(Button)); --- 77,82 ---- *************** *** 391,397 **** void DrawButtonArray(ButtonArray *array, int all) { Button *temp; - extern int ScreenWidth; int x, y, n; x = 0; --- 390,395 ---- *************** *** 442,448 **** char **name, int *trunc) { Button *temp; ! int num, cx, x, y, n; if (xp < array->x || xp > array->x+array->w) return -1; --- 440,446 ---- char **name, int *trunc) { Button *temp; ! int num, x, y, n; if (xp < array->x || xp > array->x+array->w) return -1; *** CheckLockModule.c.old Mon Jul 21 14:38:24 1997 --- CheckLockModule.c Mon Jul 21 11:01:21 1997 *************** *** 20,25 **** --- 20,27 ---- * More then one module may want to use a proc called Load ! */ + #include + extern char *IconPath, *PixmapPath; struct MyInfo { char *id; *************** *** 38,44 **** char *lock; }; ! void *CheckLockModuleInit(char *id); int CheckLockModuleParseResource(struct MyInfo *mif,char *tline,char *Module,int Clength); void CheckLockModuleLoad(struct MyInfo *mif,Display *dpy,Drawable win,int *goodies_width); void CheckLockModuleDraw(struct MyInfo *mif,Display *dpy,Window win); --- 40,46 ---- char *lock; }; ! void *CheckLockModuleInit(char *id, int k); int CheckLockModuleParseResource(struct MyInfo *mif,char *tline,char *Module,int Clength); void CheckLockModuleLoad(struct MyInfo *mif,Display *dpy,Drawable win,int *goodies_width); void CheckLockModuleDraw(struct MyInfo *mif,Display *dpy,Window win); *************** *** 46,58 **** void CheckLockModuleCreateIconTipWindow_(struct MyInfo *mif); void CheckLockModuleIconClick(struct MyInfo *mif,XEvent event); ! struct GoodyLoadable CheckLockModuleSymbol={&CheckLockModuleInit, ! &CheckLockModuleParseResource, ! &CheckLockModuleLoad, ! &CheckLockModuleDraw, ! &CheckLockModuleSeeMouse, ! &CheckLockModuleCreateIconTipWindow_, ! &CheckLockModuleIconClick}; extern int win_width, stwin_width; extern int RowHeight; --- 48,62 ---- void CheckLockModuleCreateIconTipWindow_(struct MyInfo *mif); void CheckLockModuleIconClick(struct MyInfo *mif,XEvent event); ! struct GoodyLoadable CheckLockModuleSymbol = { ! (LoadableInit_f) &CheckLockModuleInit, ! (LoadableParseResource_f) &CheckLockModuleParseResource, ! (LoadableLoad_f) &CheckLockModuleLoad, ! (LoadableDraw_f) &CheckLockModuleDraw, ! (LoadableSeeMouse_f) &CheckLockModuleSeeMouse, ! (LoadableCreateTipWindow_f) &CheckLockModuleCreateIconTipWindow_, ! (HandleIconClick_f) &CheckLockModuleIconClick ! }; extern int win_width, stwin_width; extern int RowHeight; *************** *** 59,65 **** ! void *CheckLockModuleInit(char *id) { struct MyInfo *mif; --- 63,69 ---- ! void *CheckLockModuleInit(char *id, int k) { struct MyInfo *mif; *************** *** 67,74 **** printf("FvwmTaskBar.CheckLockModule.Init(\"%s\")\n", id); fflush(stdout); #endif ! mif = NULL; ! (void *) mif = calloc(1, sizeof(struct MyInfo)); if(mif == NULL) { perror("FvwmTaskBar.CheckLockModule.Init()"); return NULL; --- 71,77 ---- printf("FvwmTaskBar.CheckLockModule.Init(\"%s\")\n", id); fflush(stdout); #endif ! mif = (struct MyInfo*)calloc(1, sizeof(struct MyInfo)); if(mif == NULL) { perror("FvwmTaskBar.CheckLockModule.Init()"); return NULL; *************** *** 87,97 **** void CheckLockModuleSetIcon(struct MyInfo *mif, char *i) ! { ! #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.CheckLockModule.AddIcon(*,\"%s\")\n", i); #endif if (mif == NULL) return; if (mif->icon != NULL) free(mif->icon); --- 90,105 ---- void CheckLockModuleSetIcon(struct MyInfo *mif, char *i) ! { ! char *path; #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.CheckLockModule.AddIcon(*,\"%s\")\n", i); #endif + if ((path=findIconFile(i,PixmapPath,R_OK)) || + (path=findIconFile(i,IconPath,R_OK))) { + free(i); + i = path; + } if (mif == NULL) return; if (mif->icon != NULL) free(mif->icon); *************** *** 178,185 **** void CheckLockModuleLoad(struct MyInfo *mif, Display *dpy, Drawable win, int *goodies_width) { - int k; - #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.CheckLockModule.LoadModule()\n"); #endif --- 186,191 ---- *************** *** 237,243 **** void CheckLockModuleDraw(struct MyInfo *mif, Display *dpy, Window win) { XGCValues gcv; - GC copy; time_t now; unsigned long CheckLockModulegcm = GCClipMask | --- 243,248 ---- *** FvwmTaskBar.c.old Mon Jul 21 14:38:24 1997 --- FvwmTaskBar.c Mon Jul 21 13:31:43 1997 *************** *** 147,154 **** Colormap PictureCMap; ! char *IconPath = NULL, ! *PixmapPath = NULL; /****************************************************************************** Main - Setup the XConnection,request the window list and loop forever --- 147,158 ---- Colormap PictureCMap; ! #if defined(FVWM_ICONDIR) ! char *IconPath = FVWM_ICONDIR; ! #else ! char *IconPath = NULL; ! #endif ! char *PixmapPath = NULL; /****************************************************************************** Main - Setup the XConnection,request the window list and loop forever *************** *** 493,499 **** RemoveButton(&buttons, buttons.head->count); for (item=windows.head; item; item=item->next) ! if (DeskNumber == item->Desk || (item->flags & STICKY)) AddButton(&buttons, item->name, &(item->p), BUTTON_UP, item->count); RedrawWindow(1); --- 497,504 ---- RemoveButton(&buttons, buttons.head->count); for (item=windows.head; item; item=item->next) ! if (DeskNumber == item->Desk || ((item->flags & STICKY) && ! !(item->flags & ICONIFIED))) AddButton(&buttons, item->name, &(item->p), BUTTON_UP, item->count); RedrawWindow(1); *************** *** 674,680 **** else if(strncasecmp(tline,CatString3(Module, "AutoStick",""), Clength+9)==0) AutoStick=True; else if(strncasecmp(tline,CatString3(Module, "AutoHide",""), ! Clength+4)==0) { AutoHide=True; AutoStick=True; } else if(strncasecmp(tline,CatString3(Module, "UseIconNames",""), Clength+12)==0) UseIconNames=True; else if(strncasecmp(tline,CatString3(Module, "ShowTransients",""), --- 679,685 ---- else if(strncasecmp(tline,CatString3(Module, "AutoStick",""), Clength+9)==0) AutoStick=True; else if(strncasecmp(tline,CatString3(Module, "AutoHide",""), ! Clength+8)==0) { AutoHide=True; AutoStick=True; } else if(strncasecmp(tline,CatString3(Module, "UseIconNames",""), Clength+12)==0) UseIconNames=True; else if(strncasecmp(tline,CatString3(Module, "ShowTransients",""), *************** *** 690,696 **** Clength+13)==0) { /* tell fvwm to launch the module for us */ ! str = safemalloc(strlen(&tline[Clength+13]) + 6); sprintf(str, "Module %s",&tline[Clength+13]); ConsoleMessage("Trying to: %s", str); SendFvwmPipe(str, 0); --- 695,701 ---- Clength+13)==0) { /* tell fvwm to launch the module for us */ ! str = safemalloc(strlen(&tline[Clength+13]) + 8); sprintf(str, "Module %s",&tline[Clength+13]); ConsoleMessage("Trying to: %s", str); SendFvwmPipe(str, 0); *************** *** 818,826 **** Tip.type = START_TIP; } else { if ((i_k = LoadableSeeMouse(x, y)) != 0) { ! if (Tip.type != GLOADABLE_TIP) GLtip = -1; ! CreateLoadableTipWindow(i_k); ! Tip.type = GLOADABLE_TIP; } else { num = LocateButton(&buttons, x, y, &bx, &by, &name, &trunc); if (num != -1 && trunc) { --- 823,830 ---- Tip.type = START_TIP; } else { if ((i_k = LoadableSeeMouse(x, y)) != 0) { ! if (!IsLoadableTip(Tip.type)) GLtip = -1; ! Tip.type = CreateLoadableTipWindow(i_k); } else { num = LocateButton(&buttons, x, y, &bx, &by, &name, &trunc); if (num != -1 && trunc) { *************** *** 861,868 **** int i_k; char tmp[100]; XEvent Event; ! int x, x1, y, y1, redraw; static unsigned long lasttime = 0L; while(XPending(dpy)) { redraw = -1; --- 865,873 ---- int i_k; char tmp[100]; XEvent Event; ! int x, y, redraw; static unsigned long lasttime = 0L; + Time time = 0L; while(XPending(dpy)) { redraw = -1; *************** *** 884,889 **** --- 889,895 ---- if (num != -1) SendFvwmPipe("Focus 0", ItemID(&windows, num)); } ButPressed = -1; + time = Event.xbutton.time; break; case ButtonPress: *************** *** 918,923 **** --- 924,930 ---- } */ redraw = 0; + time = Event.xbutton.time; break; case Expose: *************** *** 926,936 **** --- 933,945 ---- redraw = 0; else redraw = 1; + /* time = ; */ break; case ClientMessage: if ((Event.xclient.format==32) && (Event.xclient.data.l[0]==wm_del_win)) ShutMeDown(0); + /* time = ; */ break; case EnterNotify: *************** *** 953,959 **** SendFvwmPipe("Focus 0", ItemID(&windows, num)); } ! CheckForTip(Event.xmotion.x, Event.xmotion.y); break; case LeaveNotify: --- 962,969 ---- SendFvwmPipe("Focus 0", ItemID(&windows, num)); } ! CheckForTip(Event.xcrossing.x, Event.xcrossing.y); ! time = Event.xcrossing.time; break; case LeaveNotify: *************** *** 979,984 **** --- 989,995 ---- } } } + time = Event.xcrossing.time; break; case MotionNotify: *************** *** 1000,1005 **** --- 1011,1017 ---- } CheckForTip(Event.xmotion.x, Event.xmotion.y); + time = Event.xmotion.time; break; case ConfigureNotify: *************** *** 1017,1030 **** win_y = Event.xconfigure.y; } } break; } if (redraw >= 0) RedrawWindow(redraw); ! if (Event.xkey.time - lasttime > UpdateInterval*1000L) { DrawGoodies(); ! lasttime = Event.xkey.time; } } --- 1029,1043 ---- win_y = Event.xconfigure.y; } } + /* time = ; */ break; } if (redraw >= 0) RedrawWindow(redraw); ! if (time - lasttime > UpdateInterval*1000L) { DrawGoodies(); ! lasttime = time; } } *************** *** 1082,1090 **** XSizeHints hints; XGCValues gcval; unsigned long gcmask; ! unsigned int dummy1,dummy2; ! int x,y,ret,count; ! Window dummyroot,dummychild; if (!(dpy = XOpenDisplay(""))) { fprintf(stderr,"%s: can't open display %s", Module, --- 1095,1101 ---- XSizeHints hints; XGCValues gcval; unsigned long gcmask; ! int ret; if (!(dpy = XOpenDisplay(""))) { fprintf(stderr,"%s: can't open display %s", Module, *************** *** 1547,1550 **** --- 1558,1562 ---- ConsoleMessage("Failed request: %s\n", errmsg); ConsoleMessage("Major opcode: 0x%x, resource id: 0x%x\n", event->request_code, event->resourceid); + return 0; } *** Goodies.c.old Mon Jul 21 14:38:24 1997 --- Goodies.c Mon Jul 21 10:11:57 1997 *************** *** 4,9 **** --- 4,12 ---- #include #include #include + #ifdef _AIX + #include + #endif #include #include #include *************** *** 38,47 **** Pixmap mailpix, wmailpix, pmask, pclip, speakerpix, speakeroffpix,s_mask; XpmAttributes s_attr; char *DateFore = "black", ! *DateBack = "LightYellow", ! *VolumeCmd = "Exec xmix", ! *MailCmd = "Exec xterm -e mail"; ! int IgnoreOldMail = False; int ShowTips = False; char *statusfont_string = "fixed"; int last_date = -1; --- 41,47 ---- Pixmap mailpix, wmailpix, pmask, pclip, speakerpix, speakeroffpix,s_mask; XpmAttributes s_attr; char *DateFore = "black", ! *DateBack = "LightYellow"; int ShowTips = False; char *statusfont_string = "fixed"; int last_date = -1; *************** *** 48,54 **** int icons_offset=0; - void cool_get_inboxstatus(); void DrawVolume(void); void RedrawWindow(int); --- 48,53 ---- *************** *** 56,63 **** #define gray_height 8 extern unsigned char gray_bits[]; ! /* x y w h tw th open type *text win */ ! TipStruct Tip = { 0, 0, 0, 0, 0, 0, 0, 0, NULL, None }; /* Parse 'goodies' specific resources */ --- 55,62 ---- #define gray_height 8 extern unsigned char gray_bits[]; ! /* x y w h tw th open type *text win **lines nlines free*/ ! TipStruct Tip = { 0, 0, 0, 0, 0, 0, 0, 0, NULL, None, {}, 0, 0 }; /* Parse 'goodies' specific resources */ *************** *** 95,102 **** } void InitGoodies() { - struct passwd *pwent; - char tmp[1024]; XGCValues gcval; unsigned long gcmask; --- 94,99 ---- *************** *** 138,146 **** void DrawGoodies() { struct tm *tms; - static char str[40]; static time_t timer; - static int last_mail_check = -1; unsigned long gcmask; XGCValues gcval; --- 135,141 ---- *************** *** 174,181 **** void RedrawTipWindow() { if (Tip.text) { ! XDrawString(dpy, Tip.win, dategc, 3, Tip.th-4, ! Tip.text, strlen(Tip.text)); XRaiseWindow(dpy, Tip.win); /*****************/ } } --- 169,181 ---- void RedrawTipWindow() { if (Tip.text) { ! int i, y; ! y = StatusFont->ascent + StatusFont->descent; ! for (i=0; iascent + StatusFont->descent + 4); ! } XRaiseWindow(dpy, Tip.win); /*****************/ } } *************** *** 183,195 **** void PopupTipWindow(int px, int py, char *text) { int newx, newy; Window child; if (!ShowTips) return; if (Tip.win != None) DestroyTipWindow(); ! Tip.tw = XTextWidth(StatusFont, text, strlen(text)) + 6; ! Tip.th = StatusFont->ascent + StatusFont->descent + 4; XTranslateCoordinates(dpy, win, Root, px, py, &newx, &newy, &child); Tip.x = newx; --- 183,212 ---- void PopupTipWindow(int px, int py, char *text) { int newx, newy; Window child; + int tw; + char *sb; if (!ShowTips) return; if (Tip.win != None) DestroyTipWindow(); ! UpdateString(&Tip.text, text); ! ! /* parse string, and find width and height */ ! /*fprintf(stderr, "PopupTipWindow(): tip text='%s' %d\n", text, MAX_TIP_LINES);*/ ! Tip.tw = Tip.th = 0; ! sb = strtok(Tip.text, "\n"); ! for (Tip.nlines = 0; Tip.nlines < MAX_TIP_LINES; Tip.nlines++) { ! if (sb == NULL) break; ! Tip.lines[Tip.nlines] = sb; ! /* fprintf(stderr, "PopupTipWindow(): parse line='%s'\n", sb); */ ! ! tw = XTextWidth(StatusFont, sb, strlen(sb)) + 6; ! if (tw > Tip.tw) Tip.tw = tw; ! Tip.th += StatusFont->ascent + StatusFont->descent + 4; ! ! sb = strtok(NULL, "\n"); ! } XTranslateCoordinates(dpy, win, Root, px, py, &newx, &newy, &child); Tip.x = newx; *************** *** 204,210 **** if (Tip.x+Tip.tw+4 > ScreenWidth-5) Tip.x = ScreenWidth-Tip.tw-9; if (Tip.x < 5) Tip.x = 5; - UpdateString(&Tip.text, text); CreateTipWindow(Tip.x, Tip.y, Tip.w, Tip.h); if (Tip.open) XMapRaised(dpy, Tip.win); } --- 221,226 ---- *************** *** 293,296 **** --- 309,327 ---- XDestroyWindow(dpy, Tip.win); if (Tip.text) { free(Tip.text); Tip.text = NULL; } Tip.win = None; + } + + void CheckAndShowTipWindow(int tip_type) { + if (!Tip.open) { + ShowTipWindow(1); + Tip.type = tip_type; + } + } + + void CheckAndDestroyTipWindow(int tip_type) { + if (Tip.open && Tip.type == tip_type) { + ShowTipWindow(0); + if (Tip.win != None) DestroyTipWindow(); + Tip.type = NO_TIP; + } } *** Goodies.h.old Mon Jul 21 14:38:25 1997 --- Goodies.h Mon Jul 21 10:33:31 1997 *************** *** 5,18 **** #define DEFAULT_BELL_VOLUME 20 /* Tip window types */ #define NO_TIP (-1) ! #define START_TIP (-30) ! #define GLOADABLE_TIP (-6) typedef struct { int x, y, w, h, tw, th, open, type; char *text; Window win; } TipStruct; void GoodiesParseConfig(char *tline, char *Module); --- 5,25 ---- #define DEFAULT_BELL_VOLUME 20 /* Tip window types */ + /* non-negative tip types are for icon buttons */ #define NO_TIP (-1) ! #define START_TIP (-2) ! #define GLOADABLE_TIP (-3) ! /* loadable tip type numbers decrease from GLOADABLE_TIP */ + #define MAX_TIP_LINES 30 + typedef struct { int x, y, w, h, tw, th, open, type; char *text; Window win; + char *lines[MAX_TIP_LINES]; + int nlines; + int fFree; } TipStruct; void GoodiesParseConfig(char *tline, char *Module); *** GoodyLoadable.c.old Mon Jul 21 14:38:25 1997 --- GoodyLoadable.c Mon Jul 21 10:58:03 1997 *************** *** 5,10 **** --- 5,11 ---- #include #include "GoodyLoadable.h" + #include "Goodies.h" extern int win_width; extern int stwin_width; *************** *** 63,69 **** aa = calloc(a, b); if (aa != NULL) return aa; bb = calloc(a, b); ! free(aa); /* some error checking needed here * / return(bb); } --- 64,70 ---- aa = calloc(a, b); if (aa != NULL) return aa; bb = calloc(a, b); ! free(aa); / * some error checking needed here * / return(bb); } *************** *** 84,90 **** void InitHandles(void) { ! (void *) Handles = calloc(GLS, sizeof(void *)); if (Handles == NULL) { perror("FvwmTaskBar.GoodyLoadable.InitHandles()"); return; --- 85,91 ---- void InitHandles(void) { ! Handles = (void**)calloc(GLS, sizeof(void *)); if (Handles == NULL) { perror("FvwmTaskBar.GoodyLoadable.InitHandles()"); return; *************** *** 104,110 **** return; } ! (void *) h = calloc(GLS+HandlesSize, sizeof(void *)); if (h == NULL) { perror("FvwmTaskBar.GoodyLoadable.ExpandHandles()"); return; --- 105,111 ---- return; } ! h = (void**)calloc(GLS+HandlesSize, sizeof(void *)); if (h == NULL) { perror("FvwmTaskBar.GoodyLoadable.ExpandHandles()"); return; *************** *** 170,177 **** void InitGL(void) { ! (void *)GL = calloc(GLS, sizeof(struct GoodyLoadable *)); ! (void *)GLI = calloc(GLS, sizeof(struct GoodyLoadableInfo *)); if ((GL == NULL) || (GLI == NULL)) { perror("FvwmTaskBar.GoodyLoadable.InitGL()"); return; --- 171,178 ---- void InitGL(void) { ! GL = (struct GoodyLoadable**)calloc(GLS, sizeof(struct GoodyLoadable *)); ! GLI = (struct GoodyLoadableInfo**)calloc(GLS, sizeof(struct GoodyLoadableInfo *)); if ((GL == NULL) || (GLI == NULL)) { perror("FvwmTaskBar.GoodyLoadable.InitGL()"); return; *************** *** 187,194 **** struct GoodyLoadableInfo **_GLI; int k; ! (void *) _GL = calloc(GLsize+GLS, sizeof(struct GoodyLoadable *)); ! (void *) _GLI = calloc(GLsize+GLS, sizeof(struct GoodyLoadableInfo *)); if ((GL == NULL) || (GLI == NULL)) { perror("FvwmTaskBar.GoodyLoadable.ExpandGL()"); return; --- 188,195 ---- struct GoodyLoadableInfo **_GLI; int k; ! _GL = (struct GoodyLoadable**)calloc(GLsize+GLS, sizeof(struct GoodyLoadable *)); ! _GLI = (struct GoodyLoadableInfo**)calloc(GLsize+GLS, sizeof(struct GoodyLoadableInfo *)); if ((GL == NULL) || (GLI == NULL)) { perror("FvwmTaskBar.GoodyLoadable.ExpandGL()"); return; *************** *** 222,235 **** GL[GLfree] = NULL; GLI[GLfree] = NULL; ! (void *)(GLI[GLfree]) = calloc(1, sizeof(struct GoodyLoadableInfo)); if (GLI[GLfree] == NULL) { perror("FvwmTaskBar.GoodyLoadable.AddGLinfo()");fflush(stderr); return; } GLI[GLfree]->symbol = symbol; ! GLI[GLfree]->id = NULL; ! (void *) (GLI[GLfree]->id) = calloc(20, sizeof(char)); if (GLI[GLfree]->id == NULL) { perror("FvwmTaskBar.GoodyLoadable.AddGLSymbol()"); fflush(stderr); --- 223,235 ---- GL[GLfree] = NULL; GLI[GLfree] = NULL; ! GLI[GLfree] = (struct GoodyLoadableInfo*)calloc(1, sizeof(struct GoodyLoadableInfo)); if (GLI[GLfree] == NULL) { perror("FvwmTaskBar.GoodyLoadable.AddGLinfo()");fflush(stderr); return; } GLI[GLfree]->symbol = symbol; ! GLI[GLfree]->id = (char*)calloc(20, sizeof(char)); if (GLI[GLfree]->id == NULL) { perror("FvwmTaskBar.GoodyLoadable.AddGLSymbol()"); fflush(stderr); *************** *** 294,300 **** } while ((error != NULL) && (i < HandlesFree)); if (error == NULL) ! GLI[k]->data = (*(GL[k]->LoadableInit))(GLI[k]->id); else GL[k] = NULL; } --- 294,300 ---- } while ((error != NULL) && (i < HandlesFree)); if (error == NULL) ! GLI[k]->data = (*(GL[k]->LoadableInit))(GLI[k]->id, k); else GL[k] = NULL; } *************** *** 305,311 **** int go = 1; char *s; ! (void *) s = calloc(100, sizeof(char)); if (s == NULL) { perror("FvwmTaskBar.GoodyLoadable.ParseGLResource()"); return 0; --- 305,311 ---- int go = 1; char *s; ! s = (char*)calloc(100, sizeof(char)); if (s == NULL) { perror("FvwmTaskBar.GoodyLoadable.ParseGLResource()"); return 0; *************** *** 318,324 **** LoadPlugins(); return(1); } else if(strncasecmp(tline,CatString3(Module, "GoodyLoadableQuiet",""), ! Clength+15)==0) { Report = 0; return(1); } else if(strncasecmp(tline,CatString3(Module, "GoodyLoadableID",""), --- 318,324 ---- LoadPlugins(); return(1); } else if(strncasecmp(tline,CatString3(Module, "GoodyLoadableQuiet",""), ! Clength+18)==0) { Report = 0; return(1); } else if(strncasecmp(tline,CatString3(Module, "GoodyLoadableID",""), *************** *** 327,333 **** GLsetId(s); return(1); } else if(strncasecmp(tline,CatString3(Module, "GoodyLoadableSymbol",""), ! Clength+18)==0) { CopyString(&s, &tline[Clength+19]); AddGLSymbol(s); return(1); --- 327,333 ---- GLsetId(s); return(1); } else if(strncasecmp(tline,CatString3(Module, "GoodyLoadableSymbol",""), ! Clength+19)==0) { CopyString(&s, &tline[Clength+19]); AddGLSymbol(s); return(1); *************** *** 363,369 **** int LoadableSeeMouse(int x, int y) { ! int k, ans; int go; go = 1; --- 363,369 ---- int LoadableSeeMouse(int x, int y) { ! int k; int go; go = 1; *************** *** 375,390 **** return 0; } ! void CreateLoadableTipWindow(int k) { k--; ! if ((k < 0) || (k >= GLfree) || (GL[k] == NULL)) return; if (k != GLtip) { GLtip = k; (*(GL[k]->LoadableCreateTipWindow))(GLI[k]->data); } } void HandleLoadableClick(XEvent event, int k) { k--; --- 375,396 ---- return 0; } ! int CreateLoadableTipWindow(int k) { k--; ! if ((k < 0) || (k >= GLfree) || (GL[k] == NULL)) return 0; if (k != GLtip) { GLtip = k; (*(GL[k]->LoadableCreateTipWindow))(GLI[k]->data); } + return GLOADABLE_TIP - k; } + int IsLoadableTip(int type) { + int k = GLOADABLE_TIP - type; + return ((k >= 0) && (k < GLfree)); + } + void HandleLoadableClick(XEvent event, int k) { k--; *** GoodyLoadable.h.old Mon Jul 21 14:38:25 1997 --- GoodyLoadable.h Mon Jul 21 10:58:24 1997 *************** *** 8,21 **** extern int RenewGoodies; #endif struct GoodyLoadable{ ! void * (*LoadableInit)(char *); ! int (*LoadableParseResource)(void *,char *,char *,int); ! void (*LoadableLoad)(void *,Display *,Drawable); ! void (*LoadableDraw)(void *,Display *,Drawable); ! int (*LoadableSeeMouse)(void *,int x,int y); ! void (*LoadableCreateTipWindow)(void *); ! void (*HandleIconClick)(void *,XEvent event); }; int ParseGLinfo(char *tline,char *Module,int Clength); --- 8,29 ---- extern int RenewGoodies; #endif + typedef void* (*LoadableInit_f)(char *, int); + typedef int (*LoadableParseResource_f)(void *,char *,char *,int); + typedef void (*LoadableLoad_f)(void *,Display *,Drawable); + typedef void (*LoadableDraw_f)(void *,Display *,Drawable); + typedef int (*LoadableSeeMouse_f)(void *,int x,int y); + typedef void (*LoadableCreateTipWindow_f)(void *); + typedef void (*HandleIconClick_f)(void *,XEvent event); + struct GoodyLoadable{ ! LoadableInit_f LoadableInit; ! LoadableParseResource_f LoadableParseResource; ! LoadableLoad_f LoadableLoad; ! LoadableDraw_f LoadableDraw; ! LoadableSeeMouse_f LoadableSeeMouse; ! LoadableCreateTipWindow_f LoadableCreateTipWindow; ! HandleIconClick_f HandleIconClick; }; int ParseGLinfo(char *tline,char *Module,int Clength); *************** *** 22,28 **** void LoadableLoad(Display *dpy,Drawable win); void LoadableDraw(Display *dpy,Drawable win); int LoadableSeeMouse(int x,int y); ! void CreateLoadableTipWindow(int k); void HandleLoadableClick(XEvent event,int k); void PopupTipWindow(int px, int py, char *text); char *EnvExpand(char *str); --- 30,37 ---- void LoadableLoad(Display *dpy,Drawable win); void LoadableDraw(Display *dpy,Drawable win); int LoadableSeeMouse(int x,int y); ! int CreateLoadableTipWindow(int k); ! int IsLoadableTip(int type); void HandleLoadableClick(XEvent event,int k); void PopupTipWindow(int px, int py, char *text); char *EnvExpand(char *str); *** GoodyModule.c.old Mon Jul 21 14:38:26 1997 --- GoodyModule.c Mon Jul 21 11:01:49 1997 *************** *** 17,22 **** --- 17,24 ---- * More then one module may want to use a proc called Load ! */ + #include + extern char *IconPath, *PixmapPath; struct MyInfo { char *id; *************** *** 33,39 **** }; ! void *GoodyModuleInit(char *id); int GoodyModuleParseResource(struct MyInfo *mif,char *tline,char *Module,int Clength); void GoodyModuleLoad(struct MyInfo *mif,Display *dpy,Drawable win,int *goodies_width); void GoodyModuleDraw(struct MyInfo *mif,Display *dpy,Window win); --- 35,41 ---- }; ! void *GoodyModuleInit(char *id, int k); int GoodyModuleParseResource(struct MyInfo *mif,char *tline,char *Module,int Clength); void GoodyModuleLoad(struct MyInfo *mif,Display *dpy,Drawable win,int *goodies_width); void GoodyModuleDraw(struct MyInfo *mif,Display *dpy,Window win); *************** *** 41,53 **** void GoodyModuleCreateIconTipWindow_(struct MyInfo *mif); void GoodyModuleIconClick(struct MyInfo *mif,XEvent event); ! struct GoodyLoadable GoodyModuleSymbol={&GoodyModuleInit, ! &GoodyModuleParseResource, ! &GoodyModuleLoad, ! &GoodyModuleDraw, ! &GoodyModuleSeeMouse, ! &GoodyModuleCreateIconTipWindow_, ! &GoodyModuleIconClick}; extern int win_width,stwin_width; extern int RowHeight; --- 43,57 ---- void GoodyModuleCreateIconTipWindow_(struct MyInfo *mif); void GoodyModuleIconClick(struct MyInfo *mif,XEvent event); ! struct GoodyLoadable GoodyModuleSymbol = { ! (LoadableInit_f) &GoodyModuleInit, ! (LoadableParseResource_f) &GoodyModuleParseResource, ! (LoadableLoad_f) &GoodyModuleLoad, ! (LoadableDraw_f) &GoodyModuleDraw, ! (LoadableSeeMouse_f) &GoodyModuleSeeMouse, ! (LoadableCreateTipWindow_f) &GoodyModuleCreateIconTipWindow_, ! (HandleIconClick_f) &GoodyModuleIconClick ! }; extern int win_width,stwin_width; extern int RowHeight; *************** *** 54,60 **** ! void *GoodyModuleInit(char *id) { struct MyInfo *mif; --- 58,64 ---- ! void *GoodyModuleInit(char *id, int k) { struct MyInfo *mif; *************** *** 63,69 **** fflush(stdout); #endif ! (void *) mif = calloc(1, sizeof(struct MyInfo)); if (mif == NULL) { perror("FvwmTaskBar.GoodyModule.Init()"); return NULL; --- 67,73 ---- fflush(stdout); #endif ! mif = (struct MyInfo*)calloc(1, sizeof(struct MyInfo)); if (mif == NULL) { perror("FvwmTaskBar.GoodyModule.Init()"); return NULL; *************** *** 80,88 **** --- 84,98 ---- void GoodyModuleSetIcon(struct MyInfo *mif, char *i) { + char *path; #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.GoodyModule.AddIcon(*,\"%s\")\n", i); #endif + if ((path=findIconFile(i,PixmapPath,R_OK)) || + (path=findIconFile(i,IconPath,R_OK))) { + free(i); + i = path; + } if (mif == NULL) return; if (mif->icon != NULL) free(mif->icon); *************** *** 154,161 **** void GoodyModuleLoad(struct MyInfo *mif, Display *dpy, Drawable win, int *goodies_width) { - int k; - #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.GoodyModule.LoadModule()\n"); #endif --- 164,169 ---- *************** *** 193,199 **** void GoodyModuleDraw(struct MyInfo *mif, Display *dpy, Window win) { XGCValues gcv; - GC copy; unsigned long GoodyModulegcm = GCClipMask | GCClipXOrigin | GCClipYOrigin; #define gcm GoodyModulegcm --- 201,206 ---- *** MailCheckModule.c.old Mon Jul 21 14:38:26 1997 --- MailCheckModule.c Mon Jul 21 10:59:53 1997 *************** *** 22,36 **** * More then one MailCheckModule may want to use a proc called Load ! */ ! #define HasNoMail 0 ! #define HasMail 1 ! #define HasNewMail 4 ! #define HasUnreadMail 2 struct MyInfo{ char *id; /* other stuff */ char *command; /* action to execute on double click */ char *NewMailcommand; /* action to execute when mail arrives */ --- 22,56 ---- * More then one MailCheckModule may want to use a proc called Load ! */ + #include + extern char *IconPath, *PixmapPath; ! #define HDR_DELIM "From " ! #define HDR_DELIM_LEN 5 ! #define HDR_FROM "From: " ! #define HDR_FROM_LEN 6 ! #define HDR_SUBJ "Subject: " ! #define HDR_SUBJ_LEN 9 ! typedef struct MailHdr_s { ! char *sbFrom, *sbSubj; ! struct MailHdr_s *pNext; ! } MailHdr_S; + #define eDisabled 0 + #define eAnyChange 1 + #define eBigger 2 + #define eTouched 3 + + #define HasNoMail 0 + #define HasMail 1 + #define HasUnreadMail 2 + #define HasNewMail 4 + #define HasChangedMail 8 + struct MyInfo{ char *id; /* other stuff */ + char *GoodyNum; char *command; /* action to execute on double click */ char *NewMailcommand; /* action to execute when mail arrives */ *************** *** 40,45 **** --- 60,72 ---- Pixmap icon_mask; XpmAttributes icon_attr; + int AutoMailTip; + char *MailBuf; + int fMailBufChanged; + char *MailHeaderTipText; + int MailTipUnblankScreen; + Display *dpy; + char *newicon; /* icon to show when there are new mail */ char *newtip; Pixmap newicon_pix; *************** *** 61,70 **** off_t mailsize; }; void MailCheckModule_getstatus(struct MyInfo *); ! void *MailCheckModuleInit(char *id); int MailCheckModuleParseResource(struct MyInfo *mif,char *tline,char *MailCheckModule,int Clength); void MailCheckModuleLoad(struct MyInfo *mif,Display *dpy,Drawable win,int *goodies_width); void MailCheckModuleDraw(struct MyInfo *mif,Display *dpy,Window win); --- 88,99 ---- off_t mailsize; }; + static int DoAutoMailTip(struct MyInfo *mif, int fForce); + void MailCheckModule_getstatus(struct MyInfo *); ! void *MailCheckModuleInit(char *id, int); int MailCheckModuleParseResource(struct MyInfo *mif,char *tline,char *MailCheckModule,int Clength); void MailCheckModuleLoad(struct MyInfo *mif,Display *dpy,Drawable win,int *goodies_width); void MailCheckModuleDraw(struct MyInfo *mif,Display *dpy,Window win); *************** *** 72,90 **** void MailCheckModuleCreateIconTipWindow_(struct MyInfo *mif); void MailCheckModuleIconClick(struct MyInfo *mif,XEvent event); ! struct GoodyLoadable MailCheckModuleSymbol={&MailCheckModuleInit, ! &MailCheckModuleParseResource, ! &MailCheckModuleLoad, ! &MailCheckModuleDraw, ! &MailCheckModuleSeeMouse, ! &MailCheckModuleCreateIconTipWindow_, ! &MailCheckModuleIconClick}; extern int win_width,stwin_width; extern int RowHeight; ! void *MailCheckModuleInit(char *id) { struct MyInfo *mif; --- 101,121 ---- void MailCheckModuleCreateIconTipWindow_(struct MyInfo *mif); void MailCheckModuleIconClick(struct MyInfo *mif,XEvent event); ! struct GoodyLoadable MailCheckModuleSymbol = { ! (LoadableInit_f) &MailCheckModuleInit, ! (LoadableParseResource_f) &MailCheckModuleParseResource, ! (LoadableLoad_f) &MailCheckModuleLoad, ! (LoadableDraw_f) &MailCheckModuleDraw, ! (LoadableSeeMouse_f) &MailCheckModuleSeeMouse, ! (LoadableCreateTipWindow_f) &MailCheckModuleCreateIconTipWindow_, ! (HandleIconClick_f) &MailCheckModuleIconClick ! }; extern int win_width,stwin_width; extern int RowHeight; ! void *MailCheckModuleInit(char *id, int k) { struct MyInfo *mif; *************** *** 93,107 **** fflush(stdout); #endif ! (void *) mif = calloc(1, sizeof(struct MyInfo)); if (mif == NULL) { perror("FvwmTaskBar.MailCheckModule.Init()"); return NULL; } mif->id = id; mif->command = NULL; mif->NewMailcommand = NULL; mif->icon = NULL; mif->newicon = NULL; mif->unreadicon = NULL; mif->tip = "You have mail"; --- 124,144 ---- fflush(stdout); #endif ! mif = (struct MyInfo*)calloc(1, sizeof(struct MyInfo)); if (mif == NULL) { perror("FvwmTaskBar.MailCheckModule.Init()"); return NULL; } mif->id = id; + mif->GoodyNum = k; mif->command = NULL; mif->NewMailcommand = NULL; mif->icon = NULL; + mif->AutoMailTip = eDisabled; + mif->MailBuf = NULL; + mif->fMailBufChanged = False; + mif->MailHeaderTipText = NULL; + mif->MailTipUnblankScreen = False; mif->newicon = NULL; mif->unreadicon = NULL; mif->tip = "You have mail"; *************** *** 117,125 **** --- 154,168 ---- void MailCheckModuleSetIcon(struct MyInfo *mif, char *i) { + char *path; #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.MailCheckModule.AddIcon(*,\"%s\")\n", i); #endif + if ((path=findIconFile(i,PixmapPath,R_OK)) || + (path=findIconFile(i,IconPath,R_OK))) { + free(i); + i = path; + } if (mif == NULL) return; if (mif->icon != NULL) free(mif->icon); *************** *** 131,139 **** --- 174,188 ---- void MailCheckModuleSetNewIcon(struct MyInfo *mif, char *i) { + char *path; #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.MailCheckModule.AddIcon(*,\"%s\")\n", i); #endif + if ((path=findIconFile(i,PixmapPath,R_OK)) || + (path=findIconFile(i,IconPath,R_OK))) { + free(i); + i = path; + } if (mif == NULL) return; if (mif->newicon != NULL) free(mif->newicon); *************** *** 145,153 **** --- 194,208 ---- void MailCheckModuleSetUnreadIcon(struct MyInfo *mif, char *i) { + char *path; #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.MailCheckModule.AddIcon(*,\"%s\")\n", i); #endif + if ((path=findIconFile(i,PixmapPath,R_OK)) || + (path=findIconFile(i,IconPath,R_OK))) { + free(i); + i = path; + } if (mif == NULL) return; if (mif->unreadicon != NULL) free(mif->unreadicon); *************** *** 261,266 **** --- 316,341 ---- CopyString(&s, &tline[Clength+29+strlen(mif->id)]); mif->unreadtip=s; return(1); + #if 1 + } else if(strncasecmp(tline,CatString3(Module, "MailCheckModuleAutoMailTip",mif->id), + Clength+26+strlen(mif->id))==0) { + if (strcasecmp(&tline[Clength+27+strlen(mif->id)], + "MailFileTouched") == 0) { + mif->AutoMailTip = eTouched; + } else if (strcasecmp(&tline[Clength+27+strlen(mif->id)], + "MailFileBigger") == 0) { + mif->AutoMailTip = eBigger; + } else if (strcasecmp(&tline[Clength+27+strlen(mif->id)], + "MailFileAnyChange") == 0) { + mif->AutoMailTip = eAnyChange; + } else { + mif->AutoMailTip = eAnyChange; + } + return(1); + } else if(strncasecmp(tline,CatString3(Module,"MailCheckModuleMailTipUnblankScreen",mif->id), Clength+35+strlen(mif->id))==0) { + mif->MailTipUnblankScreen = True; + return(1); + #endif } else return 0; } *************** *** 268,275 **** void MailCheckModuleLoad(struct MyInfo *mif, Display *dpy, Drawable win, int *goodies_width) { - int k; - #ifdef __DEBUG__ fprintf(stderr, "FvwmTaskBar.MailCheckModule.LoadMailCheckModule()\n"); #endif --- 343,348 ---- *************** *** 305,310 **** --- 378,384 ---- return; } + mif->dpy = dpy; mif->visible = True; if ((mif->icon_attr.valuemask & XpmSize) == 0) { *************** *** 330,336 **** void get_status(struct MyInfo *mif) { ! off_t newsize; struct stat st; int fd; --- 404,410 ---- void get_status(struct MyInfo *mif) { ! static off_t oldsize = 0; off_t newsize; struct stat st; int fd; *************** *** 345,351 **** else { fstat(fd, &st); - close(fd); newsize = st.st_size; mif->show=0; if (newsize > 0) --- 419,424 ---- *************** *** 364,369 **** --- 437,456 ---- } + if (newsize != oldsize) { + if (mif->MailBuf) free(mif->MailBuf); + mif->MailBuf = (char*)safemalloc(newsize+1); + if (read(fd, mif->MailBuf, newsize) == newsize) { + mif->MailBuf[newsize] = '\0'; + } else { + mif->MailBuf[0] = '\0'; + } + mif->show |= HasChangedMail; + mif->fMailBufChanged = True; + oldsize = newsize; + } + close(fd); + mif->mailsize = newsize; } *************** *** 395,401 **** void MailCheckModuleDraw(struct MyInfo *mif, Display *dpy, Window win) { XGCValues gcv; - GC copy; time_t now; unsigned long MailCheckModulegcm = GCClipMask | --- 482,487 ---- *************** *** 410,469 **** check_lock(mif); } ! if (mif->visible) ! switch (mif->show) { ! case HasMail: ! gcv.clip_mask = mif->icon_mask; ! gcv.clip_x_origin=start + icons_offset+3; ! gcv.clip_y_origin=((RowHeight - mif->icon_attr.height) >> 1); ! XChangeGC(dpy,statusgc,gcm,&gcv); ! XCopyArea(dpy,mif->icon_pix, win, statusgc, 0, 0, ! mif->icon_attr.width, mif->icon_attr.height, ! gcv.clip_x_origin, ! gcv.clip_y_origin); ! mif->offset=icons_offset; ! icons_offset+=mif->icon_attr.width+2; ! break; ! case HasMail | HasUnreadMail: ! case HasUnreadMail: ! gcv.clip_mask = mif->unreadicon_mask; ! gcv.clip_x_origin=start + icons_offset+3; ! gcv.clip_y_origin=((RowHeight - mif->unreadicon_attr.height) >> 1); ! XChangeGC(dpy,statusgc,gcm,&gcv); ! XCopyArea(dpy,mif->unreadicon_pix, win, statusgc, 0, 0, ! mif->unreadicon_attr.width, mif->unreadicon_attr.height, ! gcv.clip_x_origin, ! gcv.clip_y_origin); ! mif->offset=icons_offset; ! icons_offset+=mif->unreadicon_attr.width+2; ! break; ! case HasMail | HasUnreadMail | HasNewMail: ! case HasMail | HasNewMail: ! case HasNewMail: ! gcv.clip_mask = mif->newicon_mask; ! gcv.clip_x_origin=start + icons_offset+3; ! gcv.clip_y_origin=((RowHeight - mif->newicon_attr.height) >> 1); ! XChangeGC(dpy,statusgc,gcm,&gcv); ! XCopyArea(dpy,mif->newicon_pix, win, statusgc, 0, 0, ! mif->newicon_attr.width, mif->newicon_attr.height, ! gcv.clip_x_origin, ! gcv.clip_y_origin); ! mif->offset=icons_offset; ! icons_offset+=mif->newicon_attr.width+2; ! break; } } --- 496,560 ---- check_lock(mif); } ! if (mif->visible) { ! if (mif->show & HasNewMail) { ! gcv.clip_mask = mif->newicon_mask; ! gcv.clip_x_origin=start + icons_offset+3; ! gcv.clip_y_origin=((RowHeight - mif->newicon_attr.height) >> 1); ! XChangeGC(dpy,statusgc,gcm,&gcv); ! XCopyArea(dpy,mif->newicon_pix, win, statusgc, 0, 0, ! mif->newicon_attr.width, mif->newicon_attr.height, ! gcv.clip_x_origin, ! gcv.clip_y_origin); ! mif->offset=icons_offset; ! icons_offset+=mif->newicon_attr.width+2; ! } else if (mif->show & HasUnreadMail) { ! gcv.clip_mask = mif->unreadicon_mask; ! gcv.clip_x_origin=start + icons_offset+3; ! gcv.clip_y_origin=((RowHeight - mif->unreadicon_attr.height) >> 1); ! XChangeGC(dpy,statusgc,gcm,&gcv); ! XCopyArea(dpy,mif->unreadicon_pix, win, statusgc, 0, 0, ! mif->unreadicon_attr.width, mif->unreadicon_attr.height, ! gcv.clip_x_origin, ! gcv.clip_y_origin); ! mif->offset=icons_offset; ! icons_offset+=mif->unreadicon_attr.width+2; ! } else if (mif->show & HasMail) { ! gcv.clip_mask = mif->icon_mask; ! gcv.clip_x_origin=start + icons_offset+3; ! gcv.clip_y_origin=((RowHeight - mif->icon_attr.height) >> 1); ! XChangeGC(dpy,statusgc,gcm,&gcv); ! XCopyArea(dpy,mif->icon_pix, win, statusgc, 0, 0, ! mif->icon_attr.width, mif->icon_attr.height, ! gcv.clip_x_origin, ! gcv.clip_y_origin); ! mif->offset=icons_offset; ! icons_offset+=mif->icon_attr.width+2; ! } + /* auto display mail */ + if (mif->AutoMailTip != eDisabled) { + if (mif->show & HasMail && + ((mif->AutoMailTip == eAnyChange && mif->show & HasChangedMail) || + (mif->AutoMailTip == eBigger && mif->show & HasNewMail) || + (mif->AutoMailTip == eTouched && mif->show & HasUnreadMail))) { + if (DoAutoMailTip(mif, 0)) CheckAndShowTipWindow(mif->GoodyNum); + } else if ((mif->show & HasMail) == 0) { + CheckAndDestroyTipWindow(mif->GoodyNum); + } } + } } *************** *** 486,491 **** --- 577,585 ---- void MailCheckModuleCreateIconTipWindow_(struct MyInfo *mif) { if (mif == NULL) return; + if (mif->AutoMailTip != eDisabled) { + DoAutoMailTip(mif, 1); + } else { switch (mif->show) { case HasMail: if (mif->tip == NULL) return; *************** *** 506,511 **** --- 600,606 ---- PopupTipWindow(win_width-stwin_width+mif->offset,0,mif->newtip); break; } + } } *************** *** 523,526 **** --- 618,770 ---- #endif } mif->lastclick = event.xbutton.time; + } + + + static char line[256]; + + static void FreeMailHeaders(MailHdr_S *p) { + if (!p) return; + if (p->pNext) { + FreeMailHeaders(p->pNext); + } + if (p->sbFrom) free(p->sbFrom); + if (p->sbSubj) free(p->sbSubj); + free(p); + } + + /* reads from passed buf, and fills line[] */ + static char *GetsBuf(char *buf) { + int i; + char ch; + static char *pCurr; + if (buf) pCurr = buf; + if (*pCurr == '\0') return NULL; + for (i=0; i<256; i++, pCurr++) { + ch = *pCurr; + if (ch == '\n' || ch == '\0') { + if (ch != '\0') pCurr++; + line[i] = '\0'; + break; + } + line[i] = ch; + } + return line; + } + + static int LeftWhitespace(char *sb) { + int wRtn = 0; + while (strchr(" \t\n\0", *sb++)) { + wRtn++; + } + return wRtn; + } + + static char *RightWhitespace(char *sb) { + int i = strlen(sb); + char *p = sb + i; + if (i==0) return sb; + while (p >= sb && strchr(" \t\n\0", *--p)) { + *p = '\0'; + } + return sb; + } + + static MailHdr_S *ParseMailHeaders(struct MyInfo *mif, int *pwCount) { + char *pLine; + MailHdr_S *MailHdr, *MailHdr_tail, *pNew; + int wCount = 0; + + /* assume list is empty */ + MailHdr = MailHdr_tail = NULL; + + /* walk through buffer to extract mail headers */ + pLine = GetsBuf(mif->MailBuf); + while (pLine != NULL) { + if (strncmp(pLine, HDR_DELIM, HDR_DELIM_LEN) == 0) { + pNew = (MailHdr_S *)safemalloc(sizeof(MailHdr_S)); + pNew->sbFrom = pNew->sbSubj = NULL; + pNew->pNext = NULL; + if (!MailHdr) { + MailHdr = MailHdr_tail = pNew; + } else { /* append to list */ + MailHdr_tail->pNext = pNew; + MailHdr_tail = pNew; + } + wCount++; + } else if (!pNew->sbFrom && + strncmp(pLine, HDR_FROM, HDR_FROM_LEN) == 0) { + UpdateString(&pNew->sbFrom, + pLine + HDR_FROM_LEN + LeftWhitespace(pLine+HDR_FROM_LEN)); + RightWhitespace(pNew->sbFrom); + } else if (!pNew->sbSubj && + strncmp(pLine, HDR_SUBJ, HDR_SUBJ_LEN) == 0) { + UpdateString(&pNew->sbSubj, + pLine + HDR_SUBJ_LEN + LeftWhitespace(pLine+HDR_SUBJ_LEN)); + RightWhitespace(pNew->sbSubj); + } + + pLine = GetsBuf(NULL); + } + + *pwCount = wCount; + return MailHdr; + } + + static char *StrNCpyPad(char *sbDst, char *sbSrc, int n, char chPad) { + int i; + for (i=0; isbFrom, 20, ' '); + sbTmp += 20; + *sbTmp++ = ' '; + StrNCpyPad(sbTmp, p->sbSubj, 30, ' '); + sbTmp += 30; + *sbTmp++ = '\n'; + p = p->pNext; + } + *sbTmp = '\0'; + + FreeMailHeaders(pMailHdr); + + return sbRtn; + } + + static int DoAutoMailTip(struct MyInfo *mif, int fForce) { + if (mif->fMailBufChanged || fForce) { + if (mif->MailHeaderTipText) free(mif->MailHeaderTipText); + mif->MailHeaderTipText = GetMailHeaders(mif); + + PopupTipWindow(win_width-stwin_width+mif->offset,0,mif->MailHeaderTipText); + if (mif->MailTipUnblankScreen) { + XForceScreenSaver(mif->dpy, ScreenSaverReset); + } + + mif->fMailBufChanged = False; + return 1; + } + return 0; } *** Makefile.in.old Mon Jul 21 14:38:27 1997 --- Makefile.in Thu Jul 17 12:00:37 1997 *************** *** 15,32 **** fvwm_name=@fvwm_name@ # # This is where the modules will be installed ! fvwm_dir=@prefix@/lib/X11/@fvwm_name@ # # Libs ! X_LIBRARY=-lX11 XPM_LIBRARY=-lXpm XEXT_LIBRARY=-lXext FVWM_LIBRARY=-l${fvwm_name} LIBS=-L${top_srcdir}/libs ${x_libraries} ${FVWM_LIBRARY} ${XPM_LIBRARY} ${XEXT_LIBRARY} ${X_LIBRARY} -ldl ! EXTRA_DEFINES=-DXPM -DSHAPE ! CC=@CC@ -rdynamic -pipe INCLUDES=-I${top_srcdir}/include ${x_includes} CFLAGS=${INCLUDES} @CFLAGS@ ${EXTRA_DEFINES} MAKEDEPEND=@MAKEDEPEND@ --- 15,34 ---- fvwm_name=@fvwm_name@ # # This is where the modules will be installed ! #fvwm_dir=@prefix@/lib/X11/@fvwm_name@ ! fvwm_dir=@libdir@ # # Libs ! X_LIBRARY=-lX11 @LIBS@ XPM_LIBRARY=-lXpm XEXT_LIBRARY=-lXext FVWM_LIBRARY=-l${fvwm_name} LIBS=-L${top_srcdir}/libs ${x_libraries} ${FVWM_LIBRARY} ${XPM_LIBRARY} ${XEXT_LIBRARY} ${X_LIBRARY} -ldl ! EXTRA_DEFINES=-DXPM -DSHAPE -DFVWM_ICONDIR=\"${fvwm_icons}\" -DPLUGINS=\"${fvwm_dir}/plugins\" ! CC=@CC@ ! LD.so=@CC@ -r INCLUDES=-I${top_srcdir}/include ${x_includes} CFLAGS=${INCLUDES} @CFLAGS@ ${EXTRA_DEFINES} MAKEDEPEND=@MAKEDEPEND@ *************** *** 72,97 **** install: all ${INSTALL_PROGRAM} ${PROG} ${fvwm_dir} clean: ! ${RM} ${PROG} ${OBJS} *~ core *.bak distclean: clean modules: ${MODULES} ! cat INSTALL CheckLockModule.so: CheckLockModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared CheckLockModule.c -o CheckLockModule.so GoodyModule.so: GoodyModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared GoodyModule.c -o GoodyModule.so ShowDateModule.so: ShowDateModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared ShowDateModule.c -o ShowDateModule.so MailCheckModule.so: MailCheckModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared MailCheckModule.c -o MailCheckModule.so ${PROG}: ${OBJS} ${CC} -o ${PROG} ${OBJS} ${LIBS} --- 74,106 ---- install: all ${INSTALL_PROGRAM} ${PROG} ${fvwm_dir} + for f in `/bin/ls *.so` ; do \ + ${INSTALL_PROGRAM} $$f ${fvwm_dir}/plugins ;\ + done clean: ! ${RM} ${PROG} ${OBJS} *~ core *.bak *.so distclean: clean modules: ${MODULES} ! # cat INSTALL CheckLockModule.so: CheckLockModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared -c CheckLockModule.c ! ${LD.so} -o CheckLockModule.so CheckLockModule.o GoodyModule.so: GoodyModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared -c GoodyModule.c ! ${LD.so} -o GoodyModule.so GoodyModule.o ShowDateModule.so: ShowDateModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared -c ShowDateModule.c ! ${LD.so} -o ShowDateModule.so ShowDateModule.o MailCheckModule.so: MailCheckModule.c GoodyLoadable.h ! ${CC} ${INCLUDES} -shared -c MailCheckModule.c ! ${LD.so} -o MailCheckModule.so MailCheckModule.o ${PROG}: ${OBJS} ${CC} -o ${PROG} ${OBJS} ${LIBS} *** ShowDateModule.c.old Mon Jul 21 14:38:27 1997 --- ShowDateModule.c Mon Jul 21 11:02:12 1997 *************** *** 24,29 **** --- 24,30 ---- char *clockfmt; char *command; char *tip; + char *hourlycommand; Time lastclick; int clock_width; int fontheight; *************** *** 44,50 **** #define SetIconTip ShowDateModuleSetIconTip #define SetIconCommand ShowDateModuleSetIconCommand ! void *dateInit(char *id); int dateParse(struct DateInfo *v,char *tline, char *Module,int Clength) ; void dateLoad(struct DateInfo *v,Display *dpy,Drawable win) ; void dateDraw(struct DateInfo *v,Display *dpy,Drawable win) ; --- 45,51 ---- #define SetIconTip ShowDateModuleSetIconTip #define SetIconCommand ShowDateModuleSetIconCommand ! void *dateInit(char *id, int k); int dateParse(struct DateInfo *v,char *tline, char *Module,int Clength) ; void dateLoad(struct DateInfo *v,Display *dpy,Drawable win) ; void dateDraw(struct DateInfo *v,Display *dpy,Drawable win) ; *************** *** 54,66 **** struct GoodyLoadable dateSymbol = { ! &dateInit, ! &dateParse, ! &dateLoad, ! &dateDraw, ! &dateInMouse, ! &dateTipWindow, ! &dateClick }; --- 55,67 ---- struct GoodyLoadable dateSymbol = { ! (LoadableInit_f) &dateInit, ! (LoadableParseResource_f) &dateParse, ! (LoadableLoad_f) &dateLoad, ! (LoadableDraw_f) &dateDraw, ! (LoadableSeeMouse_f) &dateInMouse, ! (LoadableCreateTipWindow_f) &dateTipWindow, ! (HandleIconClick_f) &dateClick }; *************** *** 96,106 **** ! void *dateInit(char *id) { struct DateInfo *p; ! p = calloc(1, sizeof(struct DateInfo)); if (p == NULL) { perror("FvwmTaskBar.ShowDateModule.dateInit()"); return NULL; --- 97,107 ---- ! void *dateInit(char *id, int k) { struct DateInfo *p; ! p = (struct DateInfo*)calloc(1, sizeof(struct DateInfo)); if (p == NULL) { perror("FvwmTaskBar.ShowDateModule.dateInit()"); return NULL; *************** *** 110,115 **** --- 111,117 ---- p->command = NULL; p->last_date = -1; p->tip = NULL; + p->hourlycommand = NULL; return p; } *************** *** 148,153 **** --- 150,159 ---- CopyString(&s, &tline[Clength+22+strlen(v->id)]); SetIconCommand(v,s); return(1); + } else if (strncasecmp(tline, CatString3(Module, "ShowDateModuleHourlyCommand",v->id), + Clength+27+strlen(v->id))==0) { + CopyString(&(v->hourlycommand), &tline[Clength+28+strlen(v->id)]); + return(1); } else return 0; } *************** *** 154,165 **** void dateLoad(struct DateInfo *v,Display *dpy,Drawable win) { - struct passwd *pwent; - char tmp[1024]; - XGCValues gcval; - unsigned long gcmask; - - if ((StatusFont = XLoadQueryFont(dpy, StatusFont_string)) == NULL) { if ((StatusFont = XLoadQueryFont(dpy, "fixed")) == NULL) { ConsoleMessage("FvwmTaskBar.ShowDateModule.dateLoad():Couldn't load fixed font.\n"); --- 160,165 ---- *************** *** 193,199 **** struct tm *tms; static char str[40]; static time_t timer; ! static int last_mail_check = -1; unsigned long gcmask; XGCValues gcval; --- 193,199 ---- struct tm *tms; static char str[40]; static time_t timer; ! static int last_hour = -1; unsigned long gcmask; XGCValues gcval; *************** *** 222,232 **** v->my_offset=icons_offset; icons_offset+=v->clock_width; /* if (Tip.open) { if (Tip.type == DATE_TIP) ! if (tms->tm_mday != v->last_date) /* reflect date change * / ! dateTipWindow(v); /* This automatically deletes any old window * / v->last_date = tms->tm_mday; } */ --- 222,239 ---- v->my_offset=icons_offset; icons_offset+=v->clock_width; + if (v->hourlycommand) { + if (tms->tm_min == 0 && tms->tm_hour != last_hour) { + last_hour = tms->tm_hour; + SendFvwmPipe(v->hourlycommand, 0); + } + } + /* if (Tip.open) { if (Tip.type == DATE_TIP) ! if (tms->tm_mday != v->last_date) / * reflect date change * / ! dateTipWindow(v); / * This automatically deletes any old window * / v->last_date = tms->tm_mday; } */