Skip to content

Commit 37d2ff6

Browse files
committed
putil: add id and pressure fields to PointerData
1 parent 26fcf13 commit 37d2ff6

File tree

2 files changed

+34
-39
lines changed

2 files changed

+34
-39
lines changed

panda/src/putil/pointerData.I

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,6 @@
1111
* @date 2002-07-15
1212
*/
1313

14-
/**
15-
*
16-
*/
17-
INLINE PointerData::
18-
PointerData() {
19-
_in_window = false;
20-
_xpos = 0;
21-
_ypos = 0;
22-
}
23-
24-
/**
25-
*
26-
*/
27-
INLINE PointerData::
28-
PointerData(const PointerData &copy) :
29-
_in_window(copy._in_window),
30-
_xpos(copy._xpos),
31-
_ypos(copy._ypos)
32-
{
33-
}
34-
35-
/**
36-
*
37-
*/
38-
INLINE void PointerData::
39-
operator = (const PointerData &copy) {
40-
_in_window = copy._in_window;
41-
_xpos = copy._xpos;
42-
_ypos = copy._ypos;
43-
}
44-
4514
/**
4615
*
4716
*/
@@ -59,13 +28,34 @@ get_y() const {
5928
}
6029

6130
/**
62-
*
31+
* If this returns false, the pointer is not currently present in the window
32+
* and the values returned by get_x() and get_y() may not be meaningful.
6333
*/
6434
INLINE bool PointerData::
6535
get_in_window() const {
6636
return _in_window;
6737
}
6838

39+
/**
40+
* Returns a unique identifier for this pointer. This is for tracking
41+
* individual fingers. This value should not be assumed to have a specific
42+
* meaning other than that there will not be two different pointers active
43+
* simultaneously with the same identifier.
44+
*/
45+
INLINE int PointerData::
46+
get_id() const {
47+
return _id;
48+
}
49+
50+
/**
51+
* Returns the pressure of the pointer. For mice, this will be 1.0 if any
52+
* button is pressed, 0.0 otherwise.
53+
*/
54+
INLINE double PointerData::
55+
get_pressure() const {
56+
return _pressure;
57+
}
58+
6959

7060
INLINE std::ostream &operator << (std::ostream &out, const PointerData &md) {
7161
md.output(out);

panda/src/putil/pointerData.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,29 @@
2424
*/
2525
class EXPCL_PANDA_PUTIL PointerData {
2626
PUBLISHED:
27-
INLINE PointerData();
28-
INLINE PointerData(const PointerData &copy);
29-
INLINE void operator = (const PointerData &copy);
30-
3127
INLINE double get_x() const;
3228
INLINE double get_y() const;
3329
INLINE bool get_in_window() const;
3430

31+
public:
32+
INLINE int get_id() const;
33+
INLINE double get_pressure() const;
34+
3535
void output(std::ostream &out) const;
3636

37+
PUBLISHED:
3738
MAKE_PROPERTY(x, get_x);
3839
MAKE_PROPERTY(y, get_y);
40+
MAKE_PROPERTY(id, get_id);
3941
MAKE_PROPERTY(in_window, get_in_window);
42+
MAKE_PROPERTY(pressure, get_pressure);
4043

4144
public:
42-
bool _in_window;
43-
double _xpos;
44-
double _ypos;
45+
bool _in_window = false;
46+
double _xpos = 0.0;
47+
double _ypos = 0.0;
48+
double _pressure = 0.0;
49+
int _id = 0;
4550
};
4651

4752
INLINE std::ostream &operator << (std::ostream &out, const PointerData &md);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy