diff --git a/DS4Windows/DS4Control/ITouchpadBehaviour.cs b/DS4Windows/DS4Control/ITouchpadBehaviour.cs index d175391..80a4343 100644 --- a/DS4Windows/DS4Control/ITouchpadBehaviour.cs +++ b/DS4Windows/DS4Control/ITouchpadBehaviour.cs @@ -4,12 +4,12 @@ namespace DS4Windows { interface ITouchpadBehaviour { - void touchesBegan(object sender, TouchpadEventArgs arg); - void touchesMoved(object sender, TouchpadEventArgs arg); - void touchButtonUp(object sender, TouchpadEventArgs arg); - void touchButtonDown(object sender, TouchpadEventArgs arg); - void touchesEnded(object sender, TouchpadEventArgs arg); - void sixaxisMoved(object sender, SixAxisEventArgs unused); - void touchUnchanged(object sender, EventArgs unused); + void touchesBegan(DS4Touchpad sender, TouchpadEventArgs arg); + void touchesMoved(DS4Touchpad sender, TouchpadEventArgs arg); + void touchButtonUp(DS4Touchpad sender, TouchpadEventArgs arg); + void touchButtonDown(DS4Touchpad sender, TouchpadEventArgs arg); + void touchesEnded(DS4Touchpad sender, TouchpadEventArgs arg); + void sixaxisMoved(DS4SixAxis sender, SixAxisEventArgs unused); + void touchUnchanged(DS4Touchpad sender, EventArgs unused); } } diff --git a/DS4Windows/DS4Control/Mouse.cs b/DS4Windows/DS4Control/Mouse.cs index cfba098..f780b63 100644 --- a/DS4Windows/DS4Control/Mouse.cs +++ b/DS4Windows/DS4Control/Mouse.cs @@ -71,7 +71,7 @@ namespace DS4Windows set { toggleGyroMouse = value; ResetToggleGyroM(); } } bool currentToggleGyroM = false; - public virtual void sixaxisMoved(object sender, SixAxisEventArgs arg) + public virtual void sixaxisMoved(DS4SixAxis sender, SixAxisEventArgs arg) { if (Global.isUsingSAforMouse(deviceNum) && Global.getGyroSensitivity(deviceNum) > 0) { @@ -156,7 +156,7 @@ namespace DS4Windows } private bool tempBool = false; - public virtual void touchesMoved(object sender, TouchpadEventArgs arg) + public virtual void touchesMoved(DS4Touchpad sender, TouchpadEventArgs arg) { s = dev.getCurrentStateRef(); @@ -210,7 +210,7 @@ namespace DS4Windows synthesizeMouseButtons(); } - public virtual void touchesBegan(object sender, TouchpadEventArgs arg) + public virtual void touchesBegan(DS4Touchpad sender, TouchpadEventArgs arg) { if (!Global.UseTPforControls[deviceNum]) { @@ -243,7 +243,7 @@ namespace DS4Windows synthesizeMouseButtons(); } - public virtual void touchesEnded(object sender, TouchpadEventArgs arg) + public virtual void touchesEnded(DS4Touchpad sender, TouchpadEventArgs arg) { s = dev.getCurrentStateRef(); slideright = slideleft = false; @@ -375,7 +375,7 @@ namespace DS4Windows return t.hwX >= 1920 * 2 / 5; } - public virtual void touchUnchanged(object sender, EventArgs unused) + public virtual void touchUnchanged(DS4Touchpad sender, EventArgs unused) { s = dev.getCurrentStateRef(); @@ -491,7 +491,7 @@ namespace DS4Windows } } - public virtual void touchButtonUp(object sender, TouchpadEventArgs arg) + public virtual void touchButtonUp(DS4Touchpad sender, TouchpadEventArgs arg) { pushed = DS4Controls.None; upperDown = leftDown = rightDown = multiDown = false; @@ -501,7 +501,7 @@ namespace DS4Windows synthesizeMouseButtons(); } - public virtual void touchButtonDown(object sender, TouchpadEventArgs arg) + public virtual void touchButtonDown(DS4Touchpad sender, TouchpadEventArgs arg) { if (arg.touches == null) upperDown = true; diff --git a/DS4Windows/DS4Library/DS4Sixaxis.cs b/DS4Windows/DS4Library/DS4Sixaxis.cs index b082fd9..403e794 100644 --- a/DS4Windows/DS4Library/DS4Sixaxis.cs +++ b/DS4Windows/DS4Library/DS4Sixaxis.cs @@ -2,6 +2,8 @@ namespace DS4Windows { + public delegate void SixAxisHandler(DS4SixAxis sender, TEventArgs args); + public class SixAxisEventArgs : EventArgs { public readonly SixAxis sixAxis; @@ -110,7 +112,8 @@ namespace DS4Windows public class DS4SixAxis { - public event EventHandler SixAccelMoved = null; + //public event EventHandler SixAccelMoved = null; + public event SixAxisHandler SixAccelMoved = null; private SixAxis sPrev = null, now = null; private CalibData[] calibrationData = new CalibData[6] { new CalibData(), new CalibData(), new CalibData(), new CalibData(), new CalibData(), new CalibData() diff --git a/DS4Windows/DS4Library/DS4Touchpad.cs b/DS4Windows/DS4Library/DS4Touchpad.cs index 47b0a9a..a2d7d36 100644 --- a/DS4Windows/DS4Library/DS4Touchpad.cs +++ b/DS4Windows/DS4Library/DS4Touchpad.cs @@ -52,13 +52,16 @@ namespace DS4Windows public class DS4Touchpad { - public event EventHandler TouchesBegan = null; // finger one or two landed (or both, or one then two, or two then one; any touches[] count increase) - public event EventHandler TouchesMoved = null; // deltaX/deltaY are set because one or both fingers were already down on a prior sensor reading - public event EventHandler TouchesEnded = null; // all fingers lifted - public event EventHandler TouchButtonDown = null; // touchpad pushed down until the button clicks - public event EventHandler TouchButtonUp = null; // touchpad button released - public event EventHandler TouchUnchanged = null; // no status change for the touchpad itself... but other sensors may have changed, or you may just want to do some processing - public event EventHandler PreTouchProcess = null; // used to publish that a touch packet is about to be processed + public delegate void TouchHandler(DS4Touchpad sender, TEventArgs args); + + public event TouchHandler TouchesBegan = null; // finger one or two landed (or both, or one then two, or two then one; any touches[] count increase) + public event TouchHandler TouchesMoved = null; // deltaX/deltaY are set because one or both fingers were already down on a prior sensor reading + public event TouchHandler TouchesEnded = null; // all fingers lifted + public event TouchHandler TouchButtonDown = null; // touchpad pushed down until the button clicks + public event TouchHandler TouchButtonUp = null; // touchpad button released + public event TouchHandler TouchUnchanged = null; // no status change for the touchpad itself... but other sensors may have changed, or you may just want to do some processing + public event TouchHandler PreTouchProcess = null; // used to publish that a touch packet is about to be processed + //public event EventHandler PreTouchProcess = null; // used to publish that a touch packet is about to be processed public readonly static int TOUCHPAD_DATA_OFFSET = 35; internal int lastTouchPadX1, lastTouchPadY1,