[Libreoffice-commits] .: Branch 'feature/gtk3' - 3 commits - vcl/inc vcl/unx
Michael Meeks
michael at kemper.freedesktop.org
Fri Jul 1 09:23:02 PDT 2011
vcl/inc/unx/gtk/gtkdata.hxx | 68 ++++++++++++
vcl/inc/unx/gtk/gtkframe.hxx | 3
vcl/inc/unx/gtk/gtkinst.hxx | 22 ++++
vcl/unx/gtk/a11y/atkbridge.cxx | 6 -
vcl/unx/gtk/app/gtkdata.cxx | 181 ++++++++++++++++++++++++++++++----
vcl/unx/gtk/app/gtksys.cxx | 95 ++++++++++++++++++
vcl/unx/gtk/window/gtkframe.cxx | 211 +++++++++++++++++++++++++++++-----------
7 files changed, 508 insertions(+), 78 deletions(-)
New commits:
commit 44bd4c499ffeef811a34f0dfe621be8769f57241
Author: Michael Meeks <michael.meeks at novell.com>
Date: Fri Jul 1 16:19:11 2011 +0100
extensive X-orcisms performed, with some horrendous cut/paste
code looks like the wild-west, needs incremental cleanup & re-factoring
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 3262670..14b1eba 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -93,6 +93,7 @@ public:
virtual void deInitNWF();
GtkSalDisplay *pDisplay;
+ GtkSalDisplay *GetDisplay() { return pDisplay; }
#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
GtkXLib *pXLib_;
#endif
@@ -121,10 +122,10 @@ public:
GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
+ virtual void registerFrame( SalFrame* pFrame );
virtual void deregisterFrame( SalFrame* pFrame );
GdkCursor *getCursor( PointerStyle ePointerStyle );
virtual int CaptureMouse( SalFrame* pFrame );
- virtual long Dispatch( XEvent *pEvent );
virtual void initScreen( int nScreen ) const;
virtual int GetDefaultMonitorNumber() const;
@@ -139,15 +140,44 @@ public:
void errorTrapPush();
void errorTrapPop();
-#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+ inline bool HasMoreEvents() { return m_aUserEvents.size() > 1; }
+ inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
+ inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
+
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ virtual long Dispatch( XEvent *pEvent );
+#else
bool IsXinerama() { return false; }
+ int GetDefaultScreenNumber() const { return 0; }
+ int GetScreenCount() const { return 1; }
std::vector<Rectangle> GetXineramaScreens() { return std::vector<Rectangle>(); }
+ Size GetScreenSize( int screen );
void SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT );
void CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
-#else
- inline bool HasMoreEvents() { return m_aUserEvents.size() > 1; }
- inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
- inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
+ bool DispatchInternalEvent();
+
+ SalFrame *m_pCapture;
+ sal_Bool MouseCaptured( const SalFrame *pFrameData ) const
+ { return m_pCapture == pFrameData; }
+ SalFrame* GetCaptureFrame() const
+ { return m_pCapture; }
+
+ struct SalUserEvent
+ {
+ SalFrame* m_pFrame;
+ void* m_pData;
+ sal_uInt16 m_nEvent;
+
+ SalUserEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
+ : m_pFrame( pFrame ),
+ m_pData( pData ),
+ m_nEvent( nEvent )
+ {}
+ };
+
+ oslMutex hEventGuard_;
+ std::list< SalUserEvent > m_aUserEvents;
+ guint32 GetLastUserEventTime( bool b ) { return GDK_CURRENT_TIME; } // horrible hack
#endif
};
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index b40c614..2d34cc7 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -31,6 +31,7 @@
#include <unx/salinst.h>
#include <unx/salsys.h>
+#include <gtk/gtk.h>
class GtkYieldMutex : public SalYieldMutex
{
@@ -97,11 +98,32 @@ public:
virtual SalBitmap* CreateSalBitmap();
};
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+class GtkSalSystem : public SalSystem
+{
+public:
+ GtkSalSystem() : SalSystem() {}
+#else
class GtkSalSystem : public X11SalSystem
{
public:
GtkSalSystem() : X11SalSystem() {}
+#endif
virtual ~GtkSalSystem();
+
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+ virtual unsigned int GetDisplayScreenCount();
+ virtual bool IsMultiDisplay();
+ virtual unsigned int GetDefaultDisplayNumber();
+ virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen );
+ virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen );
+ virtual rtl::OUString GetScreenName( unsigned int nScreen );
+ virtual int ShowNativeMessageBox( const String& rTitle,
+ const String& rMessage,
+ int nButtonCombination,
+ int nDefaultButton);
+#endif
+
virtual int ShowNativeDialog( const String& rTitle,
const String& rMessage,
const std::list< String >& rButtons,
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 3facc99..6c2f946 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -81,15 +81,21 @@ GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event,
}
}
-GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay )
- : SalDisplay( gdk_x11_display_get_xdisplay( pDisplay ) ),
- m_pGdkDisplay( pDisplay ),
- m_bStartupCompleted( false )
+GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) :
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ SalDisplay( gdk_x11_display_get_xdisplay( pDisplay ) ),
+#endif
+ m_pGdkDisplay( pDisplay ),
+ m_bStartupCompleted( false )
{
- m_bUseRandRWrapper = false; // use gdk signal instead
for(int i = 0; i < POINTER_COUNT; i++)
m_aCursors[ i ] = NULL;
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+ m_pCapture = NULL;
+#else
+ m_bUseRandRWrapper = false; // use gdk signal instead
Init ();
+#endif
gdk_window_add_filter( NULL, call_filterGdkEvent, this );
@@ -103,13 +109,15 @@ GtkSalDisplay::~GtkSalDisplay()
if( !m_bStartupCompleted )
gdk_notify_startup_complete();
+
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
doDestruct();
+ pDisp_ = NULL;
+#endif
for(int i = 0; i < POINTER_COUNT; i++)
if( m_aCursors[ i ] )
gdk_cursor_unref( m_aCursors[ i ] );
-
- pDisp_ = NULL;
}
void GtkSalDisplay::errorTrapPush()
@@ -131,6 +139,13 @@ void GtkSalDisplay::errorTrapPop()
#endif
}
+void GtkSalDisplay::registerFrame( SalFrame* pFrame )
+{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ SalDisplay::registerFrame( pFrame );
+#endif
+}
+
void GtkSalDisplay::deregisterFrame( SalFrame* pFrame )
{
if( m_pCapture == pFrame )
@@ -138,7 +153,9 @@ void GtkSalDisplay::deregisterFrame( SalFrame* pFrame )
static_cast<GtkSalFrame*>(m_pCapture)->grabPointer( FALSE );
m_pCapture = NULL;
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
SalDisplay::deregisterFrame( pFrame );
+#endif
}
extern "C" {
@@ -146,7 +163,9 @@ extern "C" {
void signalKeysChanged( GdkKeymap*, gpointer data )
{
GtkSalDisplay* pDisp = (GtkSalDisplay*)data;
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
pDisp->GetKeyboardName(true);
+#endif
}
void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data )
@@ -166,6 +185,7 @@ void signalMonitorsChanged( GdkScreen* pScreen, gpointer data )
GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event,
GdkEvent* )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
GdkFilterReturn aFilterReturn = GDK_FILTER_CONTINUE;
XEvent *pEvent = (XEvent *)sys_event;
@@ -210,10 +230,14 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event,
}
return aFilterReturn;
+#else
+ return GDK_FILTER_CONTINUE;
+#endif
}
void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( pScreen )
{
int nScreen = gdk_screen_get_number( pScreen );
@@ -233,10 +257,12 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen )
OSL_FAIL( "unknown screen changed size" );
}
}
+#endif
}
void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( pScreen )
{
if( gdk_display_get_n_screens(m_pGdkDisplay) == 1 )
@@ -263,6 +289,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
}
}
}
+#endif
}
extern "C"
@@ -273,6 +300,7 @@ extern "C"
int GtkSalDisplay::GetDefaultMonitorNumber() const
{
int n = 0;
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen );
#if GTK_CHECK_VERSION(2,20,0)
n = gdk_screen_get_primary_monitor(pScreen);
@@ -295,11 +323,15 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const
#endif
if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() )
n = m_aXineramaScreenIndexMap[n];
+#endif
return n;
}
void GtkSalDisplay::initScreen( int nScreen ) const
{
+#if GTK_CHECK_VERSION(3,0,0)
+ // no colormaps handling in gtk 3 or need to init screens ...
+#else
if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) )
nScreen = m_nDefaultScreen;
ScreenData& rSD = const_cast<ScreenData&>(m_aScreens[nScreen]);
@@ -309,9 +341,6 @@ void GtkSalDisplay::initScreen( int nScreen ) const
// choose visual for screen
SalDisplay::initScreen( nScreen );
-#if GTK_CHECK_VERSION(3,0,0)
- // no colormaps handling in gtk 3
-#else
// now set a gdk default colormap matching the chosen visual to the screen
GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, nScreen );
// should really use this:
@@ -338,6 +367,7 @@ void GtkSalDisplay::initScreen( int nScreen ) const
#endif
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
long GtkSalDisplay::Dispatch( XEvent* pEvent )
{
if( GetDisplay() == pEvent->xany.display )
@@ -354,6 +384,7 @@ long GtkSalDisplay::Dispatch( XEvent* pEvent )
return GDK_FILTER_CONTINUE;
}
+#endif
#if GTK_CHECK_VERSION(3,0,0)
namespace
@@ -913,6 +944,94 @@ gboolean GtkXLib::userEventFn(gpointer data)
return bContinue;
}
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+
+// FIXME: cut/paste from saldisp.cxx - needs some re-factoring love
+bool GtkSalDisplay::DispatchInternalEvent()
+{
+ SalFrame* pFrame = NULL;
+ void* pData = NULL;
+ sal_uInt16 nEvent = 0;
+
+ if( osl_acquireMutex( hEventGuard_ ) )
+ {
+ if( m_aUserEvents.begin() != m_aUserEvents.end() )
+ {
+ pFrame = m_aUserEvents.front().m_pFrame;
+ pData = m_aUserEvents.front().m_pData;
+ nEvent = m_aUserEvents.front().m_nEvent;
+
+ m_aUserEvents.pop_front();
+ }
+ osl_releaseMutex( hEventGuard_ );
+ }
+ else {
+ DBG_ASSERT( 1, "SalDisplay::Yield !acquireMutex\n" );
+ }
+
+ if( pFrame )
+ pFrame->CallCallback( nEvent, pData );
+
+ return pFrame != NULL;
+}
+
+// FIXME: cut/paste from saldisp.cxx - needs some re-factoring love
+void GtkSalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent )
+{
+ if( osl_acquireMutex( hEventGuard_ ) )
+ {
+ m_aUserEvents.push_back( SalUserEvent( pFrame, pData, nEvent ) );
+
+ // Notify GtkXLib::Yield() of a pending event.
+ GetGtkSalData()->pXLib_->PostUserEvent();
+
+ osl_releaseMutex( hEventGuard_ );
+ }
+ else {
+ DBG_ASSERT( 1, "SalDisplay::SendInternalEvent !acquireMutex\n" );
+ }
+}
+
+// FIXME: cut/paste from saldisp.cxx - needs some re-factoring love
+void GtkSalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent )
+{
+ if( osl_acquireMutex( hEventGuard_ ) )
+ {
+ if( ! m_aUserEvents.empty() )
+ {
+ std::list< SalUserEvent >::iterator it, next;
+ next = m_aUserEvents.begin();
+ do
+ {
+ it = next++;
+ if( it->m_pFrame == pFrame &&
+ it->m_pData == pData &&
+ it->m_nEvent == nEvent )
+ {
+ m_aUserEvents.erase( it );
+ }
+ } while( next != m_aUserEvents.end() );
+ }
+
+ osl_releaseMutex( hEventGuard_ );
+ }
+ else {
+ DBG_ASSERT( 1, "SalDisplay::CancelInternalEvent !acquireMutex\n" );
+ }
+}
+
+Size GtkSalDisplay::GetScreenSize( int nScreen )
+{
+ GdkScreen *pScreen = gdk_display_get_screen (m_pGdkDisplay, nScreen);
+ if (!pScreen)
+ return Size();
+ else
+ return Size( gdk_screen_get_width (pScreen),
+ gdk_screen_get_height (pScreen) );
+}
+
+#endif
+
// hEventGuard_ held during this invocation
void GtkXLib::PostUserEvent()
{
diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx
index 8a335da..1297419 100644
--- a/vcl/unx/gtk/app/gtksys.cxx
+++ b/vcl/unx/gtk/app/gtksys.cxx
@@ -54,6 +54,101 @@ GtkSalSystem::~GtkSalSystem()
{
}
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+unsigned int GtkSalSystem::GetDisplayScreenCount()
+{
+ return 1;
+}
+
+bool GtkSalSystem::IsMultiDisplay()
+{
+ return false;
+}
+
+unsigned int GtkSalSystem::GetDefaultDisplayNumber()
+{
+ return 0;
+}
+
+Rectangle GtkSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen )
+{
+ g_warning ("FIXME: GetDisplayScreenPosSizePixel unimplemented");
+ return Rectangle (0, 0, 1024, 768);
+}
+
+Rectangle GtkSalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen )
+{
+ return GetDisplayScreenPosSizePixel( nScreen );
+}
+
+rtl::OUString GtkSalSystem::GetScreenName( unsigned int nScreen )
+{
+ return rtl::OUString::createFromAscii( "Jim" );
+}
+
+// FIXME: shocking cut/paste from X11SalSystem ... [!] - push me lower ...
+#include <vcl/msgbox.hxx>
+#include <vcl/button.hxx>
+
+int GtkSalSystem::ShowNativeMessageBox( const String& rTitle,
+ const String& rMessage,
+ int nButtonCombination,
+ int nDefaultButton)
+{
+ int nDefButton = 0;
+ std::list< String > aButtons;
+ int nButtonIds[5], nBut = 0;
+
+ if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK ||
+ nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL )
+ {
+ aButtons.push_back( Button::GetStandardText( BUTTON_OK ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK;
+ }
+ if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL ||
+ nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO )
+ {
+ aButtons.push_back( Button::GetStandardText( BUTTON_YES ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES;
+ aButtons.push_back( Button::GetStandardText( BUTTON_NO ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO;
+ if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO )
+ nDefButton = 1;
+ }
+ if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL ||
+ nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL ||
+ nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL )
+ {
+ if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL )
+ {
+ aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY;
+ }
+ aButtons.push_back( Button::GetStandardText( BUTTON_CANCEL ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL;
+ if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL )
+ nDefButton = aButtons.size()-1;
+ }
+ if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE )
+ {
+ aButtons.push_back( Button::GetStandardText( BUTTON_ABORT ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT;
+ aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY;
+ aButtons.push_back( Button::GetStandardText( BUTTON_IGNORE ) );
+ nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE;
+ switch( nDefaultButton )
+ {
+ case SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY: nDefButton = 1;break;
+ case SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE: nDefButton = 2;break;
+ }
+ }
+ int nResult = ShowNativeDialog( rTitle, rMessage, aButtons, nDefButton );
+
+ return nResult != -1 ? nButtonIds[ nResult ] : 0;
+}
+#endif
+
// convert ~ to indicate mnemonic to '_'
static rtl::OString MapToGtkAccelerator(const String &rStr)
{
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index c0f161b..fe2e6a2 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -142,19 +142,23 @@ static sal_uInt16 GetKeyCode( guint keyval )
nCode = KEY_A + (keyval-GDK_a );
else if( keyval >= GDK_F1 && keyval <= GDK_F26 )
{
- if( GetX11SalData()->GetDisplay()->IsNumLockFromXS() )
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ if( GetGtkSalData()->GetDisplay()->IsNumLockFromXS() )
{
nCode = KEY_F1 + (keyval-GDK_F1);
}
else
+#endif
{
switch( keyval )
{
// - - - - - Sun keyboard, see vcl/unx/source/app/saldisp.cxx
case GDK_L2:
- if( GetX11SalData()->GetDisplay()->GetServerVendor() == vendor_sun )
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ if( GetGtkSalData()->GetDisplay()->GetServerVendor() == vendor_sun )
nCode = KEY_REPEAT;
else
+#endif
nCode = KEY_F12;
break;
case GDK_L3: nCode = KEY_PROPERTIES; break;
@@ -442,7 +446,9 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
{
m_nScreen = getDisplay()->GetDefaultScreenNumber();
getDisplay()->registerFrame( this );
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
getDisplay()->setHaveSystemChildFrame();
+#endif
m_bDefaultPos = true;
m_bDefaultSize = true;
Init( pSysData );
@@ -642,7 +648,7 @@ void GtkSalFrame::InitCommon()
gtk_widget_realize( m_pWindow );
//system data
- SalDisplay* pDisp = GetX11SalData()->GetDisplay();
+ GtkSalDisplay* pDisp = GetGtkSalData()->GetDisplay();
m_aSystemData.nSize = sizeof( SystemChildData );
#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
m_aSystemData.pDisplay = pDisp->GetDisplay();
@@ -691,9 +697,9 @@ void GtkSalFrame::InitCommon()
updateScreenNumber();
SetIcon(1);
- m_nWorkArea = pDisp->getWMAdaptor()->getCurrentWorkArea();
#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ m_nWorkArea = pDisp->getWMAdaptor()->getCurrentWorkArea();
/* #i64117# gtk sets a nice background pixmap
* but we actually don't really want that, so save
* some time on the Xserver as well as prevent
@@ -735,7 +741,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
p_gtk_window_set_accept_focus( pWindow, bAccept );
else if( ! bBeforeRealize )
{
- Display* pDisplay = GetX11SalData()->GetDisplay()->GetDisplay();
+ Display* pDisplay = GetGtkSalData()->GetDisplay()->GetDisplay();
XLIB_Window aWindow = GDK_WINDOW_XWINDOW( widget_get_window(GTK_WIDGET(pWindow)) );
XWMHints* pHints = XGetWMHints( pDisplay, aWindow );
if( ! pHints )
@@ -748,7 +754,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XSetWMHints( pDisplay, aWindow, pHints );
XFree( pHints );
- if (GetX11SalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz"))
+ if (GetGtkSalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz"))
return;
/* remove WM_TAKE_FOCUS protocol; this would usually be the
@@ -798,7 +804,7 @@ static void lcl_set_user_time( GdkWindow* i_pWindow, guint32 i_nTime )
p_gdk_x11_window_set_user_time( i_pWindow, i_nTime );
else
{
- Display* pDisplay = GetX11SalData()->GetDisplay()->GetDisplay();
+ Display* pDisplay = GetGtkSalData()->GetDisplay()->GetDisplay();
XLIB_Window aWindow = GDK_WINDOW_XWINDOW( i_pWindow );
Atom nUserTime = XInternAtom( pDisplay, "_NET_WM_USER_TIME", True );
if( nUserTime )
@@ -893,14 +899,14 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
{
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
}
-
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
&& getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
{
eType = GDK_WINDOW_TYPE_HINT_TOOLBAR;
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true );
}
-
+#endif
gtk_window_set_type_hint( GTK_WINDOW(m_pWindow), eType );
if( bNoDecor )
gtk_window_set_decorated( GTK_WINDOW(m_pWindow), FALSE );
@@ -917,6 +923,7 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
InitCommon();
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( eWinType == GTK_WINDOW_TOPLEVEL )
{
guint32 nUserTime = 0;
@@ -927,6 +934,7 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
}
lcl_set_user_time(widget_get_window(GTK_WIDGET(m_pWindow)), nUserTime);
}
+#endif
if( bDecoHandling )
{
@@ -934,11 +942,11 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) )
lcl_set_accept_focus( GTK_WINDOW(m_pWindow), sal_False, false );
}
-
}
GdkNativeWindow GtkSalFrame::findTopLevelSystemWindow( GdkNativeWindow aWindow )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
XLIB_Window aRoot, aParent;
XLIB_Window* pChildren;
unsigned int nChildren;
@@ -964,6 +972,9 @@ GdkNativeWindow GtkSalFrame::findTopLevelSystemWindow( GdkNativeWindow aWindow )
} while( aParent != aRoot && ! bBreak );
return aWindow;
+#else
+ return 0;
+#endif
}
void GtkSalFrame::Init( SystemParentData* pSysData )
@@ -997,6 +1008,8 @@ void GtkSalFrame::Init( SystemParentData* pSysData )
m_pForeignParent = gdk_window_foreign_new_for_display( getGdkDisplay(), m_aForeignParentWindow );
gdk_window_set_events( m_pForeignParent, GDK_STRUCTURE_MASK );
+
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
int x_ret, y_ret;
unsigned int w, h, bw, d;
XLIB_Window aRoot;
@@ -1013,10 +1026,14 @@ void GtkSalFrame::Init( SystemParentData* pSysData )
(XLIB_Window)pSysData->aWindow,
0, 0 );
}
+#else
+#warning Handling embedded windows, is going to be fun ...
+#endif
}
void GtkSalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
XEvent aEvent;
rtl_zeroMemory( &aEvent, sizeof(aEvent) );
@@ -1035,6 +1052,7 @@ void GtkSalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
m_aForeignParentWindow,
False, NoEventMask, &aEvent );
getDisplay()->errorTrapPop ();
+#endif
}
void GtkSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
@@ -1263,10 +1281,10 @@ void GtkSalFrame::Center()
long nScreenWidth, nScreenHeight;
long nScreenX = 0, nScreenY = 0;
- Size aScreenSize = GetX11SalData()->GetDisplay()->GetScreenSize( m_nScreen );
+ Size aScreenSize = GetGtkSalData()->GetDisplay()->GetScreenSize( m_nScreen );
nScreenWidth = aScreenSize.Width();
nScreenHeight = aScreenSize.Height();
- if( GetX11SalData()->GetDisplay()->IsXinerama() )
+ if( GetGtkSalData()->GetDisplay()->IsXinerama() )
{
// get xinerama screen we are on
// if there is a parent, use its center for screen determination
@@ -1276,7 +1294,7 @@ void GtkSalFrame::Center()
GdkModifierType aMask;
gdk_display_get_pointer( getGdkDisplay(), &pScreen, &x, &y, &aMask );
- const std::vector< Rectangle >& rScreens = GetX11SalData()->GetDisplay()->GetXineramaScreens();
+ const std::vector< Rectangle >& rScreens = GetGtkSalData()->GetDisplay()->GetXineramaScreens();
for( unsigned int i = 0; i < rScreens.size(); i++ )
if( rScreens[i].IsInside( Point( x, y ) ) )
{
@@ -1295,7 +1313,7 @@ void GtkSalFrame::Center()
Size GtkSalFrame::calcDefaultSize()
{
- Size aScreenSize = GetX11SalData()->GetDisplay()->GetScreenSize( m_nScreen );
+ Size aScreenSize = GetGtkSalData()->GetDisplay()->GetScreenSize( m_nScreen );
long w = aScreenSize.Width();
long h = aScreenSize.Height();
@@ -1342,9 +1360,11 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
{
if( m_pWindow )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
&& getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible );
+#endif
if( bVisible )
{
initClientId();
@@ -1355,11 +1375,13 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
if( m_bDefaultSize )
SetDefaultSize();
setMinMaxSize();
-
+
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
// #i45160# switch to desktop where a dialog with parent will appear
if( m_pParent && m_pParent->m_nWorkArea != m_nWorkArea && IS_WIDGET_MAPPED(m_pParent->m_pWindow) )
getDisplay()->getWMAdaptor()->switchToWorkArea( m_pParent->m_nWorkArea );
-
+#endif
+
if( isFloatGrabWindow() &&
m_pParent &&
m_nFloats == 0 &&
@@ -1611,7 +1633,7 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u
#if GTK_CHECK_VERSION(3,0,0) && defined GTK3_X11_RENDER
// adjust position to avoid off screen windows
// but allow toolbars to be positioned partly off screen by the user
- Size aScreenSize = GetX11SalData()->GetDisplay()->GetScreenSize( m_nScreen );
+ Size aScreenSize = GetGtkSalData()->GetDisplay()->GetScreenSize( m_nScreen );
if( ! (m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) )
{
if( nX < (long)maGeometry.nLeftDecoration )
@@ -1678,7 +1700,12 @@ void GtkSalFrame::GetClientSize( long& rWidth, long& rHeight )
void GtkSalFrame::GetWorkArea( Rectangle& rRect )
{
- rRect = GetX11SalData()->GetDisplay()->getWMAdaptor()->getWorkArea( 0 );
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ rRect = GetGtkSalData()->GetDisplay()->getWMAdaptor()->getWorkArea( 0 );
+#else
+ g_warning ("no get work area");
+ rRect = Rectangle( 0, 0, 1024, 768 );
+#endif
}
SalFrame* GtkSalFrame::GetParent() const
@@ -1849,7 +1876,7 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
{
if( nNewScreen == maGeometry.nScreenNumber )
return;
-
+
if( m_pWindow && ! isChild() )
{
GtkSalDisplay* pDisp = getDisplay();
@@ -1857,7 +1884,7 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
{
if( nNewScreen >= pDisp->GetXineramaScreens().size() )
return;
-
+
Rectangle aOldScreenRect( pDisp->GetXineramaScreens()[maGeometry.nScreenNumber] );
Rectangle aNewScreenRect( pDisp->GetXineramaScreens()[nNewScreen] );
bool bVisible = IS_WIDGET_MAPPED(m_pWindow);
@@ -1865,7 +1892,9 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
Show( sal_False );
maGeometry.nX = aNewScreenRect.Left() + (maGeometry.nX - aOldScreenRect.Left());
maGeometry.nY = aNewScreenRect.Top() + (maGeometry.nY - aOldScreenRect.Top());
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
createNewWindow( None, false, m_nScreen );
+#endif
gtk_window_move( GTK_WINDOW(m_pWindow), maGeometry.nX, maGeometry.nY );
if( bVisible )
Show( sal_True );
@@ -1885,6 +1914,7 @@ void GtkSalFrame::updateWMClass()
rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US);
const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName();
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( IS_WIDGET_REALIZED( m_pWindow ) )
{
XClassHint* pClass = XAllocClassHint();
@@ -1897,6 +1927,7 @@ void GtkSalFrame::updateWMClass()
XFree( pClass );
}
else
+#endif
gtk_window_set_wmclass( GTK_WINDOW(m_pWindow),
X11SalData::getFrameResName( m_nExtStyle ),
pResClass );
@@ -1916,6 +1947,7 @@ void GtkSalFrame::SetApplicationID( const rtl::OUString &rWMClass )
void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( m_pWindow && ! isChild() )
{
GtkSalDisplay* pDisp = getDisplay();
@@ -1988,7 +2020,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen )
gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
gtk_window_fullscreen( GTK_WINDOW(m_pWindow) );
moveToScreen( nScreen );
- Size aScreenSize = pDisp->GetScreenSize( m_nScreen );
+ Size aScreenSize = pDisp->GetScreenSize( m_nScreen );
maGeometry.nX = 0;
maGeometry.nY = 0;
maGeometry.nWidth = aScreenSize.Width();
@@ -2007,6 +2039,9 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen )
CallCallback( SALEVENT_MOVERESIZE, NULL );
}
m_bFullscreen = bFullScreen;
+#else
+# warning No fullscreening - fix me !
+#endif
}
/* definitions from xautolock.c (pl15) */
@@ -2203,6 +2238,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
guint32 nUserTime= getDisplay()->GetLastUserEventTime( true );
gdk_window_focus( widget_get_window(m_pWindow), nUserTime );
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
/* need to do an XSetInputFocus here because
* gdk_window_focus will ask a EWMH compliant WM to put the focus
* to our window - which it of course won't since our input hint
@@ -2216,6 +2252,7 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( widget_get_window(m_pWindow) ), RevertToParent, CurrentTime );
getDisplay()->errorTrapPop ();
}
+#endif
}
else
{
@@ -2246,6 +2283,7 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents )
{
static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" );
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( m_pWindow )
{
if( bGrab )
@@ -2302,6 +2340,7 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents )
gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME);
}
}
+#endif
}
void GtkSalFrame::CaptureMouse( sal_Bool bCapture )
@@ -2337,7 +2376,7 @@ void GtkSalFrame::SetPointerPos( long nX, long nY )
void GtkSalFrame::Flush()
{
-#ifdef HAVE_A_RECENT_GTK
+#if GTK_CHECK_VERSION(3,0,0)
gdk_display_flush( getGdkDisplay() );
#else
XFlush (GDK_DISPLAY_XDISPLAY (getGdkDisplay()));
@@ -2351,12 +2390,22 @@ void GtkSalFrame::Sync()
String GtkSalFrame::GetSymbolKeyName( const String&, sal_uInt16 nKeyCode )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
return getDisplay()->GetKeyName( nKeyCode );
+#else
+# warning FIXME - key names
+ return String();
+#endif
}
String GtkSalFrame::GetKeyName( sal_uInt16 nKeyCode )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
return getDisplay()->GetKeyName( nKeyCode );
+#else
+# warning FIXME - key names
+ return String();
+#endif
}
GdkDisplay *GtkSalFrame::getGdkDisplay()
@@ -2384,13 +2433,21 @@ SalFrame::SalPointerState GtkSalFrame::GetPointerState()
SalFrame::SalIndicatorState GtkSalFrame::GetIndicatorState()
{
SalIndicatorState aState;
- aState.mnState = GetX11SalData()->GetDisplay()->GetIndicatorState();
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ aState.mnState = GetGtkSalData()->GetDisplay()->GetIndicatorState();
+#else
+ g_warning ("missing get indicator state");
+#endif
return aState;
}
void GtkSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode )
{
- GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode);
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+ GetGtkSalData()->GetDisplay()->SimulateKeyPress(nKeyCode);
+#else
+ g_warning ("missing simulate keypress %d", nKeyCode);
+#endif
}
void GtkSalFrame::SetInputContext( SalInputContext* pContext )
@@ -2496,12 +2553,14 @@ void GtkSalFrame::SetParent( SalFrame* pNewParent )
);
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
+
void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nScreen )
{
bool bWasVisible = IS_WIDGET_MAPPED(m_pWindow);
if( bWasVisible )
Show( sal_False );
-
+
if( nScreen < 0 || nScreen >= getDisplay()->GetScreenCount() )
nScreen = m_nScreen;
@@ -2601,13 +2660,18 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc
// FIXME: SalObjects
}
+#endif
bool GtkSalFrame::SetPluginParent( SystemParentData* pSysParent )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( pSysParent ) // this may be the first system child frame now
getDisplay()->setHaveSystemChildFrame();
createNewWindow( pSysParent->aWindow, (pSysParent->nSize > sizeof(long)) ? pSysParent->bXEmbedSupport : false, m_nScreen );
return true;
+#else
+ return false;
+#endif
}
void GtkSalFrame::ResetClipRegion()
@@ -2652,6 +2716,7 @@ void GtkSalFrame::EndSetClipRegion()
gdk_window_shape_combine_region( widget_get_window(m_pWindow), m_pRegion, 0, 0 );
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
bool GtkSalFrame::Dispatch( const XEvent* pEvent )
{
bool bContinueDispatch = true;
@@ -2726,6 +2791,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent )
return bContinueDispatch;
}
+#endif
void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap )
{
@@ -3157,6 +3223,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE);
Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN );
if( nStateAtom && nFSAtom )
@@ -3183,7 +3250,7 @@ IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG )
&aEvent
);
}
-
+#endif
return 0;
}
@@ -3200,7 +3267,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
*/
Application::PostUserEvent( LINK( pThis, GtkSalFrame, ImplDelayedFullScreenHdl ) );
}
-
+
bool bSetFocus = pThis->m_bSetFocusOnMap;
pThis->m_bSetFocusOnMap = false;
if( ImplGetSVData()->mbIsTestTool )
@@ -3215,13 +3282,17 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
bSetFocus = true;
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( bSetFocus )
{
XSetInputFocus( pThis->getDisplay()->GetDisplay(),
GDK_WINDOW_XWINDOW( widget_get_window(GTK_WIDGET(pThis->m_pWindow))),
RevertToParent, CurrentTime );
}
-
+#else
+# warning FIXME no set input focus ...
+#endif
+
pThis->CallCallback( SALEVENT_RESIZE, NULL );
return sal_False;
@@ -3257,6 +3328,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp
return sal_False;
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
// in child case the coordinates are not root coordinates,
// need to transform
@@ -3323,6 +3395,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp
else if( bSized )
pThis->CallCallback( SALEVENT_RESIZE, NULL );
+#endif
return sal_False;
}
@@ -3701,7 +3774,6 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn )
errorTrapPush ();
gtk_im_context_focus_out( m_pIMContext );
errorTrapPop ();
- m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel();
// cancel an eventual event posted to begin preedit again
m_pFrame->getDisplay()->CancelInternalEvent( m_pFrame, &m_aInputEvent, SALEVENT_EXTTEXTINPUT );
}
commit 0ea2670c8118265a012655477b6d12f15a2b9d37
Author: Michael Meeks <michael.meeks at novell.com>
Date: Fri Jul 1 12:28:31 2011 +0100
lots more compile conditionals added, split display from saldisp
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index b84ada9..3262670 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -41,6 +41,9 @@
#include <list>
+class GtkXLib;
+class GtkSalDisplay;
+
inline GdkWindow * widget_get_window(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(3,0,0)
@@ -74,7 +77,11 @@ inline void widget_set_can_default(GtkWidget *widget, gboolean can_default)
#endif
}
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+class GtkData : public SalData
+#else
class GtkData : public X11SalData
+#endif
{
public:
GtkData() {}
@@ -84,11 +91,23 @@ public:
virtual void initNWF();
virtual void deInitNWF();
+
+ GtkSalDisplay *pDisplay;
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+ GtkXLib *pXLib_;
+#endif
};
+inline GtkData* GetGtkSalData()
+{ return (GtkData*)ImplGetSVData()->mpSalData; }
+
class GtkSalFrame;
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+class GtkSalDisplay
+#else
class GtkSalDisplay : public SalDisplay
+#endif
{
GdkDisplay* m_pGdkDisplay;
GdkCursor *m_aCursors[ POINTER_COUNT ];
@@ -112,9 +131,6 @@ public:
GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
GdkEvent* event );
- inline bool HasMoreEvents() { return m_aUserEvents.size() > 1; }
- inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
- inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
void startupNotificationCompleted() { m_bStartupCompleted = true; }
void screenSizeChanged( GdkScreen* );
@@ -122,6 +138,17 @@ public:
void errorTrapPush();
void errorTrapPop();
+
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+ bool IsXinerama() { return false; }
+ std::vector<Rectangle> GetXineramaScreens() { return std::vector<Rectangle>(); }
+ void SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT );
+ void CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
+#else
+ inline bool HasMoreEvents() { return m_aUserEvents.size() > 1; }
+ inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
+ inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
+#endif
};
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 04b8e3f..ec895d8 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -433,7 +433,6 @@ public:
static GtkSalFrame *getFromWindow( GtkWindow *pWindow );
};
-
#define OOO_TYPE_FIXED ooo_fixed_get_type()
extern "C" {
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index d73025a..1c15577 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -39,6 +39,7 @@
bool InitAtkBridge(void)
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
const char* pVersion = atk_get_toolkit_version();
if( ! pVersion )
return false;
@@ -68,13 +69,16 @@ bool InitAtkBridge(void)
AtkRegistry * registry = atk_get_default_registry();
if( registry )
atk_registry_set_factory_type( registry, OOO_TYPE_FIXED, OOO_TYPE_WRAPPER_FACTORY );
-
+#endif
+
return true;
}
void DeInitAtkBridge()
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
restore_gail_window_vtable();
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 2db12d8..3facc99 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -69,7 +69,7 @@ using namespace vcl_sal;
using ::rtl::OUString;
/***************************************************************************
- * class GtkDisplay *
+ * class GtkSalDisplay *
***************************************************************************/
extern "C" {
GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event,
@@ -781,6 +781,7 @@ void GtkXLib::Init()
Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp );
m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp );
+ GetGtkSalData()->pDisplay = m_pGtkSalDisplay;
#if !GTK_CHECK_VERSION(3,0,0)
m_pGtkSalDisplay->errorTrapPush();
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 1d409d2..81135fb 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -186,11 +186,6 @@ extern "C"
#endif
// initialize SalData
-#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
- SalData* pSalData = new SalData();
- pSalData->m_pInstance = pInstance;
- SetSalData( pSalData );
-#else
GtkData *pSalData = new GtkData();
SetSalData( pSalData );
pSalData->m_pInstance = pInstance;
@@ -198,7 +193,6 @@ extern "C"
pSalData->initNWF();
InitAtkBridge();
-#endif
return pInstance;
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index fdd6683..c0f161b 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -474,6 +474,7 @@ GtkSalFrame::~GtkSalFrame()
#endif
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( m_hBackgroundPixmap )
{
XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(),
@@ -481,6 +482,7 @@ GtkSalFrame::~GtkSalFrame()
None );
XFreePixmap( getDisplay()->GetDisplay(), m_hBackgroundPixmap );
}
+#endif
if( m_pIMHandler )
delete m_pIMHandler;
@@ -549,11 +551,12 @@ ooo_fixed_get_type()
&tinfo, (GTypeFlags) 0);
}
- return type;
+ return type;
}
void GtkSalFrame::updateScreenNumber()
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( getDisplay()->IsXinerama() && getDisplay()->GetXineramaScreens().size() > 1 )
{
Point aPoint( maGeometry.nX, maGeometry.nY );
@@ -570,6 +573,7 @@ void GtkSalFrame::updateScreenNumber()
}
else
maGeometry.nScreenNumber = static_cast<unsigned int>(m_nScreen);
+#endif
}
void GtkSalFrame::InitCommon()
@@ -640,14 +644,16 @@ void GtkSalFrame::InitCommon()
//system data
SalDisplay* pDisp = GetX11SalData()->GetDisplay();
m_aSystemData.nSize = sizeof( SystemChildData );
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
m_aSystemData.pDisplay = pDisp->GetDisplay();
+ m_aSystemData.pVisual = pDisp->GetVisual( m_nScreen ).GetVisual();
+ m_aSystemData.nDepth = pDisp->GetVisual( m_nScreen ).GetDepth();
+ m_aSystemData.aColormap = pDisp->GetColormap( m_nScreen ).GetXColormap();
+#endif
m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow));
m_aSystemData.pSalFrame = this;
m_aSystemData.pWidget = m_pWindow;
- m_aSystemData.pVisual = pDisp->GetVisual( m_nScreen ).GetVisual();
m_aSystemData.nScreen = m_nScreen;
- m_aSystemData.nDepth = pDisp->GetVisual( m_nScreen ).GetDepth();
- m_aSystemData.aColormap = pDisp->GetColormap( m_nScreen ).GetXColormap();
m_aSystemData.pAppContext = NULL;
m_aSystemData.aShellWindow = m_aSystemData.aWindow;
m_aSystemData.pShellWidget = m_aSystemData.pWidget;
@@ -687,6 +693,7 @@ void GtkSalFrame::InitCommon()
SetIcon(1);
m_nWorkArea = pDisp->getWMAdaptor()->getCurrentWorkArea();
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
/* #i64117# gtk sets a nice background pixmap
* but we actually don't really want that, so save
* some time on the Xserver as well as prevent
@@ -695,6 +702,7 @@ void GtkSalFrame::InitCommon()
XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(),
GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)),
m_hBackgroundPixmap );
+#endif
}
/* Sadly gtk_window_set_accept_focus exists only since gtk 2.4
@@ -722,6 +730,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
bGetAcceptFocusFn = false;
p_gtk_window_set_accept_focus = (setAcceptFn)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_window_set_accept_focus" );
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( p_gtk_window_set_accept_focus && bBeforeRealize )
p_gtk_window_set_accept_focus( pWindow, bAccept );
else if( ! bBeforeRealize )
@@ -775,9 +784,11 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XFree( pProtocols );
}
}
+#endif
}
static void lcl_set_user_time( GdkWindow* i_pWindow, guint32 i_nTime )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( bGetSetUserTimeFn )
{
bGetSetUserTimeFn = false;
@@ -797,6 +808,7 @@ static void lcl_set_user_time( GdkWindow* i_pWindow, guint32 i_nTime )
PropModeReplace, (unsigned char*)&i_nTime, 1 );
}
}
+#endif
};
GtkSalFrame *GtkSalFrame::getFromWindow( GtkWindow *pWindow )
@@ -1806,10 +1818,12 @@ void GtkSalFrame::moveToScreen( int nScreen )
// update system data
GtkSalDisplay* pDisp = getDisplay();
m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow));
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
m_aSystemData.pVisual = pDisp->GetVisual( m_nScreen ).GetVisual();
- m_aSystemData.nScreen = nScreen;
m_aSystemData.nDepth = pDisp->GetVisual( m_nScreen ).GetDepth();
m_aSystemData.aColormap = pDisp->GetColormap( m_nScreen ).GetXColormap();
+#endif
+ m_aSystemData.nScreen = nScreen;
m_aSystemData.pAppContext = NULL;
m_aSystemData.aShellWindow = m_aSystemData.aWindow;
// update graphics if necessary
@@ -2347,12 +2361,12 @@ String GtkSalFrame::GetKeyName( sal_uInt16 nKeyCode )
GdkDisplay *GtkSalFrame::getGdkDisplay()
{
- return static_cast<GtkSalDisplay*>(GetX11SalData()->GetDisplay())->GetGdkDisplay();
+ return GetGtkSalData()->pDisplay->GetGdkDisplay();
}
GtkSalDisplay *GtkSalFrame::getDisplay()
{
- return static_cast<GtkSalDisplay*>(GetX11SalData()->GetDisplay());
+ return GetGtkSalData()->pDisplay;
}
SalFrame::SalPointerState GtkSalFrame::GetPointerState()
@@ -2715,6 +2729,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent )
void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap )
{
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
if( m_hBackgroundPixmap )
{
XSetWindowBackgroundPixmap( getDisplay()->GetDisplay(),
@@ -2752,6 +2767,7 @@ void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap )
}
}
}
+#endif
}
gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame )
@@ -3454,6 +3470,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram
pThis->getDisplay()->SendInternalEvent( pThis, NULL, SALEVENT_FONTCHANGED );
}
+#if !GTK_CHECK_VERSION(3,0,0) || defined GTK3_X11_RENDER
/* #i64117# gtk sets a nice background pixmap
* but we actually don't really want that, so save
* some time on the Xserver as well as prevent
@@ -3468,6 +3485,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram
aWin,
pThis->m_hBackgroundPixmap );
}
+#endif
#ifndef GTK_GRAPHICS_DISABLED
if( ! pThis->m_pParent )
commit 4721b8a52d8d03cb446a457f74ce13b92e91ff97
Author: Michael Meeks <michael.meeks at novell.com>
Date: Fri Jul 1 11:47:40 2011 +0100
cleanup error trap push/pop a little (wow it is nasty and inefficient)
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 95348f4..b84ada9 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -119,6 +119,9 @@ public:
void screenSizeChanged( GdkScreen* );
void monitorsChanged( GdkScreen* );
+
+ void errorTrapPush();
+ void errorTrapPop();
};
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index e60561a..04b8e3f 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -161,6 +161,8 @@ class GtkSalFrame : public SalFrame, public basebmp::BitmapDeviceDamageTracker
void endExtTextInput( sal_uInt16 nFlags );
bool handleKeyEvent( GdkEventKey* pEvent );
void focusChanged( bool bFocusIn );
+ void errorTrapPush();
+ void errorTrapPop();
void doCallEndExtTextInput();
void sendEmptyCommit();
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 225af85..2db12d8 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -92,6 +92,9 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay )
Init ();
gdk_window_add_filter( NULL, call_filterGdkEvent, this );
+
+ if ( getenv( "SAL_IGNOREXERRORS" ) )
+ errorTrapPush(); // and leak the trap
}
GtkSalDisplay::~GtkSalDisplay()
@@ -109,6 +112,25 @@ GtkSalDisplay::~GtkSalDisplay()
pDisp_ = NULL;
}
+void GtkSalDisplay::errorTrapPush()
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_error_trap_push ();
+#else
+ GetXLib()->PushXErrorLevel( true );
+#endif
+}
+
+void GtkSalDisplay::errorTrapPop()
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_error_trap_pop_ignored ();
+#else
+ XSync( GetDisplay(), False );
+ GetXLib()->PopXErrorLevel();
+#endif
+}
+
void GtkSalDisplay::deregisterFrame( SalFrame* pFrame )
{
if( m_pCapture == pFrame )
@@ -708,13 +730,14 @@ void GtkXLib::Init()
rtl::OString aPrgName = rtl::OUStringToOString(aAppName, aEnc);
g_set_prgname(aPrgName);
}
-
+
// init gtk/gdk
gtk_init_check( &nParams, &pCmdLineAry );
- //gtk_init_check sets XError/XIOError handlers, we want our own one
+#if !GTK_CHECK_VERSION(3,0,0)
+ // gtk_init_check sets XError/XIOError handlers, ours are inferior: so use them ! (hmm)
m_aOrigGTKXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
- PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
+#endif
for (i = 0; i < nParams; i++ )
g_free( pCmdLineAry[i] );
@@ -759,17 +782,19 @@ void GtkXLib::Init()
m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp );
- PushXErrorLevel( true );
+#if !GTK_CHECK_VERSION(3,0,0)
+ m_pGtkSalDisplay->errorTrapPush();
SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
XSync( pDisp, False );
-
pKbdExtension->UseExtension( ! HasXErrorOccurred() );
- PopXErrorLevel();
-
+ m_pGtkSalDisplay->errorTrapPop();
m_pGtkSalDisplay->SetKbdExtension( pKbdExtension );
+#else
+# warning unwind keyboard extension bits
+#endif
g_signal_connect( G_OBJECT(gdk_keymap_get_default()), "keys_changed", G_CALLBACK(signalKeysChanged), m_pGtkSalDisplay );
-
+
// add signal handler to notify screen size changes
int nScreens = gdk_display_get_n_screens( pGdkDisp );
for( int n = 0; n < nScreens; n++ )
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 81135fb..1d409d2 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -186,6 +186,11 @@ extern "C"
#endif
// initialize SalData
+#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER
+ SalData* pSalData = new SalData();
+ pSalData->m_pInstance = pInstance;
+ SetSalData( pSalData );
+#else
GtkData *pSalData = new GtkData();
SetSalData( pSalData );
pSalData->m_pInstance = pInstance;
@@ -193,6 +198,7 @@ extern "C"
pSalData->initNWF();
InitAtkBridge();
+#endif
return pInstance;
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 77ba496..fdd6683 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -1006,7 +1006,7 @@ void GtkSalFrame::Init( SystemParentData* pSysData )
void GtkSalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
{
XEvent aEvent;
-
+
rtl_zeroMemory( &aEvent, sizeof(aEvent) );
aEvent.xclient.window = m_aForeignParentWindow;
aEvent.xclient.type = ClientMessage;
@@ -1017,13 +1017,12 @@ void GtkSalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode )
aEvent.xclient.data.l[2] = 0;
aEvent.xclient.data.l[3] = 0;
aEvent.xclient.data.l[4] = 0;
-
- getDisplay()->GetXLib()->PushXErrorLevel( true );
+
+ getDisplay()->errorTrapPush ();
XSendEvent( getDisplay()->GetDisplay(),
m_aForeignParentWindow,
False, NoEventMask, &aEvent );
- XSync( getDisplay()->GetDisplay(), False );
- getDisplay()->GetXLib()->PopXErrorLevel();
+ getDisplay()->errorTrapPop ();
}
void GtkSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
@@ -2199,10 +2198,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()->GetXLib()->PushXErrorLevel( true );
+ getDisplay()->errorTrapPush ();
XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( widget_get_window(m_pWindow) ), RevertToParent, CurrentTime );
- XSync( getDisplay()->GetDisplay(), False );
- getDisplay()->GetXLib()->PopXErrorLevel();
+ getDisplay()->errorTrapPop ();
}
}
else
@@ -3056,7 +3054,7 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame )
#if 1
cairo_save( cr );
cairo_set_line_width( cr, 1.0 );
- cairo_set_source_rgb( cr, 1.0, 1.0, 0 );
+ cairo_set_source_rgb( cr, 1.0, 0, 0 );
cairo_rectangle( cr, x1 + 1, y1 + 1, x2 - x1 - 2, y2 - y1 - 2 );
cairo_stroke( cr );
cairo_restore( cr );
@@ -3548,6 +3546,20 @@ 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 )
@@ -3566,10 +3578,10 @@ void GtkSalFrame::IMHandler::createIMContext()
g_signal_connect( m_pIMContext, "preedit_end",
G_CALLBACK (signalIMPreeditEnd), this );
- m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true );
+ 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 );
- m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel();
+ errorTrapPop ();
m_bFocused = true;
}
}
@@ -3579,9 +3591,9 @@ void GtkSalFrame::IMHandler::deleteIMContext()
if( m_pIMContext )
{
// first give IC a chance to deinitialize
- m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true );
+ errorTrapPush ();
gtk_im_context_set_client_window( m_pIMContext, NULL );
- m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel();
+ errorTrapPop ();
// destroy old IC
g_object_unref( m_pIMContext );
m_pIMContext = NULL;
@@ -3603,9 +3615,9 @@ void GtkSalFrame::IMHandler::updateIMSpotLocation()
aArea.y = aPosEvent.mnY;
aArea.width = aPosEvent.mnWidth;
aArea.height = aPosEvent.mnHeight;
- m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true );
+ errorTrapPush ();
gtk_im_context_set_cursor_location( m_pIMContext, &aArea );
- m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel();
+ errorTrapPop ();
}
void GtkSalFrame::IMHandler::setInputContext( SalInputContext* )
@@ -3656,9 +3668,9 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn )
m_bFocused = bFocusIn;
if( bFocusIn )
{
- m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true );
+ errorTrapPush ();
gtk_im_context_focus_in( m_pIMContext );
- m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel();
+ errorTrapPop ();
if( m_aInputEvent.mpTextAttr )
{
sendEmptyCommit();
@@ -3668,8 +3680,9 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn )
}
else
{
- m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true );
+ errorTrapPush ();
gtk_im_context_focus_out( m_pIMContext );
+ errorTrapPop ();
m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel();
// cancel an eventual event posted to begin preedit again
m_pFrame->getDisplay()->CancelInternalEvent( m_pFrame, &m_aInputEvent, SALEVENT_EXTTEXTINPUT );
More information about the Libreoffice-commits
mailing list