Просмотр исходного кода

NetDriver triple click bug fix. (#1422)

BDisp 3 лет назад
Родитель
Сommit
c604fcb30a
1 измененных файлов с 14 добавлено и 0 удалено
  1. 14 0
      Terminal.Gui/ConsoleDrivers/NetDriver.cs

+ 14 - 0
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -698,6 +698,13 @@ namespace Terminal.Gui {
 			mouseEvent.ButtonState = buttonState;
 			//System.Diagnostics.Debug.WriteLine ($"ButtonState: {mouseEvent.ButtonState} X: {mouseEvent.Position.X} Y: {mouseEvent.Position.Y}");
 
+			if (isButtonDoubleClicked) {
+				Application.MainLoop.AddIdle (() => {
+					Task.Run (async () => await ProcessButtonDoubleClickedAsync ());
+					return false;
+				});
+			}
+
 			if ((buttonState & MouseButtonState.Button1Pressed) != 0
 				|| (buttonState & MouseButtonState.Button2Pressed) != 0
 				|| (buttonState & MouseButtonState.Button3Pressed) != 0) {
@@ -865,6 +872,13 @@ namespace Terminal.Gui {
 			});
 		}
 
+		async Task ProcessButtonDoubleClickedAsync ()
+		{
+			await Task.Delay (300);
+			isButtonDoubleClicked = false;
+			buttonPressedCount = 0;
+		}
+
 		void ProcessButtonDoubleClicked (MouseEvent mouseEvent)
 		{
 			var me = new MouseEvent () {