mirror of https://github.com/fairyglade/ly.git
Use tb_poll_event instead of tb_peek_event (#320)
draw_box and position_input are called because they need to be called before *input_handles[active_input] for the cursor to be positioned correctly.
This commit is contained in:
parent
1e75402c53
commit
efac8466ef
14
src/main.c
14
src/main.c
|
@ -137,11 +137,17 @@ int main(int argc, char** argv)
|
||||||
struct term_buf buf;
|
struct term_buf buf;
|
||||||
uint8_t active_input = config.default_input;
|
uint8_t active_input = config.default_input;
|
||||||
|
|
||||||
(*input_handles[active_input])(input_structs[active_input], NULL);
|
|
||||||
|
|
||||||
// init drawing stuff
|
// init drawing stuff
|
||||||
draw_init(&buf);
|
draw_init(&buf);
|
||||||
|
|
||||||
|
// draw_box and position_input are called because they need to be
|
||||||
|
// called before *input_handles[active_input] for the cursor to be
|
||||||
|
// positioned correctly
|
||||||
|
draw_box(&buf);
|
||||||
|
position_input(&buf, &desktop, &login, &password);
|
||||||
|
(*input_handles[active_input])(input_structs[active_input], NULL);
|
||||||
|
|
||||||
if (config.animate)
|
if (config.animate)
|
||||||
{
|
{
|
||||||
animate_init(&buf);
|
animate_init(&buf);
|
||||||
|
@ -170,6 +176,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (auth_fails < 10)
|
if (auth_fails < 10)
|
||||||
{
|
{
|
||||||
|
(*input_handles[active_input])(input_structs[active_input], NULL);
|
||||||
tb_clear();
|
tb_clear();
|
||||||
animate(&buf);
|
animate(&buf);
|
||||||
draw_box(&buf);
|
draw_box(&buf);
|
||||||
|
@ -192,7 +199,11 @@ int main(int argc, char** argv)
|
||||||
tb_present();
|
tb_present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.animate) {
|
||||||
error = tb_peek_event(&event, config.min_refresh_delta);
|
error = tb_peek_event(&event, config.min_refresh_delta);
|
||||||
|
} else {
|
||||||
|
error = tb_poll_event(&event);
|
||||||
|
}
|
||||||
|
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
{
|
{
|
||||||
|
@ -218,6 +229,7 @@ int main(int argc, char** argv)
|
||||||
if (active_input > 0)
|
if (active_input > 0)
|
||||||
{
|
{
|
||||||
input_text_clear(input_structs[active_input]);
|
input_text_clear(input_structs[active_input]);
|
||||||
|
update = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TB_KEY_ARROW_UP:
|
case TB_KEY_ARROW_UP:
|
||||||
|
|
Loading…
Reference in New Issue