Use runtime option for toggling touchpad.

Related to issue #637.
This commit is contained in:
Travis Nickles 2019-04-02 00:54:29 -05:00
parent 592a0245b7
commit 79a90b828c
3 changed files with 42 additions and 30 deletions

View File

@ -1362,27 +1362,20 @@ namespace DS4Windows
public bool[] touchreleased = new bool[4] { true, true, true, true },
touchslid = new bool[4] { false, false, false, false };
public byte[] oldtouchvalue = new byte[4] { 0, 0, 0, 0 };
public int[] oldscrollvalue = new int[4] { 0, 0, 0, 0 };
protected virtual void CheckForTouchToggle(int deviceID, DS4State cState, DS4State pState)
{
if (!getUseTPforControls(deviceID) && cState.Touch1 && pState.PS)
{
if (getTouchSensitivity(deviceID) > 0 && touchreleased[deviceID])
if (GetTouchActive(deviceID) && touchreleased[deviceID])
{
oldtouchvalue[deviceID] = getTouchSensitivity(deviceID);
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
getTouchSensitivity()[deviceID] = 0;
getScrollSensitivity()[deviceID] = 0;
TouchActive[deviceID] = false;
LogDebug(Properties.Resources.TouchpadMovementOff);
AppLogger.LogToTray(Properties.Resources.TouchpadMovementOff);
touchreleased[deviceID] = false;
}
else if (touchreleased[deviceID])
{
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
TouchActive[deviceID] = true;
LogDebug(Properties.Resources.TouchpadMovementOn);
AppLogger.LogToTray(Properties.Resources.TouchpadMovementOn);
touchreleased[deviceID] = false;
@ -1396,10 +1389,7 @@ namespace DS4Windows
{
if (deviceID < 4)
{
oldtouchvalue[deviceID] = getTouchSensitivity(deviceID);
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
TouchSensitivity[deviceID] = 0;
ScrollSensitivity[deviceID] = 0;
TouchActive[deviceID] = false;
}
}

View File

@ -161,6 +161,8 @@ namespace DS4Windows
s = dev.getCurrentStateRef();
if (Global.getUseTPforControls(deviceNum) == false)
{
if (Global.TouchActive[deviceNum])
{
int[] disArray = Global.getTouchDisInvertTriggers(deviceNum);
tempBool = true;
@ -184,6 +186,19 @@ namespace DS4Windows
wheel.touchesMoved(arg, dragging || dragging2);
}
else
{
if (Global.getTrackballMode(deviceNum))
{
int iIndex = trackballBufferTail;
trackballXBuffer[iIndex] = 0;
trackballYBuffer[iIndex] = 0;
trackballBufferTail = (iIndex + 1) % TRACKBALL_BUFFER_LEN;
if (trackballBufferHead == trackballBufferTail)
trackballBufferHead = (trackballBufferHead + 1) % TRACKBALL_BUFFER_LEN;
}
}
}
else
{
if (!(swipeUp || swipeDown || swipeLeft || swipeRight) && arg.touches.Length == 1)
{

View File

@ -240,6 +240,7 @@ namespace DS4Windows
public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false };
public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true };
public static bool[] linkedProfileCheck = new bool[4] { true, true, true, true };
public static bool[] touchpadActive = new bool[5] { true, true, true, true, true };
public static X360Controls[] defaultButtonMapping = { X360Controls.None, X360Controls.LXNeg, X360Controls.LXPos,
X360Controls.LYNeg, X360Controls.LYPos, X360Controls.RXNeg, X360Controls.RXPos, X360Controls.RYNeg, X360Controls.RYPos,
@ -667,6 +668,12 @@ namespace DS4Windows
return m_Config.touchSensitivity[index];
}
public static bool[] TouchActive => touchpadActive;
public static bool GetTouchActive(int index)
{
return touchpadActive[index];
}
public static byte[] FlashType => m_Config.flashType;
public static byte getFlashType(int index)
{