From 0702be25655bcb6828fe297eb423157ab18d115f Mon Sep 17 00:00:00 2001 From: xiaoyi1212 Date: Wed, 10 Apr 2024 22:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=AE=E7=9B=98=E5=8A=A0=E5=85=A5=20Ctrl=20?= =?UTF-8?q?=E6=8C=89=E9=94=AE=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- driver/keyboard.c | 11 +++++++++++ include/keyboard.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/driver/keyboard.c b/driver/keyboard.c index d438216..42e7dca 100644 --- a/driver/keyboard.c +++ b/driver/keyboard.c @@ -102,12 +102,18 @@ int handle_keyboard_input(){ int release = key & 0xb10000000; char c = key_status->is_shift ? shift_keyboard_map[(unsigned char )key] : keyboard_map[(unsigned char )key]; + if(!release) { if(c == -1) { key_status->is_shift = 1; return 0; } + if(key == 29){ + key_status->is_ctrl = 1; + return 0; + } + if(c == 0) return 0; queue_push(key_char_queue,(char)c); @@ -115,6 +121,11 @@ int handle_keyboard_input(){ if(c == -1){ key_status->is_shift = 0; } + + if(key == 29){ + key_status->is_ctrl = 0; + return 0; + } } return 0; diff --git a/include/keyboard.h b/include/keyboard.h index 5c65b4c..8cc70b1 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -6,6 +6,8 @@ typedef struct { int is_shift; + int is_ctrl; + int is_esc; }KEY_STATUS; typedef struct {