From 4bcf5e7981dad0bf8a4186ac7fc13b752b155ff7 Mon Sep 17 00:00:00 2001 From: Simon Chan Date: Sat, 17 Oct 2020 00:18:00 +0800 Subject: [PATCH] fix: properly handle (ignore) mouse side buttons --- ModernFlyouts/FlyoutHandler.cs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/ModernFlyouts/FlyoutHandler.cs b/ModernFlyouts/FlyoutHandler.cs index a29dd0da..70507320 100644 --- a/ModernFlyouts/FlyoutHandler.cs +++ b/ModernFlyouts/FlyoutHandler.cs @@ -289,12 +289,25 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b } else if (wParam == (IntPtr)12) { - //Volume - AudioFlyoutHelper?.OnExternalUpdated( - (int)lParam == (int)HookMessageEnum.HOOK_MEDIA_NEXT || - (int)lParam == (int)HookMessageEnum.HOOK_MEDIA_PREVIOUS || - (int)lParam == (int)HookMessageEnum.HOOK_MEDIA_PLAYPAUSE || - (int)lParam == (int)HookMessageEnum.HOOK_MEDIA_STOP); + switch ((long)lParam) + { + case (long)HookMessageEnum.HOOK_MEDIA_NEXT: + case (long)HookMessageEnum.HOOK_MEDIA_PREVIOUS: + case (long)HookMessageEnum.HOOK_MEDIA_PLAYPAUSE: + case (long)HookMessageEnum.HOOK_MEDIA_STOP: + //Media + AudioFlyoutHelper?.OnExternalUpdated(true); + break; + case (long)HookMessageEnum.HOOK_MEDIA_VOLMINUS: + case (long)HookMessageEnum.HOOK_MEDIA_VOLMUTE: + case (long)HookMessageEnum.HOOK_MEDIA_VOLPLUS: + //Volume + AudioFlyoutHelper?.OnExternalUpdated(false); + break; + default: + //Ignore mouse side buttons and other keyboard special keys + break; + } } }