[Libreoffice-commits] .: Branch 'feature/gtk3' - 5 commits - vcl/inc vcl/unx
Michael Meeks
michael at kemper.freedesktop.org
Mon Oct 3 12:03:10 PDT 2011
vcl/inc/generic/gendata.hxx | 99 +++++++++++++++
vcl/inc/generic/gendisp.hxx | 2
vcl/inc/generic/geninst.h | 21 +++
vcl/inc/unx/gtk/gtkdata.hxx | 33 +++--
vcl/inc/unx/gtk/gtkframe.hxx | 3
vcl/inc/unx/gtk/gtkinst.hxx | 6
vcl/inc/unx/kde/kdedata.hxx | 2
vcl/inc/unx/saldata.hxx | 83 +++++--------
vcl/inc/unx/saldisp.hxx | 53 +-------
vcl/inc/unx/salinst.h | 4
vcl/inc/unx/saltimer.h | 8 -
vcl/unx/generic/app/i18n_ic.cxx | 12 -
vcl/unx/generic/app/i18n_status.cxx | 16 +-
vcl/unx/generic/app/saldata.cxx | 192 +++++++++++++++----------------
vcl/unx/generic/app/saldisp.cxx | 54 +++++---
vcl/unx/generic/app/salinst.cxx | 29 ++--
vcl/unx/generic/app/saltimer.cxx | 6
vcl/unx/generic/app/sm.cxx | 8 -
vcl/unx/generic/app/wmadaptor.cxx | 168 ++++++++++++++-------------
vcl/unx/generic/dtrans/X11_selection.cxx | 8 -
vcl/unx/generic/gdi/gcach_xpeer.cxx | 8 -
vcl/unx/generic/gdi/salbmp.cxx | 19 +--
vcl/unx/generic/gdi/salgdi.cxx | 4
vcl/unx/generic/gdi/salgdi2.cxx | 9 -
vcl/unx/generic/gdi/salvd.cxx | 8 -
vcl/unx/generic/gdi/xrender_peer.cxx | 4
vcl/unx/generic/window/salframe.cxx | 54 +++++---
vcl/unx/generic/window/salobj.cxx | 29 ++--
vcl/unx/gtk/app/gtkdata.cxx | 100 +++++++++-------
vcl/unx/gtk/app/gtkinst.cxx | 46 ++++++-
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 6
vcl/unx/gtk/window/gtkframe.cxx | 88 +++++---------
vcl/unx/gtk/window/gtkobject.cxx | 6
vcl/unx/kde/kdedata.cxx | 13 --
vcl/unx/kde/salnativewidgets-kde.cxx | 2
vcl/unx/kde4/KDEData.hxx | 2
vcl/unx/kde4/KDESalDisplay.hxx | 4
vcl/unx/kde4/KDESalFrame.cxx | 2
vcl/unx/kde4/KDEXLib.cxx | 22 ---
vcl/unx/x11/x11sys.cxx | 10 -
40 files changed, 682 insertions(+), 561 deletions(-)
New commits:
commit 91edcac144aab23ab502d39ca6ddab21a52f9a78
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon Oct 3 20:00:17 2011 +0100
gtk3: try to improve AnyInput (absent toolkit support for it)
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 4e5f7b6..0c9af2a 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -86,9 +86,11 @@ class GtkSalTimer : public SalTimer
public:
GtkSalTimer();
~GtkSalTimer();
- sal_uLong m_nTimeoutMS;
virtual void Start( sal_uLong nMS );
virtual void Stop();
+ bool Expired();
+
+ sal_uLong m_nTimeoutMS;
};
class GtkData : public SalGenericData
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index e27042a..3df5218 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -79,6 +79,7 @@ public:
#define GTK_YIELD_GRAB() GtkYieldMutex::GtkYieldGuard aLocalGtkYieldGuard( static_cast<GtkYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex()) )
+class GtkSalTimer;
#if GTK_CHECK_VERSION(3,0,0)
class GtkInstance : public SvpSalInstance
{
@@ -109,6 +110,11 @@ public:
virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual bool AnyInput( sal_uInt16 nType );
+
+ void RemoveTimer (SalTimer *pTimer);
+ private:
+ std::vector<GtkSalTimer *> m_aTimers;
+ bool IsTimerExpired();
};
#endif // _VCL_GTKINST_HXX
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 62707b1..f5075a9 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -780,9 +780,23 @@ GtkSalTimer::GtkSalTimer()
GtkSalTimer::~GtkSalTimer()
{
+ GtkInstance *pInstance = static_cast<GtkInstance *>(GetSalData()->m_pInstance);
+ pInstance->RemoveTimer( this );
Stop();
}
+bool GtkSalTimer::Expired()
+{
+ if( !m_pTimeout )
+ return false;
+ GSourceFuncs *pKlass = m_pTimeout->source_funcs;
+ gint timeout = 0;
+ if( pKlass && pKlass->prepare )
+ return !!pKlass->prepare( m_pTimeout, &timeout );
+ else
+ return false;
+}
+
extern "C"
{
gboolean call_timeoutFn( gpointer pData )
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 19abff4..6e0cb6d 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -38,6 +38,7 @@
#include <unx/gtk/atkbridge.hxx>
#include <headless/svpvd.hxx>
#include <headless/svpbmp.hxx>
+#include <vcl/apptypes.hxx>
#include <rtl/strbuf.hxx>
@@ -200,6 +201,8 @@ extern "C"
GtkInstance::~GtkInstance()
{
+ while( !m_aTimers.empty() )
+ delete *m_aTimers.begin();
DeInitAtkBridge();
}
@@ -443,7 +446,17 @@ SalBitmap* GtkInstance::CreateSalBitmap()
SalTimer* GtkInstance::CreateSalTimer()
{
- return new GtkSalTimer();
+ GtkSalTimer *pTimer = new GtkSalTimer();
+ m_aTimers.push_back( pTimer );
+ return pTimer;
+}
+
+void GtkInstance::RemoveTimer (SalTimer *pTimer)
+{
+ std::vector<GtkSalTimer *>::iterator it;
+ it = std::find( m_aTimers.begin(), m_aTimers.end(), pTimer );
+ if( it != m_aTimers.end() )
+ m_aTimers.erase( it );
}
void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
@@ -451,19 +464,36 @@ void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
GetGtkSalData()->Yield( bWait, bHandleAllCurrentEvents );
}
-bool GtkInstance::AnyInput( sal_uInt16 nType )
+bool GtkInstance::IsTimerExpired()
{
-#if GTK_CHECK_VERSION(3,0,0)
- g_warning ("any input returning false");
+ gint nPriority;
+ GMainContext *pCtx = g_main_context_default();
+ // sets time_is_fresh to FALSE
+ if( !g_main_context_prepare( pCtx, &nPriority ) )
+ return false;
+ for( std::vector<GtkSalTimer *>::iterator it = m_aTimers.begin();
+ it != m_aTimers.end(); ++it )
+ {
+ if( (*it)->Expired() )
+ return true;
+ }
return false;
-#else
+}
+
+bool GtkInstance::AnyInput( sal_uInt16 nType )
+{
+ if( (nType & INPUT_TIMER) && IsTimerExpired() )
+ return true;
+ else
+#warning FIXME: this is really not ideal - we should snoop for misc. types
+ /* FIXME: AnyInput is also extremely fragile ... if we just return
+ !!gtk_events_pending(); we hang on start [!] ... amazing ...*/
+ return false;
+#if 0
return X11SalInstance::AnyInput( nType );
#endif
}
-// FIXME: these above should all be in a more generic, shared base of unix's salinst.cxx
-
-
#if GTK_CHECK_VERSION(3,0,0)
#define GTK3_INCLUDED
#include "../../headless/svpinst.cxx"
commit c4d0ac89e8b782e7a81836b16bdcdf7188ad6b1c
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon Oct 3 16:36:26 2011 +0100
generic: re-work X error push/pop and error message handling
diff --git a/vcl/inc/generic/gendata.hxx b/vcl/inc/generic/gendata.hxx
index 0392adc..ef7725f 100644
--- a/vcl/inc/generic/gendata.hxx
+++ b/vcl/inc/generic/gendata.hxx
@@ -73,6 +73,10 @@ class VCL_DLLPUBLIC SalGenericData : public SalData
return m_eType;
}
+ // Mostly useful for remote protocol backends
+ virtual void ErrorTrapPush() = 0;
+ virtual bool ErrorTrapPop( bool bIgnoreError = true ) = 0; // true on error
+
// Not the prettiest - but helpful for migrating old code ...
inline SalDisplay *GetSalDisplay() const
{
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 3f8444c..4e5f7b6 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -111,6 +111,9 @@ public:
virtual void PostUserEvent();
void Yield( bool bWait, bool bHandleAllCurrentEvents );
inline GdkDisplay *GetGdkDisplay();
+
+ virtual void ErrorTrapPush();
+ virtual bool ErrorTrapPop( bool bIgnoreError );
};
class GtkSalFrame;
@@ -151,9 +154,6 @@ public:
void screenSizeChanged( GdkScreen* );
void monitorsChanged( GdkScreen* );
- void errorTrapPush();
- void errorTrapPop();
-
virtual void PostUserEvent();
#if !GTK_CHECK_VERSION(3,0,0)
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 0e3ada1..4fa86d3 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -162,13 +162,10 @@ class GtkSalFrame : public SalFrame, basebmp::BitmapDeviceDamageTracker
void endExtTextInput( sal_uInt16 nFlags );
bool handleKeyEvent( GdkEventKey* pEvent );
void focusChanged( bool bFocusIn );
- void errorTrapPush();
- void errorTrapPop();
void doCallEndExtTextInput();
void sendEmptyCommit();
-
static void signalIMCommit( GtkIMContext*, gchar*, gpointer );
static gboolean signalIMDeleteSurrounding( GtkIMContext*, gint, gint, gpointer );
static void signalIMPreeditChanged( GtkIMContext*, gpointer );
diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx
index 30573b0..2d5dca5 100644
--- a/vcl/inc/unx/saldata.hxx
+++ b/vcl/inc/unx/saldata.hxx
@@ -31,6 +31,8 @@
// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <signal.h>
+#include <unx/salunx.h>
+#include <vcl/salgtype.hxx>
#include <unx/salstd.hxx>
#include <salframe.hxx>
#include <unx/salinst.h>
@@ -56,6 +58,19 @@ typedef unsigned int pthread_t;
// -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
class VCLPLUG_GEN_PUBLIC X11SalData : public SalGenericData
{
+ static int XErrorHdl( Display*, XErrorEvent* );
+ static int XIOErrorHdl( Display* );
+
+ struct XErrorStackEntry
+ {
+ bool m_bIgnore;
+ bool m_bWas;
+ unsigned int m_nLastErrorRequest;
+ XErrorHandler m_aHandler;
+ };
+ std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
+ XIOErrorHandler m_aOrigXIOErrorHandler;
+
protected:
SalXLib *pXLib_;
pthread_t hMainThread_;
@@ -66,11 +81,10 @@ public:
virtual void Init();
virtual void Dispose();
+
virtual void initNWF();
virtual void deInitNWF();
- inline void XError( Display *pDisplay, XErrorEvent *pEvent ) const;
-
SalDisplay* GetX11Display() const { return GetSalDisplay(); }
void DeleteDisplay(); // for shutdown
@@ -81,15 +95,20 @@ public:
inline void StopTimer();
void Timeout() const;
- static int XErrorHdl( Display*, XErrorEvent* );
- static int XIOErrorHdl( Display* );
+ // X errors
+ virtual void ErrorTrapPush();
+ virtual bool ErrorTrapPop( bool bIgnoreError );
+ void XError( Display *pDisp, XErrorEvent *pEvent );
+ bool HasXErrorOccurred() const
+ { return m_aXErrorHandlerStack.back().m_bWas; }
+ unsigned int GetLastXErrorRequestCode() const
+ { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
+ void ResetXErrorOccurred()
+ { m_aXErrorHandlerStack.back().m_bWas = false; }
+ void PushXErrorLevel( bool bIgnore );
+ void PopXErrorLevel();
};
-#ifdef _SV_SALDISP_HXX
-inline void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const
-{ pXLib_->XError( pDisplay, pEvent ); }
-#endif
-
#endif // _SV_SALDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 20a1abc..73e5277 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -203,22 +203,11 @@ protected:
sal_uLong m_nTimeoutMS;
int m_pTimeoutFDS[2];
- bool m_bHaveSystemChildFrames;
-
int nFDs_;
fd_set aReadFDS_;
fd_set aExceptionFDS_;
YieldEntry *pYieldEntries_;
- struct XErrorStackEntry
- {
- bool m_bIgnore;
- bool m_bWas;
- unsigned int m_nLastErrorRequest;
- XErrorHandler m_aHandler;
- };
- std::vector< XErrorStackEntry > m_aXErrorHandlerStack;
- XIOErrorHandler m_aOrigXIOErrorHandler;
public:
SalXLib();
virtual ~SalXLib();
@@ -234,22 +223,10 @@ public:
YieldFunc handle );
virtual void Remove( int fd );
- void XError( Display *pDisp, XErrorEvent *pEvent );
- bool HasXErrorOccurred() const { return m_aXErrorHandlerStack.back().m_bWas; }
- unsigned int GetLastXErrorRequestCode() const { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; }
- void ResetXErrorOccurred() { m_aXErrorHandlerStack.back().m_bWas = false; }
- void PushXErrorLevel( bool bIgnore );
- void PopXErrorLevel();
-
- virtual void StartTimer( sal_uLong nMS );
- virtual void StopTimer();
+ virtual void StartTimer( sal_uLong nMS );
+ virtual void StopTimer();
bool CheckTimeout( bool bExecuteTimers = true );
-
- void setHaveSystemChildFrame()
- { m_bHaveSystemChildFrames = true; }
- bool getHaveSystemChildFrame() const
- { return m_bHaveSystemChildFrames; }
};
// -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -366,25 +343,20 @@ protected:
void doDestruct();
void addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight );
public:
- static SalDisplay *GetSalDisplay( Display* display );
- static sal_Bool BestVisual( Display *pDisp,
- int nScreen,
- XVisualInfo &rVI );
-
- SalDisplay( Display* pDisp );
+ static SalDisplay *GetSalDisplay( Display* display );
+ static sal_Bool BestVisual( Display *pDisp,
+ int nScreen,
+ XVisualInfo &rVI );
- virtual ~SalDisplay();
+ SalDisplay( Display* pDisp );
- void setHaveSystemChildFrame() const
- { pXLib_->setHaveSystemChildFrame(); }
- bool getHaveSystemChildFrame() const
- { return pXLib_->getHaveSystemChildFrame(); }
+ virtual ~SalDisplay();
void Init();
void PrintInfo() const;
#ifdef DBG_UTIL
- void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const;
+ void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const;
#endif
void Beep() const;
@@ -492,8 +464,8 @@ public:
virtual long Dispatch( XEvent *pEvent );
virtual void Yield();
-
- sal_Bool IsEvent();
+ sal_Bool IsEvent();
+ void SetupInput( SalI18N_InputMethod *pInputMethod );
};
/*----------------------------------------------------------
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index e2fcdae..d99894c 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -468,15 +468,14 @@ void IIIMPStatusWindow::GetFocus()
if( it != rFrames.end() )
{
const SystemEnvData* pParentEnvData = m_pResetFocus->GetSystemData();
- SalXLib* pXLib = GetGenericData()->GetSalDisplay()->GetXLib();
- pXLib->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
XSetInputFocus( (Display*)pParentEnvData->pDisplay,
(XLIB_Window)pParentEnvData->aShellWindow,
RevertToNone,
CurrentTime
);
XSync( (Display*)pParentEnvData->pDisplay, False );
- pXLib->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
m_pResetFocus = NULL;
}
@@ -501,15 +500,14 @@ IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn )
if( pParent && pParent->isMapped() )
{
const SystemEnvData* pEnv = pParent->GetSystemData();
- SalXLib* pXLib = GetGenericData()->GetSalDisplay()->GetXLib();
- pXLib->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
XSetInputFocus( (Display*)pEnv->pDisplay,
(XLIB_Window)pEnv->aShellWindow,
RevertToNone,
CurrentTime
);
XSync( (Display*)pEnv->pDisplay, False );
- pXLib->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
}
}
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 940dc22..4b235a4 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -232,43 +232,6 @@ static const char* XRequest[] = {
"X_NoOperation"
};
-// -=-= C statics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
-{
- OSL_ASSERT( GetX11SalData()->GetType() != SAL_DATA_GTK );
-
- GetX11SalData()->XError( pDisplay, pEvent );
- return 0;
-}
-
-int X11SalData::XIOErrorHdl( Display * )
-{
- OSL_ASSERT( GetX11SalData()->GetType() != SAL_DATA_GTK );
-
- /* #106197# hack: until a real shutdown procedure exists
- * _exit ASAP
- */
- if( ImplGetSVData()->maAppData.mbAppQuit )
- _exit(1);
-
- // really bad hack
- if( ! SessionManagerClient::checkDocumentsSaved() )
- /* oslSignalAction eToDo = */ osl_raiseSignal (OSL_SIGNAL_USER_X11SUBSYSTEMERROR, NULL);
-
- std::fprintf( stderr, "X IO Error\n" );
- std::fflush( stdout );
- std::fflush( stderr );
-
- /* #106197# the same reasons to use _exit instead of exit in salmain
- * do apply here. Since there is nothing to be done after an XIO
- * error we have to _exit immediately.
- */
- _exit(0);
- return 0;
-}
-
// -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <pthread.h>
@@ -281,11 +244,16 @@ X11SalData::X11SalData( SalGenericDataType t )
m_pPlugin = NULL;
hMainThread_ = pthread_self();
+
+ m_aOrigXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)XIOErrorHdl );
+ PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
}
X11SalData::~X11SalData()
{
DeleteDisplay();
+ PopXErrorLevel();
+ XSetIOErrorHandler (m_aOrigXIOErrorHandler);
}
void X11SalData::Dispose()
@@ -317,6 +285,75 @@ void X11SalData::deInitNWF( void )
{
}
+void X11SalData::ErrorTrapPush()
+{
+ PushXErrorLevel( true );
+}
+
+bool X11SalData::ErrorTrapPop( bool bIgnoreError )
+{
+ bool err = false;
+ if( !bIgnoreError )
+ err = HasXErrorOccurred();
+ PopXErrorLevel();
+ return err;
+}
+
+
+void X11SalData::PushXErrorLevel( bool bIgnore )
+{
+ m_aXErrorHandlerStack.push_back( XErrorStackEntry() );
+ XErrorStackEntry& rEnt = m_aXErrorHandlerStack.back();
+ rEnt.m_bWas = false;
+ rEnt.m_bIgnore = bIgnore;
+ rEnt.m_nLastErrorRequest = 0;
+ rEnt.m_aHandler = XSetErrorHandler( (XErrorHandler)XErrorHdl );
+}
+
+void X11SalData::PopXErrorLevel()
+{
+ if( m_aXErrorHandlerStack.size() )
+ {
+ XSetErrorHandler( m_aXErrorHandlerStack.back().m_aHandler );
+ m_aXErrorHandlerStack.pop_back();
+ }
+}
+
+// -=-= C statics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
+{
+ GetX11SalData()->XError( pDisplay, pEvent );
+ return 0;
+}
+
+int X11SalData::XIOErrorHdl( Display * )
+{
+ /* #106197# hack: until a real shutdown procedure exists
+ * _exit ASAP
+ */
+ if( ImplGetSVData()->maAppData.mbAppQuit )
+ _exit(1);
+
+ // really bad hack
+ if( ! SessionManagerClient::checkDocumentsSaved() )
+ /* oslSignalAction eToDo = */ osl_raiseSignal (OSL_SIGNAL_USER_X11SUBSYSTEMERROR, NULL);
+
+ std::fprintf( stderr, "X IO Error\n" );
+ std::fflush( stdout );
+ std::fflush( stderr );
+
+ /* #106197# the same reasons to use _exit instead of exit in salmain
+ * do apply here. Since there is nothing to be done after an XIO
+ * error we have to _exit immediately.
+ */
+ _exit(0);
+ return 0;
+}
+
+
+
// -=-= SalXLib =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SalXLib::SalXLib()
@@ -363,10 +400,6 @@ SalXLib::SalXLib()
FD_SET( m_pTimeoutFDS[0], &aReadFDS_ );
nFDs_ = m_pTimeoutFDS[0] + 1;
}
-
- m_bHaveSystemChildFrames = false;
- m_aOrigXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
}
SalXLib::~SalXLib()
@@ -374,28 +407,6 @@ SalXLib::~SalXLib()
// close 'wakeup' pipe.
close (m_pTimeoutFDS[0]);
close (m_pTimeoutFDS[1]);
-
- PopXErrorLevel();
- XSetIOErrorHandler (m_aOrigXIOErrorHandler);
-}
-
-void SalXLib::PushXErrorLevel( bool bIgnore )
-{
- m_aXErrorHandlerStack.push_back( XErrorStackEntry() );
- XErrorStackEntry& rEnt = m_aXErrorHandlerStack.back();
- rEnt.m_bWas = false;
- rEnt.m_bIgnore = bIgnore;
- rEnt.m_nLastErrorRequest = 0;
- rEnt.m_aHandler = XSetErrorHandler( (XErrorHandler)X11SalData::XErrorHdl );
-}
-
-void SalXLib::PopXErrorLevel()
-{
- if( m_aXErrorHandlerStack.size() )
- {
- XSetErrorHandler( m_aXErrorHandlerStack.back().m_aHandler );
- m_aXErrorHandlerStack.pop_back();
- }
}
void SalXLib::Init()
@@ -470,19 +481,10 @@ void SalXLib::Init()
exit(0);
}
- SalDisplay *pSalDisplay = new SalX11Display( pDisp );
+ SalX11Display *pSalDisplay = new SalX11Display( pDisp );
pInputMethod->CreateMethod( pDisp );
- pSalDisplay->SetInputMethod( pInputMethod );
-
- PushXErrorLevel( true );
- SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
- XSync( pDisp, False );
-
- pKbdExtension->UseExtension( ! HasXErrorOccurred() );
- PopXErrorLevel();
-
- pSalDisplay->SetKbdExtension( pKbdExtension );
+ pSalDisplay->SetupInput( pInputMethod );
}
extern "C" {
@@ -536,11 +538,8 @@ static void PrintXError( Display *pDisplay, XErrorEvent *pEvent )
std::fflush( stderr );
}
-void SalXLib::XError( Display *pDisplay, XErrorEvent *pEvent )
+void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent )
{
- if( m_bHaveSystemChildFrames )
- return;
-
if( ! m_aXErrorHandlerStack.back().m_bIgnore )
{
if ( (pEvent->error_code == BadAlloc)
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index c0ca7fe..004b3fc 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -113,6 +113,11 @@ using ::rtl::OUString;
#define SALCOLOR_WHITE MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF )
#define SALCOLOR_BLACK MAKE_SALCOLOR( 0x00, 0x00, 0x00 )
+inline X11SalData* GetX11SalData()
+{
+ return (X11SalData*)ImplGetSVData()->mpSalData;
+}
+
// -=-= Prototyps =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-= static variables -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -831,6 +836,22 @@ void SalDisplay::Init()
#endif
}
+void SalX11Display::SetupInput( SalI18N_InputMethod *pInputMethod )
+{
+ SetInputMethod( pInputMethod );
+
+ GetGenericData()->ErrorTrapPush();
+ SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp_ );
+ XSync( pDisp_, False );
+
+ bool bError = GetGenericData()->ErrorTrapPop( false );
+ GetGenericData()->ErrorTrapPush();
+ pKbdExtension->UseExtension( ! bError );
+ GetGenericData()->ErrorTrapPop();
+
+ SetKbdExtension( pKbdExtension );
+}
+
// Sound
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void SalDisplay::Beep() const
@@ -2078,13 +2099,13 @@ void SalX11Display::Yield()
Dispatch( &aEvent );
#ifdef DBG_UTIL
- if( pXLib_->HasXErrorOccurred() )
+ if( GetX11SalData()->HasXErrorOccurred() )
{
XFlush( pDisp_ );
DbgPrintDisplayEvent("SalDisplay::Yield (WasXError)", &aEvent);
}
#endif
- pXLib_->ResetXErrorOccurred();
+ GetX11SalData()->ResetXErrorOccurred();
}
long SalX11Display::Dispatch( XEvent *pEvent )
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index 967fc53..e8c9174 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -582,7 +582,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
XFree( pProperty );
pProperty = NULL;
XLIB_Window aCheckWindow = None;
- m_pSalDisplay->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
if( XGetWindowProperty( m_pDisplay,
aWMChild,
m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ],
@@ -596,26 +596,31 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
&pProperty ) == 0
&& aRealType == XA_CARDINAL
&& nFormat == 32
- && nItems != 0
- && ! m_pSalDisplay->GetXLib()->HasXErrorOccurred()
- )
+ && nItems != 0 )
{
- aCheckWindow = *(XLIB_Window*)pProperty;
- XFree( pProperty );
- pProperty = NULL;
- if( aCheckWindow == aWMChild )
+ if (! GetGenericData()->ErrorTrapPop( false ) )
{
- m_bValid = true;
- /*
- * get name of WM
- * this is NOT part of the GNOME WM hints, but e.g. Sawfish
- * already supports this part of the extended WM hints
- */
- m_aWMAtoms[ UTF8_STRING ] = XInternAtom( m_pDisplay, "UTF8_STRING", False );
- getNetWmName();
+ GetGenericData()->ErrorTrapPush();
+
+ aCheckWindow = *(XLIB_Window*)pProperty;
+ XFree( pProperty );
+ pProperty = NULL;
+ if( aCheckWindow == aWMChild )
+ {
+ m_bValid = true;
+ /*
+ * get name of WM
+ * this is NOT part of the GNOME WM hints, but e.g. Sawfish
+ * already supports this part of the extended WM hints
+ */
+ m_aWMAtoms[ UTF8_STRING ] = XInternAtom( m_pDisplay, "UTF8_STRING", False );
+ getNetWmName();
+ }
}
+ else
+ GetGenericData()->ErrorTrapPush();
}
- m_pSalDisplay->GetXLib()->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
else if( pProperty )
{
@@ -785,7 +790,7 @@ bool WMAdaptor::getNetWmName()
XFree( pProperty );
pProperty = NULL;
XLIB_Window aCheckWindow = None;
- m_pSalDisplay->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
if( XGetWindowProperty( m_pDisplay,
aWMChild,
m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ],
@@ -799,63 +804,25 @@ bool WMAdaptor::getNetWmName()
&pProperty ) == 0
&& aRealType == XA_WINDOW
&& nFormat == 32
- && nItems != 0
- && ! m_pSalDisplay->GetXLib()->HasXErrorOccurred()
- )
- {
- aCheckWindow = *(XLIB_Window*)pProperty;
- XFree( pProperty );
- pProperty = NULL;
- if( aCheckWindow == aWMChild )
+ && nItems != 0 )
{
- bNetWM = true;
- // get name of WM
- m_aWMAtoms[ UTF8_STRING ] = XInternAtom( m_pDisplay, "UTF8_STRING", False );
- if( XGetWindowProperty( m_pDisplay,
- aWMChild,
- m_aWMAtoms[ NET_WM_NAME ],
- 0, 256,
- False,
- AnyPropertyType, /* m_aWMAtoms[ UTF8_STRING ],*/
- &aRealType,
- &nFormat,
- &nItems,
- &nBytesLeft,
- &pProperty ) == 0
- && nItems != 0
- )
- {
- if (aRealType == m_aWMAtoms[ UTF8_STRING ])
- {
- m_aWMName = String( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
- }
- else
- if (aRealType == XA_STRING)
- {
- m_aWMName = String( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_ISO_8859_1 );
- }
-
- XFree( pProperty );
- pProperty = NULL;
- }
- else if( pProperty )
+ if ( GetGenericData()->ErrorTrapPop( false ) )
{
+ GetGenericData()->ErrorTrapPush();
+ aCheckWindow = *(XLIB_Window*)pProperty;
XFree( pProperty );
pProperty = NULL;
- }
- // if this is metacity, check for version to enable a legacy workaround
- if( m_aWMName.EqualsAscii( "Metacity" ) )
- {
- int nVersionMajor = 0, nVersionMinor = 0;
- Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
- if( nVersionAtom )
+ if( aCheckWindow == aWMChild )
{
+ bNetWM = true;
+ // get name of WM
+ m_aWMAtoms[ UTF8_STRING ] = XInternAtom( m_pDisplay, "UTF8_STRING", False );
if( XGetWindowProperty( m_pDisplay,
aWMChild,
- nVersionAtom,
+ m_aWMAtoms[ NET_WM_NAME ],
0, 256,
False,
- m_aWMAtoms[ UTF8_STRING ],
+ AnyPropertyType, /* m_aWMAtoms[ UTF8_STRING ],*/
&aRealType,
&nFormat,
&nItems,
@@ -864,27 +831,68 @@ bool WMAdaptor::getNetWmName()
&& nItems != 0
)
{
- String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
- nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32();
- nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32();
+ if (aRealType == m_aWMAtoms[ UTF8_STRING ])
+ m_aWMName = String( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
+ else if (aRealType == XA_STRING)
+ m_aWMName = String( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_ISO_8859_1 );
+
+ XFree( pProperty );
+ pProperty = NULL;
}
- if( pProperty )
+ else if( pProperty )
{
XFree( pProperty );
pProperty = NULL;
}
+
+ // if this is metacity, check for version to enable a legacy workaround
+ if( m_aWMName.EqualsAscii( "Metacity" ) )
+ {
+ int nVersionMajor = 0, nVersionMinor = 0;
+ Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
+ if( nVersionAtom )
+ {
+ if( XGetWindowProperty( m_pDisplay,
+ aWMChild,
+ nVersionAtom,
+ 0, 256,
+ False,
+ m_aWMAtoms[ UTF8_STRING ],
+ &aRealType,
+ &nFormat,
+ &nItems,
+ &nBytesLeft,
+ &pProperty ) == 0
+ && nItems != 0
+ )
+ {
+ String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
+ nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32();
+ nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32();
+ }
+ if( pProperty )
+ {
+ XFree( pProperty );
+ pProperty = NULL;
+ }
+ }
+ if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) )
+ m_bLegacyPartialFullscreen = true;
+ }
}
- if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) )
- m_bLegacyPartialFullscreen = true;
+ }
+ else
+ {
+ if( pProperty )
+ {
+ XFree( pProperty );
+ pProperty = NULL;
+ }
+ GetGenericData()->ErrorTrapPush();
}
}
- }
- else if( pProperty )
- {
- XFree( pProperty );
- pProperty = NULL;
- }
- m_pSalDisplay->GetXLib()->PopXErrorLevel();
+
+ GetGenericData()->ErrorTrapPop();
}
else if( pProperty )
{
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index c2057e7..d0201e3 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -226,10 +226,9 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
// but this call can actually work on servers with backing store
// defaults even if the rectangle is offscreen
// so better catch the XError
- pXLib->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
XImage* pImage = XGetImage( pXDisp, aDrawable, nX, nY, nWidth, nHeight, AllPlanes, ZPixmap );
- bool bWasError = pXLib->HasXErrorOccurred() && pXLib->GetLastXErrorRequestCode() == X_GetImage;
- pXLib->PopXErrorLevel();
+ bool bWasError = GetGenericData()->ErrorTrapPop( false );
if( ! bWasError && pImage && pImage->data )
{
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index 1669ab6..2b26120 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -84,20 +84,17 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
src_x, src_y, w, h, dest_x, dest_y );
else
{
- SalXLib* pLib = GetGenericData()->GetSalDisplay()->GetXLib();
- pLib->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
XImage* pImage = XGetImage( pDisplay, aSrc, src_x, src_y, w, h,
AllPlanes, ZPixmap );
if( pImage )
{
if( pImage->data )
- {
XPutImage( pDisplay, aDest, aDestGC, pImage,
0, 0, dest_x, dest_y, w, h );
- }
XDestroyImage( pImage );
}
- pLib->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
}
else
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 6d821bd..ad43f7a 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -114,7 +114,7 @@ X11SalFrame* X11SalFrame::s_pSaveYourselfFrame = NULL;
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
static void doReparentPresentationDialogues( SalDisplay* pDisplay )
{
- pDisplay->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
while( aPresentationReparentList.begin() != aPresentationReparentList.end() )
{
int x, y;
@@ -139,7 +139,7 @@ static void doReparentPresentationDialogues( SalDisplay* pDisplay )
if( hPresFocusWindow )
XSetInputFocus( pDisplay->GetDisplay(), hPresFocusWindow, PointerRoot, CurrentTime );
XSync( pDisplay->GetDisplay(), False );
- pDisplay->GetXLib()->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
// -=-= SalFrame / X11SalFrame =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -201,12 +201,12 @@ void X11SalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
aEvent.xclient.data.l[3] = 0;
aEvent.xclient.data.l[4] = 0;
- GetDisplay()->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
XSendEvent( pDisplay_->GetDisplay(),
mhForeignParent,
False, NoEventMask, &aEvent );
XSync( pDisplay_->GetDisplay(), False );
- GetDisplay()->GetXLib()->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
@@ -281,9 +281,9 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData*
}
else if( pParentData )
{
- // plugin parent may be killed unexpectedly by
- // plugging process; ignore XErrors in that case
- GetDisplay()->setHaveSystemChildFrame();
+ // plugin parent may be killed unexpectedly by plugging
+ // process; start permanantly ignoring X errors ...
+ GetGenericData()->ErrorTrapPush();
nStyle_ |= SAL_FRAME_STYLE_PLUG;
Attributes.override_redirect = True;
@@ -3786,7 +3786,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
static const char* pDisableStackingCheck = getenv( "SAL_DISABLE_STACKING_CHECK" );
- GetDisplay()->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
/*
* don't rely on the new parent from the event.
@@ -3805,7 +3805,11 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
&hDummy,
&Children,
&nChildren );
- if( GetDisplay()->GetXLib()->HasXErrorOccurred() )
+
+ bool bError = GetGenericData()->ErrorTrapPop( false );
+ GetGenericData()->ErrorTrapPush();
+
+ if( bError )
{
hWM_Parent = GetShellWindow();
break;
@@ -3813,7 +3817,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
/* this sometimes happens if a Show(sal_True) is
* immediately followed by Show(sal_False) (which is braindead anyway)
*/
- if( hDummy == hWM_Parent )
+ if( hDummy == hWM_Parent )
hDummy = hRoot;
if( hDummy != hRoot )
{
@@ -3844,7 +3848,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
// Reparenting before Destroy
aPresentationReparentList.remove( GetStackingWindow() );
mhStackingWindow = None;
- GetDisplay()->GetXLib()->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
return 0;
}
@@ -3895,7 +3899,11 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
* so need real geometries here
* (this will fail with virtual roots ?)
*/
- GetDisplay()->GetXLib()->ResetXErrorOccurred();
+
+ // reset error occurred
+ GetGenericData()->ErrorTrapPop();
+ GetGenericData()->ErrorTrapPush();
+
int xp, yp, x, y;
unsigned int wp, w, hp, h, bw, d;
XGetGeometry( GetXDisplay(),
@@ -3907,7 +3915,10 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
&hRoot,
&xp, &yp, &wp, &hp, &bw, &d );
bool bResized = false;
- if( ! GetDisplay()->GetXLib()->HasXErrorOccurred() )
+ bool bError = GetGenericData()->ErrorTrapPop( false );
+ GetGenericData()->ErrorTrapPush();
+
+ if( ! bError )
{
maGeometry.nRightDecoration = wp - w - maGeometry.nLeftDecoration;
maGeometry.nBottomDecoration = hp - h - maGeometry.nTopDecoration;
@@ -3922,7 +3933,6 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
maGeometry.nHeight = h;
}
-
// limit width and height if we are too large: #47757
// olwm and fvwm need this, it doesnt harm the rest
@@ -3951,7 +3961,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
if( bResized )
CallCallback( SALEVENT_RESIZE, NULL );
- GetDisplay()->GetXLib()->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
return 1;
}
diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx
index cc9487f..da09378 100644
--- a/vcl/unx/generic/window/salobj.cxx
+++ b/vcl/unx/generic/window/salobj.cxx
@@ -134,7 +134,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
static_cast<unsigned int> (pSalDisp->GetVisual( nScreen ).GetVisualId()),
static_cast<unsigned int> (aVisID) );
#endif
- pSalDisp->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
// create colormap for visual - there might not be one
pObject->maColormap = aAttribs.colormap = XCreateColormap(
@@ -152,9 +152,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
pVisual,
CWEventMask|CWColormap, &aAttribs );
XSync( pDisp, False );
- sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred();
- pSalDisp->GetXLib()->PopXErrorLevel();
- if( bWasXError )
+ if( GetGenericData()->ErrorTrapPop( false ) )
{
pObject->maSecondary = None;
delete pObject;
@@ -163,7 +161,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
XReparentWindow( pDisp, pObject->maSecondary, pObject->maPrimary, 0, 0 );
}
- pSalDisp->GetXLib()->PushXErrorLevel( true );
+ GetGenericData()->ErrorTrapPush();
if( bShow ) {
XMapWindow( pDisp, pObject->maSecondary );
XMapWindow( pDisp, pObject->maPrimary );
@@ -179,9 +177,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
pObjData->pAppContext = NULL;
XSync(pDisp, False);
- sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred();
- pSalDisp->GetXLib()->PopXErrorLevel();
- if( bWasXError )
+ if( GetGenericData()->ErrorTrapPop( false ) )
{
delete pObject;
return NULL;
@@ -278,7 +274,8 @@ X11SalObject::~X11SalObject()
std::list< SalObject* >& rObjects = GetGenericData()->GetSalDisplay()->getSalObjects();
rObjects.remove( this );
SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
- pSalDisp->GetXLib()->PushXErrorLevel( true );
+
+ GetGenericData()->ErrorTrapPush();
if ( maSecondary )
XDestroyWindow( (Display*)maSystemChildData.pDisplay, maSecondary );
if ( maPrimary )
@@ -286,7 +283,7 @@ X11SalObject::~X11SalObject()
if ( maColormap )
XFreeColormap((Display*)maSystemChildData.pDisplay, maColormap);
XSync( (Display*)maSystemChildData.pDisplay, False );
- pSalDisp->GetXLib()->PopXErrorLevel();
+ GetGenericData()->ErrorTrapPop();
}
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 48431b3..62707b1 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -99,7 +99,7 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) :
gdk_window_add_filter( NULL, call_filterGdkEvent, this );
if ( getenv( "SAL_IGNOREXERRORS" ) )
- errorTrapPush(); // and leak the trap
+ GetGenericData()->ErrorTrapPush(); // and leak the trap
}
GtkSalDisplay::~GtkSalDisplay()
@@ -119,20 +119,6 @@ GtkSalDisplay::~GtkSalDisplay()
gdk_cursor_unref( m_aCursors[ i ] );
}
-void GtkSalDisplay::errorTrapPush()
-{
- gdk_error_trap_push ();
-}
-
-void GtkSalDisplay::errorTrapPop()
-{
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_error_trap_pop ();
-#else
- gdk_error_trap_pop_ignored (); // faster
-#endif
-}
-
extern "C" {
void signalKeysChanged( GdkKeymap*, gpointer data )
@@ -768,6 +754,25 @@ void GtkData::Init()
}
}
+void GtkData::ErrorTrapPush()
+{
+ gdk_error_trap_push ();
+}
+
+bool GtkData::ErrorTrapPop( bool bIgnoreError )
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ if( bIgnoreError )
+ {
+ gdk_error_trap_pop_ignored (); // faster
+ return false;
+ }
+#else
+ (void) bIgnoreError;
+#endif
+ return gdk_error_trap_pop () != 0;
+}
+
GtkSalTimer::GtkSalTimer()
: m_pTimeout( 0 )
{
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 39cc60a..0b99e6d 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -454,9 +454,8 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
{
m_nScreen = getDisplay()->GetDefaultScreenNumber();
getDisplay()->registerFrame( this );
-#if !GTK_CHECK_VERSION(3,0,0)
- getDisplay()->setHaveSystemChildFrame();
-#endif
+ // permanently ignore errors from our unruly children ...
+ GetGenericData()->ErrorTrapPush();
m_bDefaultPos = true;
m_bDefaultSize = true;
m_nIdleFullScreen = 0;
@@ -1045,11 +1044,11 @@ void GtkSalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
aEvent.xclient.data.l[3] = 0;
aEvent.xclient.data.l[4] = 0;
- getDisplay()->errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
XSendEvent( getDisplay()->GetDisplay(),
m_aForeignParentWindow,
False, NoEventMask, &aEvent );
- getDisplay()->errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
#endif
}
@@ -2185,9 +2184,9 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
{
// sad but true: this can cause an XError, we need to catch that
// to do this we need to synchronize with the XServer
- getDisplay()->errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( widget_get_window(m_pWindow) ), RevertToParent, CurrentTime );
- getDisplay()->errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
}
#endif
}
@@ -2226,17 +2225,14 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents )
if( bGrab )
{
bool bUseGdkGrab = true;
- if( getDisplay()->getHaveSystemChildFrame() )
+ const std::list< SalFrame* >& rFrames = getDisplay()->getFrames();
+ for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
{
- const std::list< SalFrame* >& rFrames = getDisplay()->getFrames();
- for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
+ const GtkSalFrame* pFrame = static_cast< const GtkSalFrame* >(*it);
+ if( pFrame->m_bWindowIsGtkPlug )
{
- const GtkSalFrame* pFrame = static_cast< const GtkSalFrame* >(*it);
- if( pFrame->m_bWindowIsGtkPlug )
- {
- bUseGdkGrab = false;
- break;
- }
+ bUseGdkGrab = false;
+ break;
}
}
if( bUseGdkGrab )
@@ -2606,7 +2602,7 @@ bool GtkSalFrame::SetPluginParent( SystemParentData* pSysParent )
{
#if !GTK_CHECK_VERSION(3,0,0)
if( pSysParent ) // this may be the first system child frame now
- getDisplay()->setHaveSystemChildFrame();
+ GetGenericData()->ErrorTrapPush(); // permanantly ignore unruly children's errors
createNewWindow( pSysParent->aWindow, (pSysParent->nSize > sizeof(long)) ? pSysParent->bXEmbedSupport : false, m_nScreen );
return true;
#else
@@ -3607,20 +3603,6 @@ GtkSalFrame::IMHandler::~IMHandler()
deleteIMContext();
}
-void GtkSalFrame::IMHandler::errorTrapPush()
-{
- if (!m_pFrame)
- return;
- m_pFrame->getDisplay()->errorTrapPush();
-}
-
-void GtkSalFrame::IMHandler::errorTrapPop()
-{
- if (!m_pFrame)
- return;
- m_pFrame->getDisplay()->errorTrapPop();
-}
-
void GtkSalFrame::IMHandler::createIMContext()
{
if( ! m_pIMContext )
@@ -3639,10 +3621,10 @@ void GtkSalFrame::IMHandler::createIMContext()
g_signal_connect( m_pIMContext, "preedit_end",
G_CALLBACK (signalIMPreeditEnd), this );
- errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
gtk_im_context_set_client_window( m_pIMContext, widget_get_window(GTK_WIDGET(m_pFrame->m_pWindow)) );
gtk_im_context_focus_in( m_pIMContext );
- errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
m_bFocused = true;
}
}
@@ -3652,9 +3634,9 @@ void GtkSalFrame::IMHandler::deleteIMContext()
if( m_pIMContext )
{
// first give IC a chance to deinitialize
- errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
gtk_im_context_set_client_window( m_pIMContext, NULL );
- errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
// destroy old IC
g_object_unref( m_pIMContext );
m_pIMContext = NULL;
@@ -3676,9 +3658,9 @@ void GtkSalFrame::IMHandler::updateIMSpotLocation()
aArea.y = aPosEvent.mnY;
aArea.width = aPosEvent.mnWidth;
aArea.height = aPosEvent.mnHeight;
- errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
gtk_im_context_set_cursor_location( m_pIMContext, &aArea );
- errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
}
void GtkSalFrame::IMHandler::setInputContext( SalInputContext* )
@@ -3729,9 +3711,9 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn )
m_bFocused = bFocusIn;
if( bFocusIn )
{
- errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
gtk_im_context_focus_in( m_pIMContext );
- errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
if( m_aInputEvent.mpTextAttr )
{
sendEmptyCommit();
@@ -3741,9 +3723,9 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn )
}
else
{
- errorTrapPush ();
+ GetGenericData()->ErrorTrapPush();
gtk_im_context_focus_out( m_pIMContext );
- errorTrapPop ();
+ GetGenericData()->ErrorTrapPop();
// cancel an eventual event posted to begin preedit again
m_pFrame->getDisplay()->CancelInternalEvent( m_pFrame, &m_aInputEvent, SALEVENT_EXTTEXTINPUT );
}
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index d1dc388..177fa4e 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -181,19 +181,10 @@ void KDEXLib::Init()
Display* pDisp = QPaintDevice::x11AppDisplay();
- SalDisplay *pSalDisplay = new SalKDEDisplay( pDisp );
+ SalX11Display *pSalDisplay = new SalKDEDisplay( pDisp );
pInputMethod->CreateMethod( pDisp );
- pSalDisplay->SetInputMethod( pInputMethod );
-
- PushXErrorLevel( true );
- SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
- XSync( pDisp, False );
-
- pKbdExtension->UseExtension( ! HasXErrorOccurred() );
- PopXErrorLevel();
-
- pSalDisplay->SetKbdExtension( pKbdExtension );
+ pSalDisplay->SetupInput( pInputMethod );
}
void KDEXLib::doStartup()
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index ad46e61..a5804b3 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -178,16 +178,7 @@ void KDEXLib::Init()
SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
pInputMethod->CreateMethod( pDisp );
- pSalDisplay->SetInputMethod( pInputMethod );
-
- PushXErrorLevel( true );
- SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
- XSync( pDisp, False );
-
- pKbdExtension->UseExtension( ! HasXErrorOccurred() );
- PopXErrorLevel();
-
- pSalDisplay->SetKbdExtension( pKbdExtension );
+ pSalDisplay->SetupInput( pInputMethod );
}
// When we use Qt event loop, it can actually use its own event loop handling, or wrap
commit 34f59b6169eb2b1da60b896d847c789f433f59b3
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon Oct 3 15:16:32 2011 +0100
generic: try to cleanup SalXLib cruft some more
diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx
index 59a61f1..30573b0 100644
--- a/vcl/inc/unx/saldata.hxx
+++ b/vcl/inc/unx/saldata.hxx
@@ -85,10 +85,6 @@ public:
static int XIOErrorHdl( Display* );
};
-inline X11SalData* GetX11SalData()
-{ return (X11SalData*)ImplGetSVData()->mpSalData; }
-
-
#ifdef _SV_SALDISP_HXX
inline void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const
{ pXLib_->XError( pDisplay, pEvent ); }
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 2a0a1e8..20a1abc 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -200,7 +200,7 @@ class VCLPLUG_GEN_PUBLIC SalXLib
{
protected:
timeval m_aTimeout;
- sal_uLong m_nTimeoutMS;
+ sal_uLong m_nTimeoutMS;
int m_pTimeoutFDS[2];
bool m_bHaveSystemChildFrames;
@@ -210,7 +210,6 @@ protected:
fd_set aExceptionFDS_;
YieldEntry *pYieldEntries_;
-
struct XErrorStackEntry
{
bool m_bIgnore;
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 9b9a150..e89efd8 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -39,10 +39,11 @@
// -=-= SalInstanceData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalXLib;
class VCLPLUG_GEN_PUBLIC X11SalInstance : public SalGenericInstance
{
protected:
-
+ SalXLib *mpXLib;
public:
X11SalInstance( SalYieldMutex* pMutex ) : SalGenericInstance( pMutex ) {}
virtual ~X11SalInstance();
@@ -71,6 +72,7 @@ public:
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
void FillFontPathList( std::list< rtl::OString >& o_rFontPaths );
+ void SetLib( SalXLib *pXLib ) { mpXLib = pXLib; }
// dtrans implementation
virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
diff --git a/vcl/inc/unx/saltimer.h b/vcl/inc/unx/saltimer.h
index f5c889c..a61887f 100644
--- a/vcl/inc/unx/saltimer.h
+++ b/vcl/inc/unx/saltimer.h
@@ -31,15 +31,17 @@
#include <saltimer.hxx>
+class SalXLib;
class X11SalTimer : public SalTimer
{
+ SalXLib *mpXLib;
public:
- X11SalTimer() {}
+ X11SalTimer( SalXLib *pXLib ) : mpXLib( pXLib ) {}
virtual ~X11SalTimer();
// overload all pure virtual methods
- void Start( sal_uIntPtr nMS );
- void Stop();
+ void Start( sal_uIntPtr nMS );
+ void Stop();
};
#endif
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 99136ad..940dc22 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -91,6 +91,11 @@
#endif
#endif
+inline X11SalData* GetX11SalData()
+{
+ return (X11SalData*)ImplGetSVData()->mpSalData;
+}
+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
static const struct timeval noyield__ = { 0, 0 };
static const struct timeval yield__ = { 0, 10000 };
@@ -232,7 +237,7 @@ static const char* XRequest[] = {
int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
{
- OSL_ASSERT( GetX11SalData()->GetType() == SAL_DATA_UNX );
+ OSL_ASSERT( GetX11SalData()->GetType() != SAL_DATA_GTK );
GetX11SalData()->XError( pDisplay, pEvent );
return 0;
@@ -240,7 +245,7 @@ int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
int X11SalData::XIOErrorHdl( Display * )
{
- OSL_ASSERT( GetX11SalData()->GetType() == SAL_DATA_UNX );
+ OSL_ASSERT( GetX11SalData()->GetType() != SAL_DATA_GTK );
/* #106197# hack: until a real shutdown procedure exists
* _exit ASAP
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 4e30e1a..c0ca7fe 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -494,12 +494,12 @@ SalDisplay::SalDisplay( Display *display ) :
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "SalDisplay::SalDisplay()\n" );
#endif
- X11SalData *pSalData = GetX11SalData();
+ SalGenericData *pData = GetGenericData();
- DBG_ASSERT( ! pSalData->GetDisplay(), "Second SalDisplay created !!!\n" );
- pSalData->SetDisplay( this );
+ DBG_ASSERT( ! pData->GetDisplay(), "Second SalDisplay created !!!\n" );
+ pData->SetDisplay( this );
- pXLib_ = pSalData->GetLib();
+ pXLib_ = ((X11SalData *)ImplGetSVData()->mpSalData)->GetLib();
m_nDefaultScreen = DefaultScreen( pDisp_ );
}
@@ -524,7 +524,7 @@ SalDisplay::~SalDisplay( )
void SalDisplay::doDestruct()
{
- X11SalData *pSalData = GetX11SalData();
+ SalGenericData *pData = GetGenericData();
delete m_pWMAdaptor;
m_pWMAdaptor = NULL;
@@ -565,8 +565,8 @@ void SalDisplay::doDestruct()
pXLib_->Remove( ConnectionNumber( pDisp_ ) );
}
- if( pSalData->GetDisplay() == this )
- pSalData->SetDisplay( NULL );
+ if( pData->GetDisplay() == static_cast<const SalGenericDisplay *>( this ) )
+ pData->SetDisplay( NULL );
}
static int DisplayHasEvent( int fd, SalX11Display *pDisplay )
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index da5d036..1f1ab0b 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -77,6 +77,7 @@ extern "C"
SetSalData( pSalData );
pSalData->m_pInstance = pInstance;
pSalData->Init();
+ pInstance->SetLib( pSalData->GetLib() );
return pInstance;
}
@@ -145,14 +146,11 @@ Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData )
bool X11SalInstance::AnyInput(sal_uInt16 nType)
{
- X11SalData *pSalData = GetX11SalData();
-
SalGenericData *pData = GetGenericData();
Display *pDisplay = pData->GetSalDisplay()->GetDisplay();
sal_Bool bRet = sal_False;
- if( (nType & INPUT_TIMER) &&
- pSalData->GetSalDisplay()->GetXLib()->CheckTimeout( false ) )
+ if( (nType & INPUT_TIMER) && mpXLib->CheckTimeout( false ) )
{
bRet = sal_True;
}
@@ -172,12 +170,13 @@ bool X11SalInstance::AnyInput(sal_uInt16 nType)
return bRet;
}
-// -----------------------------------------------------------------------
-
void X11SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
-{ GetX11SalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); }
+{
+ mpXLib->Yield( bWait, bHandleAllCurrentEvents );
+}
-void* X11SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes )
+void* X11SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType,
+ int& rReturnedBytes )
{
static const char* pDisplay = getenv( "DISPLAY" );
rReturnedType = AsciiCString;
diff --git a/vcl/unx/generic/app/saltimer.cxx b/vcl/unx/generic/app/saltimer.cxx
index 98d6ccd..8ed841f 100644
--- a/vcl/unx/generic/app/saltimer.cxx
+++ b/vcl/unx/generic/app/saltimer.cxx
@@ -78,7 +78,7 @@ void SalXLib::StartTimer( sal_uLong nMS )
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SalTimer* X11SalInstance::CreateSalTimer()
{
- return new X11SalTimer();
+ return new X11SalTimer( mpXLib );
}
X11SalTimer::~X11SalTimer()
@@ -87,12 +87,12 @@ X11SalTimer::~X11SalTimer()
void X11SalTimer::Stop()
{
- GetX11SalData()->GetLib()->StopTimer();
+ mpXLib->StopTimer();
}
void X11SalTimer::Start( sal_uLong nMS )
{
- GetX11SalData()->GetLib()->StartTimer( nMS );
+ mpXLib->StartTimer( nMS );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 5515354..ad46e61 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -370,7 +370,8 @@ void KDEXLib::StopTimer()
void KDEXLib::timeoutActivated()
{
- GetX11SalData()->Timeout();
+ X11SalData *pData = (X11SalData*)ImplGetSVData()->mpSalData;
+ pData->Timeout();
// QTimer is not single shot, so will be restarted immediatelly
}
commit d230d99ec46101635c2b07d5efa62b5e24252714
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon Oct 3 12:21:34 2011 +0100
generic: create shared display class and re-factor to use it
diff --git a/vcl/inc/generic/gendata.hxx b/vcl/inc/generic/gendata.hxx
new file mode 100644
index 0000000..0392adc
--- /dev/null
+++ b/vcl/inc/generic/gendata.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Michael Meeks <michael.meeks at suse.org> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _SV_GENDATA_HXX
+#define _SV_GENDATA_HXX
+
+#include <osl/socket.hxx>
+#include <saldatabasic.hxx>
+
+class SalGenericDisplay;
+
+// Not the prettiest - but helpful for migrating old code ...
+class SalDisplay;
+class GtkSalDisplay;
+enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
+ SAL_DATA_KDE3, SAL_DATA_KDE4,
+ SAL_DATA_UNX };
+
+class VCL_DLLPUBLIC SalGenericData : public SalData
+{
+ protected:
+ SalGenericDataType m_eType;
+ SalGenericDisplay *m_pDisplay;
+ // cached hostname to avoid slow lookup
+ rtl::OUString m_aHostname;
+ // for transient storage of unicode strings eg. 'u123' by input methods
+ rtl::OUString m_aUnicodeEntry;
+ public:
+ SalGenericData( SalGenericDataType t ) : SalData(), m_eType( t ) {}
+ virtual ~SalGenericData() {}
+ virtual void Dispose() {}
+
+ SalGenericDisplay *GetDisplay() const { return m_pDisplay; }
+ void SetDisplay( SalGenericDisplay *pDisp ) { m_pDisplay = pDisp; }
+
+ const rtl::OUString& GetHostname()
+ {
+ if (!m_aHostname.getLength())
+ osl_getLocalHostname( &m_aHostname.pData );
+ return m_aHostname;
+ }
+ rtl::OUString &GetUnicodeCommand()
+ {
+ return m_aUnicodeEntry;
+ }
+ inline SalGenericDataType GetType() const
+ {
+ return m_eType;
+ }
+
+ // 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 );
+ return (SalDisplay *)GetDisplay();
+ }
+ inline GtkSalDisplay *GetGtkDisplay() const
+ {
+ return (GtkSalDisplay *)GetDisplay();
+ }
+};
+
+inline SalGenericData * GetGenericData()
+{
+ return (SalGenericData *)ImplGetSVData()->mpSalData;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/gendisp.hxx b/vcl/inc/generic/gendisp.hxx
index e088be8..63f3c1a 100644
--- a/vcl/inc/generic/gendisp.hxx
+++ b/vcl/inc/generic/gendisp.hxx
@@ -81,9 +81,9 @@ public:
{ return m_pCapture == pFrameData; }
SalFrame* GetCaptureFrame() const
{ return m_pCapture; }
-
};
+
#endif // _VCL_GEN_DISP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index b242852..3f8444c 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -35,6 +35,7 @@
#include <gtk/gtk.h>
#include <tools/postx.h>
+#include <generic/gendata.hxx>
#include <unx/saldisp.hxx>
#include <unx/saldata.hxx>
#include <unx/gtk/gtksys.hxx>
@@ -90,13 +91,11 @@ public:
virtual void Stop();
};
-class GtkData : public SalData
+class GtkData : public SalGenericData
{
+ GSource *m_pUserEvent;
oslMutex m_aDispatchMutex;
oslCondition m_aDispatchCondition;
- GSource *m_pUserEvent;
-
- GtkSalDisplay *m_pGtkSalDisplay;
public:
GtkData();
@@ -111,13 +110,9 @@ public:
virtual void PostUserEvent();
void Yield( bool bWait, bool bHandleAllCurrentEvents );
- GtkSalDisplay *GetDisplay() { return m_pGtkSalDisplay; }
inline GdkDisplay *GetGdkDisplay();
};
-inline GtkData* GetGtkSalData()
-{ return (GtkData*)ImplGetSVData()->mpSalData; }
-
class GtkSalFrame;
#if GTK_CHECK_VERSION(3,0,0)
@@ -168,8 +163,16 @@ public:
#endif
};
-inline GdkDisplay *GtkData::GetGdkDisplay() { return m_pGtkSalDisplay->GetGdkDisplay(); }
-
+inline GtkData* GetGtkSalData()
+{
+ return (GtkData*)ImplGetSVData()->mpSalData;
+}
+inline GdkDisplay *GtkData::GetGdkDisplay()
+{
+ return GetGtkDisplay()->GetGdkDisplay();
+}
+#if !GTK_CHECK_VERSION(3,0,0)
+#endif
#endif // _VCL_GTKDATA_HXX
diff --git a/vcl/inc/unx/kde/kdedata.hxx b/vcl/inc/unx/kde/kdedata.hxx
index 6f04d0a..f948af0 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() {}
+ KDEData() : X11SalData( SAL_DATA_KDE3 ) {}
virtual ~KDEData();
virtual void Init();
diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx
index e4bfadf..59a61f1 100644
--- a/vcl/inc/unx/saldata.hxx
+++ b/vcl/inc/unx/saldata.hxx
@@ -34,7 +34,7 @@
#include <unx/salstd.hxx>
#include <salframe.hxx>
#include <unx/salinst.h>
-#include <saldatabasic.hxx>
+#include <generic/gendata.hxx>
#include <osl/module.h>
#include <vclpluginapi.h>
@@ -54,30 +54,24 @@ typedef unsigned int pthread_t;
#endif
// -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-class VCLPLUG_GEN_PUBLIC X11SalData : public SalData
+class VCLPLUG_GEN_PUBLIC X11SalData : public SalGenericData
{
protected:
- SalXLib *pXLib_;
- SalDisplay *m_pSalDisplay;
- pthread_t hMainThread_;
- rtl::OUString maLocalHostName;
- rtl::OUString maUnicodeAccumulator;
+ SalXLib *pXLib_;
+ pthread_t hMainThread_;
public:
- X11SalData();
+ X11SalData( SalGenericDataType t );
virtual ~X11SalData();
virtual void Init();
+ virtual void Dispose();
virtual void initNWF();
virtual void deInitNWF();
inline void XError( Display *pDisplay, XErrorEvent *pEvent ) const;
- SalDisplay* GetDisplay() const
- { return m_pSalDisplay; }
- void SetSalDisplay( SalDisplay* pDisplay )
- { m_pSalDisplay = pDisplay; }
-
+ SalDisplay* GetX11Display() const { return GetSalDisplay(); }
void DeleteDisplay(); // for shutdown
inline SalXLib* GetLib() const { return pXLib_; }
@@ -87,12 +81,8 @@ public:
inline void StopTimer();
void Timeout() const;
- const rtl::OUString& GetLocalHostName();
- rtl::OUString& GetUnicodeAccumulator() { return maUnicodeAccumulator; }
-
static int XErrorHdl( Display*, XErrorEvent* );
static int XIOErrorHdl( Display* );
-
};
inline X11SalData* GetX11SalData()
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index bb9b92a..1a67e23 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -186,7 +186,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
maClientData.aInputEv.mbOnlyCursor = sal_False;
SalI18N_InputMethod *pInputMethod;
- pInputMethod = GetX11SalData()->GetDisplay()->GetInputMethod();
+ pInputMethod = GetGenericData()->GetSalDisplay()->GetInputMethod();
mnSupportedPreeditStyle = XIMPreeditCallbacks | XIMPreeditPosition
| XIMPreeditNothing | XIMPreeditNone;
@@ -299,7 +299,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
// XCreateIC() fails on Redflag Linux 2.0 if there is no
// fontset though the data itself is not evaluated nor is
// it required according to the X specs.
- Display* pDisplay = GetX11SalData()->GetDisplay()->GetDisplay();
+ Display* pDisplay = GetGenericData()->GetSalDisplay()->GetDisplay();
XFontSet pFontSet = get_font_set(pDisplay);
if (pFontSet != NULL)
@@ -420,7 +420,7 @@ SalI18N_InputContext::Map( SalFrame *pFrame )
if ( maContext == NULL )
{
SalI18N_InputMethod *pInputMethod;
- pInputMethod = GetX11SalData()->GetDisplay()->GetInputMethod();
+ pInputMethod = GetGenericData()->GetSalDisplay()->GetInputMethod();
maContext = XCreateIC( pInputMethod->GetMethod(),
XNVaNestedList, mpAttributes,
@@ -661,7 +661,7 @@ SalI18N_InputContext::SetICFocus( SalFrame* pFocusFrame )
{
sendEmptyCommit(pFocusFrame);
// begin preedit again
- GetX11SalData()->GetDisplay()->SendInternalEvent( pFocusFrame, &maClientData.aInputEv, SALEVENT_EXTTEXTINPUT );
+ GetGenericData()->GetSalDisplay()->SendInternalEvent( pFocusFrame, &maClientData.aInputEv, SALEVENT_EXTTEXTINPUT );
}
XSetICFocus( maContext );
@@ -678,7 +678,7 @@ SalI18N_InputContext::UnsetICFocus( SalFrame* pFrame )
if ( mbUseable && (maContext != NULL) )
{
// cancel an eventual event posted to begin preedit again
- GetX11SalData()->GetDisplay()->CancelInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SALEVENT_EXTTEXTINPUT );
+ GetGenericData()->GetSalDisplay()->CancelInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SALEVENT_EXTTEXTINPUT );
maClientData.pFrame = NULL;
XUnsetICFocus( maContext );
}
@@ -739,7 +739,7 @@ SalI18N_InputContext::EndExtTextInput( sal_uInt16 /*nFlags*/ )
if( static_cast<X11SalFrame*>(maClientData.pFrame)->hasFocus() )
{
// begin preedit again
- GetX11SalData()->GetDisplay()->SendInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SALEVENT_EXTTEXTINPUT );
+ GetGenericData()->GetSalDisplay()->SendInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SALEVENT_EXTTEXTINPUT );
}
}
}
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index f818f04..e2fcdae 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -185,7 +185,7 @@ bool XIMStatusWindow::checkLastParent() const
{
if( m_pLastParent )
{
- const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames();
+ const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
{
if( *it == m_pLastParent )
@@ -214,7 +214,7 @@ Point XIMStatusWindow::updatePosition()
XLIB_Window aChild;
XTranslateCoordinates( (Display*)pParentEnvData->pDisplay,
(XLIB_Window)pParentEnvData->aShellWindow,
- GetX11SalData()->GetDisplay()->GetRootWindow( GetX11SalData()->GetDisplay()->GetDefaultScreenNumber() ),
+ GetGenericData()->GetSalDisplay()->GetRootWindow( GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() ),
0, 0,
&x, &y,
&aChild );
@@ -461,14 +461,14 @@ void IIIMPStatusWindow::GetFocus()
* since reset focus really is an internal hack there should
* not be a method to be called in SalFrame destructor
*/
- const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames();
+ const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
std::list< SalFrame* >::const_iterator it;
for( it = rFrames.begin(); it != rFrames.end() && *it != m_pResetFocus; ++it )
;
if( it != rFrames.end() )
{
const SystemEnvData* pParentEnvData = m_pResetFocus->GetSystemData();
- SalXLib* pXLib = GetX11SalData()->GetDisplay()->GetXLib();
+ SalXLib* pXLib = GetGenericData()->GetSalDisplay()->GetXLib();
pXLib->PushXErrorLevel( true );
XSetInputFocus( (Display*)pParentEnvData->pDisplay,
(XLIB_Window)pParentEnvData->aShellWindow,
@@ -501,7 +501,7 @@ IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn )
if( pParent && pParent->isMapped() )
{
const SystemEnvData* pEnv = pParent->GetSystemData();
- SalXLib* pXLib = GetX11SalData()->GetDisplay()->GetXLib();
+ SalXLib* pXLib = GetGenericData()->GetSalDisplay()->GetXLib();
pXLib->PushXErrorLevel( true );
XSetInputFocus( (Display*)pEnv->pDisplay,
(XLIB_Window)pEnv->aShellWindow,
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 978199d..99136ad 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -232,12 +232,16 @@ static const char* XRequest[] = {
int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
{
+ OSL_ASSERT( GetX11SalData()->GetType() == SAL_DATA_UNX );
+
GetX11SalData()->XError( pDisplay, pEvent );
return 0;
}
int X11SalData::XIOErrorHdl( Display * )
{
+ OSL_ASSERT( GetX11SalData()->GetType() == SAL_DATA_UNX );
+
/* #106197# hack: until a real shutdown procedure exists
* _exit ASAP
*/
@@ -264,34 +268,34 @@ int X11SalData::XIOErrorHdl( Display * )
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <pthread.h>
-X11SalData::X11SalData()
+X11SalData::X11SalData( SalGenericDataType t )
+ : SalGenericData( t )
{
pXLib_ = NULL;
- m_pSalDisplay = NULL;
m_pInstance = NULL;
m_pPlugin = NULL;
hMainThread_ = pthread_self();
}
-const rtl::OUString& X11SalData::GetLocalHostName()
+X11SalData::~X11SalData()
{
- if (!maLocalHostName.getLength())
- osl_getLocalHostname( &maLocalHostName.pData );
- return maLocalHostName;
+ DeleteDisplay();
}
-X11SalData::~X11SalData()
+void X11SalData::Dispose()
{
- DeleteDisplay();
+ deInitNWF();
+ delete GetDisplay();
+ SetSalData( NULL );
}
void X11SalData::DeleteDisplay()
{
- delete m_pSalDisplay;
- m_pSalDisplay = NULL;
+ delete GetDisplay();
+ SetDisplay( NULL );
delete pXLib_;
- pXLib_ = NULL;
+ pXLib_ = NULL;
}
void X11SalData::Init()
@@ -558,7 +562,7 @@ void SalXLib::XError( Display *pDisplay, XErrorEvent *pEvent )
return;
- if( pDisplay != GetX11SalData()->GetDisplay()->GetDisplay() )
+ if( pDisplay != GetGenericData()->GetSalDisplay()->GetDisplay() )
return;
PrintXError( pDisplay, pEvent );
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index d1b1e56..4e30e1a 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -319,7 +319,7 @@ sal_IsLocalDisplay( Display *pDisplay )
if( pPtr != NULL )
{
- const OUString& rLocalHostname( GetX11SalData()->GetLocalHostName() );
+ const OUString& rLocalHostname( GetGenericData()->GetHostname() );
if( rLocalHostname.getLength() )
{
*pPtr = '\0';
@@ -497,11 +497,10 @@ SalDisplay::SalDisplay( Display *display ) :
X11SalData *pSalData = GetX11SalData();
DBG_ASSERT( ! pSalData->GetDisplay(), "Second SalDisplay created !!!\n" );
- pSalData->SetSalDisplay( this );
+ pSalData->SetDisplay( this );
- pXLib_ = pSalData->GetLib();
+ pXLib_ = pSalData->GetLib();
m_nDefaultScreen = DefaultScreen( pDisp_ );
-
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -567,7 +566,7 @@ void SalDisplay::doDestruct()
}
if( pSalData->GetDisplay() == this )
- pSalData->SetSalDisplay( NULL );
+ pSalData->SetDisplay( NULL );
}
static int DisplayHasEvent( int fd, SalX11Display *pDisplay )
@@ -2763,12 +2762,12 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap, int nS
// PseudoColor
SalColormap::SalColormap( const BitmapPalette &rPalette )
- : m_pDisplay( GetX11SalData()->GetDisplay() ),
+ : m_pDisplay( GetGenericData()->GetSalDisplay() ),
m_hColormap( None ),
m_nWhitePixel( SALCOLOR_NONE ),
m_nBlackPixel( SALCOLOR_NONE ),
m_nUsed( rPalette.GetEntryCount() ),
- m_nScreen( GetX11SalData()->GetDisplay()->GetDefaultScreenNumber() )
+ m_nScreen( GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() )
{
m_aPalette = std::vector<SalColor>(m_nUsed);
@@ -2787,7 +2786,7 @@ SalColormap::SalColormap( const BitmapPalette &rPalette )
// MonoChrome
SalColormap::SalColormap()
- : m_pDisplay( GetX11SalData()->GetDisplay() ),
+ : m_pDisplay( GetGenericData()->GetSalDisplay() ),
m_hColormap( None ),
m_nWhitePixel( 1 ),
m_nBlackPixel( 0 ),
@@ -2804,12 +2803,12 @@ SalColormap::SalColormap()
// TrueColor
SalColormap::SalColormap( sal_uInt16 nDepth )
- : m_pDisplay( GetX11SalData()->GetDisplay() ),
+ : m_pDisplay( GetGenericData()->GetSalDisplay() ),
m_hColormap( None ),
m_nWhitePixel( (1 << nDepth) - 1 ),
m_nBlackPixel( 0x00000000 ),
m_nUsed( 1 << nDepth ),
- m_nScreen( GetX11SalData()->GetDisplay()->GetDefaultScreenNumber() )
+ m_nScreen( GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() )
{
const SalVisual *pVisual = &m_pDisplay->GetVisual( m_nScreen );
@@ -2900,7 +2899,7 @@ SalColormap::~SalColormap()
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void SalColormap::SetPalette( const BitmapPalette &rPalette )
{
- if( this != &GetX11SalData()->GetDisplay()->GetColormap(m_nScreen) )
+ if( this != &GetGenericData()->GetSalDisplay()->GetColormap(m_nScreen) )
{
m_nBlackPixel = SALCOLOR_NONE;
m_nWhitePixel = SALCOLOR_NONE;
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index e5025a4..da5d036 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -73,7 +73,7 @@ extern "C"
X11SalInstance* pInstance = new X11SalInstance( new SalYieldMutex() );
// initialize SalData
- X11SalData *pSalData = new X11SalData;
+ X11SalData *pSalData = new X11SalData( SAL_DATA_UNX );
SetSalData( pSalData );
pSalData->m_pInstance = pInstance;
pSalData->Init();
@@ -90,11 +90,7 @@ X11SalInstance::~X11SalInstance()
// dispose SalDisplay list from SalData
// would be done in a static destructor else which is
// a little late
-
- X11SalData *pSalData = GetX11SalData();
- pSalData->deInitNWF();
- delete pSalData;
- SetSalData( NULL );
+ GetGenericData()->Dispose();
}
@@ -150,11 +146,13 @@ Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData )
bool X11SalInstance::AnyInput(sal_uInt16 nType)
{
X11SalData *pSalData = GetX11SalData();
- Display *pDisplay = pSalData->GetDisplay()->GetDisplay();
+
+ SalGenericData *pData = GetGenericData();
+ Display *pDisplay = pData->GetSalDisplay()->GetDisplay();
sal_Bool bRet = sal_False;
if( (nType & INPUT_TIMER) &&
- pSalData->GetDisplay()->GetXLib()->CheckTimeout( false ) )
+ pSalData->GetSalDisplay()->GetXLib()->CheckTimeout( false ) )
{
bRet = sal_True;
}
@@ -258,7 +256,7 @@ static void getServerDirectories( std::list< rtl::OString >& o_rFontPaths )
void X11SalInstance::FillFontPathList( std::list< rtl::OString >& o_rFontPaths )
{
- Display *pDisplay = GetX11SalData()->GetDisplay()->GetDisplay();
+ Display *pDisplay = GetGenericData()->GetSalDisplay()->GetDisplay();
DBG_ASSERT( pDisplay, "No Display !" );
if( pDisplay )
@@ -351,7 +349,7 @@ void X11SalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, cons
void X11SalInstance::PostPrintersChanged()
{
- SalDisplay* pDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pDisp = GetGenericData()->GetSalDisplay();
const std::list< SalFrame* >& rList = pDisp->getFrames();
for( std::list< SalFrame* >::const_iterator it = rList.begin();
it != rList.end(); ++it )
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx
index 77b2e6f..7bb084b 100644
--- a/vcl/unx/generic/app/sm.cxx
+++ b/vcl/unx/generic/app/sm.cxx
@@ -288,7 +288,7 @@ IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG )
task of the quick-starter)
*/
*pSmRestartHint = SmRestartNever;
- const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames();
+ const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
{
Window *pWindow = (*it)->GetWindow();
@@ -382,7 +382,7 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG
pOneInstance->CallCallback( &aEvent );
}
- const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames();
+ const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
SMprintf( rFrames.begin() != rFrames.end() ? "shutdown on first frame\n" : "shutdown event but no frame\n" );
if( rFrames.begin() != rFrames.end() )
rFrames.front()->CallCallback( SALEVENT_SHUTDOWN, 0 );
@@ -487,7 +487,7 @@ void SessionManagerClient::open()
pClientID = NULL;
ICEConnectionObserver::unlock();
- SalDisplay* pDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pDisp = GetGenericData()->GetSalDisplay();
if( pDisp->GetDrawable(pDisp->GetDefaultScreenNumber()) && !m_aClientID.isEmpty() )
{
XChangeProperty( pDisp->GetDisplay(),
@@ -794,7 +794,7 @@ void ICEConnectionObserver::ICEWatchProc(
SMprintf( "ICE connection on %d %s\n",
IceConnectionNumber( connection ),
opening ? "inserted" : "removed" );
- SMprintf( "Display connection is %d\n", ConnectionNumber( GetX11SalData()->GetDisplay()->GetDisplay() ) );
+ SMprintf( "Display connection is %d\n", ConnectionNumber( GetGenericData()->GetSalDisplay()->GetDisplay() ) );
#endif
}
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index b33349b..967fc53 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -2403,7 +2403,7 @@ void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const
*/
void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const
{
- rtl::OString aWmClient( rtl::OUStringToOString( GetX11SalData()->GetLocalHostName(), RTL_TEXTENCODING_ASCII_US ) );
+ rtl::OString aWmClient( rtl::OUStringToOString( GetGenericData()->GetHostname(), RTL_TEXTENCODING_ASCII_US ) );
XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, aWmClient.getLength() };
XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp );
}
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index 22f1099..05927c3 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -3332,10 +3332,10 @@ void SelectionManager::startDrag(
osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() );
if( rSolarMutex.tryToAcquire() )
{
- pCaptureFrame = GetX11SalData()->GetDisplay()->GetCaptureFrame();
+ pCaptureFrame = GetGenericData()->GetSalDisplay()->GetCaptureFrame();
if( pCaptureFrame )
{
- GetX11SalData()->GetDisplay()->CaptureMouse( NULL );
+ GetGenericData()->GetSalDisplay()->CaptureMouse( NULL );
nPointerGrabSuccess =
XGrabPointer( m_pDisplay, it->second.m_aRootWindow, True,
DRAG_EVENT_MASK,
@@ -3372,7 +3372,7 @@ void SelectionManager::startDrag(
{
osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() );
if( rSolarMutex.tryToAcquire() )
- GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame );
+ GetGenericData()->GetSalDisplay()->CaptureMouse( pCaptureFrame );
#if OSL_DEBUG_LEVEL > 0
else
OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" );
@@ -3461,7 +3461,7 @@ void SelectionManager::startDrag(
{
osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() );
if( rSolarMutex.tryToAcquire() )
- GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame );
+ GetGenericData()->GetSalDisplay()->CaptureMouse( pCaptureFrame );
#if OSL_DEBUG_LEVEL > 0
else
OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" );
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index 14191c7..fdf01a2 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -55,7 +55,7 @@ struct MultiScreenGlyph
// ===========================================================================
X11GlyphPeer::X11GlyphPeer()
-: mpDisplay( GetX11SalData()->GetDisplay()->GetDisplay() )
+: mpDisplay( GetGenericData()->GetSalDisplay()->GetDisplay() )
, mnMaxScreens(0)
, mnDefaultScreen(0)
, mnExtByteCount(0)
@@ -67,7 +67,7 @@ X11GlyphPeer::X11GlyphPeer()
if( !mpDisplay )
return;
- SalDisplay& rSalDisplay = *GetX11SalData()->GetDisplay();
+ SalDisplay& rSalDisplay = *GetGenericData()->GetSalDisplay();
mpDisplay = rSalDisplay.GetDisplay();
mnMaxScreens = rSalDisplay.GetScreenCount();
if( mnMaxScreens > MAX_GCACH_SCREENS )
@@ -85,7 +85,7 @@ X11GlyphPeer::X11GlyphPeer()
X11GlyphPeer::~X11GlyphPeer()
{
- SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
Display* const pX11Disp = pSalDisp->GetDisplay();
XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
for( int i = 0; i < mnMaxScreens; i++ )
@@ -131,7 +131,7 @@ void X11GlyphPeer::InitAntialiasing()
// enable client side antialiasing for screen visuals that are suitable
// mnForcedAA is a bitmask of screens enabled for client side antialiasing
mnForcedAA = (~(~0U << mnMaxScreens)) ^ mnUsingXRender;
- SalDisplay& rSalDisplay = *GetX11SalData()->GetDisplay();
+ SalDisplay& rSalDisplay = *GetGenericData()->GetSalDisplay();
for( int nScreen = 0; nScreen < mnMaxScreens; ++nScreen)
{
Visual* pVisual = rSalDisplay.GetVisual( nScreen ).GetVisual();
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 22a5d1e..c2057e7 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -217,7 +217,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
if( aDrawable && nWidth && nHeight && nDrawableDepth )
{
- SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
SalXLib* pXLib = pSalDisp->GetXLib();
Display* pXDisp = pSalDisp->GetDisplay();
@@ -743,7 +743,7 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB(
}
}
- XImage* pImage = ImplCreateXImage( GetX11SalData()->GetDisplay(), nScreen,
+ XImage* pImage = ImplCreateXImage( GetGenericData()->GetSalDisplay(), nScreen,
nDrawableDepth, aTwoRect );
if( pImage )
@@ -866,7 +866,7 @@ bool X11SalBitmap::Create(
);
bool bFreePixmap = false;
if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap )
- XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle );
+ XFreePixmap( GetGenericData()->GetSalDisplay()->GetDisplay(), pixmapHandle );
return bSuccess;
}
@@ -985,7 +985,7 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const S
, mnDepth ( pImage->depth )
, mnScreen ( nScreen )
{
- SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
Display* pXDisp = pSalDisp->GetDisplay();
if( (maPixmap = XCreatePixmap( pXDisp, aDrawable, ImplGetWidth(), ImplGetHeight(), ImplGetDepth() )) )
@@ -1060,7 +1060,7 @@ ImplSalDDB::ImplSalDDB(
) : mnDepth( nDrawableDepth )
, mnScreen( nScreen )
{
- SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
Display* pXDisp = pSalDisp->GetDisplay();
if( (maPixmap = XCreatePixmap( pXDisp, aDrawable, nWidth, nHeight, nDrawableDepth )) )
@@ -1093,7 +1093,7 @@ ImplSalDDB::ImplSalDDB(
ImplSalDDB::~ImplSalDDB()
{
if( maPixmap && ImplGetSVData() )
- XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), maPixmap );
+ XFreePixmap( GetGenericData()->GetSalDisplay()->GetDisplay(), maPixmap );
}
// -----------------------------------------------------------------------------
@@ -1162,7 +1162,7 @@ void ImplSalDDB::ImplDraw(
long nDestY,
const GC& rGC
) {
- SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
Display* pXDisp = pSalDisp->GetDisplay();
if( 1 == nSrcDrawableDepth )
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 1eb14c5..13ca603 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -201,7 +201,7 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
if( nScreen != m_nScreen )
{
freeResources();
- m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap( nScreen );
+ m_pColormap = &GetGenericData()->GetSalDisplay()->GetColormap( nScreen );
m_nScreen = nScreen;
}
@@ -224,7 +224,7 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen )
{
- m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen);
+ m_pColormap = &GetGenericData()->GetSalDisplay()->GetColormap(nScreen);
m_nScreen = nScreen;
SetDrawable( aTarget, nScreen );
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index a73a3ca..1669ab6 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -84,7 +84,7 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
src_x, src_y, w, h, dest_x, dest_y );
else
{
- SalXLib* pLib = GetX11SalData()->GetDisplay()->GetXLib();
+ SalXLib* pLib = GetGenericData()->GetSalDisplay()->GetXLib();
pLib->PushXErrorLevel( true );
XImage* pImage = XGetImage( pDisplay, aSrc, src_x, src_y, w, h,
AllPlanes, ZPixmap );
@@ -413,7 +413,7 @@ void X11SalGraphics::YieldGraphicsExpose()
XLIB_Window aWindow = GetDrawable();
if( ! pFrame )
{
- const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames();
+ const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end() && ! pFrame; ++it )
{
const SystemEnvData* pEnvData = (*it)->GetSystemData();
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 0bb3451..b02f8af 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -58,7 +58,7 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
XLIB_Window aRoot;
int x, y;
unsigned int w = 0, h = 0, bw, d;
- Display* pDisp = GetX11SalData()->GetDisplay()->GetDisplay();
+ Display* pDisp = GetGenericData()->GetSalDisplay()->GetDisplay();
XGetGeometry( pDisp, pData->hDrawable,
&aRoot, &x, &y, &w, &h, &bw, &d );
int nScreen = 0;
@@ -70,16 +70,16 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
}
nDX = (long)w;
nDY = (long)h;
- if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable,
+ if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable,
static_cast< XRenderPictFormat* >( pData->pXRenderFormat )) )
{
delete pVDev;
return NULL;
}
}
- else if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount,
+ else if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount,
pGraphics ? static_cast<X11SalGraphics*>(pGraphics)->GetScreenNumber() :
- GetX11SalData()->GetDisplay()->GetDefaultScreenNumber() ) )
+ GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() ) )
{
delete pVDev;
return NULL;
diff --git a/vcl/unx/generic/gdi/xrender_peer.cxx b/vcl/unx/generic/gdi/xrender_peer.cxx
index eda3254..52611e7 100644
--- a/vcl/unx/generic/gdi/xrender_peer.cxx
+++ b/vcl/unx/generic/gdi/xrender_peer.cxx
@@ -47,7 +47,7 @@ using namespace rtl;
// ---------------------------------------------------------------------------
XRenderPeer::XRenderPeer()
-: mpDisplay( GetX11SalData()->GetDisplay()->GetDisplay() ),
+: mpDisplay( GetGenericData()->GetSalDisplay()->GetDisplay() ),
mpStandardFormatA8( NULL ),
mnRenderVersion( 0 ),
mpRenderLib( NULL )
@@ -216,7 +216,7 @@ sal_uInt32 XRenderPeer::InitRenderText()
// and the visual must be supported too on at least one screen
sal_uInt32 nRetMask = 0;
- SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+ SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
const int nScreenCount = pSalDisp->GetScreenCount();
XRenderPictFormat* pVisualFormat = NULL;
int nMaxDepth = 0;
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 305d015..6d821bd 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -650,7 +650,7 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData*
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
X11SalFrame::X11SalFrame( SalFrame *pParent, sal_uLong nSalFrameStyle, SystemParentData* pSystemParent )
{
- X11SalData* pSalData = GetX11SalData();
+ SalGenericData *pData = GetGenericData();
// initialize frame geometry
memset( &maGeometry, 0, sizeof(maGeometry) );
@@ -659,7 +659,7 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, sal_uLong nSalFrameStyle, SystemPar
mbTransientForRoot = false;
- pDisplay_ = pSalData->GetDisplay();
+ pDisplay_ = pData->GetSalDisplay();
// insert frame in framelist
pDisplay_->registerFrame( this );
@@ -2796,13 +2796,13 @@ SalFrame::SalPointerState X11SalFrame::GetPointerState()
SalFrame::SalIndicatorState X11SalFrame::GetIndicatorState()
{
SalIndicatorState aState;
- aState.mnState = GetX11SalData()->GetDisplay()->GetIndicatorState();
+ aState.mnState = GetGenericData()->GetSalDisplay()->GetIndicatorState();
return aState;
}
void X11SalFrame::SimulateKeyPress( sal_uInt16 nKeyCode )
{
- GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode);
+ GetGenericData()->GetSalDisplay()->SimulateKeyPress(nKeyCode);
}
long X11SalFrame::HandleMouseEvent( XEvent *pEvent )
@@ -3099,7 +3099,7 @@ GetAlternateKeyCode( const sal_uInt16 nKeyCode )
void X11SalFrame::beginUnicodeSequence()
{
- rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() );
+ rtl::OUString& rSeq( GetGenericData()->GetUnicodeCommand() );
DeletionListener aDeleteWatch( this );
if( rSeq.getLength() )
@@ -3126,7 +3126,7 @@ void X11SalFrame::beginUnicodeSequence()
bool X11SalFrame::appendUnicodeSequence( sal_Unicode c )
{
bool bRet = false;
- rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list