Redraw only when input changed.

This commit is contained in:
Jari Vetoniemi 2014-11-02 07:58:45 +02:00
parent e8fc51d80c
commit a90bf2f512
3 changed files with 9 additions and 4 deletions

View File

@ -369,6 +369,7 @@ bm_wl_registry_register(struct wayland *wayland)
return false;
set_repeat_info(&wayland->input, 40, 400);
wayland->input.last_code = 0xDEADBEEF;
return true;
}

View File

@ -38,10 +38,13 @@ render(const struct bm_menu *menu)
}
}
uint32_t count;
bm_menu_get_filtered_items(menu, &count);
uint32_t lines = (count < menu->lines ? count : menu->lines) + 1;
bm_wl_window_render(&wayland->window, menu, lines);
if (wayland->input.code != wayland->input.last_code) {
uint32_t count;
bm_menu_get_filtered_items(menu, &count);
uint32_t lines = (count < menu->lines ? count : menu->lines) + 1;
bm_wl_window_render(&wayland->window, menu, lines);
wayland->input.last_code = wayland->input.code;
}
}
static enum bm_key

View File

@ -51,6 +51,7 @@ struct input {
xkb_keysym_t sym;
uint32_t code;
uint32_t last_code;
uint32_t modifiers;
xkb_keysym_t repeat_sym;