commit 89c06a15709368c76ffde3c77291b1d9cf880cb9
parent 2c329aa6247ff532fce877debb1e80075bcbbba3
Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 9 Feb 2020 10:13:25 +0100
minor fixes from Evil_Bob
* fix errors in die(), to add newlines
* fix double include of unistd.h
* change into to long, where it needs > 16 bit
* tiny code-style fixes
Diffstat:
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/thinglaunch.c b/thinglaunch.c
@@ -5,20 +5,22 @@
* For now this is a slightly modified version of the original from
* Matt Johnston <matt@ucc.asn.au>. See LICENSE.orig for his messages.
*/
-#include <unistd.h>
+
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xlocale.h>
+
+#include <errno.h>
+#include <libgen.h>
#include <locale.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
-#include <libgen.h>
+#include <unistd.h>
#include <wchar.h>
#include "arg.h"
@@ -128,7 +130,7 @@ getcolor(const char *colstr)
XColor color;
if (!XAllocNamedColor(dpy, cmap, colstr, &color, &color))
- die("error, canno allocate color '%s'\n", colstr);
+ die("error, cannot allocate color '%s'\n", colstr);
return color.pixel;
}
@@ -236,11 +238,11 @@ createwindow(void)
display_name = getenv("DISPLAY");
if (display_name == NULL)
- die("DISPLAY not set");
+ die("DISPLAY not set.\n");
dpy = XOpenDisplay(display_name);
if (dpy == NULL)
- die("Couldn't connect to DISPLAY");
+ die("Couldn't connect to DISPLAY.\n");
if (!XSetLocaleModifiers(""))
fprintf(stderr, "warning: could not set local modifiers.\n");
@@ -261,7 +263,7 @@ createwindow(void)
left, top, WINWIDTH, WINHEIGHT, borderwidth,
bgcol, bgcol);*/
- attrib.override_redirect= True;
+ attrib.override_redirect = True;
win = XCreateWindow(dpy, RootWindow(dpy, screen),
left, top, WINWIDTH, WINHEIGHT,
0, CopyFromParent,InputOutput,CopyFromParent,
@@ -270,7 +272,7 @@ createwindow(void)
/* set up the window hints etc */
win_size_hints = XAllocSizeHints();
if (!win_size_hints)
- die("out of memory allocating hints");
+ die("out of memory allocating hints.\n");
win_size_hints->flags = PMaxSize | PMinSize;
win_size_hints->min_width = win_size_hints->max_width = WINWIDTH;
@@ -316,7 +318,7 @@ setupgc(void)
/* setup the font */
font_info = XLoadQueryFont(dpy, font);
if (!font_info)
- die("couldn't load font");
+ die("couldn't load font.\n");
XSetFont(dpy, gc, font_info->fid);
}
@@ -342,7 +344,6 @@ eventloop(void)
default:
break;
}
-
}
}
@@ -350,9 +351,10 @@ eventloop(void)
void
grabhack(void)
{
- int maxwait = 3000000; /* 3 seconds */
- int interval = 5000; /* 5 millisec */
- int i, x;
+ long maxwait = 3000000; /* 3 seconds */
+ long interval = 5000; /* 5 millisec */
+ long i;
+ int x;
redraw();
@@ -365,7 +367,7 @@ grabhack(void)
return;
}
- die("Couldn't grab keyboard");
+ die("Couldn't grab keyboard.\n");
}
void