@@ -65,6 +65,8 @@ namespace
6565 // trackpad modifier, click if pressed, touch otherwise
6666 bool p_trackpad1_click = false ;
6767 bool p_trackpad2_click = false ;
68+ bool trackpad1_click_reverse;
69+ bool trackpad2_click_reverse;
6870
6971 DWORD exitCode = 0 ;
7072 CString lastcmd;
@@ -384,18 +386,33 @@ namespace
384386 // ************************************************
385387 void Axis_Set (CString id, CString xvalue, CString yvalue)
386388 {
389+ // touch event at x,y
387390 executeCommandLine (" client_commandline.exe buttonevent touchandhold " + id + " 32" , exitCode);
388391 executeCommandLine (" client_commandline.exe axisevent " + id + " 0 " + xvalue+" " +yvalue, exitCode);
389392
390- if ((p_trackpad1_click && id == steamvr_controller1_id) || (p_trackpad2_click && id == steamvr_controller2_id))
393+ // emulate trackpad click
394+ if (id == steamvr_controller1_id && (!p_trackpad1_click == trackpad1_click_reverse))
391395 {
392396 executeCommandLine (" client_commandline.exe buttonevent pressandhold " + id + " 32" , exitCode); // touchpad pressed
393397 touchpadpressed = true ;
398+ return ;
394399 }
395- else {
400+
401+
402+ if (id == steamvr_controller2_id && (!p_trackpad2_click == trackpad2_click_reverse))
403+ {
404+ executeCommandLine (" client_commandline.exe buttonevent pressandhold " + id + " 32" , exitCode); // touchpad pressed
405+ touchpadpressed = true ;
406+ return ;
407+ }
408+
409+ // if pressed, but no click request, unpress
410+ if (touchpadpressed)
411+ {
396412 executeCommandLine (" client_commandline.exe buttonevent unpress " + id + " 32" , exitCode); // touchpad unpressed
397413 touchpadpressed = false ;
398414 }
415+
399416 }
400417
401418
@@ -658,7 +675,10 @@ namespace
658675 }
659676
660677
661-
678+ // string to bool
679+ bool ToBool (const std::string & s) {
680+ return s == " true" ;
681+ }
662682
663683}
664684
@@ -710,10 +730,16 @@ int main(int argc,char *argv[])
710730 sf::String profile = (sf::String)ini.GetValue (" main" , " profile" , " 0" );
711731
712732
733+ trackpad1_click_reverse = ToBool (ini.GetValue (" axes" , " trackpad1_click_reverse" , " false" ));
734+ trackpad2_click_reverse = ToBool (ini.GetValue (" axes" , " trackpad2_click_reverse" , " false" ));
735+
736+
737+
738+
713739
714740 // Create the window of the application
715741 sf::String appname=" Joy2OpenVR " ;
716- appname += " 0.4b " ;
742+ appname += " 0.5b " ;
717743 sf::RenderWindow window (sf::VideoMode (600 , 780 ), appname, sf::Style::Close);
718744 window.setVerticalSyncEnabled (true );
719745
0 commit comments