From df7b513ca1bdac41dc9874b3f18dc6daab111a5b Mon Sep 17 00:00:00 2001 From: puffer Date: Mon, 26 Feb 2024 14:49:55 +0100 Subject: [PATCH] Update mouse.c --- src/system/drivers/mouse.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/system/drivers/mouse.c b/src/system/drivers/mouse.c index b897d63..489eeab 100644 --- a/src/system/drivers/mouse.c +++ b/src/system/drivers/mouse.c @@ -46,22 +46,19 @@ uint8_t mouse_read() { return inb8(0x60); } -void set_mouse_style(char* s) { - switch(s) { - case "normal": - vfs_op_status status = driver_read(vfs, 0x00000000, "/etc/graphics/cursor_normal.tga", &mouse_img); - if (status == STATUS_OK) { - mouse_img_size = - vfs_get_file_size(vfs, 0x00000000, "/etc/graphics/cursor_normal.tga"); - } else { - return; - } - - current_mouse_style = "normal"; - break; - deafult; - dprintf("[\e[0;31mMouse Handler\e[0m] Invalid cursor style (%s)!\n", s); +void set_mouse_style(const char* s) { + if (strcmp(s, "normal") == 0) { + vfs_op_status status = driver_read(vfs, 0x00000000, "/etc/graphics/cursor_normal.tga", &mouse_img); + if (status == STATUS_OK) { + mouse_img_size = vfs_get_file_size(vfs, 0x00000000, "/etc/graphics/cursor_normal.tga"); current_mouse_style = "normal"; + } else { + return; + } + } else { + printf("[\e[0;31mMouse Handler\e[0m] Invalid cursor style (%s)! Setting the cursor to default!\n", s); + current_mouse_style = "normal"; + set_mouse_style(current_mouse_style); } }