summaryrefslogtreecommitdiff
path: root/src/drivers/hdi/mouse.h
blob: 5b3d08f779a2e634e4aceb47e7c489653b0adfb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#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 );

#endif // MOUSE_H