|
|
@ -357,19 +357,18 @@ cleanup(void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
static int
|
|
|
|
keypress(XKeyEvent *ev) {
|
|
|
|
keypress_confirm(XKeyEvent *ev, KeySym ksym) {
|
|
|
|
char buf[32];
|
|
|
|
if (ev->state & ControlMask) {
|
|
|
|
int len;
|
|
|
|
switch(ksym) {
|
|
|
|
|
|
|
|
case XK_c:
|
|
|
|
KeySym ksym = NoSymbol;
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
Status status;
|
|
|
|
sel = No;
|
|
|
|
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (status == XBufferOverflow) {
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (winmode == WinConfirm) {
|
|
|
|
|
|
|
|
switch(ksym) {
|
|
|
|
switch(ksym) {
|
|
|
|
case XK_KP_Enter:
|
|
|
|
case XK_KP_Enter:
|
|
|
|
case XK_Return:
|
|
|
|
case XK_Return:
|
|
|
@ -385,12 +384,6 @@ keypress(XKeyEvent *ev) {
|
|
|
|
case XK_N:
|
|
|
|
case XK_N:
|
|
|
|
sel = No;
|
|
|
|
sel = No;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
case XK_c:
|
|
|
|
|
|
|
|
if (ev->state == ControlMask) {
|
|
|
|
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
|
|
|
|
sel = No;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case XK_Escape:
|
|
|
|
case XK_Escape:
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
sel = No;
|
|
|
|
sel = No;
|
|
|
@ -402,7 +395,22 @@ keypress(XKeyEvent *ev) {
|
|
|
|
sel = Yes;
|
|
|
|
sel = Yes;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
|
|
|
keypress_pin(XKeyEvent *ev, KeySym ksym, char* buf, int len) {
|
|
|
|
|
|
|
|
if (ev->state & ControlMask) {
|
|
|
|
|
|
|
|
switch(ksym) {
|
|
|
|
|
|
|
|
case XK_c:
|
|
|
|
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(ksym) {
|
|
|
|
switch(ksym) {
|
|
|
|
case XK_Delete:
|
|
|
|
case XK_Delete:
|
|
|
|
if (pin[cursor] == '\0') {
|
|
|
|
if (pin[cursor] == '\0') {
|
|
|
@ -416,11 +424,6 @@ keypress(XKeyEvent *ev) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
insert(NULL, nextrune(cursor, -1) - cursor);
|
|
|
|
insert(NULL, nextrune(cursor, -1) - cursor);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case XK_c:
|
|
|
|
|
|
|
|
if (ev->state == ControlMask) {
|
|
|
|
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case XK_Escape:
|
|
|
|
case XK_Escape:
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
pinentry->canceled = 1;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
@ -446,11 +449,33 @@ keypress(XKeyEvent *ev) {
|
|
|
|
insert(buf, len);
|
|
|
|
insert(buf, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
|
|
|
keypress(XKeyEvent *ev) {
|
|
|
|
|
|
|
|
char buf[32];
|
|
|
|
|
|
|
|
int len;
|
|
|
|
|
|
|
|
int ret = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeySym ksym = NoSymbol;
|
|
|
|
|
|
|
|
Status status;
|
|
|
|
|
|
|
|
len = XmbLookupString(xic, ev, buf, sizeof(buf), &ksym, &status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (status != XBufferOverflow) {
|
|
|
|
|
|
|
|
if (winmode == WinConfirm) {
|
|
|
|
|
|
|
|
ret = keypress_confirm(ev, ksym);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ret = keypress_pin(ev, ksym, buf, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret == 0) {
|
|
|
|
drawwin();
|
|
|
|
drawwin();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|