tdf#154470 try moving the Show of the client to after the float positioning

Change-Id: I785120bdad1a3c3311aeca0c8ec5b8b014999872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150108
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 11fa327..75437f8 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -341,10 +341,11 @@ enum class FloatWinPopupFlags
    NoMouseUpClose       = 0x000200,
    GrabFocus            = 0x000400,
    NoHorzPlacement      = 0x000800,
    MakeClientWindowVisibleBeforePopup  = 0x001000,
};
namespace o3tl
{
    template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x0fff> {};
    template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x1fff> {};
}

// Flags for Window::Show()
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 3ab98c5..d64f7cd 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -821,8 +821,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
    if( pParentToolBox->IsKeyEvent() )
        nFlags |= FloatWinPopupFlags::GrabFocus;

    GetWindow()->Show(true, ShowFlags::NoFocusChange | ShowFlags::NoActivate);
    mpFloatWin->StartPopupMode( pParentToolBox, nFlags );
    mpFloatWin->StartPopupMode( pParentToolBox, nFlags | FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup);

    if( pParentToolBox->IsKeyEvent() )
    {
@@ -839,8 +838,7 @@ void ImplDockingWindowWrapper::StartPopupMode( const tools::Rectangle& rRect, Fl
        return;

    ImplPreparePopupMode();
    GetWindow()->Show(true, ShowFlags::NoFocusChange | ShowFlags::NoActivate);
    mpFloatWin->StartPopupMode( rRect, nFlags );
    mpFloatWin->StartPopupMode( rRect, nFlags | FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup);
}

IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 6fd221b..7455a3bb 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -795,6 +795,21 @@ void FloatingWindow::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopu
    SetPosPixel( mpImplData->maPos );
    ImplGetFrame()->PositionByToolkit(rRect, nFlags);

    /*
    tdf#140762 tdf#152671 Make dock win visible before showing popup

    Make them visible again *before* starting popup mode for the floating
    window.  This e.g. makes NVDA announce popups in the toolbar or the Calc
    autofilter dropdown.
    */
    if (nFlags & FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup)
    {
        if (vcl::Window* pClientWindow = ImplGetClientWindow())
        {
            pClientWindow->Show(true, ShowFlags::NoFocusChange | ShowFlags::NoActivate);
        }
    }

    // set data and display window
    // convert maFloatRect to absolute device coordinates
    // so they can be compared across different frames