[kbd] Fix bad modifier handling

This commit is contained in:
Kevin Lange 2011-10-31 01:48:03 -05:00
parent 4cdef2bd06
commit b433abe28e
2 changed files with 6 additions and 14 deletions

View File

@ -138,21 +138,21 @@ void norm(int scancode) {
* Toggle Shift
*/
void shft(int scancode) {
keyboard_state.shift ^= 1;
keyboard_state.shift = !((scancode & KEY_UP_MASK) == KEY_UP_MASK);
}
/*
* Toggle Alt
*/
void altk(int scancode) {
keyboard_state.alt ^= 1;
keyboard_state.alt = !((scancode & KEY_UP_MASK) == KEY_UP_MASK);
}
/*
* Toggle Control
*/
void ctlk(int scancode) {
keyboard_state.ctrl ^= 1;
keyboard_state.ctrl = !((scancode & KEY_UP_MASK) == KEY_UP_MASK);
}
/*
@ -227,6 +227,8 @@ keyboard_handler_t key_method[] = {
};
extern uint8_t mouse_cycle;
void
keyboard_handler(
struct regs *r
@ -239,6 +241,7 @@ keyboard_handler(
return;
}
keyboard_handler_t handler;
handler = key_method[(int)scancode & KEY_CODE_MASK];
if (handler) {
handler(scancode);

View File

@ -126,7 +126,6 @@ void init_cursor(char * filename, char * alpha) {
}
void mouse_handler(struct regs *r) {
IRQ_OFF;
switch (mouse_cycle) {
case 0:
mouse_byte[0] = inportb(0x60);
@ -167,47 +166,37 @@ void mouse_handler(struct regs *r) {
draw_sprite(cursor, actual_x / 10 - 24, 767 - actual_y / 10 - 24);
break;
}
IRQ_ON;
}
void mouse_wait(uint8_t a_type) {
IRQ_OFF;
uint32_t timeout = 100000;
if (!a_type) {
while (--timeout) {
if ((inportb(0x64) & 0x01) == 1) {
IRQ_ON;
return;
}
}
IRQ_ON;
return;
} else {
while (--timeout) {
if (!((inportb(0x64) & 0x02))) {
IRQ_ON;
return;
}
}
IRQ_ON;
return;
}
}
void mouse_write(uint8_t write) {
IRQ_OFF;
mouse_wait(1);
outportb(0x64, 0xD4);
mouse_wait(1);
outportb(0x60, write);
IRQ_ON;
}
uint8_t mouse_read() {
IRQ_OFF;
mouse_wait(0);
char t = inportb(0x60);
IRQ_ON;
return t;
}