summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-10-03 16:36:26 +0100
committerMichael Meeks <michael.meeks@suse.com>2011-10-25 13:41:52 +0100
commitc529623457889a67473f773d080941903e2784fc (patch)
treea8a41cbb19a3063d10c22db8e6fe6d5dddc5960b
parentf88ff49c733392e66dd178928efa3d807f2cffca (diff)
generic: re-work X error push/pop and error message handling
-rw-r--r--vcl/inc/generic/gendata.hxx4
-rw-r--r--vcl/inc/unx/gtk/gtkdata.hxx6
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx3
-rw-r--r--vcl/inc/unx/saldata.hxx37
-rw-r--r--vcl/inc/unx/saldisp.hxx50
-rw-r--r--vcl/unx/generic/app/i18n_status.cxx10
-rw-r--r--vcl/unx/generic/app/saldata.cxx155
-rw-r--r--vcl/unx/generic/app/saldisp.cxx25
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx166
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx5
-rw-r--r--vcl/unx/generic/gdi/salgdi2.cxx7
-rw-r--r--vcl/unx/generic/window/salframe.cxx40
-rw-r--r--vcl/unx/generic/window/salobj.cxx17
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx35
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx64
-rw-r--r--vcl/unx/kde/kdedata.cxx13
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx11
17 files changed, 319 insertions, 329 deletions
diff --git a/vcl/inc/generic/gendata.hxx b/vcl/inc/generic/gendata.hxx
index 0392adc9eae9..ef7725f6a559 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 3f8444c62eec..4e5f7b68f3f2 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 0e3ada125613..4fa86d3af173 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 30573b00132c..2d5dca512673 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 20a1abc457a6..73e527765d38 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 e2fcdae113c7..d99894c6955d 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 940dc22b0517..4b235a4f7ac6 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 c0ca7fe1eb22..004b3fc4f914 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 89e9d5b486e9..ed97ddb189f0 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -579,7 +579,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 ],
@@ -593,26 +593,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 )
{
@@ -779,7 +784,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 ],
@@ -793,63 +798,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,
@@ -858,27 +825,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 c2057e79fb9b..d0201e3df6d6 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 1669ab6f2662..2b2612025a68 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 6d821bdee88a..ad43f7afefe6 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 cc9487fda4be..da0937858150 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 5f39bd9c9053..52b7166c2899 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 )
@@ -773,6 +759,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 bc7a568165c7..e16dd4b10d6b 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 d1dc388b7d31..177fa4ed5e3a 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 ad46e61f4c44..a5804b39b5e4 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