summary refs log tree commit diff
path: root/keyboard.c
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2022-01-20 15:06:08 -0500
committerZach DeCook <zachdecook@librem.one>2022-01-20 15:06:08 -0500
commit8a674df8a5babcb4f7fddd723b0a141c5a2e02e7 (patch)
treeec1743e36e5d5a1d62de3f9945966b3f58813b6e /keyboard.c
parent06b2a395645406fc8b07678205fe1888ac0c4488 (diff)
downloadsuggpicker-8a674df8a5babcb4f7fddd723b0a141c5a2e02e7.tar.gz
print_intersect: remove
Diffstat (limited to 'keyboard.c')
-rw-r--r--keyboard.c89
1 files changed, 11 insertions, 78 deletions
diff --git a/keyboard.c b/keyboard.c
index 1e2e0a5..6cfd717 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -145,61 +145,26 @@ kbd_unpress_key(struct kbd *kb, uint32_t time) {
 void
 kbd_release_key(struct kbd *kb, uint32_t time) {
 	kbd_unpress_key(kb, time);
-	if (kb->print_intersect && kb->last_swipe) {
-		printf("\n");
-		// Important so autocompleted words get typed in time
-		fflush(stdout);
-		kbd_draw_layout(kb);
-		kb->last_swipe = NULL;
-	}
+	printf("\n");
+	// Important so autocompleted words get typed in time
+	fflush(stdout);
+	kbd_draw_layout(kb);
 }
 
 void
 kbd_motion_key(struct kbd *kb, uint32_t time, uint32_t x, uint32_t y) {
-	// Output intersecting keys
-	// (for external 'swiping'-based accelerators).
-	if (kb->print_intersect) {
-		if (kb->last_press) {
-			kbd_unpress_key(kb, time);
-			// Redraw last press as a swipe.
-			kbd_draw_key(kb, kb->last_swipe, Swipe);
-		}
-		struct key *intersect_key;
-		intersect_key = kbd_get_key(kb, x, y);
-		if (intersect_key &&
-		    (!kb->last_swipe || intersect_key->label != kb->last_swipe->label)) {
-			kbd_print_key_stdout(kb, intersect_key);
-			kb->last_swipe = intersect_key;
-			kbd_draw_key(kb, kb->last_swipe, Swipe);
-		}
-	} else {
-		kbd_unpress_key(kb, time);
-	}
+
 }
 
 void
 kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) {
-	if ((kb->compose == 1) && (k->type != Compose) && (k->type != Mod) &&
-	    (k->layout)) {
-		kb->compose++;
-		if (kb->debug)
-			fprintf(stderr, "showing compose %d\n", kb->compose);
-		kbd_switch_layout(kb, k->layout);
-		return;
-	}
+
 
 	switch (k->type) {
 	case Code:
-
-		kb->last_swipe = kb->last_press = k;
+		kb->last_press = k;
 		kbd_draw_key(kb, k, Press);
-		if (kb->print || kb->print_intersect)
-			kbd_print_key_stdout(kb, k);
-		if (kb->compose) {
-			if (kb->debug)
-				fprintf(stderr, "pressing composed key\n");
-			kb->compose++;
-		}
+		kbd_print_key_stdout(kb, k);
 		break;
 	default:
 		break;
@@ -208,47 +173,15 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) {
 
 void
 kbd_print_key_stdout(struct kbd *kb, struct key *k) {
-	/* printed keys may slightly differ from the actual output
-	 * we generally print what is on the key LABEL and only support the normal
-	 * and shift layers. Other modifiers produce no output (Ctrl,Alt)
-	 * */
-
-	bool handled = true;
-	if (k->type == Code) {
-		switch (k->code) {
-		case KEY_SPACE:
-			printf(" ");
-			break;
-		case KEY_ENTER:
-			printf("\n");
-			break;
-		case KEY_BACKSPACE:
-			printf("\b");
-			break;
-		case KEY_TAB:
-			printf("\t");
-			break;
-		default:
-			handled = false;
-			break;
-		}
-	} else if (k->type != Copy) {
-		return;
-	}
-
-	if (!handled) {
-		if ((kb->mods & Shift) || (kb->mods & CapsLock))
-			printf("%s", k->shift_label);
-		else if (!(kb->mods & Ctrl) && !(kb->mods & Alt) && !(kb->mods & Super))
-			printf("%s", k->label);
-	}
+	/* we generally print what is on the key LABEL and only support the normal */
+	printf("%s", k->label);
 	fflush(stdout);
 }
 
 void
 kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type) {
 	struct drwsurf *d = kb->surf;
-	const char *label = (kb->mods & Shift) ? k->shift_label : k->label;
+	const char *label = k->label;
 	if (kb->debug)
 		fprintf(stderr, "Draw key +%d+%d %dx%d -> %s\n", k->x, k->y, k->w, k->h,
 		        label);