summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-27 12:48:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-04-27 12:50:31 +0100
commitfc1605e4dc88b6c563dc0712954f58d8bb6979a7 (patch)
tree4b7563a069d198a59d6b83c7a3cc81a70a422a2a /vcl
parent12288cec079d004ce491043aca6ba57bf13f73af (diff)
don't dismiss floating windows on wheel, etc gestures outside area
so if you are not exactly over the active floating listbox menu and use the scroll mouse then it still gets the scroll event instead of popping down and delivering it to the underlying window. Change-Id: I6ab0b725af2a8adc712bfe4ec586dcd64a2efdd7
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/winproc.cxx62
1 files changed, 14 insertions, 48 deletions
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 6cb1c902b6ff..139d77149e1e 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1376,17 +1376,6 @@ protected:
public:
- struct WindowDescription
- {
- vcl::Window *m_pMouseWindow;
- bool m_bIsFloat;
- WindowDescription(vcl::Window *pMouseWindow, bool bIsFloat)
- : m_pMouseWindow(pMouseWindow)
- , m_bIsFloat(bIsFloat)
- {
- }
- };
-
HandleGestureEventBase(vcl::Window *pWindow, const Point &rMousePos)
: m_pSVData(ImplGetSVData())
, m_pWindow(pWindow)
@@ -1394,10 +1383,9 @@ public:
{
}
bool Setup();
- WindowDescription FindTarget();
- vcl::Window *Dispatch(const WindowDescription& rTarget);
+ vcl::Window* FindTarget();
+ vcl::Window* Dispatch(vcl::Window* pTarget);
virtual bool CallCommand(vcl::Window *pWindow, const Point &rMousePos) = 0;
- void Teardown(const WindowDescription& rTarget);
virtual ~HandleGestureEventBase() {}
};
@@ -1414,10 +1402,9 @@ bool HandleGestureEventBase::Setup()
return true;
}
-HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
+vcl::Window* HandleGestureEventBase::FindTarget()
{
// first check any floating window ( eg. drop down listboxes)
- bool bIsFloat = false;
vcl::Window *pMouseWindow = NULL;
if (m_pSVData->maWinData.mpFirstFloat && !m_pSVData->maWinData.mpCaptureWin &&
@@ -1425,10 +1412,14 @@ HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
{
HitTest nHitTest = HITTEST_OUTSIDE;
pMouseWindow = m_pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( m_pWindow, m_aMousePos, nHitTest );
+ if (!pMouseWindow)
+ pMouseWindow = m_pSVData->maWinData.mpFirstFloat;
}
// then try the window directly beneath the mouse
if( !pMouseWindow )
+ {
pMouseWindow = m_pWindow->ImplFindWindow( m_aMousePos );
+ }
else
{
// transform coordinates to float window frame coordinates
@@ -1437,7 +1428,6 @@ HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
pMouseWindow->AbsoluteScreenToOutputPixel(
m_pWindow->OutputToAbsoluteScreenPixel(
m_pWindow->ScreenToOutputPixel( m_aMousePos ) ) ) ) );
- bIsFloat = true;
}
while (acceptableWheelScrollTarget(pMouseWindow))
@@ -1448,13 +1438,11 @@ HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
pMouseWindow = pMouseWindow->GetParent();
}
- return WindowDescription(pMouseWindow, bIsFloat);
+ return pMouseWindow;
}
-vcl::Window *HandleGestureEventBase::Dispatch(const WindowDescription& rTarget)
+vcl::Window *HandleGestureEventBase::Dispatch(vcl::Window* pMouseWindow)
{
- vcl::Window *pMouseWindow = rTarget.m_pMouseWindow;
-
vcl::Window *pDispatchedTo = NULL;
if (acceptableWheelScrollTarget(pMouseWindow) && pMouseWindow->IsEnabled())
@@ -1493,23 +1481,6 @@ vcl::Window *HandleGestureEventBase::Dispatch(const WindowDescription& rTarget)
return pDispatchedTo;
}
-void HandleGestureEventBase::Teardown(const WindowDescription& rTarget)
-{
- // close floaters
- if (!rTarget.m_bIsFloat && m_pSVData->maWinData.mpFirstFloat)
- {
- FloatingWindow* pLastLevelFloat = m_pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
- if( pLastLevelFloat )
- {
- sal_uLong nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
- if ( nPopupFlags & FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE )
- {
- pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
- }
- }
- }
-}
-
class HandleWheelEvent : public HandleGestureEventBase
{
private:
@@ -1554,21 +1525,19 @@ bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt)
if (!Setup())
return false;
- WindowDescription aTarget = FindTarget();
+ vcl::Window *pMouseWindow = FindTarget();
// avoid the problem that scrolling via wheel to this point brings a widget
// under the mouse that also accepts wheel commands, so stick with the old
// widget if the time gap is very small
if (shouldReusePreviousMouseWindow(aPreviousEvent, rEvt) && acceptableWheelScrollTarget(pPreviousWindow))
{
- aTarget.m_pMouseWindow = pPreviousWindow;
+ pMouseWindow = pPreviousWindow;
}
aPreviousEvent = rEvt;
- pPreviousWindow = Dispatch(aTarget);
-
- Teardown(aTarget);
+ pPreviousWindow = Dispatch(pMouseWindow);
return pPreviousWindow != NULL;
}
@@ -1588,12 +1557,9 @@ bool HandleGestureEvent::HandleEvent()
if (!Setup())
return false;
- WindowDescription aTarget = FindTarget();
-
- bool bHandled = Dispatch(aTarget) != NULL;
-
- Teardown(aTarget);
+ vcl::Window *pTarget = FindTarget();
+ bool bHandled = Dispatch(pTarget) != NULL;
return bHandled;
}