aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI
diff options
context:
space:
mode:
authorXenovyy <135486168+Xenovyy@users.noreply.github.com>2026-03-17 18:44:12 -0400
committerGitHub <noreply@github.com>2026-03-17 22:44:12 +0000
commita94ee1ca224f5822351ee2f7fd5261dc2e508fdf (patch)
tree00da989c865684d6a1b3aac2ce2ef21ca0d494fc /Minecraft.Client/Common/UI
parentb774d13806fee4665eb91e84d1240e7cbecb7cbc (diff)
Fixed the ear bleeding sound when using a slider with mouse controls (#1296)main
* Fixed the ear bleeding sound when using a slider with mouse controls Now only ticks every 9 "ticks" unless the slider has less than 18 possible values.. * cured rtm516's ocd title * rtm516 reaches enlightenment * rtm516 reaches total enlightenment
Diffstat (limited to 'Minecraft.Client/Common/UI')
-rw-r--r--Minecraft.Client/Common/UI/UIControl_Slider.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Common/UI/UIControl_Slider.cpp
index 2d56a29c..c9b773a7 100644
--- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp
+++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp
@@ -66,12 +66,44 @@ void UIControl_Slider::init(UIString label, int id, int min, int max, int curren
#endif
}
+bool IsUsingKeyboardMouse()
+{
+#ifdef _WINDOWS64
+
+ if (g_KBMInput.IsKBMActive()) return true;
+
+ return g_KBMInput.HasAnyInput();
+#else
+ return false;
+#endif
+}
+
void UIControl_Slider::handleSliderMove(int newValue)
{
if (m_current!=newValue)
{
- ui.PlayUISFX(eSFX_Scroll);
- m_current = newValue;
+ int valueCount = 1;
+ if (!m_allPossibleLabels.empty()) {
+ valueCount = static_cast<int>(m_allPossibleLabels.size());
+ }
+ else {
+ long long range = static_cast<long long>(m_max) - static_cast<long long>(m_min) + 1;
+ if (range <= 0) range = 1;
+ valueCount = static_cast<int>(range);
+ }
+
+ if (IsUsingKeyboardMouse() == true) {
+ if (newValue % 10 == 0) {
+ ui.PlayUISFX(eSFX_Scroll);
+ m_current = newValue;
+ } else if (valueCount <= 20) {
+ ui.PlayUISFX(eSFX_Scroll);
+ m_current = newValue;
+ }
+ } else {
+ ui.PlayUISFX(eSFX_Scroll);
+ m_current = newValue;
+ }
if(newValue < m_allPossibleLabels.size())
{