#include #include #include "libami.h" #include "module.h" #include "alloc.h" void md_update_battery(int pct, int time, int ac) { struct mcmd_update_battery batt = { 0 }; int res; batt.battery_time = time; batt.battery_pct = pct; batt.battery_ac = ac; res = md_command0(None, MCMD_UPDATE_BATTERY, &batt, sizeof(batt)); (void) res; } Window md_create_appicon(Window p, int x, int y, char *name, Pixmap pm1, Pixmap pm2, Pixmap pmm) { char *data; Window w; int res, l=strlen(name); #ifdef HAVE_ALLOCA struct NewAppIcon *nai=alloca(sizeof(struct NewAppIcon)+l); #else struct NewAppIcon *nai=malloc(sizeof(struct NewAppIcon)+l); if(nai==NULL) return None; #endif nai->x=x; nai->y=y; nai->pm1=pm1; nai->pm2=pm2; nai->pmm=pmm; strcpy(nai->name, name); res=md_command(p, MCMD_CREATEAPPICON, nai, sizeof(struct NewAppIcon)+l, &data); if(res=0 && p) return p; if(p) free(p); return NULL; }