Forgotten updates
This commit is contained in:
34
padkey.c
34
padkey.c
@@ -221,11 +221,36 @@ static int handle_idle_pointer(struct PadKey *this, struct js_event *event)
|
||||
static int cursorY = 0;
|
||||
|
||||
if (this->pointer.vx != 0 || this->pointer.vy != 0) {
|
||||
int dx = this->pointer.vx / 4096;
|
||||
int dy = this->pointer.vy / 4096;
|
||||
int dx;
|
||||
int dy;
|
||||
int v;
|
||||
|
||||
this->pointer.charge++;
|
||||
if (this->pointer.charge < 96) {
|
||||
v = this->pointer.charge / 3;
|
||||
} else {
|
||||
v = 32;
|
||||
}
|
||||
|
||||
if (this->pointer.vx < 0) {
|
||||
dx = -v;
|
||||
} else if (this->pointer.vx == 0) {
|
||||
dx = 0;
|
||||
} else {
|
||||
dx = v;
|
||||
}
|
||||
if (this->pointer.vy < 0) {
|
||||
dy = -v;
|
||||
} else if (this->pointer.vy == 0) {
|
||||
dy = 0;
|
||||
} else {
|
||||
dy = v;
|
||||
}
|
||||
|
||||
XTestFakeRelativeMotionEvent(this->display, dx, dy, 0);
|
||||
XFlush(this->display);
|
||||
} else {
|
||||
this->pointer.charge = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -244,6 +269,7 @@ int PadKey_handle(struct PadKey *this)
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(this->fd, &rfds);
|
||||
|
||||
#if 1
|
||||
if (this->pointer.vx != 0 || this->pointer.vy != 0) {
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 20000;
|
||||
@@ -251,6 +277,10 @@ int PadKey_handle(struct PadKey *this)
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100000;
|
||||
}
|
||||
#else
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 20000;
|
||||
#endif
|
||||
|
||||
retval = select(this->fd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (retval == -1) {
|
||||
|
||||
@@ -11,6 +11,7 @@ void Pointer_initialize(struct Pointer *this)
|
||||
this->yNumber = 1;
|
||||
this->vx = 0;
|
||||
this->vy = 0;
|
||||
this->charge = 0;
|
||||
this->leftNumber = 0;
|
||||
this->centerNumber = 1;
|
||||
this->rightNumber = 3;
|
||||
|
||||
Reference in New Issue
Block a user