From 3cb8e9e211c30089516f56f465176d3a959631f9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 17 Apr 2020 11:30:06 +0200 Subject: loplugin:buriedassign in vcl Change-Id: I529052c1ba7591d91d3848080af8b06e077b6f14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92409 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/inc/unx/salunxtime.h | 3 +- vcl/source/control/button.cxx | 21 ++++------ vcl/source/control/edit.cxx | 86 ++++++++++++++++++++------------------ vcl/source/control/imp_listbox.cxx | 14 ++++--- vcl/source/control/scrbar.cxx | 7 ++-- vcl/source/control/spinbtn.cxx | 7 ++-- vcl/source/control/spinfld.cxx | 7 ++-- vcl/source/control/tabctrl.cxx | 7 ++-- vcl/source/filter/ixbm/xbmread.cxx | 8 ++-- vcl/source/fontsubset/ttcr.cxx | 21 +++++----- vcl/source/gdi/dibtools.cxx | 6 ++- vcl/source/gdi/impvect.cxx | 4 +- vcl/source/gdi/pdfwriter_impl.cxx | 3 +- vcl/source/outdev/hatch.cxx | 6 ++- vcl/source/window/brdwin.cxx | 5 ++- vcl/source/window/splitwin.cxx | 7 ++-- vcl/unx/generic/app/wmadaptor.cxx | 34 ++++++++------- 17 files changed, 133 insertions(+), 113 deletions(-) diff --git a/vcl/inc/unx/salunxtime.h b/vcl/inc/unx/salunxtime.h index 1ed979e83e5b..13f8ecc35bf1 100644 --- a/vcl/inc/unx/salunxtime.h +++ b/vcl/inc/unx/salunxtime.h @@ -71,7 +71,8 @@ inline timeval &operator += ( timeval &t1, sal_uIntPtr t2 ) inline timeval operator - ( const timeval &t1, const timeval &t2 ) { timeval t0 = t1; - return t0 -= t2; + t0 -= t2; + return t0; } #endif // INCLUDED_VCL_INC_UNX_SALUNXTIME_H diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index b16fc3d9c46c..e9533fec6ff4 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1414,11 +1414,10 @@ void PushButton::DataChanged( const DataChangedEvent& rDCEvt ) bool PushButton::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && (pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow()) ) { // trigger redraw as mouse over state has changed @@ -2507,11 +2506,10 @@ void RadioButton::DataChanged( const DataChangedEvent& rDCEvt ) bool RadioButton::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) { // trigger redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::Radiobutton, ControlPart::Entire) ) @@ -3411,11 +3409,10 @@ void CheckBox::DataChanged( const DataChangedEvent& rDCEvt ) bool CheckBox::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) { // trigger redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::Checkbox, ControlPart::Entire) ) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index d177eb1fb7bc..f9ef8642a8a9 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -813,50 +813,53 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool aSelection.Min() > 0 && /* first char needs not to be checked */ xBI.is() && i18n::ScriptType::COMPLEX == xBI->getScriptType( rStr, 0 ); - uno::Reference < i18n::XExtendedInputSequenceChecker > xISC; - if (bIsInputSequenceChecking && (xISC = ImplGetInputSequenceChecker()).is()) - { - sal_Unicode cChar = rStr[0]; - sal_Int32 nTmpPos = aSelection.Min(); - sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()? - i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; - - // the text that needs to be checked is only the one - // before the current cursor position - const OUString aOldText( maText.getStr(), nTmpPos); - OUString aTmpText( aOldText ); - if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get()) + if (bIsInputSequenceChecking) + { + uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = ImplGetInputSequenceChecker(); + if (xISC.is()) { - xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode ); + sal_Unicode cChar = rStr[0]; + sal_Int32 nTmpPos = aSelection.Min(); + sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()? + i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; + + // the text that needs to be checked is only the one + // before the current cursor position + const OUString aOldText( maText.getStr(), nTmpPos); + OUString aTmpText( aOldText ); + if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get()) + { + xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode ); - // find position of first character that has changed - sal_Int32 nOldLen = aOldText.getLength(); - sal_Int32 nTmpLen = aTmpText.getLength(); - const sal_Unicode *pOldTxt = aOldText.getStr(); - const sal_Unicode *pTmpTxt = aTmpText.getStr(); - sal_Int32 nChgPos = 0; - while ( nChgPos < nOldLen && nChgPos < nTmpLen && - pOldTxt[nChgPos] == pTmpTxt[nChgPos] ) - ++nChgPos; + // find position of first character that has changed + sal_Int32 nOldLen = aOldText.getLength(); + sal_Int32 nTmpLen = aTmpText.getLength(); + const sal_Unicode *pOldTxt = aOldText.getStr(); + const sal_Unicode *pTmpTxt = aTmpText.getStr(); + sal_Int32 nChgPos = 0; + while ( nChgPos < nOldLen && nChgPos < nTmpLen && + pOldTxt[nChgPos] == pTmpTxt[nChgPos] ) + ++nChgPos; - const OUString aChgText( aTmpText.copy( nChgPos ) ); + const OUString aChgText( aTmpText.copy( nChgPos ) ); - // remove text from first pos to be changed to current pos - maText.remove( nChgPos, nTmpPos - nChgPos ); + // remove text from first pos to be changed to current pos + maText.remove( nChgPos, nTmpPos - nChgPos ); - if (!aChgText.isEmpty()) - { - aNewText = aChgText; - aSelection.Min() = nChgPos; // position for new text to be inserted + if (!aChgText.isEmpty()) + { + aNewText = aChgText; + aSelection.Min() = nChgPos; // position for new text to be inserted + } + else + aNewText.clear(); } else - aNewText.clear(); - } - else - { - // should the character be ignored (i.e. not get inserted) ? - if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode )) - aNewText.clear(); + { + // should the character be ignored (i.e. not get inserted) ? + if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode )) + aNewText.clear(); + } } } @@ -1821,10 +1824,13 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawF void Edit::ImplInvalidateOutermostBorder( vcl::Window* pWin ) { // allow control to show focused state - vcl::Window *pInvalWin = pWin, *pBorder = pWin; - while( ( pBorder = pInvalWin->GetWindow( GetWindowType::Border ) ) != pInvalWin && pBorder && - pInvalWin->ImplGetFrame() == pBorder->ImplGetFrame() ) + vcl::Window *pInvalWin = pWin; + for (;;) { + vcl::Window* pBorder = pInvalWin->GetWindow( GetWindowType::Border ); + if (pBorder == pInvalWin || !pBorder || + pInvalWin->ImplGetFrame() != pBorder->ImplGetFrame() ) + break; pInvalWin = pBorder; } diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 52fe1dc48132..d60ebfcaece5 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -2619,11 +2619,10 @@ void ImplWin::FillLayoutData() const bool ImplWin::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && (pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow()) ) { // trigger redraw as mouse over state has changed if ( IsNativeControlSupported(ControlType::Listbox, ControlPart::Entire) @@ -2674,8 +2673,13 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) bool bMouseOver = false; vcl::Window *pChild = pWin->GetWindow( GetWindowType::FirstChild ); - while( pChild && !(bMouseOver = pChild->IsMouseOver()) ) + while( pChild ) + { + bMouseOver = pChild->IsMouseOver(); + if (bMouseOver) + break; pChild = pChild->GetWindow( GetWindowType::Next ); + } if( bMouseOver ) nState |= ControlState::ROLLOVER; diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index f70ad9ff4cd2..0cf1c9c5f82c 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1257,11 +1257,10 @@ tools::Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) bool ScrollBar::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) { // Trigger a redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::Scrollbar, ControlPart::Entire) ) diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index 645aba468a36..826cb3188ac9 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -431,11 +431,10 @@ tools::Rectangle* SpinButton::ImplFindPartRect( const Point& rPt ) bool SpinButton::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if ((rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr) + if (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) { - if (!pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if (pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()) { // trigger redraw if mouse over state has changed if (IsNativeControlSupported(ControlType::Spinbox, ControlPart::Entire) || diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 4872d5b1436f..f90235d72659 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -829,11 +829,10 @@ tools::Rectangle* SpinField::ImplFindPartRect(const Point& rPt) bool SpinField::PreNotify(NotifyEvent& rNEvt) { - const MouseEvent* pMouseEvt = nullptr; - - if ((rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr) + if (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) { - if (!pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if (pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()) { // trigger redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::Spinbox, ControlPart::Entire) || diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index febd414b1468..a0782f384649 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1540,11 +1540,10 @@ ImplTabItem* TabControl::ImplGetItem(const Point& rPt) const bool TabControl::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) { // trigger redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::TabItem, ControlPart::Entire) ) diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index 9b16c901b762..76d41bf22d6d 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -141,8 +141,8 @@ OString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, { bStatus = false; - if( ( ( nPos2 = aRet.indexOf( pTok2 ) ) != -1 ) && - ( nPos2 > nPos1 ) ) + nPos2 = aRet.indexOf( pTok2 ); + if( ( nPos2 != -1 ) && ( nPos2 > nPos1 ) ) { bStatus = true; } @@ -208,7 +208,9 @@ void XBMReader::ParseData( SvStream* pInStm, const OString& aLastLine, XBMFormat sal_Int32 nPos; // delete opening curly bracket - if( (nPos = ( aLine = aLastLine ).indexOf('{') ) != -1 ) + aLine = aLastLine; + nPos = aLine.indexOf('{'); + if( nPos != -1 ) aLine = aLine.copy(nPos + 1); bFirstLine = false; diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 5d2f337c6c88..92ecfa9a87a6 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -272,18 +272,19 @@ SFErrCodes StreamToFile(TrueTypeCreator *_this, const char* fname) FILE* fd; if ((r = StreamToMemory(_this, &ptr, &length)) != SFErrCodes::Ok) return r; - if (fname && (fd = fopen(fname, "wb")) != nullptr) + r = SFErrCodes::BadFile; + if (fname) { - if (fwrite(ptr, 1, length, fd) != length) { - r = SFErrCodes::FileIo; - } else { - r = SFErrCodes::Ok; + fd = fopen(fname, "wb"); + if (fd) + { + if (fwrite(ptr, 1, length, fd) != length) { + r = SFErrCodes::FileIo; + } else { + r = SFErrCodes::Ok; + } + fclose(fd); } - fclose(fd); - } - else - { - r = SFErrCodes::BadFile; } free(ptr); return r; diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index b061da93022d..54d17c83d47c 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -1168,9 +1168,11 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess const & rAcc, bool bRLE4 ) nSaveIndex = nX - 1; bFound = false; - while( ( nX < nWidth ) && ( nCount < 256 ) - && ( cPix = rAcc.GetIndexFromData( pScanline, nX ) ) != cLast ) + while( ( nX < nWidth ) && ( nCount < 256 ) ) { + cPix = rAcc.GetIndexFromData( pScanline, nX ); + if (cPix == cLast) + break; nX++; nCount++; cLast = cPix; bFound = true; diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 73179fc8e11e..60027e19cb1c 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -564,7 +564,9 @@ void ImplChain::ImplEndAdd( sal_uLong nFlag ) for( sal_uLong i = 0; i < mnCount; ) { const ChainMove& rMove = aImplMove[ mpCodes[ i ] ]; - aArr[ ++i ] = Point( nLastX += rMove.nDX, nLastY += rMove.nDY ); + nLastX += rMove.nDX; + nLastY += rMove.nDY; + aArr[ ++i ] = Point( nLastX, nLastY ); } aArr.ImplSetRealSize( mnCount + 1 ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 05fca4cf21f4..587b328307f5 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10017,7 +10017,8 @@ sal_Int32 PDFWriterImpl::createDest( const tools::Rectangle& rRect, sal_Int32 nP sal_Int32 PDFWriterImpl::registerDestReference( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { - return m_aDestinationIdTranslation[ nDestId ] = createDest( rRect, nPageNr, eType ); + m_aDestinationIdTranslation[ nDestId ] = createDest( rRect, nPageNr, eType ); + return m_aDestinationIdTranslation[ nDestId ]; } void PDFWriterImpl::setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ) diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 33ff9e648213..c5cba12778e7 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -260,7 +260,8 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, long nDist, s const long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan ); long nPY; - rInc = Size( 0, nDist = FRound( nDist / cos( fAngle ) ) ); + nDist = FRound( nDist / cos( fAngle ) ); + rInc = Size( 0, nDist ); if( nAngle > 0 ) { @@ -292,7 +293,8 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, long nDist, s const long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan ); long nPX; - rInc = Size( nDist = FRound( nDist / sin( fAngle ) ), 0 ); + nDist = FRound( nDist / sin( fAngle ) ); + rInc = Size( nDist, 0 ); if( nAngle > 0 ) { diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 65110bfc07d2..abfcd3ecf5b0 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -679,8 +679,11 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c bool bMouseOver = false; vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild); - while(pCtrlChild && !(bMouseOver = pCtrlChild->IsMouseOver())) + while(pCtrlChild) { + bMouseOver = pCtrlChild->IsMouseOver(); + if (bMouseOver) + break; pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next); } diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 4c8dac465a47..4cc59d084554 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -2061,11 +2061,10 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) bool SplitWindow::PreNotify( NotifyEvent& rNEvt ) { - const MouseEvent* pMouseEvt = nullptr; - - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != nullptr ) + if( rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE ) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent(); + if( pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) { // trigger redraw if mouse over state has changed tools::Rectangle aFadeInRect; diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index e39285c4ac6d..d6034ea333f6 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -263,22 +263,26 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : m_aWMName = "ReflectionX"; XFree( pProperty ); } - else if( (aRwmRunning = XInternAtom( m_pDisplay, "_WRQ_WM_RUNNING", True )) != None && - XGetWindowProperty( m_pDisplay, - m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ), - aRwmRunning, - 0, 32, - False, - XA_STRING, - &aRealType, - &nFormat, - &nItems, - &nBytesLeft, - &pProperty ) == 0 ) + else { - if( aRealType == XA_STRING ) - m_aWMName = "ReflectionX Windows"; - XFree( pProperty ); + aRwmRunning = XInternAtom( m_pDisplay, "_WRQ_WM_RUNNING", True ); + if( aRwmRunning != None && + XGetWindowProperty( m_pDisplay, + m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ), + aRwmRunning, + 0, 32, + False, + XA_STRING, + &aRealType, + &nFormat, + &nItems, + &nBytesLeft, + &pProperty ) == 0 ) + { + if( aRealType == XA_STRING ) + m_aWMName = "ReflectionX Windows"; + XFree( pProperty ); + } } } if( m_aWMName.isEmpty() ) -- cgit