25
25
#include < stdio.h>
26
26
#include < cstring>
27
27
28
- // sleep
29
- // #include <chrono>
30
- // #include <thread>
31
-
32
28
XInputSimulatorImplLinux::XInputSimulatorImplLinux ()
33
29
{
34
30
if ((display = XOpenDisplay (NULL )) == NULL ) {
@@ -57,8 +53,6 @@ void XInputSimulatorImplLinux::initMouseEvent(int button)
57
53
58
54
void XInputSimulatorImplLinux::mouseMoveTo (int x, int y)
59
55
{
60
- std::cout << " move the mouse!\n " ;
61
-
62
56
if (!display){
63
57
return ;
64
58
}
@@ -73,8 +67,6 @@ void XInputSimulatorImplLinux::mouseMoveTo(int x, int y)
73
67
74
68
void XInputSimulatorImplLinux::mouseMoveRelative (int x, int y)
75
69
{
76
- // throw NotImplementedException();
77
-
78
70
if (!display){
79
71
return ;
80
72
}
@@ -85,8 +77,6 @@ void XInputSimulatorImplLinux::mouseMoveRelative(int x, int y)
85
77
86
78
void XInputSimulatorImplLinux::mouseDown (int button)
87
79
{
88
- // throw NotImplementedException();
89
-
90
80
this ->initMouseEvent (button);
91
81
92
82
event.type = ButtonPress;
@@ -97,8 +87,6 @@ void XInputSimulatorImplLinux::mouseDown(int button)
97
87
98
88
void XInputSimulatorImplLinux::mouseUp (int button)
99
89
{
100
- // throw NotImplementedException();
101
-
102
90
this ->initMouseEvent (button);
103
91
104
92
event.type = ButtonRelease;
@@ -109,21 +97,17 @@ void XInputSimulatorImplLinux::mouseUp(int button)
109
97
110
98
void XInputSimulatorImplLinux::mouseClick (int button)
111
99
{
112
- // throw NotImplementedException();
113
100
this ->mouseDown (button);
114
- // std::this_thread::sleep_for(std::chrono::milliseconds(1000));
115
101
this ->mouseUp (button);
116
102
}
117
103
// kajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjfkajsdölfkjasdölfkjasldökfjaölsdkjfalsdkjfalskdjfaldskjf
118
104
void XInputSimulatorImplLinux::mouseScrollX (int length)
119
105
{
120
- // throw NotImplementedException();
121
-
122
106
int button;
123
107
if (length < 0 ){
124
- button = 6 ;
108
+ button = 6 ; // scroll left button
125
109
}else {
126
- button = 7 ;
110
+ button = 7 ; // scroll right button
127
111
}
128
112
129
113
if (length < 0 ){
@@ -132,20 +116,17 @@ void XInputSimulatorImplLinux::mouseScrollX(int length)
132
116
133
117
for (int cnt = 0 ; cnt < length; cnt++){
134
118
this ->mouseDown (button);
135
- // std::this_thread::sleep_for(std::chrono::milliseconds(200));
136
119
this ->mouseUp (button);
137
120
}
138
121
}
139
122
140
123
void XInputSimulatorImplLinux::mouseScrollY (int length)
141
124
{
142
- // throw NotImplementedException();
143
-
144
125
int button;
145
126
if (length < 0 ){
146
- button = 4 ;
127
+ button = 4 ; // scroll up button
147
128
}else {
148
- button = 5 ;
129
+ button = 5 ; // scroll down button
149
130
}
150
131
151
132
if (length < 0 ){
@@ -154,7 +135,6 @@ void XInputSimulatorImplLinux::mouseScrollY(int length)
154
135
155
136
for (int cnt = 0 ; cnt < length; cnt++){
156
137
this ->mouseDown (button);
157
- // std::this_thread::sleep_for(std::chrono::milliseconds(200));
158
138
this ->mouseUp (button);
159
139
}
160
140
}
0 commit comments