This commit is contained in:
Nishi 2025-11-18 22:51:48 +09:00
commit 75fde75982
Signed by: nishi
GPG key ID: 27EF69B208EB9343
3 changed files with 21 additions and 6 deletions

View file

@ -22,9 +22,12 @@ void init_mail(void){
void check_mail(void){
struct stat s;
if(stat(mailpath, &s) == 0){
if(s.st_mtime > last){
printf("!\n");
s.st_mtime = 0;
if(stat(mailpath, &s) == 0 || last != 0){
if((s.st_mtime == 0 && last != 0) || s.st_mtime > last){
MwVaApply(image,
MwNpixmap, full,
NULL);
}
last = s.st_mtime;

View file

@ -24,6 +24,7 @@ static void resize(MwWidget handle, void* user, void* client){
}
static void tick(MwWidget handle, void* user, void* client){
(void)handle;
(void)user;
(void)client;
@ -35,22 +36,33 @@ static void tick(MwWidget handle, void* user, void* client){
}
}
static void mouseUp(MwWidget handle, void* user, void* client){
(void)handle;
(void)user;
(void)client;
MwVaApply(image,
MwNpixmap, empty,
NULL);
}
int main() {
init_mail();
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 48, 48,
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 96, 96,
MwNtitle, "mbiff",
NULL);
empty = MwLoadXPM(window, mailempty);
full = MwLoadXPM(window, mailfull);
image = MwVaCreateWidget(MwImageClass, "image", window, 0, 0, 48, 48,
image = MwVaCreateWidget(MwImageClass, "image", window, 0, 0, 96, 96,
MwNpixmap, empty,
NULL);
MwAddUserHandler(image, MwNmouseUpHandler, mouseUp, NULL);
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);

View file

@ -21,7 +21,7 @@
#endif
#ifndef _PATH_MAILDIR
#define _PATH_MAILDIR "/var/mail"
#define _PATH_MAILDIR "/var/spool/mail"
#endif
/* main.c */