summary refs log tree commit diff
path: root/keyboard.c
diff options
context:
space:
mode:
authorArenM <aren@peacevolution.org>2022-07-05 12:54:33 -0400
committerZach DeCook <zachdecook@librem.one>2022-07-11 00:59:10 -0400
commit6566a7f57d695d888650d43225844f9641414919 (patch)
treebd41dae2b3add5810e7b2dbf146667a5e402f0d9 /keyboard.c
parent1c4df6ae2b9c94feb6b65e616520275b645bfa5c (diff)
downloadsuggpicker-6566a7f57d695d888650d43225844f9641414919.tar.gz
only commit surface when it changed
This is based off of a commit in wvkbd

Previously wvkbd (and suggpicker) would commit a (usually unchanged) surface at the framerate of the compositor,
this only commits the buffer when we render something new.
Diffstat (limited to 'keyboard.c')
-rw-r--r--keyboard.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/keyboard.c b/keyboard.c
index 2b1506a..293a2f6 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -73,6 +73,7 @@ kbd_unpress_key(struct kbd *kb) {
 	if (kb->last_press) {
 		kbd_draw_key(kb, kb->last_press, Unpress);
 		kb->last_press = NULL;
+		drwsurf_flip(kb->surf);
 	}
 }
 
@@ -83,7 +84,6 @@ kbd_release_key(struct kbd *kb) {
 		// Important so autocompleted words get typed in time
 		fflush(stdout);
 		kbd_unpress_key(kb);
-		kbd_draw_layout(kb);
 	}
 }
 
@@ -104,6 +104,7 @@ kbd_press_key(struct kbd *kb, struct key *k) {
 	if (k->label) {
 		kb->last_press = k;
 		kbd_draw_key(kb, k, Press);
+		drwsurf_flip(kb->surf);
 	}
 }