remove unnecessary Window::Update() calls, which immediately follow Invalidate

Update() is effectively "paint immediately". Rather just let the
invalidate do it's thing and have the widget paint on the next paint
loop, along with the rest of the stuff.

This is probably mostly cargo-cult, from the days when our
invalidate/paint timer could take a long time to kick in.

Change-Id: Idff06526e9a2892244cfd8ce6947916032b0d1a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90567
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx
index 3eda45a..3ec0f72 100644
--- a/basctl/source/dlged/dlgedview.cxx
+++ b/basctl/source/dlged/dlgedview.cxx
@@ -110,7 +110,6 @@
        rWin.Scroll( -nScrollX, -nScrollY );
        aMap.SetOrigin( Point( aOrg.X() - nScrollX, aOrg.Y() - nScrollY ) );
        rWin.SetMapMode( aMap );
        rWin.Update();
        rWin.Invalidate();

        // update scroll bars
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
index 9a23632..100703e 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -110,7 +110,6 @@
        rWin.Scroll( -nScrollX, -nScrollY );
        aMap.SetOrigin( Point( aOrg.X() - nScrollX, aOrg.Y() - nScrollY ) );
        rWin.SetMapMode( aMap );
        rWin.Update();
        rWin.Invalidate();

        if ( m_pReportWindow )
diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx
index feaec57..ea117e5 100644
--- a/sc/source/ui/view/olinewin.cxx
+++ b/sc/source/ui/view/olinewin.cxx
@@ -123,7 +123,6 @@

    ScrollRel( nDiff, nStart, nEnd );
    Invalidate( GetRectangle( 0, nInvStart, GetOutputSizeLevel() - 1, nInvEnd ) );
    Update();

    // if focus becomes invisible, move it to next visible button
    ImplMoveFocusToVisible( nDiff < 0 );
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 31df3f5..82eb0940 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -826,7 +826,6 @@
        if (mpWindow)
        {
            mpWindow->Invalidate(mrView.maRedrawRegion);
            mpWindow->Update();
        }
}

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 5f09eb9..be73000 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -114,7 +114,6 @@
                {
                    // for previewing, since rows/columns are known in PaintHdl (UI)
                    pSh->GetWin()->Invalidate();
                    pSh->GetWin()->Update();
                }
            }
            else
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e859625..43636df 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1462,7 +1462,6 @@
                else
                {
                    pBorder->Invalidate( InvalidateFlags::NoErase );
                    pBorder->Update();
                }
            }
            else if( (GetStyle() & WB_FLATBUTTON) ||
@@ -2206,7 +2205,6 @@
    mbChecked = true;
    mpWindowImpl->mnStyle |= WB_TABSTOP;
    Invalidate();
    Update();
    VclPtr<vcl::Window> xWindow = this;
    if ( mbRadioCheck )
        ImplUncheckAllOther();
@@ -2255,7 +2253,6 @@
    {
        GetButtonState() |= DrawButtonFlags::Pressed;
        Invalidate();
        Update();
        StartTracking();
        return;
    }
@@ -2280,7 +2277,6 @@
            else
            {
                Invalidate();
                Update();
            }
        }
    }
@@ -2292,7 +2288,6 @@
            {
                GetButtonState() |= DrawButtonFlags::Pressed;
                Invalidate();
                Update();
            }
        }
        else
@@ -2301,7 +2296,6 @@
            {
                GetButtonState() &= ~DrawButtonFlags::Pressed;
                Invalidate();
                Update();
            }
        }
    }
@@ -2317,14 +2311,12 @@
        {
            GetButtonState() |= DrawButtonFlags::Pressed;
            Invalidate();
            Update();
        }
    }
    else if ( (GetButtonState() & DrawButtonFlags::Pressed) && (aKeyCode.GetCode() == KEY_ESCAPE) )
    {
        GetButtonState() &= ~DrawButtonFlags::Pressed;
        Invalidate();
        Update();
    }
    else
        Button::KeyInput( rKEvt );
@@ -2447,7 +2439,6 @@
    {
        GetButtonState() &= ~DrawButtonFlags::Pressed;
        Invalidate();
        Update();
    }

    HideFocus();
