diff options
Diffstat (limited to 'src/drivers/hdi/ps2/mouse.c')
-rw-r--r-- | src/drivers/hdi/ps2/mouse.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/drivers/hdi/ps2/mouse.c b/src/drivers/hdi/ps2/mouse.c index 46984eb..43b8e4f 100644 --- a/src/drivers/hdi/ps2/mouse.c +++ b/src/drivers/hdi/ps2/mouse.c @@ -85,19 +85,14 @@ static mouse_vtable_t mouse_vtable = { } }; -void mouse_init( mouse_t *mouse, mouse_event_handler_t handler, void *context ) +void mouse_init( mouse_t *mouse, mouse_event_handler_t handler, const uint32_t res_x, const uint32_t res_y, void *context ) { memset( mouse, 0, sizeof( mouse_t ) ); // TODO: we should probe for wheel mouse and more than 3 packets mouse->nof_packets = DEFAULT_NOF_PACKETS; - vga_text_t *vga_text = (vga_text_t *)context; - - mouse->res_x = vga_text->res_x; - mouse->res_y = vga_text->res_y; - mouse->cursor_x = mouse->res_x / 2; - mouse->cursor_y = mouse->res_y / 2; + mouse_set_resolution( mouse, res_x, res_y ); mouse->handler = handler; mouse->context = context; @@ -248,3 +243,11 @@ void mouse_print_info( void *obj ) { puts( "PS/2 mouse driver" ); } + +void mouse_set_resolution( mouse_t *mouse, const uint32_t res_x, const uint32_t res_y ) +{ + mouse->res_x = res_x; + mouse->res_y = res_y; + mouse->cursor_x = mouse->res_x / 2; + mouse->cursor_y = mouse->res_y / 2; +} |