diff options
| -rw-r--r-- | args.c | 6 | ||||
| -rw-r--r-- | graphics.c | 6 | ||||
| -rw-r--r-- | input_field.c | 6 | ||||
| -rw-r--r-- | state.h | 1 |
4 files changed, 15 insertions, 4 deletions
@@ -11,12 +11,13 @@ void parse_args(client_state* state, int argc, char* argv[]) { {"center", no_argument, 0, 'c'}, {"exact-match", no_argument, 0, 'e'}, {"verbose", no_argument, 0, 'v'}, + {"password", no_argument, 0, 'P'}, {0, 0, 0, 0} }; int opt; int long_index = 0; - while ((opt = getopt_long(argc, argv, "l:cev", long_opts, &long_index)) != -1) { + while ((opt = getopt_long(argc, argv, "l:cevP", long_opts, &long_index)) != -1) { switch (opt) { case 'l': state->lines = atoi(optarg); @@ -30,6 +31,9 @@ void parse_args(client_state* state, int argc, char* argv[]) { case 'v': state->verbose = true; break; + case 'P': + state->password = true; + break; default: fprintf(stderr, "Usage: NOT WHAT YOU TYPED\n"); break; @@ -246,6 +246,12 @@ typedef struct { void init_text_buffer(client_state* state, text_buffer_t* buffer, char* text, size_t text_len) { buffer->pixel_len = 0; + char buf[text_len]; + if (state->password && text == state->input_buffer) { + memset(buf, '*', text_len); + text = buf; + } + // generate openg bullshit glGenVertexArrays(1, &buffer->vao); glBindVertexArray(buffer->vao); diff --git a/input_field.c b/input_field.c index 9eded28..4672212 100644 --- a/input_field.c +++ b/input_field.c @@ -52,7 +52,7 @@ void update_text_buffer(client_state* state) { init_text_buffer(state, &state->input_buffer_grafix, state->input_buffer, array_size(state->input_buffer)); } -bool type_key(client_state* state, xkb_keysym_t keysym) { +key_repeat_t type_key(client_state* state, xkb_keysym_t keysym) { bool ctrl = xkb_state_mod_name_is_active(state->xkb_state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE); bool alt = xkb_state_mod_name_is_active(state->xkb_state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE); @@ -109,9 +109,9 @@ bool type_key(client_state* state, xkb_keysym_t keysym) { state->cursor_index++; } update_text_buffer(state); - return true; + return KEY_REPEAT; } - return false; + return KEY_NO_REPEAT; } @@ -117,6 +117,7 @@ typedef struct { bool exact_match; bool center; bool verbose; + bool password; // input item_t* items; |
