diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2010-10-12 15:52:53 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2010-10-14 18:13:44 +0200 |
commit | 6b5a13a80bef8026abb53d665af3240ad3148eeb (patch) | |
tree | 32618903068576711c7e9ff42eec8e9ae66a240c /vcl/unx/kde4 | |
parent | ca6513e4d1813971f780370f40a0972b47fd747e (diff) |
proper accessor for SalKDEDisplay instead of random public vars
Diffstat (limited to 'vcl/unx/kde4')
-rw-r--r-- | vcl/unx/kde4/KDESalDisplay.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalDisplay.hxx | 10 | ||||
-rw-r--r-- | vcl/unx/kde4/KDEXLib.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/kde4/VCLKDEApplication.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/kde4/VCLKDEApplication.hxx | 4 |
5 files changed, 17 insertions, 9 deletions
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx index becaf55fe183..69781c1d495b 100644 --- a/vcl/unx/kde4/KDESalDisplay.cxx +++ b/vcl/unx/kde4/KDESalDisplay.cxx @@ -30,9 +30,15 @@ #include "KDEXLib.hxx" +#include <assert.h> + +SalKDEDisplay* SalKDEDisplay::selfptr = NULL; + SalKDEDisplay::SalKDEDisplay( Display* pDisp ) : SalX11Display( pDisp ) { + assert( selfptr == NULL ); + selfptr = this; } SalKDEDisplay::~SalKDEDisplay() @@ -41,6 +47,7 @@ SalKDEDisplay::~SalKDEDisplay() static_cast<KDEXLib*>(GetXLib())->doStartup(); // clean up own members doDestruct(); + selfptr = NULL; // prevent SalDisplay from closing KApplication's display pDisp_ = NULL; } diff --git a/vcl/unx/kde4/KDESalDisplay.hxx b/vcl/unx/kde4/KDESalDisplay.hxx index ded1405ae930..08201cbc747c 100644 --- a/vcl/unx/kde4/KDESalDisplay.hxx +++ b/vcl/unx/kde4/KDESalDisplay.hxx @@ -34,7 +34,15 @@ class SalKDEDisplay : public SalX11Display { public: SalKDEDisplay( Display* pDisp ); - virtual ~SalKDEDisplay(); + virtual ~SalKDEDisplay(); + static SalKDEDisplay* self(); + private: + static SalKDEDisplay* selfptr; }; +inline SalKDEDisplay* SalKDEDisplay::self() +{ + return selfptr; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 009c3d1647f1..1937f9a3b722 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -147,8 +147,6 @@ void KDEXLib::Init() Display* pDisp = QX11Info::display(); SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp); - m_pApplication->disp = pSalDisplay; - pInputMethod->CreateMethod( pDisp ); pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); diff --git a/vcl/unx/kde4/VCLKDEApplication.cxx b/vcl/unx/kde4/VCLKDEApplication.cxx index 0c6982d07054..c923598736e8 100644 --- a/vcl/unx/kde4/VCLKDEApplication.cxx +++ b/vcl/unx/kde4/VCLKDEApplication.cxx @@ -37,14 +37,13 @@ VCLKDEApplication::VCLKDEApplication() : KApplication() { - disp = 0; } bool VCLKDEApplication::x11EventFilter(XEvent* event) { //if we have a display and the display consumes the event //do not process the event in qt - if (disp && disp->Dispatch(event) > 0) + if (SalKDEDisplay::self() && SalKDEDisplay::self()->Dispatch(event) > 0) { return true; } diff --git a/vcl/unx/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx index 820fec5e03ce..17a9b6eb0917 100644 --- a/vcl/unx/kde4/VCLKDEApplication.hxx +++ b/vcl/unx/kde4/VCLKDEApplication.hxx @@ -36,8 +36,6 @@ #undef Region -class SalKDEDisplay; - /* #i59042# override KApplications method for session management * since it will interfere badly with our own. */ @@ -49,8 +47,6 @@ class VCLKDEApplication : public KApplication virtual void commitData(QSessionManager&) {}; virtual bool x11EventFilter(XEvent* event); - - SalKDEDisplay* disp; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |