summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-25 12:21:12 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-01-25 16:27:52 +0100
commit250ad9311a613d9b4e1cf5cf5fdaf33d9b326220 (patch)
treed910f6b5810ba6a78424df37338993458819a990 /toolkit
parent19f8a979ff86be39a3938b3d7b25c1431191e708 (diff)
tdf#115227 svtools: suppress UNO notifications for color selectors
This is nominally a regression from commit 43bc3031483d172eccd72c3804e2d4fc2ef37de4 (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 daeed90f4586eb9533041fb89bee163a5193596c (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/48570 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/unocontrol.cxx55
1 files changed, 39 insertions, 16 deletions
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 6c8435791883..2f41e3f367d4 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -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