@@ -3092,7 +3083,6 @@

    VclPtr<vcl::Window> xWindow = this;
    Invalidate();
    Update();
    Toggle();
    if ( xWindow->IsDisposed() )
        return;
@@ -3112,7 +3102,6 @@
    {
        GetButtonState() |= DrawButtonFlags::Pressed;
        Invalidate();
        Update();
        StartTracking();
        return;
    }
@@ -3137,7 +3126,6 @@
            else
            {
                Invalidate();
                Update();
            }
        }
    }
@@ -3149,7 +3137,6 @@
            {
                GetButtonState() |= DrawButtonFlags::Pressed;
                Invalidate();
                Update();
            }
        }
        else
@@ -3158,7 +3145,6 @@
            {
                GetButtonState() &= ~DrawButtonFlags::Pressed;
                Invalidate();
                Update();
            }
        }
    }
@@ -3174,14 +3160,12 @@
        {
            GetButtonState() |= DrawButtonFlags::Pressed;
            Invalidate();
            Update();
        }
    }
    else if ( (GetButtonState() & DrawButtonFlags::Pressed) && (aKeyCode.GetCode() == KEY_ESCAPE) )
    {
        GetButtonState() &= ~DrawButtonFlags::Pressed;
        Invalidate();
        Update();
    }
    else
        Button::KeyInput( rKEvt );
@@ -3346,7 +3330,6 @@
    {
        GetButtonState() &= ~DrawButtonFlags::Pressed;
        Invalidate();
        Update();
    }

    HideFocus();
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 9e29102..8ffbc5f 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2638,7 +2638,6 @@
            && ! IsNativeControlSupported(ControlType::Listbox, ControlPart::ButtonDown) )
            {
                GetParent()->GetWindow( GetWindowType::Border )->Invalidate( InvalidateFlags::NoErase );
                GetParent()->GetWindow( GetWindowType::Border )->Update();
            }
        }
    }
diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index 16ec32d..a99c84a 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -169,7 +169,6 @@
        if ( IsReallyVisible() )
        {
            Invalidate();
            Update();
        }
    }
    else if ( mnPercent != nNewPercent )
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index e7d2129..aec48bc 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -588,7 +588,6 @@
    {
        if ( ImplDoAction() )
        {
            Update();
            Invalidate();
        }
    }
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index 6c738b5..645aba4 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -193,7 +193,6 @@

    if ( mbUpperIn || mbLowerIn )
    {
        Update();
        CaptureMouse();
        if ( mbRepeat )
            maRepeatTimer.Start();
@@ -213,14 +212,12 @@
    {
        mbUpperIn   = false;
        Invalidate( maUpperRect );
        Update();
        Up();
    }
    else if ( mbLowerIn )
    {
        mbLowerIn = false;
        Invalidate( maLowerRect );
        Update();
        Down();
    }

@@ -238,7 +235,6 @@
        mbUpperIn = false;
        maRepeatTimer.Stop();
        Invalidate( maUpperRect );
        Update();
    }
    else if ( !maLowerRect.IsInside( rMEvt.GetPosPixel() ) &&
              mbLowerIn && mbInitialDown )
@@ -246,7 +242,6 @@
        mbLowerIn = false;
        maRepeatTimer.Stop();
        Invalidate( maLowerRect );
        Update();
    }
    else if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) &&
              !mbUpperIn && mbInitialUp )
@@ -255,7 +250,6 @@
        if ( mbRepeat )
            maRepeatTimer.Start();
        Invalidate( maUpperRect );
        Update();
    }
    else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) &&
              !mbLowerIn && mbInitialDown )
@@ -264,7 +258,6 @@
        if ( mbRepeat )
            maRepeatTimer.Start();
        Invalidate( maLowerRect );
        Update();
    }
}

diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 20596fe..4872d5b 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -406,7 +406,6 @@

        if (mbUpperIn || mbLowerIn)
        {
            Update();
            CaptureMouse();
            if (mbRepeat)
                maRepeatTimer.Start();
@@ -428,14 +427,12 @@
    {
        mbUpperIn = false;
        Invalidate(maUpperRect);
        Update();
        Up();
    }
    else if (mbLowerIn)
    {
        mbLowerIn = false;
        Invalidate(maLowerRect);
        Update();
        Down();
    }

@@ -461,7 +458,6 @@

                mbUpperIn = bNewUpperIn;
                Invalidate(maUpperRect);
                Update();
            }
        }
        else if (mbInitialDown)
