From d229640e9862761366725f0c6a1f0ab798fe2cd2 Mon Sep 17 00:00:00 2001 From: Nathaniel Stenzel Date: Tue, 15 Oct 2024 02:23:16 -0500 Subject: [PATCH 1/2] Give ZeroOne mode access to the timers that gradient mode uses. This lets the cursor keep moving. Make ZeroOne mode move in the right direction. Correct some case sensitivity issues. Note: Testing shows that the timer does not seem to work for absolute movement mode which seems to stick. --- src/axis.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/axis.cpp b/src/axis.cpp index 1a454ca..a63cb36 100644 --- a/src/axis.cpp +++ b/src/axis.cpp @@ -41,7 +41,7 @@ bool Axis::read( QTextStream &stream ) { float fval; //step through each word, check if it's a token we recognize for ( QStringList::Iterator it = words.begin(); it != words.end(); ++it ) { - if (*it == "maxspeed") { + if (*it == "maxSpeed") { ++it; //move to the next word, which should be the maximum speed. //if no value was given, there's an error in the file, stop reading. if (it == words.end()) return false; @@ -120,7 +120,7 @@ bool Axis::read( QTextStream &stream ) { else return false; } //the rest of the options are keywords without integers - else if (*it == "zeroone") { + else if (*it == "ZeroOne") { interpretation = ZeroOne; gradient = false; absolute = false; @@ -222,7 +222,7 @@ void Axis::jsevent( int value ) { //if was on but now should be off: if (isOn && abs(state) <= dZone) { isOn = false; - if (gradient) { + if (gradient || (interpretation == ZeroOne)) { duration = 0; release(); timer.stop(); @@ -233,15 +233,15 @@ void Axis::jsevent( int value ) { //if was off but now should be on: else if (!isOn && abs(state) >= dZone) { isOn = true; - if (gradient) { + if (gradient || (interpretation == ZeroOne)) { duration = (abs(state) * FREQ) / JOYMAX; connect(&timer, SIGNAL(timeout()), this, SLOT(timerCalled())); timer.start(MSEC); } } //otherwise, state doesn't change! Don't touch it. - else return; - + else return; //this line would hurt ZeroOne without the timer that was previously only used by gradient + //We never even get here //gradient will trigger movement on its own via timer(). //non-gradient needs to be told to move. if (!gradient) { @@ -437,6 +437,8 @@ void Axis::move( bool press ) { else dist = maxSpeed; e.type = absolute ? FakeEvent::MouseMoveAbsolute : FakeEvent::MouseMove; + //go the right direction for ZeroOne mode + if ((interpretation == ZeroOne) && (state < 0)) dist = -dist; if (mode == MousePosVert) { e.move.x = 0; e.move.y = dist; From 7591bff4f7565ee6f8d266f264f9ee67520ed8c3 Mon Sep 17 00:00:00 2001 From: Nathaniel Stenzel Date: Tue, 15 Oct 2024 18:01:33 -0500 Subject: [PATCH 2/2] Remove the click bounce from joystick axis to mouse click. "mode > Keyboard" might be easier but do we want that for absolute mode? --- src/axis.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/axis.cpp b/src/axis.cpp index a63cb36..aeda8aa 100644 --- a/src/axis.cpp +++ b/src/axis.cpp @@ -220,9 +220,11 @@ void Axis::jsevent( int value ) { state = (value + JOYMAX) / 2; //set isOn, deal with state changing. //if was on but now should be off: + if (isOn && abs(state) <= dZone) { isOn = false; - if (gradient || (interpretation == ZeroOne)) { + if (gradient || ((interpretation == ZeroOne) && (mode != Keyboard))) { + //"mode > Keyboard"" might be easier but do we want that for absolute mode? duration = 0; release(); timer.stop(); @@ -233,7 +235,8 @@ void Axis::jsevent( int value ) { //if was off but now should be on: else if (!isOn && abs(state) >= dZone) { isOn = true; - if (gradient || (interpretation == ZeroOne)) { + if (gradient || ((interpretation == ZeroOne) && (mode != Keyboard))) { + //"mode > Keyboard"" might be easier but do we want that for absolute mode? duration = (abs(state) * FREQ) / JOYMAX; connect(&timer, SIGNAL(timeout()), this, SLOT(timerCalled())); timer.start(MSEC); @@ -241,9 +244,10 @@ void Axis::jsevent( int value ) { } //otherwise, state doesn't change! Don't touch it. else return; //this line would hurt ZeroOne without the timer that was previously only used by gradient - //We never even get here + //We never even get here and if we did, the feedback on the gui would not happen //gradient will trigger movement on its own via timer(). //non-gradient needs to be told to move. + if (!gradient) { move(isOn); }