[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmix] gui: Fix kmix tray icon scrolling for high-precision scroll devices like
From: Christian Esken <esken () kde ! org>
Date: 2015-01-20 21:11:32
Message-ID: E1YDg5E-00051v-An () scm ! kde ! org
[Download RAW message or body]
Git commit e318bedab3022b2972f0fe9699529afa75d68372 by Christian Esken.
Committed on 20/01/2015 at 21:09.
Pushed by esken into branch 'master'.
Fix kmix tray icon scrolling for high-precision scroll devices like
touchpads.
BUGS: 341536
CCBUGS: 313579
REVIEW: 121725
M +23 -6 gui/kmixdockwidget.cpp
M +1 -0 gui/kmixdockwidget.h
http://commits.kde.org/kmix/e318bedab3022b2972f0fe9699529afa75d68372
diff --git a/gui/kmixdockwidget.cpp b/gui/kmixdockwidget.cpp
index d72f42c..78b2a66 100644
--- a/gui/kmixdockwidget.cpp
+++ b/gui/kmixdockwidget.cpp
@@ -54,6 +54,7 @@ KMixDockWidget::KMixDockWidget(KMixWindow* parent)
, _oldToolTipValue(-1)
, _oldPixmapType('-')
, _kmixMainWindow(parent)
+ , _delta(0)
{
setToolTipIconByName("kmix");
setTitle(i18n( "Volume Control"));
@@ -359,15 +360,31 @@ KMixDockWidget::trayWheelEvent(int delta,Qt::Orientation wheelOrientation)
Volume &vol = ( md->playbackVolume().hasVolume() ) ? md->playbackVolume() : md->captureVolume();
- // bko313579 Do not use "delta", as that is setting more related to documents (Editor, Browser). KMix should
- // simply always use its own VOLUME_STEP_DIVISOR as a base for percentage change.
- bool decrease = delta < 0;
+// kDebug() << "I am seeing a wheel event with delta=" << delta << " and orientation=" << wheelOrientation;
if (wheelOrientation == Qt::Horizontal) // Reverse horizontal scroll: bko228780
- decrease = !decrease;
- long cv = vol.volumeStep(decrease);
+ {
+ delta = -delta;
+ }
+ // bko313579, bko341536, Review #121725 - Use delta and round it by 120.
+ _delta += delta;
+ bool decrease = delta < 0;
+ unsigned long inc = 0;
+ while (_delta >= 120) {
+ _delta -= 120;
+ inc++;
+ }
+ while (_delta <= -120) {
+ _delta += 120;
+ inc++;
+ }
+
+ if (inc == 0) {
+ return;
+ }
+ long cv = vol.volumeStep(decrease) * inc;
bool isInactive = vol.isCapture() ? !md->isRecSource() : md->isMuted();
- kDebug() << "Operating on capture=" << vol.isCapture() << ", isInactive=" << isInactive;
+// kDebug() << "Operating on capture=" << vol.isCapture() << ", isInactive=" << isInactive;
if ( cv > 0 && isInactive)
{
// increasing from muted state: unmute and start with a low volume level
diff --git a/gui/kmixdockwidget.h b/gui/kmixdockwidget.h
index a0d7a46..3405500 100644
--- a/gui/kmixdockwidget.h
+++ b/gui/kmixdockwidget.h
@@ -68,6 +68,7 @@ class KMixDockWidget : public KStatusNotifierItem
int _oldToolTipValue;
char _oldPixmapType;
KMixWindow* _kmixMainWindow;
+ int _delta;
bool onlyHaveOneMouseButtonAction();
void refreshVolumeLevels();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic