-static void appenditem(Item *item, Item **list, Item **last);
-static void calcoffsets(void);
-static void drawmenu(void);
-static char *fstrstr(const char *s, const char *sub);
-static void grabkeyboard(void);
-static void insert(const char *s, ssize_t n);
-static void keypress(XKeyEvent *ev);
-static void match(void);
-static void paste(void);
-static void readstdin(void);
-static void run(void);
-static void setup(void);
-static void usage(void);
-
-static char text[BUFSIZ];
-static size_t cursor = 0;
-static const char *font = NULL;
-static const char *prompt = NULL;
-static const char *normbgcolor = "#cccccc";
-static const char *normfgcolor = "#000000";
-static const char *selbgcolor = "#0066ff";
-static const char *selfgcolor = "#ffffff";
-static unsigned int bh, mw, mh;
-static unsigned int inputw = 0;
-static unsigned int lines = 0;
-static unsigned int promptw;
-static unsigned long normcol[ColLast];
-static unsigned long selcol[ColLast];
-static Atom utf8;
-static Bool topbar = True;
-static DC *dc;
-static Item *items = NULL;
-static Item *matches, *sel;
-static Item *prev, *curr, *next;
+static char text[BUFSIZ] = "";
+static int bh, mw, mh;
+static int sw, sh; /* X display screen geometry width, height */
+static int inputw, promptw;
+static size_t cursor;
+static struct item *items = NULL;
+static struct item *matches, *matchend;
+static struct item *prev, *curr, *next, *sel;
+static int mon = -1, screen;
+
+static Atom clip, utf8;
+static Display *dpy;