From 12c0fc92e15118510b86c189f53d727ce84dc238 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 17 Mar 2009 01:34:50 +0000 Subject: [PATCH] Somewhat adjusted the behavior of the volume slider. It now stays up when initially clicked and requires a second mouseclick to begin tracking it. This prevents abrupt volume changes as would be seen if you had previously turned down the volume and then invoked the volume control again (it would immediately jump to whatever level the mouse cursor happened to be at when the slider popped up). This fixes ticket #3570. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29568 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/desklink/VolumeSlider.cpp | 24 ++++++++---------------- src/bin/desklink/VolumeSlider.h | 2 +- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/bin/desklink/VolumeSlider.cpp b/src/bin/desklink/VolumeSlider.cpp index 4629fbca8c..36954eaf48 100644 --- a/src/bin/desklink/VolumeSlider.cpp +++ b/src/bin/desklink/VolumeSlider.cpp @@ -322,9 +322,7 @@ SliderView::SliderView(BRect rect, BMessage *msg, const char *title, fRightBitmap.SetBits(kRightBits, kRightWidth * kRightHeight, 0, B_CMAP8); fButtonBitmap.SetBits(kButtonBits, kButtonWidth * kButtonHeight, 0, B_CMAP8); - SetTracking(true); SetValue(value); - SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); } @@ -333,20 +331,6 @@ SliderView::~SliderView() } -void -SliderView::Pulse() -{ - uint32 mouseButtons; - BPoint where; - GetMouse(&where, &mouseButtons, true); - // button not pressed, exit - if (!(mouseButtons & B_PRIMARY_MOUSE_BUTTON)) { - SetTracking(false); - Invoke(); - } -} - - void SliderView::Draw(BRect updateRect) { @@ -394,6 +378,14 @@ SliderView::Draw(BRect updateRect) } +void +SliderView::MouseDown(BPoint point) +{ + SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); + SetTracking(true); +} + + void SliderView::MouseMoved(BPoint point, uint32 transit, const BMessage *message) { diff --git a/src/bin/desklink/VolumeSlider.h b/src/bin/desklink/VolumeSlider.h index 19f13ecae5..8ea4f17fcb 100644 --- a/src/bin/desklink/VolumeSlider.h +++ b/src/bin/desklink/VolumeSlider.h @@ -40,9 +40,9 @@ class SliderView : public BControl { ~SliderView(); virtual void Draw(BRect); + virtual void MouseDown(BPoint point); virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); virtual void MouseUp(BPoint point); - virtual void Pulse(); private: BBitmap fLeftBitmap, fRightBitmap, fButtonBitmap;