diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-09-22 17:17:34 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-09-25 15:15:55 +0200 |
commit | 974d65aed528783bb06b96e5400b5ab347e0b258 (patch) | |
tree | 3211b6344488908ce5556e04770dfa9ce9077f04 /vcl | |
parent | 1de71f95047630c1488e0a63a3a43cea8dfb8507 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkdata.hxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkutil.cxx | 19 | ||||
-rw-r--r-- | vcl/unx/gtk/gtkdata.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkdata.cxx | 1 |
4 files changed, 26 insertions, 3 deletions
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; } |