aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kernel/graphics/vesa.c23
-rw-r--r--src/kernel/input/ps2/mouse.c55
2 files changed, 64 insertions, 14 deletions
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c
index 1b793a9..4d6dc84 100644
--- a/src/kernel/graphics/vesa.c
+++ b/src/kernel/graphics/vesa.c
@@ -209,6 +209,7 @@ void set_optimal_resolution()
serial_write("Using mode: ");
serial_write_hex(highest);
+ serial_write("\n");
debug("Using mode: %dx%dx%d", vbe_width, vbe_height, vbe_bpl << 3);
}
@@ -350,20 +351,24 @@ void vesa_keyboard_char(char ch)
}
int prev_coords[2] = {};
+int first = 1; // TODO: Better initial cursor buffer solution
void vesa_draw_cursor(int x, int y)
{
// Reset previous area
char *reset = (char *) &fb[prev_coords[0] * vbe_bpl + prev_coords[1] * vbe_pitch];
char *prev = (char *) &cursor_buffer[prev_coords[0] * vbe_bpl + prev_coords[1] * vbe_pitch];
- for (int cy = 0; cy <= 19; cy++) {
- for (int cx = 0; cx <= 12; cx++) {
- reset[vbe_bpl * cx] = prev[vbe_bpl * cx];
- reset[vbe_bpl * cx + 1] = prev[vbe_bpl * cx + 1];
- reset[vbe_bpl * cx + 2] = prev[vbe_bpl * cx + 2];
+ if (!first) {
+ for (int cy = 0; cy <= 19; cy++) {
+ for (int cx = 0; cx <= 12; cx++) {
+ reset[vbe_bpl * cx] = prev[vbe_bpl * cx];
+ reset[vbe_bpl * cx + 1] = prev[vbe_bpl * cx + 1];
+ reset[vbe_bpl * cx + 2] = prev[vbe_bpl * cx + 2];
+ }
+ reset += vbe_pitch;
+ prev += vbe_pitch;
}
- reset += vbe_pitch;
- prev += vbe_pitch;
}
+ first = 0;
// Draw cursor
prev_coords[0] = x;
@@ -380,10 +385,6 @@ void vesa_draw_cursor(int x, int y)
draw[vbe_bpl * cx] = terminal_color[2];
draw[vbe_bpl * cx + 1] = terminal_color[1];
draw[vbe_bpl * cx + 2] = terminal_color[0];
- } else {
- draw[vbe_bpl * cx] = terminal_background[2];
- draw[vbe_bpl * cx + 1] = terminal_background[1];
- draw[vbe_bpl * cx + 2] = terminal_background[0];
}
}
draw += vbe_pitch;
diff --git a/src/kernel/input/ps2/mouse.c b/src/kernel/input/ps2/mouse.c
index 97ae256..cb7406f 100644
--- a/src/kernel/input/ps2/mouse.c
+++ b/src/kernel/input/ps2/mouse.c
@@ -84,15 +84,64 @@ void mouse_install()
mouse_wait(1);
outb(0x64, 0x20);
mouse_wait(0);
- status = (inb(0x60) | 2);
+ status = (inb(0x60) | 3);
mouse_wait(1);
outb(0x64, 0x60);
mouse_wait(1);
outb(0x60, status);
- // Use default settings
- mouse_write(0xF6);
+ // Enable mousewheel
+ mouse_write(0xF2);
mouse_read();
+ mouse_read();
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(200);
+ mouse_read();
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(100);
+ mouse_read();
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(80);
+ mouse_read();
+ mouse_write(0xF2);
+ mouse_read();
+ status = mouse_read();
+ if (status == 3) serial_write("Scrollwheel support!\n");
+
+ // Activate 4th and 5th mouse buttons
+ mouse_write(0xF2);
+ mouse_read();
+ mouse_read();
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(200);
+ mouse_read();
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(200);
+ mouse_read();
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(80);
+ mouse_read();
+ mouse_write(0xF2);
+ mouse_read();
+ status = mouse_read();
+ if (status == 4) serial_write("4th and 5th mouse button support!\n");
+
+ /* TODO: Fix mouse laggyness
+ mouse_write(0xE8);
+ mouse_read();
+ mouse_write(0x03);
+ mouse_read();
+
+ mouse_write(0xF3);
+ mouse_read();
+ mouse_write(200);
+ mouse_read(); */
// Enable mouse
mouse_write(0xF4);