Add option to set custom 'no input' text

This commit is contained in:
qikiqi 2018-02-17 15:31:04 +02:00
parent 7d21942206
commit 7787456845
3 changed files with 11 additions and 1 deletions

View File

@ -304,6 +304,10 @@ Sets the string to be shown while verifying the password/input/key/etc. Defaults
.B \-\-wrongtext="text"
Sets the string to be shown upon entering an incorrect password. Defaults to "wrong!".
.TP
.B \-\-noinputtext="text"
Sets the string to be shown upon pressing backspace without anything to delete. Defaults to "no input".
.TP
.B \-\-radius
The radius of the circle. Defaults to 90.

View File

@ -154,6 +154,7 @@ double ring_width = 7.0;
char* verif_text = "verifying…";
char* wrong_text = "wrong!";
char* noinput_text = "no input";
int keylayout_mode = -1;
char* layout_text = NULL;
@ -1130,6 +1131,7 @@ int main(int argc, char *argv[]) {
{"veriftext", required_argument, NULL, 0},
{"wrongtext", required_argument, NULL, 0},
{"noinputtext", required_argument, NULL, 0},
{"modsize", required_argument, NULL, 0},
{"radius", required_argument, NULL, 0},
{"ring-width", required_argument, NULL, 0},
@ -1546,6 +1548,9 @@ int main(int argc, char *argv[]) {
else if (strcmp(longopts[longoptind].name, "wrongtext") == 0) {
wrong_text = optarg;
}
else if (strcmp(longopts[longoptind].name, "noinputtext") == 0) {
noinput_text = optarg;
}
else if (strcmp(longopts[longoptind].name, "verifsize") == 0) {
char *arg = optarg;

View File

@ -119,6 +119,7 @@ extern double layout_size;
extern char *verif_text;
extern char *wrong_text;
extern char *noinput_text;
extern char *layout_text;
/* Whether the failed attempts should be displayed. */
@ -749,7 +750,7 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
default:
if (unlock_state == STATE_NOTHING_TO_DELETE) {
draw_data.status_text.show = true;
strncpy(draw_data.status_text.str, "no input", sizeof(draw_data.status_text.str));
strncpy(draw_data.status_text.str, noinput_text, sizeof(draw_data.status_text.str));
draw_data.status_text.font = get_font_face(WRONG_FONT);
draw_data.status_text.color = wrong16;
draw_data.status_text.size = wrong_size;