Kaydet (Commit) 250ad931 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#115227 svtools: suppress UNO notifications for color selectors

This is nominally a regression from commit
43bc3031 (unify color selectors,
2016-10-28), but that just changed the Writer color picker to behave the
same way as the Impress one.

The Impress one started to emit these events with
daeed90f (re-base on ALv2 code.
Includes:, 2012-11-15), to fix i#118707, improving accessibility.

That means either the focus changes and then accessibility is happy or
the focus does not change and then the UNO API client only gets events
when the user actually switches to an other window.

Fix the problem with suppressing UNO-level notifications for the
problematic events, by moving the existing VclListenerLock to a public
header and using it at two more places in svtools.

This should address not just color selectors, but in general other
toolbar menus / popup windows.

Change-Id: If427708c5b9fe4fa49cb8f00ec04b32cb28eb391
Reviewed-on: https://gerrit.libreoffice.org/48570Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 19f8a979
......@@ -233,6 +233,23 @@ public:
virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override;
};
class TOOLKIT_DLLPUBLIC VclListenerLock
{
private:
VCLXWindow* m_pLockWindow;
public:
explicit VclListenerLock(VCLXWindow* _pLockWindow);
/**
* @param bSystemWindow - if pVclWindow or its first system window parent
* is locked.
*/
explicit VclListenerLock(vcl::Window* pVclWindow, bool bSystemWindow);
~VclListenerLock();
VclListenerLock(const VclListenerLock&) = delete;
VclListenerLock& operator=(const VclListenerLock&) = delete;
};
#endif // INCLUDED_TOOLKIT_AWT_VCLXWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -35,6 +35,7 @@
#include <svtools/framestatuslistener.hxx>
#include <svtools/valueset.hxx>
#include <svtools/toolbarmenu.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include "toolbarmenuimp.hxx"
using namespace ::com::sun::star::uno;
......@@ -1486,6 +1487,7 @@ bool ToolbarPopup::IsInPopupMode()
void ToolbarPopup::EndPopupMode()
{
VclListenerLock aLock(this, /*bSystemWindow=*/true);
GetDockingManager()->EndPopupMode(this);
}
......
......@@ -19,6 +19,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/svapp.hxx>
......@@ -213,6 +214,8 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow()
pWin->EnableDocking();
mxImpl->SetPopupWindow(pWin,pToolBox);
VclListenerLock aLock(pWin, /*bSystemWindow=*/true);
vcl::Window::GetDockingManager()->StartPopupMode( pToolBox, pWin, eFloatFlags );
}
}
......
......@@ -94,27 +94,50 @@ static Sequence< OUString> lcl_ImplGetPropertyNames( const Reference< XMultiProp
return aNames;
}
class VclListenerLock
namespace
{
private:
VCLXWindow* m_pLockWindow;
public:
explicit VclListenerLock( VCLXWindow* _pLockWindow )
: m_pLockWindow( _pLockWindow )
VCLXWindow* GetParentSystemWindow(vcl::Window* pWindow)
{
while (pWindow)
{
if ( m_pLockWindow )
m_pLockWindow->suspendVclEventListening( );
if (pWindow->IsSystemWindow())
break;
pWindow = pWindow->GetParent();
}
~VclListenerLock()
uno::Reference<awt::XWindow> xWindow = VCLUnoHelper::GetInterface(pWindow);
return VCLXWindow::GetImplementation(xWindow);
}
}
VclListenerLock::VclListenerLock(VCLXWindow* _pLockWindow)
: m_pLockWindow(_pLockWindow)
{
if (m_pLockWindow)
m_pLockWindow->suspendVclEventListening();
}
VclListenerLock::VclListenerLock(vcl::Window* pVclWindow, bool bSystemWindow)
: m_pLockWindow(nullptr)
{
if (bSystemWindow)
m_pLockWindow = GetParentSystemWindow(pVclWindow);
else
{
if ( m_pLockWindow )
m_pLockWindow->resumeVclEventListening( );
uno::Reference<awt::XWindow> xWindow = VCLUnoHelper::GetInterface(pVclWindow);
m_pLockWindow = VCLXWindow::GetImplementation(xWindow);
}
VclListenerLock(const VclListenerLock&) = delete;
VclListenerLock& operator=(const VclListenerLock&) = delete;
};
if (m_pLockWindow)
m_pLockWindow->suspendVclEventListening();
}
VclListenerLock::~VclListenerLock()
{
if (m_pLockWindow)
m_pLockWindow->resumeVclEventListening();
}
typedef ::std::map< OUString, sal_Int32 > MapString2Int;
struct UnoControl_Data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment