summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-10-20 17:22:19 +0100
committerMichael Meeks <michael.meeks@suse.com>2011-10-25 13:41:56 +0100
commit1bfd9b5465f1a2930210a54c285936c3ecb4bff5 (patch)
tree8b690658e162b359607ef6a1b4a3f9a33ef54564 /vcl
parent0dc6cb349ca1246a0febfaad15e5724fef2bd264 (diff)
generic: fix misc. initialization problems & simplify a little
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/svpinst.cxx14
-rw-r--r--vcl/inc/generic/gendata.hxx6
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx2
-rw-r--r--vcl/inc/unx/kde/kdedata.hxx2
-rw-r--r--vcl/inc/unx/saldata.hxx2
-rw-r--r--vcl/unx/generic/app/saldata.cxx5
-rw-r--r--vcl/unx/generic/app/salinst.cxx7
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx6
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx4
-rw-r--r--vcl/unx/kde/kdedata.cxx5
-rw-r--r--vcl/unx/kde4/KDEData.hxx3
-rw-r--r--vcl/unx/kde4/main.cxx5
12 files changed, 32 insertions, 29 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index b3e868316a58..9c0eb6ea0430 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -43,20 +43,26 @@
#include <salframe.hxx>
#include <svdata.hxx>
-#include <saldatabasic.hxx>
+#include <generic/gendata.hxx>
#include <vcl/solarmutex.hxx>
// FIXME: split off into a separate, standalone module to aid linking
#ifndef GTK3_INCLUDED
+class SvpSalData : public SalGenericData
+{
+public:
+ SvpSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_SVP, pInstance ) { }
+ virtual void ErrorTrapPush() {}
+ virtual bool ErrorTrapPop( bool ) { return false; }
+};
+
// plugin factory function
extern "C"
{
SAL_DLLPUBLIC_EXPORT SalInstance* create_SalInstance()
{
SvpSalInstance* pInstance = new SvpSalInstance( new SalYieldMutex() );
- SalData* pSalData = new SalData();
- pSalData->m_pInstance = pInstance;
- SetSalData( pSalData );
+ new SvpSalData( pInstance );
return pInstance;
}
}
diff --git a/vcl/inc/generic/gendata.hxx b/vcl/inc/generic/gendata.hxx
index 10b0a09fc66d..c52e8919f16a 100644
--- a/vcl/inc/generic/gendata.hxx
+++ b/vcl/inc/generic/gendata.hxx
@@ -39,7 +39,7 @@ class SalDisplay;
class GtkSalDisplay;
enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
SAL_DATA_KDE3, SAL_DATA_KDE4,
- SAL_DATA_UNX };
+ SAL_DATA_UNX, SAL_DATA_SVP };
class VCL_DLLPUBLIC SalGenericData : public SalData
{
@@ -51,7 +51,7 @@ class VCL_DLLPUBLIC SalGenericData : public SalData
// for transient storage of unicode strings eg. 'u123' by input methods
rtl::OUString m_aUnicodeEntry;
public:
- SalGenericData( SalGenericDataType t ) : SalData(), m_eType( t ), m_pDisplay( NULL ) {}
+ SalGenericData( SalGenericDataType t, SalInstance *pInstance ) : SalData(), m_eType( t ), m_pDisplay( NULL ) { m_pInstance = pInstance; SetSalData( this ); }
virtual ~SalGenericData() {}
virtual void Dispose() {}
@@ -80,7 +80,7 @@ class VCL_DLLPUBLIC SalGenericData : public SalData
// Not the prettiest - but helpful for migrating old code ...
inline SalDisplay *GetSalDisplay() const
{
- OSL_ASSERT( m_eType == SAL_DATA_UNX || m_eType == SAL_DATA_GTK );
+ OSL_ASSERT( m_eType != SAL_DATA_GTK3 );
return (SalDisplay *)GetDisplay();
}
inline GtkSalDisplay *GetGtkDisplay() const
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 0c9af2ae508e..458dfdd1cfab 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -100,7 +100,7 @@ class GtkData : public SalGenericData
oslCondition m_aDispatchCondition;
public:
- GtkData();
+ GtkData( SalInstance *pInstance );
virtual ~GtkData();
virtual void Init();
diff --git a/vcl/inc/unx/kde/kdedata.hxx b/vcl/inc/unx/kde/kdedata.hxx
index f948af090379..6112b47c5a7d 100644
--- a/vcl/inc/unx/kde/kdedata.hxx
+++ b/vcl/inc/unx/kde/kdedata.hxx
@@ -36,7 +36,7 @@
class KDEData : public X11SalData
{
public:
- KDEData() : X11SalData( SAL_DATA_KDE3 ) {}
+ KDEData( SalInstance *pInstance ) : X11SalData( SAL_DATA_KDE3, pInstance ) {}
virtual ~KDEData();
virtual void Init();
diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx
index 2d5dca512673..9c49014309ab 100644
--- a/vcl/inc/unx/saldata.hxx
+++ b/vcl/inc/unx/saldata.hxx
@@ -76,7 +76,7 @@ protected:
pthread_t hMainThread_;
public:
- X11SalData( SalGenericDataType t );
+ X11SalData( SalGenericDataType t, SalInstance *pInstance );
virtual ~X11SalData();
virtual void Init();
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 4b235a4f7ac6..0459ee4139a7 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -236,11 +236,10 @@ static const char* XRequest[] = {
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <pthread.h>
-X11SalData::X11SalData( SalGenericDataType t )
- : SalGenericData( t )
+X11SalData::X11SalData( SalGenericDataType t, SalInstance *pInstance )
+ : SalGenericData( t, pInstance )
{
pXLib_ = NULL;
- m_pInstance = NULL;
m_pPlugin = NULL;
hMainThread_ = pthread_self();
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 27ceda05fc99..c98ed9da290d 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -74,9 +74,8 @@ extern "C"
X11SalInstance* pInstance = new X11SalInstance( new SalYieldMutex() );
// initialize SalData
- X11SalData *pSalData = new X11SalData( SAL_DATA_UNX );
- SetSalData( pSalData );
- pSalData->m_pInstance = pInstance;
+ X11SalData *pSalData = new X11SalData( SAL_DATA_UNX, pInstance );
+
pSalData->Init();
pInstance->SetLib( pSalData->GetLib() );
@@ -168,7 +167,9 @@ bool X11SalInstance::AnyInput(sal_uInt16 nType)
bRet = aInput.bRet;
}
+#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "AnyInput 0x%x = %s\n", nType, bRet ? "true" : "false" );
+#endif
return bRet;
}
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 9de7075c7d5c..27a2413a6c56 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -537,11 +537,11 @@ int GtkSalDisplay::CaptureMouse( SalFrame* pSFrame )
* class GtkData *
**********************************************************************/
-GtkData::GtkData()
+GtkData::GtkData( SalInstance *pInstance )
#if GTK_CHECK_VERSION(3,0,0)
- : SalGenericData( SAL_DATA_GTK3 )
+ : SalGenericData( SAL_DATA_GTK3, pInstance )
#else
- : SalGenericData( SAL_DATA_GTK )
+ : SalGenericData( SAL_DATA_GTK, pInstance )
#endif
{
m_pUserEvent = NULL;
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index b50e38cc7904..b5b70c08d2bd 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -189,9 +189,7 @@ extern "C"
#endif
// initialize SalData
- GtkData *pSalData = new GtkData();
- SetSalData( pSalData );
- pSalData->m_pInstance = pInstance;
+ GtkData *pSalData = new GtkData( pInstance );
pSalData->Init();
pSalData->initNWF();
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index 177fa4ed5e3a..0eb4e4f6eafc 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -254,10 +254,9 @@ extern "C" {
#endif
// initialize SalData
- KDEData *pSalData = new KDEData();
- SetSalData( pSalData );
- pSalData->m_pInstance = pInstance;
+ KDEData *pSalData = new KDEData( pInstance );
pSalData->Init();
+ pInstance->SetLib( pSalData->GetLib() );
pSalData->initNWF();
return pInstance;
diff --git a/vcl/unx/kde4/KDEData.hxx b/vcl/unx/kde4/KDEData.hxx
index 5b487f9ce3fa..7cf38a824391 100644
--- a/vcl/unx/kde4/KDEData.hxx
+++ b/vcl/unx/kde4/KDEData.hxx
@@ -34,7 +34,8 @@
class KDEData : public X11SalData
{
public:
- KDEData() : X11SalData( SAL_DATA_KDE4 ) {}
+ KDEData( SalInstance *pInstance )
+ : X11SalData( SAL_DATA_KDE4, pInstance ) {}
virtual ~KDEData();
virtual void Init();
diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx
index 12e4e14ce286..a0028a37eff7 100644
--- a/vcl/unx/kde4/main.cxx
+++ b/vcl/unx/kde4/main.cxx
@@ -97,11 +97,10 @@ extern "C" {
#endif
// initialize SalData
- KDEData *salData = new KDEData();
- SetSalData(salData);
- salData->m_pInstance = pInstance;
+ KDEData *salData = new KDEData( pInstance );
salData->Init();
salData->initNWF();
+ pInstance->SetLib(salData->GetLib());
return pInstance;
}