From 9e0a3d8543c6e00682a9067d6df93719435b5973 Mon Sep 17 00:00:00 2001 From: dbuechel Date: Tue, 12 Mar 2019 07:51:55 +0100 Subject: [PATCH] SEBWIN-141: Minor enhancements of explorer shell & touch activator. --- SafeExamBrowser.WindowsApi/ExplorerShell.cs | 7 +------ SafeExamBrowser.WindowsApi/TouchActivator.cs | 6 ++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/SafeExamBrowser.WindowsApi/ExplorerShell.cs b/SafeExamBrowser.WindowsApi/ExplorerShell.cs index 4ee9b6d0..5b5af83e 100644 --- a/SafeExamBrowser.WindowsApi/ExplorerShell.cs +++ b/SafeExamBrowser.WindowsApi/ExplorerShell.cs @@ -84,11 +84,7 @@ namespace SafeExamBrowser.WindowsApi attempts = 0; suspendedThreads.Remove(thread); - if (success) - { - logger.Debug($"Successfully resumed explorer shell thread with ID = {thread.Id}."); - } - else + if (!success) { logger.Warn($"Failed to resume explorer shell thread with ID = {thread.Id} within {MAX_ATTEMPTS} attempts!"); } @@ -136,7 +132,6 @@ namespace SafeExamBrowser.WindowsApi if (success) { suspendedThreads.Add(thread); - logger.Debug($"Successfully suspended explorer shell thread with ID = {thread.Id}."); } else { diff --git a/SafeExamBrowser.WindowsApi/TouchActivator.cs b/SafeExamBrowser.WindowsApi/TouchActivator.cs index bbdf737f..76ac1207 100644 --- a/SafeExamBrowser.WindowsApi/TouchActivator.cs +++ b/SafeExamBrowser.WindowsApi/TouchActivator.cs @@ -80,6 +80,7 @@ namespace SafeExamBrowser.WindowsApi var position = $"{mouseData.Point.X}/{mouseData.Point.Y}"; var extraInfo = mouseData.DwExtraInfo.ToUInt32(); var isTouch = (extraInfo & Constant.MOUSEEVENTF_MASK) == Constant.MOUSEEVENTF_FROMTOUCH; + var inActivationArea = 0 < mouseData.Point.X && mouseData.Point.X < 100; if (isTouch) { @@ -88,7 +89,7 @@ namespace SafeExamBrowser.WindowsApi isDown = false; } - if (message == Constant.WM_LBUTTONDOWN && 0 < mouseData.Point.X && mouseData.Point.X < 50) + if (message == Constant.WM_LBUTTONDOWN && inActivationArea) { isDown = true; Task.Delay(100).ContinueWith(_ => CheckPosition()); @@ -102,10 +103,11 @@ namespace SafeExamBrowser.WindowsApi private void CheckPosition() { var position = new POINT(); + var hasMoved = position.X > 200; User32.GetCursorPos(ref position); - if (isDown && position.X > 200) + if (isDown && hasMoved) { logger.Debug("Detected activation gesture for action center."); Activate?.Invoke();