vcl/inc/unx/gtk/gtkdata.hxx | 8 ++++++++ vcl/unx/gtk/a11y/atkutil.cxx | 19 ++++++++++++++++--- vcl/unx/gtk/gtkdata.cxx | 1 + vcl/unx/gtk3/gtk3gtkdata.cxx | 1 + 4 files changed, 26 insertions(+), 3 deletions(-)
New commits: commit 974d65aed528783bb06b96e5400b5ab347e0b258 Author: Michael Stahl <[email protected]> Date: Fri Sep 22 17:17:34 2017 +0200 vcl: [loplugin:badstatics] aDocumentFocusListener Move it into class GtkSalData; have to use 2 variables because the class is only defined in atkutil.cxx but the ~GtkSalData is in gtkdata.cxx. Change-Id: I3b12f02a1a5454f39206cbd0fe224d3f08a44c73 Reviewed-on: https://gerrit.libreoffice.org/42673 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 146c1656f302..4f4d520fc141 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -35,7 +35,10 @@ #include <list> +namespace com { namespace sun { namespace star { namespace accessibility { class XAccessibleEventListener; } } } } + class GtkSalDisplay; +class DocumentFocusListener; inline GdkWindow * widget_get_window(GtkWidget *widget) { @@ -99,10 +102,15 @@ class GtkSalData : public GenericUnixSalData osl::Condition m_aDispatchCondition; css::uno::Any m_aException; + css::uno::Reference<css::accessibility::XAccessibleEventListener> m_xDocumentFocusListener; + DocumentFocusListener * m_pDocumentFocusListener; + public: GtkSalData( SalInstance *pInstance ); virtual ~GtkSalData() override; + DocumentFocusListener & GetDocumentFocusListener(); + void Init(); virtual void Dispose() override; diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index c30a41905302..14bb6045c376 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -38,6 +38,7 @@ #include <vcl/menu.hxx> #include <vcl/toolbox.hxx> +#include <unx/gtk/gtkdata.hxx> #include "atkwrapper.hxx" #include "atkutil.hxx" @@ -512,10 +513,22 @@ WindowList g_aWindowList; } +DocumentFocusListener & GtkSalData::GetDocumentFocusListener() +{ + if (!m_pDocumentFocusListener) + { + m_pDocumentFocusListener = new DocumentFocusListener; + m_xDocumentFocusListener.set(m_pDocumentFocusListener); + } + return *m_pDocumentFocusListener; +} + static void handle_get_focus(::VclWindowEvent const * pEvent) { - static rtl::Reference< DocumentFocusListener > aDocumentFocusListener = - new DocumentFocusListener; + GtkSalData *const pSalData(GetGtkSalData()); + assert(pSalData); + + DocumentFocusListener & rDocumentFocusListener(pSalData->GetDocumentFocusListener()); vcl::Window *pWindow = pEvent->GetWindow(); @@ -566,7 +579,7 @@ static void handle_get_focus(::VclWindowEvent const * pEvent) g_aWindowList.list.insert(pWindow); try { - aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + rDocumentFocusListener.attachRecursive(xAccessible, xContext, xStateSet); } catch (const uno::Exception&) { diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx index e5cdd81daba0..eaa34d9461e5 100644 --- a/vcl/unx/gtk/gtkdata.cxx +++ b/vcl/unx/gtk/gtkdata.cxx @@ -417,6 +417,7 @@ GtkSalData::GtkSalData( SalInstance *pInstance ) : GenericUnixSalData( SAL_DATA_GTK, pInstance ) , m_aDispatchMutex() , m_aDispatchCondition() + , m_pDocumentFocusListener(nullptr) { m_pUserEvent = nullptr; } diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx index 4057b0e896c9..844dc77f20c1 100644 --- a/vcl/unx/gtk3/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/gtk3gtkdata.cxx @@ -388,6 +388,7 @@ GtkSalData::GtkSalData( SalInstance *pInstance ) : GenericUnixSalData( SAL_DATA_GTK3, pInstance ) , m_aDispatchMutex() , m_aDispatchCondition() + , m_pDocumentFocusListener(nullptr) { m_pUserEvent = nullptr; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
