summaryrefslogtreecommitdiff
path: root/src/drivers/hdi/mouse.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/hdi/mouse.h')
-rw-r--r--src/drivers/hdi/mouse.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/drivers/hdi/mouse.h b/src/drivers/hdi/mouse.h
new file mode 100644
index 0000000..90417f3
--- /dev/null
+++ b/src/drivers/hdi/mouse.h
@@ -0,0 +1,55 @@
+#ifndef MOUSE_H
+#define MOUSE_H
+
+#include "driver.h"
+
+typedef enum {
+ MOUSE_EVENT_TYPE_BUTTON_UP,
+ MOUSE_EVENT_TYPE_BUTTON_DOWN,
+ MOUSE_EVENT_TYPE_MOVE
+} mouse_event_type_t;
+
+typedef enum {
+ MOUSE_BUTTON_LEFT = 1,
+ MOUSE_BUTTON_RIGHT = 2,
+ MOUSE_BUTTON_MIDDLE = 3
+} mouse_button_t;
+
+typedef struct {
+ mouse_event_type_t type;
+ mouse_button_t button;
+ int32_t old_cursor_x;
+ int32_t old_cursor_y;
+ int32_t cursor_x;
+ int32_t cursor_y;
+} mouse_event_t;
+
+typedef void (*mouse_event_handler_t)( mouse_event_t *event, void *context );
+
+typedef struct {
+ driver_t base;
+ uint32_t res_x;
+ uint32_t res_y;
+ int32_t cursor_x;
+ int32_t cursor_y;
+ mouse_event_handler_t handler;
+} mouse_t;
+
+typedef struct {
+ driver_vtable_t base;
+ void (*set_resolution)( void *obj, const uint32_t x, const uint32_t y );
+ void (*set_position)( void *obj, const uint32_t x, const uint32_t y );
+} mouse_vtable_t;
+
+void mouse_init( mouse_t *mouse, mouse_event_handler_t handler, interrupt_t *interrupt, 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( void *obj, const uint32_t x, const uint32_t y );
+void mouse_set_position( void *obj, const uint32_t x, const uint32_t y );
+
+uint32_t mouse_handle_interrupt( interrupt_handler_t *handler, uint32_t esp );
+
+#endif // MOUSE_H