Xinqi Bao's Git
projects
/
dmenu.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
cleaned up
[dmenu.git]
/
dinput.c
diff --git
a/dinput.c
b/dinput.c
index
490380d
..
d8f2515
100644
(file)
--- a/
dinput.c
+++ b/
dinput.c
@@
-25,32
+25,33
@@
static void cleanup(void);
static void drawcursor(void);
static void drawinput(void);
static void cleanup(void);
static void drawcursor(void);
static void drawinput(void);
-static void eprint(const char *errstr, ...);
static Bool grabkeyboard(void);
static void kpress(XKeyEvent * e);
static void run(void);
static void setup(Bool topbar);
#include "config.h"
static Bool grabkeyboard(void);
static void kpress(XKeyEvent * e);
static void run(void);
static void setup(Bool topbar);
#include "config.h"
+#include "draw.h"
/* variables */
static char *prompt = NULL;
static char text[4096];
static int promptw = 0;
static int ret = 0;
/* variables */
static char *prompt = NULL;
static char text[4096];
static int promptw = 0;
static int ret = 0;
-static int screen;
-static unsigned int mw, mh;
static unsigned int cursor = 0;
static unsigned int numlockmask = 0;
static Bool running = True;
static unsigned int cursor = 0;
static unsigned int numlockmask = 0;
static Bool running = True;
-static Display *dpy;
-static Window parent, win;
+static Window win;
-#include "draw.c"
+Display *dpy;
+DC dc;
+int screen;
+unsigned int mw, mh;
+Window parent;
void
cleanup(void) {
void
cleanup(void) {
- d
c
cleanup();
+ d
raw
cleanup();
XDestroyWindow(dpy, win);
XUngrabKeyboard(dpy, CurrentTime);
}
XDestroyWindow(dpy, win);
XUngrabKeyboard(dpy, CurrentTime);
}
@@
-86,16
+87,6
@@
drawinput(void)
XFlush(dpy);
}
XFlush(dpy);
}
-void
-eprint(const char *errstr, ...) {
- va_list ap;
-
- va_start(ap, errstr);
- vfprintf(stderr, errstr, ap);
- va_end(ap);
- exit(EXIT_FAILURE);
-}
-
Bool
grabkeyboard(void) {
unsigned int len;
Bool
grabkeyboard(void) {
unsigned int len;
@@
-278,11
+269,6
@@
setup(Bool topbar) {
}
XFreeModifiermap(modmap);
}
XFreeModifiermap(modmap);
- /* style */
- dc.norm[ColBG] = getcolor(normbgcolor);
- dc.norm[ColFG] = getcolor(normfgcolor);
- dc.sel[ColBG] = getcolor(selbgcolor);
- dc.sel[ColFG] = getcolor(selfgcolor);
initfont(font);
/* menu window */
initfont(font);
/* menu window */
@@
-323,8
+309,7
@@
setup(Bool topbar) {
DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
- /* pixmap */
- dcsetup();
+ drawsetup();
if(prompt)
promptw = MIN(textw(prompt), mw / 5);
cursor = strlen(text);
if(prompt)
promptw = MIN(textw(prompt), mw / 5);
cursor = strlen(text);