summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-25 09:35:29 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-25 09:35:29 +0200
commit96d1781a9ba365baef0f89ef85a2b103bfd6370a (patch)
treeb435c4fb19cb587495b96829dc9862ca3bb28311 /src/drivers
parente77368940afaa2bbc7bd883ef6cd25a5565a1bbd (diff)
downloadabaos-96d1781a9ba365baef0f89ef85a2b103bfd6370a.tar.gz
abaos-96d1781a9ba365baef0f89ef85a2b103bfd6370a.tar.bz2
put the mouse object into the global context so we can adjust the
resolution when switching video modes
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/hdi/ps2/mouse.c17
-rw-r--r--src/drivers/hdi/ps2/mouse.h4
2 files changed, 13 insertions, 8 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;
+}
diff --git a/src/drivers/hdi/ps2/mouse.h b/src/drivers/hdi/ps2/mouse.h
index cbd02ef..166b4df 100644
--- a/src/drivers/hdi/ps2/mouse.h
+++ b/src/drivers/hdi/ps2/mouse.h
@@ -54,12 +54,14 @@ typedef struct {
driver_vtable_t base;
} mouse_vtable_t;
-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 );
void mouse_activate( void *obj );
void mouse_deactivate( void *obj );
void mouse_deinit( void *obj );
void mouse_print_info( void *obj );
+void mouse_set_resolution( mouse_t *mouse, const uint32_t x, const uint32_t y );
+
uint32_t mouse_handle_interrupt( interrupt_handler_t *handler, uint32_t esp );
#endif // MOUSE_H