diff --git a/ThreeFingerDragOnWindows/settings/SettingsData.cs b/ThreeFingerDragOnWindows/settings/SettingsData.cs
index 5da0679..cc64f49 100644
--- a/ThreeFingerDragOnWindows/settings/SettingsData.cs
+++ b/ThreeFingerDragOnWindows/settings/SettingsData.cs
@@ -19,6 +19,14 @@ public class SettingsData{
// Three finger drag Settings
public bool ThreeFingerDrag { get; set; } = true;
+ public enum ThreeFingerDragButtonType {
+ NONE,
+ LEFT,
+ RIGHT,
+ MIDDLE,
+ }
+ public ThreeFingerDragButtonType ThreeFingerDragButton { get; set; } = ThreeFingerDragButtonType.LEFT;
+
public bool ThreeFingerDragAllowReleaseAndRestart { get; set; } = true;
public int ThreeFingerDragReleaseDelay { get; set; } = 500;
diff --git a/ThreeFingerDragOnWindows/settings/ThreeFingerDragSettings.xaml b/ThreeFingerDragOnWindows/settings/ThreeFingerDragSettings.xaml
index bb07dd4..d6e5bbb 100644
--- a/ThreeFingerDragOnWindows/settings/ThreeFingerDragSettings.xaml
+++ b/ThreeFingerDragOnWindows/settings/ThreeFingerDragSettings.xaml
@@ -66,6 +66,18 @@
+
+
+ None
+ Left
+ Right
+ Middle
+
+
+
= 2))){
// Stop dragging
@@ -90,7 +90,7 @@ private void OnTimerElapsed(object source, ElapsedEventArgs e){
private void StopDrag(){
_isDragging = false;
- MouseOperations.MouseClick(MouseOperations.MOUSEEVENTF_LEFTUP);
+ MouseOperations.ThreeFingersDragMouseUp();
}
private int GetReleaseDelay(){
diff --git a/ThreeFingerDragOnWindows/utils/MouseOperations.cs b/ThreeFingerDragOnWindows/utils/MouseOperations.cs
index 4821d9c..3421214 100644
--- a/ThreeFingerDragOnWindows/utils/MouseOperations.cs
+++ b/ThreeFingerDragOnWindows/utils/MouseOperations.cs
@@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
+using ThreeFingerDragOnWindows.settings;
namespace ThreeFingerDragOnWindows.utils;
@@ -10,6 +11,8 @@ public class MouseOperations {
public const int MOUSEEVENTF_LEFTUP = 0x0004;
public const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
public const int MOUSEEVENTF_RIGHTUP = 0x0010;
+ public const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
+ public const int MOUSEEVENTF_MIDDLEUP = 0x0040;
// moving the cursor does not work with floating point values
// decimal parts are kept and then added to be taken in account
@@ -72,6 +75,34 @@ public static void MouseClick(int mouseEventFlag){
if(result == 0) Console.WriteLine("Failed to send mouse click. Error code: " + Marshal.GetLastWin32Error());
}
+ public static void ThreeFingersDragMouseDown(){
+ switch (App.SettingsData.ThreeFingerDragButton){
+ case SettingsData.ThreeFingerDragButtonType.LEFT:
+ MouseClick(MOUSEEVENTF_LEFTDOWN);
+ break;
+ case SettingsData.ThreeFingerDragButtonType.RIGHT:
+ MouseClick(MOUSEEVENTF_RIGHTDOWN);
+ break;
+ case SettingsData.ThreeFingerDragButtonType.MIDDLE:
+ MouseClick(MOUSEEVENTF_MIDDLEDOWN);
+ break;
+ }
+ }
+
+ public static void ThreeFingersDragMouseUp(){
+ switch (App.SettingsData.ThreeFingerDragButton){
+ case SettingsData.ThreeFingerDragButtonType.LEFT:
+ MouseClick(MOUSEEVENTF_LEFTUP);
+ break;
+ case SettingsData.ThreeFingerDragButtonType.RIGHT:
+ MouseClick(MOUSEEVENTF_RIGHTUP);
+ break;
+ case SettingsData.ThreeFingerDragButtonType.MIDDLE:
+ MouseClick(MOUSEEVENTF_MIDDLEUP);
+ break;
+ }
+ }
+
[StructLayout(LayoutKind.Sequential)]
private struct Input {
@@ -98,4 +129,4 @@ public IntMousePoint(int x, int y){
this.x = x;
this.y = y;
}
-}
\ No newline at end of file
+}