about summary refs log tree commit diff
path: root/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard.c')
-rw-r--r--keyboard.c99
1 files changed, 1 insertions, 98 deletions
diff --git a/keyboard.c b/keyboard.c
index 3c77a4b..5a6471d 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -1,4 +1,3 @@
-#include "proto/virtual-keyboard-unstable-v1-client-protocol.h"
 #include <linux/input-event-codes.h>
 #include <stdio.h>
 #include <sys/mman.h>
@@ -169,20 +168,6 @@ kbd_unpress_key(struct kbd *kb, uint32_t time) {
 	bool unlatch_shift = false;
 
 	if (kb->last_press) {
-		unlatch_shift = (kb->mods & Shift) == Shift;
-
-		if (unlatch_shift) {
-			kb->mods ^= Shift;
-			zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0);
-		}
-
-		if (kb->last_press->type == Copy) {
-			zwp_virtual_keyboard_v1_key(kb->vkbd, time, 127, // COMP key
-			                            WL_KEYBOARD_KEY_STATE_RELEASED);
-		} else {
-			zwp_virtual_keyboard_v1_key(kb->vkbd, time, kb->last_press->code,
-			                            WL_KEYBOARD_KEY_STATE_RELEASED);
-		}
 
 		if (kb->compose >= 2) {
 			kb->compose = 0;
@@ -245,20 +230,9 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) {
 
 	switch (k->type) {
 	case Code:
-		if (k->code_mod) {
-			if (k->reset_mod) {
-				zwp_virtual_keyboard_v1_modifiers(kb->vkbd, k->code_mod, 0, 0, 0);
-			} else {
-				zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods ^ k->code_mod, 0,
-				                                  0, 0);
-			}
-		} else {
-			zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0);
-		}
+
 		kb->last_swipe = kb->last_press = k;
 		kbd_draw_key(kb, k, Press);
-		zwp_virtual_keyboard_v1_key(kb->vkbd, time, kb->last_press->code,
-		                            WL_KEYBOARD_KEY_STATE_PRESSED);
 		if (kb->print || kb->print_intersect)
 			kbd_print_key_stdout(kb, k);
 		if (kb->compose) {
@@ -267,72 +241,6 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) {
 			kb->compose++;
 		}
 		break;
-	case Mod:
-		kb->mods ^= k->code;
-		if (k->code == Shift) {
-			kbd_draw_layout(kb);
-		}
-		if (kb->mods & k->code) {
-			kbd_draw_key(kb, k, Press);
-		} else {
-			kbd_draw_key(kb, k, Unpress);
-		}
-		zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0);
-		break;
-	case Layout:
-		// switch to the layout determined by the key
-		kbd_switch_layout(kb, k->layout);
-		break;
-	case Compose:
-		// switch to the associated layout determined by the *next* keypress
-		if (kb->compose == 0) {
-			kb->compose = 1;
-		} else {
-			kb->compose = 0;
-		}
-		if ((bool)kb->compose) {
-			kbd_draw_key(kb, k, Press);
-		} else {
-			kbd_draw_key(kb, k, Unpress);
-		}
-		break;
-	case NextLayer:
-		// switch to the next layout in the layer sequence
-		kb->layer_index++;
-		enum layout_id layer;
-		if (kb->landscape) {
-			layer = kb->landscape_layers[kb->layer_index];
-		} else {
-			layer = kb->layers[kb->layer_index];
-		}
-		if (layer == NumLayouts) {
-			kb->layer_index = 0;
-			if (kb->landscape) {
-				layer = kb->landscape_layers[kb->layer_index];
-			} else {
-				layer = kb->layers[kb->layer_index];
-			}
-		}
-		kbd_switch_layout(kb, &kb->layouts[layer]);
-		break;
-	case BackLayer:
-		// switch to the previously active layout
-		if (kb->prevlayout)
-			kbd_switch_layout(kb, kb->prevlayout);
-		break;
-	case Copy:
-		// copy code as unicode chr by setting a temporary keymap
-		kb->last_swipe = kb->last_press = k;
-		kbd_draw_key(kb, k, Press);
-		if (kb->debug)
-			fprintf(stderr, "pressing copy key\n");
-		create_and_upload_keymap(kb, kb->layout->keymap_name, k->code, k->code_mod);
-		zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0);
-		zwp_virtual_keyboard_v1_key(kb->vkbd, time, 127, // COMP key
-		                            WL_KEYBOARD_KEY_STATE_PRESSED);
-		if (kb->print || kb->print_intersect)
-			kbd_print_key_stdout(kb, k);
-		break;
 	default:
 		break;
 	}
@@ -475,11 +383,6 @@ create_and_upload_keymap(struct kbd *kb, const char *name, uint32_t comp_unichr,
 	if (ptr == (void *)-1) {
 		die("could not map keymap data\n");
 	}
-	if (kb->vkbd == NULL) {
-		die("kb.vkbd = NULL\n");
-	}
 	strcpy(ptr, keymap_str);
-	zwp_virtual_keyboard_v1_keymap(kb->vkbd, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
-	                               keymap_fd, keymap_size);
 	free((void *)keymap_str);
 }