forked from alexfru/dflat20
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmouse-ansi.c
67 lines (56 loc) · 1.37 KB
/
mouse-ansi.c
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* ------------- mouse-ansi.c ------------- */
#include "dflat.h"
#include "unikey.h"
extern int mouse_x; /* set in events-unix.c */
extern int mouse_y;
extern int mouse_button;
/* ---------- reset the mouse ---------- */
void resetmouse(void)
{
}
/* ----- test to see if the mouse driver is installed ----- */
BOOL mouse_installed(void)
{
return 1;
}
/* ------ return true if mouse buttons are pressed ------- */
int mousebuttons(void)
{
return mouse_button;
}
/* ---------- return mouse coordinates ---------- */
void get_mouseposition(int *x, int *y)
{
*x = mouse_x;
*y = mouse_y;
}
/* -------- position the mouse cursor -------- */
void set_mouseposition(int x, int y)
{
//char buf[32];
//mouse_x = x;
//mouse_y = y;
//sprintf(buf, "\e[%d;%dH", y+1, x+1);
//write(1, buf, strlen(buf));
}
/* --------- display the mouse cursor -------- */
void show_mousecursor(void)
{
//const char *p = "\e[?25h";
//write(1, p, strlen(p));
}
/* --------- hide the mouse cursor ------- */
void hide_mousecursor(void)
{
//const char *p = "\e[?25l";
//write(1, p, strlen(p));
}
/* --- return true if a mouse button has been released --- */
int button_releases(void)
{
return (mouse_button == kMouseLeftUp || mouse_button == kMouseRightUp);
}
/* ----- set mouse travel limits ------- */
void set_mousetravel(int minx, int maxx, int miny, int maxy)
{
}