diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-09-29 10:54:48 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-10-01 01:21:03 +0200 |
commit | 4c6f17f730929e630ec2412785e2f4a8964940c7 (patch) | |
tree | 6018c68d591bbd8f037c2a52bf81f6af00bee6be /framework/source/uielement | |
parent | cb9970400d0bbd73e508f25a67e1ad2c7dd28eb6 (diff) |
Wayland: Make the shapes popup work in the overflow toolbar
Was failing to show, with this warning:
Gdk-WARNING **: Tried to map a popup with a non-top most parent
To make it work, needed to implement a way to pass as extra
"ParentWindow" property to the ui element. It's documented in the
XUIElementFactory idl, but was not used by the framework impl.
Change-Id: Ifea24fc333709478634f70230699963e952e9157
Reviewed-on: https://gerrit.libreoffice.org/42937
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/source/uielement')
-rw-r--r-- | framework/source/uielement/subtoolbarcontroller.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/toolbarwrapper.cxx | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index 0ef2c4ab8af6..e712dd3801a5 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -208,6 +208,7 @@ css::uno::Reference< css::awt::XWindow > SubToolBarController::createPopupWindow auto aPropSeq( comphelper::InitPropertySequence( { { "Frame", css::uno::makeAny( xFrame ) }, + { "ParentWindow", css::uno::makeAny( m_xParentWindow ) }, { "Persistent", css::uno::makeAny( false ) }, { "PopupMode", css::uno::makeAny( true ) } } ) ); @@ -239,7 +240,6 @@ css::uno::Reference< css::awt::XWindow > SubToolBarController::createPopupWindow if ( pTbxWindow && pTbxWindow->GetType() == WindowType::TOOLBOX ) { ToolBox* pToolBar = static_cast< ToolBox* >( pTbxWindow.get() ); - pToolBar->SetParent( pToolBox ); // calc and set size for popup mode Size aSize = pToolBar->CalcPopupWindowSizePixel(); pToolBar->SetSizePixel( aSize ); diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 1f090b60760d..b5b56f0ab070 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -124,16 +124,16 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) UIConfigElementWrapperBase::initialize( aArguments ); bool bPopupMode( false ); + Reference< XWindow > xParentWindow; for ( sal_Int32 i = 0; i < aArguments.getLength(); i++ ) { PropertyValue aPropValue; if ( aArguments[i] >>= aPropValue ) { if ( aPropValue.Name == "PopupMode" ) - { aPropValue.Value >>= bPopupMode; - break; - } + else if ( aPropValue.Name == "ParentWindow" ) + xParentWindow.set( aPropValue.Value, UNO_QUERY ); } } @@ -145,7 +145,9 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) ToolBarManager* pToolBarManager = nullptr; { SolarMutexGuard aSolarMutexGuard; - VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + if ( !xParentWindow.is() ) + xParentWindow.set( xFrame->getContainerWindow() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xParentWindow ); if ( pWindow ) { sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE; |