From 974d65aed528783bb06b96e5400b5ab347e0b258 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 22 Sep 2017 17:17:34 +0200 Subject: 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 Reviewed-by: Michael Stahl --- vcl/unx/gtk/a11y/atkutil.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'vcl/unx/gtk/a11y') 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 #include +#include #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&) { -- cgit v1.2.3