aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kernel/graphics/font.h22
-rw-r--r--src/kernel/graphics/vesa.c21
-rw-r--r--src/kernel/input/ps2/mouse.c5
3 files changed, 43 insertions, 5 deletions
diff --git a/src/kernel/graphics/font.h b/src/kernel/graphics/font.h
index 7a110e1..bcf0b30 100644
--- a/src/kernel/graphics/font.h
+++ b/src/kernel/graphics/font.h
@@ -7,6 +7,28 @@
#include <stdint.h>
+uint16_t cursor[19] = {
+ 0b100000000000,
+ 0b110000000000,
+ 0b111000000000,
+ 0b111100000000,
+ 0b111110000000,
+ 0b111111000000,
+ 0b111111100000,
+ 0b111111110000,
+ 0b111111111000,
+ 0b111111111100,
+ 0b111111111110,
+ 0b111111111111,
+ 0b111111111111,
+ 0b111111110000,
+ 0b111101111000,
+ 0b111001111000,
+ 0b110000111100,
+ 0b000000111100,
+ 0b000000011000
+};
+
uint8_t font_16[758][16] = {
// 32 $20 'SPACE'
// width 8, bbx 0, bby -4, bbw 8, bbh 16
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c
index eb70583..f72f4ab 100644
--- a/src/kernel/graphics/vesa.c
+++ b/src/kernel/graphics/vesa.c
@@ -342,11 +342,22 @@ void vesa_draw_number(int n) {
}
void vesa_draw_cursor(int x, int y) {
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (x > vbe_width - 1) x = vbe_width - 1;
- if (y > vbe_height - 1) y = vbe_height - 1;
- vesa_draw_rectangle(x, y, x + font_width, y + font_height, terminal_color);
+ int pos = x * vbe_bpl + y * vbe_pitch;
+ char *draw = (char *) &fb[pos];
+ for (int cy = 0; cy <= 19; cy++) {
+ for (int cx = 0; cx <= 12 + 1; cx++) {
+ if (cursor[cy] & ((1 << 12) >> cx)) {
+ 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;
+ }
}
void vesa_set_color(uint32_t color) {
diff --git a/src/kernel/input/ps2/mouse.c b/src/kernel/input/ps2/mouse.c
index 0ee7b2b..015c1a5 100644
--- a/src/kernel/input/ps2/mouse.c
+++ b/src/kernel/input/ps2/mouse.c
@@ -29,6 +29,11 @@ void mouse_handler(struct regs *a_r) {
mouse_but_2 = (mouse_byte[0] >> 1) & 1;
mouse_but_3 = (mouse_byte[0] >> 2) & 1;
mouse_cycle = 0;
+
+ if (mouse_x < 0) mouse_x = 0;
+ if (mouse_y < 0) mouse_y = 0;
+ if (mouse_x > vbe_width - 1) mouse_x = vbe_width - 1;
+ if (mouse_y > vbe_height - 1) mouse_y = vbe_height - 1;
vesa_draw_cursor(mouse_x, mouse_y);
break;
default: