diff options
author | zavok <an2qzavok@gmail.com> | 2015-12-02 23:20:29 +0300 |
---|---|---|
committer | zavok <an2qzavok@gmail.com> | 2015-12-02 23:20:29 +0300 |
commit | 682a9649bd0371d7c1554ecbd38954dc0b9299af (patch) | |
tree | a3c7110df8a34d6aa3138772d43f3c7fad6eff32 /spine.c | |
parent | 2df401ad8c93e0fafb81c1832fc99a4be8b4ac4f (diff) |
bugfix, you can bring window up more than once now
Diffstat (limited to 'spine.c')
-rw-r--r-- | spine.c | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -189,7 +189,7 @@ cleanup(void) { } -int +static int keypress(XKeyEvent *ev) { char buf[32]; int len; @@ -301,19 +301,6 @@ run(void) { void promptwin(void) { - if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) - fputs("warning: no locale support\n", stderr); - if(!(dpy = XOpenDisplay(pinentry->display))) /*NULL was here*/ - die("dmenu: cannot open display\n"); - screen = DefaultScreen(dpy); - root = RootWindow(dpy, screen); - sw = DisplayWidth(dpy, screen); - sh = DisplayHeight(dpy, screen); - drw = drw_create(dpy, screen, root, sw, sh); - drw_load_fonts(drw, fonts, LENGTH(fonts)); - if(!drw->fontcount) - die("No fonts could be loaded.\n"); - drw_setscheme(drw, &scheme[SchemeNorm]); grabkeyboard(); setup(); run(); @@ -346,12 +333,26 @@ confirm(void) { return confirmed; } -int +static int spinecmdhandler (pinentry_t recieved_pinentry) { pinentry = recieved_pinentry; + + if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fputs("warning: no locale support\n", stderr); + if(!(dpy = XOpenDisplay(pinentry->display))) /*NULL was here*/ + die("dmenu: cannot open display\n"); + screen = DefaultScreen(dpy); + root = RootWindow(dpy, screen); + sw = DisplayWidth(dpy, screen); + sh = DisplayHeight(dpy, screen); + drw = drw_create(dpy, screen, root, sw, sh); + drw_load_fonts(drw, fonts, LENGTH(fonts)); + if(!drw->fontcount) + die("No fonts could be loaded.\n"); + drw_setscheme(drw, &scheme[SchemeNorm]); + if (pinentry->timeout){ struct sigaction sa; - memset(&sa, 0, sizeof(sa)); sa.sa_handler = catchsig; sigaction(SIGALRM, &sa, NULL); @@ -361,7 +362,6 @@ spinecmdhandler (pinentry_t recieved_pinentry) { return password(); else return confirm(); - return -1; } @@ -369,6 +369,7 @@ pinentry_cmd_handler_t pinentry_cmd_handler = spinecmdhandler; int main(int argc, char *argv[]){ + pinentry_init("spine"); pinentry_parse_opts(argc, argv); if (pinentry_loop()) |