Add usage information, more error checking
This commit is contained in:
parent
db1e571082
commit
676e24e237
2 changed files with 27 additions and 20 deletions
12
config.h
12
config.h
|
@ -1,14 +1,14 @@
|
||||||
const static char *background_color = "#FFFFFF";
|
const static char *background_color = "#3e3e3e";
|
||||||
const static char *border_color = "#FF0000";
|
const static char *border_color = "#ececec";
|
||||||
|
|
||||||
const static char *font_style = "Inconsolata:style=Medium:size=15";
|
const static char *font_style = "Inconsolata:style=Medium:size=15";
|
||||||
const static char *font_color = "#00FF00";
|
const static char *font_color = "#ececec";
|
||||||
const static unsigned short text_padding = 10;
|
const static unsigned short text_padding = 10;
|
||||||
|
|
||||||
const static unsigned short width = 300;
|
const static unsigned short width = 300;
|
||||||
const static unsigned short border_size = 5;
|
const static unsigned short border_size = 2;
|
||||||
const static unsigned short pos_x = 30;
|
const static unsigned short pos_x = 40;
|
||||||
const static unsigned short pos_y = 30;
|
const static unsigned short pos_y = 50;
|
||||||
|
|
||||||
enum corners { top_left, top_right, down_right, down_left };
|
enum corners { top_left, top_right, down_right, down_left };
|
||||||
enum corners corner = top_right;
|
enum corners corner = top_right;
|
||||||
|
|
11
main.c
11
main.c
|
@ -20,6 +20,11 @@ void expire()
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
if (argc != 2) {
|
||||||
|
fprintf(stderr, "Usage: herbe message\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
signal(SIGALRM, expire);
|
signal(SIGALRM, expire);
|
||||||
alarm(duration);
|
alarm(duration);
|
||||||
|
|
||||||
|
@ -76,8 +81,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
XMapWindow(display, window);
|
XMapWindow(display, window);
|
||||||
|
|
||||||
// TODO free xftcolor
|
|
||||||
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -93,6 +96,10 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XftDrawDestroy(draw);
|
||||||
|
XftColorFree(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &color);
|
||||||
|
XftFontClose(display, font);
|
||||||
|
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue