commit - 843ffc790805c026d5aad57ff70c2aa4c8d1a559
commit + f0265770ee263ac1bc617a68ad833f1802205353
blob - cedd4aa10eb18ca8cbfdde4f37854e84f927556a
blob + b4bdae85cf9a942494727a55ab2ca9fd26106f17
--- xitems.c
+++ xitems.c
#define PROGNAME "xitems"
#define MAXKS 32
-
-#define LEN(A) (sizeof(A)/sizeof((A)[0]))
/* usage -- print usage information and die. */
static void
width = w;
it = it->next;
} while (it != first);
+
+ if (o_x + width > DisplayWidth(dpy, screen))
+ o_x = DisplayWidth(dpy, screen) - width;
+ if (o_y + height*n > DisplayHeight(dpy, screen))
+ o_y = DisplayHeight(dpy, screen) - height*n;
XAllocNamedColor(dpy, DefaultColormap(dpy, screen), o_bg, &col, &dummy);
swa.background_pixel = col.pixel;
while ((linelen = getline(&line, &linesize, stdin)) != -1) {
struct item *it;
- line[--linelen] = '\0'; /* get rid of '\n' */
+ if (line[linelen-1] == '\n')
+ line[--linelen] = '\0';
if (!(it = insitem(last, line)))
die(1, "couldn't insert new item");
n++;