summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-09-01 14:32:01 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2016-09-23 23:25:48 +0200
commit06283e7b00f9f7b7ad1a3e30d2dcb85c8d550588 (patch)
tree94a0d9797f1717a5f6ac18e55882d97decedffe8 /vcl
parent3bc2b8c5e0c4213b53a974944189bdf7f8155502 (diff)
tdf#101822 X11 SalDisplay init => AfterAppInit
This fixes all X11 based VCL plugins to move display initialization into AfterAppInit (gen, TDE, KDE4), This is done by moving input method and display into SalXLib, so they are available in AfterAppInit. Otherwise the configmgr service won't be available in SalDisplay::BestVisual. Change-Id: I9380075b9770bceb8f453bbcb7fe31291634ff89
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/kde/kdedata.hxx3
-rw-r--r--vcl/inc/unx/saldisp.hxx17
-rw-r--r--vcl/inc/unx/salinst.h5
-rw-r--r--vcl/unx/generic/app/saldata.cxx24
-rw-r--r--vcl/unx/generic/app/saldisp.cxx21
-rw-r--r--vcl/unx/generic/app/salinst.cxx17
-rw-r--r--vcl/unx/kde/kdedata.cxx11
-rw-r--r--vcl/unx/kde/salnativewidgets-kde.cxx6
-rw-r--r--vcl/unx/kde4/KDESalInstance.cxx8
-rw-r--r--vcl/unx/kde4/KDESalInstance.hxx3
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx10
11 files changed, 86 insertions, 39 deletions
diff --git a/vcl/inc/unx/kde/kdedata.hxx b/vcl/inc/unx/kde/kdedata.hxx
index 025e0f9924c0..cc238dc95aa9 100644
--- a/vcl/inc/unx/kde/kdedata.hxx
+++ b/vcl/inc/unx/kde/kdedata.hxx
@@ -71,6 +71,9 @@ public:
class KDESalInstance : public X11SalInstance
{
+protected:
+ virtual SalX11Display* CreateDisplay() const override;
+
public:
KDESalInstance( SalYieldMutex* pMutex )
: X11SalInstance( pMutex ) {}
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 7be3df6563ad..ee651b67a221 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -143,6 +143,8 @@ public:
SalColor GetColor( Pixel nPixel ) const;
};
+class SalI18N_InputMethod;
+
typedef int(*YieldFunc)(int fd, void* data);
class VCLPLUG_GEN_PUBLIC SalXLib
@@ -157,6 +159,9 @@ protected:
fd_set aReadFDS_;
fd_set aExceptionFDS_;
+ Display *m_pDisplay;
+ SalI18N_InputMethod *m_pInputMethod;
+
public:
SalXLib();
virtual ~SalXLib();
@@ -176,9 +181,12 @@ public:
virtual void StopTimer();
bool CheckTimeout( bool bExecuteTimers = true );
+
+ SalI18N_InputMethod* GetInputMethod() const { return m_pInputMethod; }
+ void SetInputMethod( SalI18N_InputMethod *pInputMethod );
+ Display* GetDisplay() const { return m_pDisplay; }
};
-class SalI18N_InputMethod;
class SalI18N_KeyboardExtension;
class AttributeProvider;
@@ -251,7 +259,6 @@ public:
protected:
SalXLib *pXLib_;
- SalI18N_InputMethod *mpInputMethod;
SalI18N_KeyboardExtension *mpKbdExtension;
AttributeProvider *mpFactory;
@@ -359,10 +366,8 @@ public:
bool XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate ) const;
SalXLib* GetXLib() const { return pXLib_; }
- SalI18N_InputMethod* GetInputMethod() const { return mpInputMethod; }
+ SalI18N_InputMethod* GetInputMethod() const { return pXLib_->GetInputMethod(); }
SalI18N_KeyboardExtension* GetKbdExtension() const { return mpKbdExtension; }
- void SetInputMethod( SalI18N_InputMethod *pInputMethod )
- { mpInputMethod = pInputMethod; }
void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
{ mpKbdExtension = pKbdExtension; }
::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; }
@@ -394,7 +399,7 @@ public:
virtual void PostUserEvent() override;
bool IsEvent();
- void SetupInput( SalI18N_InputMethod *pInputMethod );
+ void SetupInput();
};
namespace vcl_sal {
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index fdb1dee6b5a7..3c3934ba08c1 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -34,6 +34,7 @@ namespace com { namespace sun { namespace star { namespace datatransfer {
class SalXLib;
class X11SalGraphics;
+class SalX11Display;
class VCLPLUG_GEN_PUBLIC X11SalInstance : public SalGenericInstance
{
@@ -43,6 +44,8 @@ private:
protected:
SalXLib *mpXLib;
+ virtual SalX11Display* CreateDisplay() const;
+
public:
explicit X11SalInstance(SalYieldMutex* pMutex);
virtual ~X11SalInstance() override;
@@ -77,6 +80,8 @@ public:
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) override;
void SetLib( SalXLib *pXLib ) { mpXLib = pXLib; }
+ virtual void AfterAppInit() override;
+
// dtrans implementation
virtual css::uno::Reference< css::uno::XInterface >
CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index b584f66a1eab..d607bd700be1 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -334,6 +334,9 @@ SalXLib::SalXLib()
FD_ZERO( &aReadFDS_ );
FD_ZERO( &aExceptionFDS_ );
+ m_pInputMethod = nullptr;
+ m_pDisplay = nullptr;
+
m_pTimeoutFDS[0] = m_pTimeoutFDS[1] = -1;
if (pipe (m_pTimeoutFDS) != -1)
{
@@ -375,6 +378,14 @@ SalXLib::~SalXLib()
// close 'wakeup' pipe.
close (m_pTimeoutFDS[0]);
close (m_pTimeoutFDS[1]);
+
+ delete m_pInputMethod;
+}
+
+void SalXLib::SetInputMethod( SalI18N_InputMethod *pInputMethod )
+{
+ delete m_pInputMethod;
+ m_pInputMethod = pInputMethod;
}
static Display *OpenX11Display(OString& rDisplay)
@@ -431,14 +442,14 @@ static Display *OpenX11Display(OString& rDisplay)
void SalXLib::Init()
{
- SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
- pInputMethod->SetLocale();
+ m_pInputMethod = new SalI18N_InputMethod;
+ m_pInputMethod->SetLocale();
XrmInitialize();
OString aDisplay;
- Display *pDisp = OpenX11Display(aDisplay);
+ m_pDisplay = OpenX11Display(aDisplay);
- if ( !pDisp )
+ if ( !m_pDisplay )
{
OUString aProgramFileURL;
osl_getExecutableFile( &aProgramFileURL.pData );
@@ -455,11 +466,6 @@ void SalXLib::Init()
std::fflush( stderr );
exit(0);
}
-
- SalX11Display *pSalDisplay = new SalX11Display( pDisp );
-
- pInputMethod->CreateMethod( pDisp );
- pSalDisplay->SetupInput( pInputMethod );
}
extern "C" {
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 881827b15f54..2f21308ceea9 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -285,7 +285,6 @@ bool SalDisplay::BestVisual( Display *pDisplay,
SalDisplay::SalDisplay( Display *display ) :
pXLib_( nullptr ),
- mpInputMethod( nullptr ),
mpKbdExtension( nullptr ),
mpFactory( nullptr ),
pDisp_( display ),
@@ -343,8 +342,6 @@ void SalDisplay::doDestruct()
if( IsDisplay() )
{
- delete mpInputMethod;
- mpInputMethod = nullptr;
delete mpKbdExtension;
mpKbdExtension = nullptr;
@@ -662,10 +659,8 @@ void SalDisplay::Init()
#endif
}
-void SalX11Display::SetupInput( SalI18N_InputMethod *pInputMethod )
+void SalX11Display::SetupInput()
{
- SetInputMethod( pInputMethod );
-
GetGenericData()->ErrorTrapPush();
SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp_ );
XSync( pDisp_, False );
@@ -1444,10 +1439,14 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent,
memset( pPrintable, 0, *pLen );
*pStatusReturn = 0;
+ SalI18N_InputMethod *pInputMethod = nullptr;
+ if ( pXLib_ )
+ pInputMethod = pXLib_->GetInputMethod();
+
// first get the printable of the possibly modified KeySym
if ( (aInputContext == nullptr)
|| (pEvent->type == KeyRelease)
- || (mpInputMethod != nullptr && mpInputMethod->PosixLocale()) )
+ || (pInputMethod != nullptr && pInputMethod->PosixLocale()) )
{
// XmbLookupString must not be called for KeyRelease events
// Cannot enter space in c locale problem #89616# #88978# btraq #4478197
@@ -1960,6 +1959,10 @@ void SalX11Display::Yield()
bool SalX11Display::Dispatch( XEvent *pEvent )
{
+ SalI18N_InputMethod *pInputMethod = nullptr;
+ if ( pXLib_ )
+ pInputMethod = pXLib_->GetInputMethod();
+
if( pEvent->type == KeyPress || pEvent->type == KeyRelease )
{
::Window aWindow = pEvent->xkey.window;
@@ -1976,12 +1979,12 @@ bool SalX11Display::Dispatch( XEvent *pEvent )
}
if( it != m_aFrames.end() )
{
- if ( mpInputMethod->FilterEvent( pEvent , aWindow ) )
+ if ( pInputMethod && pInputMethod->FilterEvent( pEvent , aWindow ) )
return false;
}
}
else
- if ( mpInputMethod->FilterEvent( pEvent, None ) )
+ if ( pInputMethod && pInputMethod->FilterEvent( pEvent, None ) )
return false;
SalInstance* pInstance = GetSalData()->m_pInstance;
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index c995a4881601..77941353c3a4 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -31,6 +31,8 @@
#include <unx/salframe.h>
#include <unx/genprn.h>
#include <unx/sm.hxx>
+#include <unx/i18n_im.hxx>
+#include <unx/saldisp.hxx>
#include <vcl/inputtypes.hxx>
#include <vcl/helper.hxx>
@@ -85,6 +87,11 @@ X11SalInstance::~X11SalInstance()
GetGenericData()->Dispose();
}
+SalX11Display* X11SalInstance::CreateDisplay() const
+{
+ return new SalX11Display( mpXLib->GetDisplay() );
+}
+
// AnyInput from sv/mow/source/app/svapp.cxx
struct PredicateReturn
@@ -195,6 +202,16 @@ void X11SalInstance::DestroyFrame( SalFrame* pFrame )
delete pFrame;
}
+void X11SalInstance::AfterAppInit()
+{
+ assert( mpXLib->GetDisplay() );
+ assert( mpXLib->GetInputMethod() );
+
+ SalX11Display *pSalDisplay = CreateDisplay();
+ mpXLib->GetInputMethod()->CreateMethod( mpXLib->GetDisplay() );
+ pSalDisplay->SetupInput();
+}
+
extern "C" { static void SAL_CALL thisModule() {} }
void X11SalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService)
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index f136cc60f293..71955f5a764c 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -104,8 +104,8 @@ KDEXLib::~KDEXLib()
void KDEXLib::Init()
{
- SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
- pInputMethod->SetLocale();
+ m_pInputMethod = new SalI18N_InputMethod;
+ m_pInputMethod->SetLocale();
XrmInitialize();
KAboutData *kAboutData = new KAboutData( "LibreOffice",
@@ -163,12 +163,7 @@ void KDEXLib::Init()
m_pApplication = new VCLKDEApplication();
kapp->disableSessionManagement();
- Display* pDisp = QPaintDevice::x11AppDisplay();
-
- SalX11Display *pSalDisplay = new SalKDEDisplay( pDisp );
-
- pInputMethod->CreateMethod( pDisp );
- pSalDisplay->SetupInput( pInputMethod );
+ m_pDisplay = QPaintDevice::x11AppDisplay();
}
void KDEXLib::doStartup()
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index 6fd0de51afe7..77fd622d1fa3 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -27,6 +27,7 @@
#include <unx/salgdi.h>
#include <unx/kde/kdedata.hxx>
#include "unx/pixmap.hxx"
+#include <unx/i18n_im.hxx>
#include <vcl/settings.hxx>
#include "unx/fontmanager.hxx"
@@ -2106,6 +2107,11 @@ uno::Reference< ui::dialogs::XFilePicker2 > KDESalInstance::createFilePicker(
new UnxFilePicker( xMSF ) );
}
+SalX11Display* KDESalInstance::CreateDisplay() const
+{
+ return new SalKDEDisplay( QPaintDevice::x11AppDisplay() );
+}
+
// KDESalData pieces
// Create the widget painter so we have some control over
diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx
index 86c9d8f2e50f..f8bf400fbfa2 100644
--- a/vcl/unx/kde4/KDESalInstance.cxx
+++ b/vcl/unx/kde4/KDESalInstance.cxx
@@ -23,6 +23,9 @@
#include "KDESalFrame.hxx"
#include "KDEXLib.hxx"
+#include "KDESalDisplay.hxx"
+
+#include <QX11Info>
using namespace com::sun::star;
@@ -55,4 +58,9 @@ int KDESalInstance::getFrameWidth()
return static_cast<KDEXLib*>( mpXLib )->getFrameWidth();
}
+SalX11Display* KDESalInstance::CreateDisplay() const
+{
+ return new SalKDEDisplay( QX11Info::display() );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx
index 45acd789cd4f..2220816a334c 100644
--- a/vcl/unx/kde4/KDESalInstance.hxx
+++ b/vcl/unx/kde4/KDESalInstance.hxx
@@ -26,6 +26,9 @@ class SalFrame;
class KDESalInstance : public X11SalInstance
{
+ protected:
+ virtual SalX11Display* CreateDisplay() const override;
+
public:
explicit KDESalInstance(SalYieldMutex* pMutex);
virtual ~KDESalInstance() override {}
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 38f515097827..510c5c9c81e2 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -96,8 +96,8 @@ KDEXLib::~KDEXLib()
void KDEXLib::Init()
{
- SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
- pInputMethod->SetLocale();
+ m_pInputMethod = new SalI18N_InputMethod;
+ m_pInputMethod->SetLocale();
XrmInitialize();
KAboutData *kAboutData = new KAboutData( "LibreOffice",
@@ -195,11 +195,7 @@ void KDEXLib::Init()
setupEventLoop();
- Display* pDisp = QX11Info::display();
- SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
-
- pInputMethod->CreateMethod( pDisp );
- pSalDisplay->SetupInput( pInputMethod );
+ m_pDisplay = QX11Info::display();
}
// When we use Qt event loop, it can actually use its own event loop handling, or wrap