@@ -479,7 +475,6 @@

                mbLowerIn = bNewLowerIn;
                Invalidate(maLowerRect);
                Update();
            }
        }
    }
diff --git a/vcl/source/treelist/iconviewimpl.cxx b/vcl/source/treelist/iconviewimpl.cxx
index 9305d7b..3494dee 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -94,13 +94,11 @@
    ShowCursor( false );

    m_nFlags &= ~LBoxFlags::Filling;
    m_pView->Update();
    m_pStartEntry = pNext;

    if( nRealDelta >= m_nVisibleCount )
    {
        m_pView->Invalidate( GetVisibleArea() );
        m_pView->Update();
    }
    else
    {
@@ -132,12 +130,10 @@
    m_nFlags &= ~LBoxFlags::Filling;
    ShowCursor( false );

    m_pView->Update();
    m_pStartEntry = pPrev;
    if( nRealDelta >= m_nVisibleCount )
    {
        m_pView->Invalidate( GetVisibleArea() );
        m_pView->Update();
    }
    else
    {
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index bc40721..50672b2 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -394,13 +394,11 @@
    ShowCursor( false );

    m_nFlags &= ~LBoxFlags::Filling;
    m_pView->Update();
    m_pStartEntry = pNext;

    if( nRealDelta >= m_nVisibleCount )
    {
        m_pView->Invalidate( GetVisibleArea() );
        m_pView->Update();
    }
    else
    {
@@ -432,12 +430,10 @@
    m_nFlags &= ~LBoxFlags::Filling;
    ShowCursor( false );

    m_pView->Update();
    m_pStartEntry = pPrev;
    if( nRealDelta >= m_nVisibleCount )
    {
        m_pView->Invalidate( GetVisibleArea() );
        m_pView->Update();
    }
    else
    {
@@ -3268,7 +3264,6 @@
    if( !pArg )
    {
        m_pView->Invalidate();
        m_pView->Update();
    }
    else
    {
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index e5ba910..ce8bba8 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -504,7 +504,6 @@
                pEraseWindow->Invalidate(aRect, InvalidateFlags::NoChildren     |
                                                InvalidateFlags::NoClipChildren |
                                                InvalidateFlags::Transparent);
                pEraseWindow->Update();
            }
            rRenderContext.Push(PushFlags::CLIPREGION);
            rRenderContext.IntersectClipRegion(rFramePosSize);
@@ -1173,7 +1172,6 @@
            {
                tools::Rectangle aRect = ImplGetItemRectPos(nPos);
                Invalidate(aRect);
                Update();
            }
        }
    }
@@ -1228,7 +1226,6 @@
        {
            tools::Rectangle aRect = ImplGetItemRectPos(nPos);
            Invalidate(aRect, InvalidateFlags::NoErase);
            Update();
        }
    }
}
@@ -1258,7 +1255,6 @@
    {
        tools::Rectangle aRect = ImplGetItemRectPos(nPos);
        Invalidate(aRect);
        Update();
    }
}

@@ -1333,7 +1329,6 @@
    if ( IsReallyVisible() )
    {
        Invalidate();
        Update();
    }
}

@@ -1354,7 +1349,6 @@
        if ((nTime_ms - mnLastProgressPaint_ms) > 100)
        {
            Invalidate(maPrgsFrameRect);
            Update();
            mnLastProgressPaint_ms = nTime_ms;
        }
    }
@@ -1370,7 +1364,6 @@
    if ( IsReallyVisible() )
    {
        Invalidate();
        Update();
    }
}

@@ -1378,17 +1371,8 @@
{
    if ((GetStyle() & WB_RIGHT) && !mbProgressMode && IsReallyVisible() && IsUpdateMode())
    {
        if (mbFormat)
        {
            Invalidate();
            Window::SetText(rText);
        }
        else
        {
            Invalidate();
            Window::SetText(rText);
            Update();
        }
        Window::SetText(rText);
        Invalidate();
    }
    else if (mbProgressMode)
    {
@@ -1396,7 +1380,6 @@
        if (IsReallyVisible())
        {
            Invalidate();
            Update();
        }
    }
    else