[Libreoffice-commits] core.git: Branch 'feature/sidebar' - sfx2/source

Andre Fischer af at apache.org
Fri May 17 11:58:45 PDT 2013


 sfx2/source/sidebar/Deck.cxx         |   86 +++++++++++++++++++----------------
 sfx2/source/sidebar/Deck.hxx         |    5 +-
 sfx2/source/sidebar/FocusManager.cxx |    8 ++-
 3 files changed, 56 insertions(+), 43 deletions(-)

New commits:
commit 58da1dc5061fcd9abc7dd296d0d7d04d651dc10f
Author: Andre Fischer <af at apache.org>
Date:   Thu May 16 11:08:30 2013 +0000

    Resolves: #i122321# Fix processing of scroll wheel...
    
    to not block other events
    
    (cherry picked from commit 0a5d252c19fdd4e1e705668a604fb319dc6ceccb)
    
    Change-Id: Ib1a3fa50e071688df41983ce8e2cb6b1c93e18c9

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 0a319e1..6534ec7 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 171fff7..f49d38f 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 081fa25..6ed64a5 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;
 }
 
 


More information about the Libreoffice-commits mailing list