renamed some functions to make it more readable
This commit is contained in:
parent
bb393554fd
commit
d32fd15ea4
18
main.c
18
main.c
|
@ -109,7 +109,7 @@ drawmenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
input(char *pattern)
|
match(char *pattern)
|
||||||
{
|
{
|
||||||
unsigned int plen;
|
unsigned int plen;
|
||||||
Item *i, *j;
|
Item *i, *j;
|
||||||
|
@ -178,7 +178,7 @@ kpress(XKeyEvent * e)
|
||||||
case XK_U:
|
case XK_U:
|
||||||
case XK_u:
|
case XK_u:
|
||||||
text[0] = 0;
|
text[0] = 0;
|
||||||
input(text);
|
match(text);
|
||||||
drawmenu();
|
drawmenu();
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
@ -201,7 +201,7 @@ kpress(XKeyEvent * e)
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
strncpy(text, sel->text, sizeof(text));
|
strncpy(text, sel->text, sizeof(text));
|
||||||
input(text);
|
match(text);
|
||||||
break;
|
break;
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
if(!(sel && sel->right))
|
if(!(sel && sel->right))
|
||||||
|
@ -233,9 +233,9 @@ kpress(XKeyEvent * e)
|
||||||
prev_nitem = nitem;
|
prev_nitem = nitem;
|
||||||
do {
|
do {
|
||||||
text[--i] = 0;
|
text[--i] = 0;
|
||||||
input(text);
|
match(text);
|
||||||
} while(i && nitem && prev_nitem == nitem);
|
} while(i && nitem && prev_nitem == nitem);
|
||||||
input(text);
|
match(text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -245,14 +245,14 @@ kpress(XKeyEvent * e)
|
||||||
strncat(text, buf, sizeof(text));
|
strncat(text, buf, sizeof(text));
|
||||||
else
|
else
|
||||||
strncpy(text, buf, sizeof(text));
|
strncpy(text, buf, sizeof(text));
|
||||||
input(text);
|
match(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawmenu();
|
drawmenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
readinput()
|
readstdin()
|
||||||
{
|
{
|
||||||
static char *maxname = NULL;
|
static char *maxname = NULL;
|
||||||
char *p, buf[1024];
|
char *p, buf[1024];
|
||||||
|
@ -309,7 +309,7 @@ main(int argc, char *argv[])
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
root = RootWindow(dpy, screen);
|
root = RootWindow(dpy, screen);
|
||||||
|
|
||||||
maxname = readinput();
|
maxname = readstdin();
|
||||||
|
|
||||||
/* grab as early as possible, but after reading all items!!! */
|
/* grab as early as possible, but after reading all items!!! */
|
||||||
while(XGrabKeyboard(dpy, root, True, GrabModeAsync,
|
while(XGrabKeyboard(dpy, root, True, GrabModeAsync,
|
||||||
|
@ -346,7 +346,7 @@ main(int argc, char *argv[])
|
||||||
cmdw = mw / 3;
|
cmdw = mw / 3;
|
||||||
|
|
||||||
text[0] = 0;
|
text[0] = 0;
|
||||||
input(text);
|
match(text);
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
drawmenu();
|
drawmenu();
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
Loading…
Reference in New Issue