From 3aab13b7fb7341061612e732433a11f830c376f6 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 25 Feb 2017 22:57:59 -0800 Subject: [PATCH] Updated win32 global hotkeys plugin vol up/down to be consistent with main app behavior (5% >= 10%, 1% <= 10%) --- .../win32globalhotkeys/win32globalhotkeys_plugin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/contrib/win32globalhotkeys/win32globalhotkeys_plugin.cpp b/src/contrib/win32globalhotkeys/win32globalhotkeys_plugin.cpp index d9bd3990b..9d457be1a 100644 --- a/src/contrib/win32globalhotkeys/win32globalhotkeys_plugin.cpp +++ b/src/contrib/win32globalhotkeys/win32globalhotkeys_plugin.cpp @@ -38,6 +38,8 @@ #include #include +#include + musik::core::sdk::IPlaybackService* playback; static HHOOK hook = nullptr; @@ -66,6 +68,8 @@ LRESULT CALLBACK ShellProc(int code, WPARAM wParam, LPARAM lParam) { short alt = GetAsyncKeyState(VK_RMENU) & 0x8000; //bool win = GetAsyncKeyState(VK_LWIN) & 0x8000; + double delta; + if (ctrl && alt) { switch (p->vkCode) { case VK_F1: @@ -91,13 +95,15 @@ LRESULT CALLBACK ShellProc(int code, WPARAM wParam, LPARAM lParam) { case VK_F5: case 'K': case 'k': - playback->SetVolume(playback->GetVolume() - 0.05); + delta = round(playback->GetVolume() * 100.0) > 10.0 ? 0.05 : 0.01; + playback->SetVolume(playback->GetVolume() - delta); return 1; case VK_F6: case 'I': case 'i': - playback->SetVolume(playback->GetVolume() + 0.05); + delta = round(playback->GetVolume() * 100.0) >= 10.0 ? 0.05 : 0.01; + playback->SetVolume(playback->GetVolume() + delta); return 1; case VK_F7: