about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--keyboard.c89
-rw-r--r--keyboard.h2
-rw-r--r--main.c8
3 files changed, 12 insertions, 87 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);
diff --git a/keyboard.h b/keyboard.h
index ec36418..2e05e72 100644
--- a/keyboard.h
+++ b/keyboard.h
@@ -91,8 +91,6 @@ struct kbd {
 	struct clr_scheme scheme;
 	struct clr_scheme scheme1;
 
-	bool print;
-	bool print_intersect;
 	uint32_t w, h, s;
 	bool landscape;
 	uint8_t mods;
diff --git a/main.c b/main.c
index 61ee075..13f8a38 100644
--- a/main.c
+++ b/main.c
@@ -337,12 +337,10 @@ layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface) {
 void
 usage(char *argv0) {
 	fprintf(stderr,
-	        "usage: %s [-hov] [-H height] [-L landscape height] [-fn font]\n",
+	        "usage: %s [-hv] [-H height] [-L landscape height] [-fn font]\n",
 	        argv0);
 	fprintf(stderr, "Options:\n");
 	fprintf(stderr, "  -D         - Enable debug\n");
-	fprintf(stderr, "  -o         - Print pressed keys to standard output\n");
-	fprintf(stderr, "  -O         - Print intersected keys to standard output\n");
 	fprintf(stderr, "  -H [int]   - Height in pixels\n");
 	fprintf(stderr, "  -L [int]   - Landscape height in pixels\n");
 	fprintf(stderr, "  --fn [font] - Set font (e.g: DejaVu Sans 20)\n");
@@ -443,10 +441,6 @@ main(int argc, char **argv) {
 			keyboard.debug = true;
 		} else if ((!strcmp(argv[i], "-fn")) || (!strcmp(argv[i], "--fn"))) {
 			fc_font_pattern = estrdup(argv[++i]);
-		} else if (!strcmp(argv[i], "-o")) {
-			keyboard.print = true;
-		} else if (!strcmp(argv[i], "-O")) {
-			keyboard.print_intersect = true;
 		} else if ((!strcmp(argv[i], "-hidden")) ||
 		           (!strcmp(argv[i], "--hidden"))) {
 			starthidden = true;