diff options
author | Andre Fischer <af@apache.org> | 2013-05-16 11:08:30 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-20 15:02:31 +0100 |
commit | 05b2cd081452571dde558b5376d0db41f9049ab4 (patch) | |
tree | 50707c8e4a864c03f27605bfe415b5f23ff41e72 /sfx2 | |
parent | 2e52faf39b08b4b4575554a965c570015c46b04b (diff) |
Resolves: #i122321# Fix processing of scroll wheel...
to not block other events
(cherry picked from commit 0a5d252c19fdd4e1e705668a604fb319dc6ceccb)
Change-Id: Ib1a3fa50e071688df41983ce8e2cb6b1c93e18c9
(cherry picked from commit 58da1dc5061fcd9abc7dd296d0d7d04d651dc10f)
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 86 | ||||
-rw-r--r-- | sfx2/source/sidebar/Deck.hxx | 5 | ||||
-rw-r--r-- | sfx2/source/sidebar/FocusManager.cxx | 8 |
3 files changed, 56 insertions, 43 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 0a319e17bc85..6534ec77eff9 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -217,49 +217,57 @@ void Deck::DataChanged (const DataChangedEvent& rEvent) long Deck::Notify (NotifyEvent& rEvent) { - if (rEvent.GetType() != EVENT_COMMAND) - return sal_False; + if (rEvent.GetType() == EVENT_COMMAND) + { + CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData()); + if (pCommandEvent != NULL) + switch (pCommandEvent->GetCommand()) + { + case COMMAND_WHEEL: + return ProcessWheelEvent(pCommandEvent, rEvent) + ? sal_True + : sal_False; + + default: + break; + } + } - CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData()); - if (pCommandEvent == NULL) - return sal_False; + return Window::Notify(rEvent); +} - switch (pCommandEvent->GetCommand()) - { - case COMMAND_WHEEL: - { - if ( ! mpVerticalScrollBar - || ! mpVerticalScrollBar->IsVisible()) - return sal_False; - - // Ignore all wheel commands from outside the vertical - // scroll bar. Otherwise after a scroll we might land on - // a spin field and subsequent wheel events would change - // the value of that control. - if (rEvent.GetWindow() != mpVerticalScrollBar.get()) - return sal_True; - - // Get the wheel data and check that it describes a valid - // vertical scroll. - const CommandWheelData* pData = pCommandEvent->GetWheelData(); - if (pData==NULL - || pData->GetModifier() - || pData->GetMode() != COMMAND_WHEEL_SCROLL - || pData->IsHorz()) - return sal_False; - - // Execute the actual scroll action. - long nDelta = pData->GetDelta(); - mpVerticalScrollBar->DoScroll( - mpVerticalScrollBar->GetThumbPos() - nDelta); - return sal_True; - } - default: - break; - } - return sal_False; + +bool Deck::ProcessWheelEvent ( + CommandEvent* pCommandEvent, + NotifyEvent& rEvent) +{ + if ( ! mpVerticalScrollBar) + return false; + if ( ! mpVerticalScrollBar->IsVisible()) + return false; + + // Ignore all wheel commands from outside the vertical scroll bar. + // Otherwise after a scroll we might land on a spin field and + // subsequent wheel events would change the value of that control. + if (rEvent.GetWindow() != mpVerticalScrollBar.get()) + return true; + + // Get the wheel data and check that it describes a valid vertical + // scroll. + const CommandWheelData* pData = pCommandEvent->GetWheelData(); + if (pData==NULL + || pData->GetModifier() + || pData->GetMode() != COMMAND_WHEEL_SCROLL + || pData->IsHorz()) + return false; + + // Execute the actual scroll action. + long nDelta = pData->GetDelta(); + mpVerticalScrollBar->DoScroll( + mpVerticalScrollBar->GetThumbPos() - nDelta); + return true; } diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx index 171fff774af7..f49d38f19fe6 100644 --- a/sfx2/source/sidebar/Deck.hxx +++ b/sfx2/source/sidebar/Deck.hxx @@ -100,8 +100,9 @@ private: ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar; DECL_LINK(HandleVerticalScrollBarChange,void*); - - + bool ProcessWheelEvent ( + CommandEvent* pCommandEvent, + NotifyEvent& rEvent); }; diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index 081fa25621d7..6ed64a50b68e 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -554,6 +554,10 @@ IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent) case VCLEVENT_WINDOW_GETFOCUS: case VCLEVENT_WINDOW_LOSEFOCUS: pSource->Invalidate(); + return 1; + + default: + break; } return 0; @@ -608,14 +612,14 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent) break; } } - break; + return 1; } default: break; } - return 1; + return 0; } |