diff --git a/kernel/devices/mouse.c b/kernel/devices/mouse.c index eef80c85..d480c00c 100644 --- a/kernel/devices/mouse.c +++ b/kernel/devices/mouse.c @@ -9,6 +9,9 @@ uint8_t mouse_cycle = 0; int8_t mouse_byte[3]; +#define PACKETS_IN_PIPE 64 +#define DISCARD_POINT 32 + fs_node_t * mouse_pipe; void mouse_handler(struct regs *r) { @@ -35,6 +38,12 @@ void mouse_handler(struct regs *r) { packet.buttons |= RIGHT_CLICK; } mouse_cycle = 0; + + mouse_device_packet_t bitbucket; + while (pipe_size(mouse_pipe) > (DISCARD_POINT * sizeof(packet))) { + kprintf("[debug] Discarding a packet...\n"); + read_fs(mouse_pipe, 0, sizeof(packet), (uint8_t *)&bitbucket); + } write_fs(mouse_pipe, 0, sizeof(packet), (uint8_t *)&packet); break; } @@ -76,7 +85,7 @@ void mouse_install() { LOG(INFO, "Initializing mouse cursor driver"); uint8_t status; IRQ_OFF; - mouse_pipe = make_pipe(sizeof(mouse_device_packet_t) * 40); + mouse_pipe = make_pipe(sizeof(mouse_device_packet_t) * PACKETS_IN_PIPE); mouse_wait(1); outportb(0x64,0xA8); mouse_wait(1); diff --git a/userspace/terminal.c b/userspace/terminal.c index b1c76cc6..7805c771 100644 --- a/userspace/terminal.c +++ b/userspace/terminal.c @@ -2639,13 +2639,7 @@ static void cell_redraw_inverted(uint16_t x, uint16_t y) { void draw_cursor() { if (!cursor_on) return; timer_tick = 0; -#if 0 - for (uint32_t x = 0; x < char_width; ++x) { - term_set_point(csr_x * char_width + x, csr_y * char_height + (char_height - 1), term_colors[current_fg]); - } -#else cell_redraw_inverted(csr_x, csr_y); -#endif } void term_redraw_all() {