diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-27 14:06:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-28 08:55:28 +0200 |
commit | d2d85921605415908c553e84db654628f9f0c0b1 (patch) | |
tree | 161816623c32febde1c62d524fa1ef0a20a1aeda /vcl/source/window/winproc.cxx | |
parent | 26c82e22bf4f077022ae88d0a7f8ad0fa6d2a5ba (diff) |
loplugin:oncevar in vcl
Change-Id: I37a6dacda12e1c2910737d74aa344c7e2e195aeb
Reviewed-on: https://gerrit.libreoffice.org/39328
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window/winproc.cxx')
-rw-r--r-- | vcl/source/window/winproc.cxx | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index a892734d97d2..9cfb68742127 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -299,7 +299,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent pWinFrameData->mnLastMouseX = nX; pWinFrameData->mnLastMouseY = nY; pWinFrameData->mnMouseCode = nCode; - MouseEventModifiers nTmpMask = MouseEventModifiers::SYNTHETIC | MouseEventModifiers::MODIFIERCHANGED; + MouseEventModifiers const nTmpMask = MouseEventModifiers::SYNTHETIC | MouseEventModifiers::MODIFIERCHANGED; pWinFrameData->mnMouseMode = nMode & ~nTmpMask; if ( bMouseLeave ) { @@ -624,7 +624,6 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent } // call handler - bool bDrag = false; bool bCallHelpRequest = true; SAL_WARN_IF( !pChild, "vcl", "ImplHandleMouseEvent: pChild is NULL" ); @@ -751,44 +750,41 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent } else if ( (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN) || (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) ) { - if ( !bDrag ) + // Command-Events + if ( /*!bRet &&*/ (nClicks == 1) && (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN) && + (nCode == MOUSE_MIDDLE) ) { - // Command-Events - if ( /*!bRet &&*/ (nClicks == 1) && (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN) && - (nCode == MOUSE_MIDDLE) ) - { - MouseMiddleButtonAction nMiddleAction = pChild->GetSettings().GetMouseSettings().GetMiddleButtonAction(); - if ( nMiddleAction == MouseMiddleButtonAction::AutoScroll ) - bRet = !ImplCallCommand( pChild, CommandEventId::StartAutoScroll, nullptr, true, &aChildPos ); - } - else + MouseMiddleButtonAction nMiddleAction = pChild->GetSettings().GetMouseSettings().GetMiddleButtonAction(); + if ( nMiddleAction == MouseMiddleButtonAction::AutoScroll ) + bRet = !ImplCallCommand( pChild, CommandEventId::StartAutoScroll, nullptr, true, &aChildPos ); + } + else + { + // ContextMenu + const MouseSettings& rMSettings = pChild->GetSettings().GetMouseSettings(); + if ( (nCode == rMSettings.GetContextMenuCode()) && + (nClicks == rMSettings.GetContextMenuClicks()) ) { - // ContextMenu - const MouseSettings& rMSettings = pChild->GetSettings().GetMouseSettings(); - if ( (nCode == rMSettings.GetContextMenuCode()) && - (nClicks == rMSettings.GetContextMenuClicks()) ) + bool bContextMenu = (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN); + if ( bContextMenu ) { - bool bContextMenu = (nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN); - if ( bContextMenu ) + if( pSVData->maAppData.mpActivePopupMenu ) { - if( pSVData->maAppData.mpActivePopupMenu ) - { - /* #i34277# there already is a context menu open - * that was probably just closed with EndPopupMode. - * We need to give the eventual corresponding - * PopupMenu::Execute a chance to end properly. - * Therefore delay context menu command and - * issue only after popping one frame of the - * Yield stack. - */ - ContextMenuEvent* pEv = new ContextMenuEvent; - pEv->pWindow = pChild; - pEv->aChildPos = aChildPos; - Application::PostUserEvent( Link<void*,void>( pEv, ContextMenuEventLink ) ); - } - else - bRet = ! ImplCallCommand( pChild, CommandEventId::ContextMenu, nullptr, true, &aChildPos ); + /* #i34277# there already is a context menu open + * that was probably just closed with EndPopupMode. + * We need to give the eventual corresponding + * PopupMenu::Execute a chance to end properly. + * Therefore delay context menu command and + * issue only after popping one frame of the + * Yield stack. + */ + ContextMenuEvent* pEv = new ContextMenuEvent; + pEv->pWindow = pChild; + pEv->aChildPos = aChildPos; + Application::PostUserEvent( Link<void*,void>( pEv, ContextMenuEventLink ) ); } + else + bRet = ! ImplCallCommand( pChild, CommandEventId::ContextMenu, nullptr, true, &aChildPos ); } } } |