aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ginput/touch/QWidget/gmouse_lld_QWidget.c
blob: 53b167bb007045f7183195c82d114287801d4c95 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * This file is subject to the terms of the GFX License. If a copy of
 * the license was not distributed with this file, you can obtain one at:
 *
 *              http://ugfx.org/license.html
 */

#include "ugfx/gfx.h"


#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE

#define GMOUSE_DRIVER_VMT		GMOUSEVMT_QWidget
#include "../../../../src/ginput/ginput_driver_mouse.h"

GMouse* qwidgetMouse;
coord_t qwidgetMouseX;
coord_t qwidgetMouseY;
coord_t qwidgetMouseZ;
uint16_t qwidgetMouseButtons;

static gBool _init(GMouse* m, unsigned driverinstance)
{
    (void)driverinstance;

    qwidgetMouse = m;

	return gTrue;
}

static gBool _read(GMouse* m, GMouseReading* pdr)
{
    (void)m;

    pdr->x = qwidgetMouseX;
    pdr->y = qwidgetMouseY;
    pdr->z = qwidgetMouseZ;
    pdr->buttons = qwidgetMouseButtons;

	return gTrue;
}

const GMouseVMT GMOUSE_DRIVER_VMT[1] = {{
	{
        GDRIVER_TYPE_MOUSE,
        0,
        sizeof(GMouse),
		_gmouseInitDriver,
		_gmousePostInitDriver,
		_gmouseDeInitDriver
	},
    1,				// z_max
    0,  			// z_min
    1,              // z_touchon
    0,              // z_touchoff
	{				// pen_jitter
        1,          // calibrate
        1,			// click
        1           // move
	},
	{				// finger_jitter
        1,          // calibrate
        1,			// click
        1			// move
	},
    _init,          // init
	0,				// deinit
    _read,          // get
	0,				// calsave
	0				// calload
}};

#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */