SEBWIN-141: Minor enhancements of explorer shell & touch activator.

This commit is contained in:
dbuechel 2019-03-12 07:51:55 +01:00
parent 31857bfb25
commit 9e0a3d8543
2 changed files with 5 additions and 8 deletions

View file

@ -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
{

View file

@ -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();