diff options
-rw-r--r-- | vcl/Library_vclplug_gtk3.mk | 3 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkdata.hxx | 75 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 39 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 177 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkinst.cxx | 71 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtksys.cxx | 95 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 127 | ||||
-rw-r--r-- | vcl/unx/headless/svpinst.cxx | 6 |
8 files changed, 517 insertions, 76 deletions
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk index d4105a8ff96f..52af1d052046 100644 --- a/vcl/Library_vclplug_gtk3.mk +++ b/vcl/Library_vclplug_gtk3.mk @@ -120,7 +120,10 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk3,\ vcl/unx/gtk3/window/gtk3gtkframe \ vcl/unx/gtk3/window/gtk3gtkobject \ vcl/unx/headless/svpbmp \ + vcl/unx/headless/svpdummies \ vcl/unx/headless/svpelement \ + vcl/unx/headless/svpframe \ + vcl/unx/headless/svpprn \ vcl/unx/headless/svptext \ vcl/unx/headless/svpvd \ )) diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 7da40c5309f9..0b92f7eeacb9 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -38,6 +38,7 @@ #include <unx/saldisp.hxx> #include <unx/saldata.hxx> #include <vcl/ptrstyle.hxx> +#include <osl/conditn.h> #include <list> @@ -77,6 +78,37 @@ inline void widget_set_can_default(GtkWidget *widget, gboolean can_default) #endif } +class GtkXLib : public SalXLib +{ + GtkSalDisplay *m_pGtkSalDisplay; + std::list<GSource *> m_aSources; + GSource *m_pTimeout; + GSource *m_pUserEvent; + oslMutex m_aDispatchMutex; + oslCondition m_aDispatchCondition; + XIOErrorHandler m_aOrigGTKXIOErrorHandler; + +public: + static gboolean timeoutFn(gpointer data); + static gboolean userEventFn(gpointer data); + + GtkXLib(); + virtual ~GtkXLib(); + + virtual void Init(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); + virtual void Insert( int fd, void* data, + YieldFunc pending, + YieldFunc queued, + YieldFunc handle ); + virtual void Remove( int fd ); + + virtual void StartTimer( sal_uLong nMS ); + virtual void StopTimer(); + virtual void Wakeup(); + virtual void PostUserEvent(); +}; + #if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER class GtkData : public SalData #else @@ -93,8 +125,10 @@ public: virtual void deInitNWF(); GtkSalDisplay *pDisplay; + GtkSalDisplay *GetDisplay() { return pDisplay; } #if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER GtkXLib *pXLib_; + SalXLib *GetLib() { return pXLib_; } #endif }; @@ -121,10 +155,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 +173,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 5745a9538f49..399aa124fb29 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -31,6 +31,8 @@ #include <unx/salinst.h> #include <unx/salsys.h> +#include <unx/headless/svpinst.hxx> +#include <gtk/gtk.h> class GtkYieldMutex : public SalYieldMutex { @@ -77,11 +79,20 @@ public: #define GTK_YIELD_GRAB() GtkYieldMutex::GtkYieldGuard aLocalGtkYieldGuard( static_cast<GtkYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex()) ) +#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER +class GtkInstance : public SvpSalInstance +{ + SalYieldMutex *mpSalYieldMutex; +public: + GtkInstance( SalYieldMutex* pMutex ) + : SvpSalInstance(), mpSalYieldMutex( pMutex ) +#else class GtkInstance : public X11SalInstance { public: GtkInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) +#endif {} virtual ~GtkInstance(); @@ -95,13 +106,41 @@ public: sal_uInt16 nBitCount, const SystemGraphicsData* ); virtual SalBitmap* CreateSalBitmap(); + + virtual osl::SolarMutex* GetYieldMutex(); + virtual sal_uIntPtr ReleaseYieldMutex(); + virtual void AcquireYieldMutex( sal_uIntPtr nCount ); + virtual bool CheckYieldMutex(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); + virtual bool AnyInput( sal_uInt16 nType ); }; +#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 ca594feeaa84..43bf11e2847c 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -54,7 +54,6 @@ #include <osl/thread.h> #include <osl/process.h> -#include <osl/conditn.h> #include <tools/debug.hxx> #include "unx/i18n_im.hxx" #include "unx/i18n_xkb.hxx" @@ -81,15 +80,22 @@ 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; + hEventGuard_ = osl_createMutex(); +#else + m_bUseRandRWrapper = false; // use gdk signal instead Init (); +#endif gdk_window_add_filter( NULL, call_filterGdkEvent, this ); @@ -103,13 +109,18 @@ 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; + osl_destroyMutex( hEventGuard_ ); + hEventGuard_ = NULL; } void GtkSalDisplay::errorTrapPush() @@ -131,6 +142,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 +156,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 +166,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 +188,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 +233,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 +260,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 +292,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } } } +#endif } extern "C" @@ -273,6 +303,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); @@ -301,11 +332,15 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const 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]); @@ -315,9 +350,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: @@ -344,6 +376,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 ) @@ -360,6 +393,7 @@ long GtkSalDisplay::Dispatch( XEvent* pEvent ) return GDK_FILTER_CONTINUE; } +#endif #if GTK_CHECK_VERSION(3,0,0) namespace @@ -617,37 +651,6 @@ int GtkSalDisplay::CaptureMouse( SalFrame* pSFrame ) * class GtkXLib * ***************************************************************************/ -class GtkXLib : public SalXLib -{ - GtkSalDisplay *m_pGtkSalDisplay; - std::list<GSource *> m_aSources; - GSource *m_pTimeout; - GSource *m_pUserEvent; - oslMutex m_aDispatchMutex; - oslCondition m_aDispatchCondition; - XIOErrorHandler m_aOrigGTKXIOErrorHandler; - -public: - static gboolean timeoutFn(gpointer data); - static gboolean userEventFn(gpointer data); - - GtkXLib(); - virtual ~GtkXLib(); - - virtual void Init(); - virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); - virtual void Insert( int fd, void* data, - YieldFunc pending, - YieldFunc queued, - YieldFunc handle ); - virtual void Remove( int fd ); - - virtual void StartTimer( sal_uLong nMS ); - virtual void StopTimer(); - virtual void Wakeup(); - virtual void PostUserEvent(); -}; - GtkXLib::GtkXLib() { #if OSL_DEBUG_LEVEL > 1 @@ -784,12 +787,12 @@ void GtkXLib::Init() rtl::OUString envValue(name, strlen(name), aEnc); osl_setEnvironment(envVar.pData, envValue.pData); - Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp ); - m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp ); GetGtkSalData()->pDisplay = m_pGtkSalDisplay; #if !GTK_CHECK_VERSION(3,0,0) + Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp ); + m_pGtkSalDisplay->errorTrapPush(); SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp ); XSync( pDisp, False ); @@ -931,6 +934,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/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 103752ccbc91..4db319355316 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -436,4 +436,75 @@ SalBitmap* GtkInstance::CreateSalBitmap() #endif } +// FIXME: these should all be in a more generic, shared base of unix's salinst.cxx + +osl::SolarMutex* GtkInstance::GetYieldMutex() +{ + return mpSalYieldMutex; +} + +sal_uIntPtr GtkInstance::ReleaseYieldMutex() +{ + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() == + osl::Thread::getCurrentIdentifier() ) + { + sal_uLong nCount = pYieldMutex->GetAcquireCount(); + sal_uLong n = nCount; + while ( n ) + { + pYieldMutex->release(); + n--; + } + + return nCount; + } + else + return 0; +} + +void GtkInstance::AcquireYieldMutex( sal_uIntPtr nCount ) +{ + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + while ( nCount ) + { + pYieldMutex->acquire(); + nCount--; + } +} + +bool GtkInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier() ) + bRet = false; + + return bRet; +} + +void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) +{ + GetGtkSalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); +} + +bool GtkInstance::AnyInput( sal_uInt16 nType ) +{ +#if GTK_CHECK_VERSION(3,0,0) && !defined GTK3_X11_RENDER + g_warning ("any input returning false"); + return false; +#else + 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) && !defined GTK3_X11_RENDER +#define GTK3_INCLUDED +#include "../../headless/svpinst.cxx" +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 66987ef533e1..c3250055c73f 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 352c2845d4ea..af3ad2dd8e26 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 ); @@ -488,16 +494,16 @@ GtkSalFrame::~GtkSalFrame() delete m_pIMHandler; if( m_pFixedContainer ) - gtk_widget_destroy( GTK_WIDGET(m_pFixedContainer) ); + gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) ); if( m_pWindow ) { g_object_set_data( G_OBJECT( m_pWindow ), "SalFrame", NULL ); gtk_widget_destroy( m_pWindow ); } if( m_pForeignParent ) - g_object_unref( G_OBJECT(m_pForeignParent) ); + g_object_unref( G_OBJECT( m_pForeignParent ) ); if( m_pForeignTopLevel ) - g_object_unref(G_OBJECT( m_pForeignTopLevel) ); + g_object_unref( G_OBJECT( m_pForeignTopLevel) ); } void GtkSalFrame::moveWindow( long nX, long nY ) @@ -642,15 +648,15 @@ 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(); 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)); +#endif m_aSystemData.pSalFrame = this; m_aSystemData.pWidget = m_pWindow; m_aSystemData.nScreen = m_nScreen; @@ -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 ) @@ -1088,6 +1106,7 @@ void GtkSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) sal_Bool GtkSalFrame::PostEvent( void* pData ) { + g_warning ("post event"); getDisplay()->SendInternalEvent( this, pData ); return sal_True; } @@ -1263,10 +1282,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 +1295,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 +1314,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 +1361,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(); @@ -1356,9 +1377,11 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) 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 && @@ -1611,7 +1634,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 +1701,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 @@ -1865,7 +1893,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 +1915,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 +1928,7 @@ void GtkSalFrame::updateWMClass() XFree( pClass ); } else +#endif gtk_window_set_wmclass( GTK_WINDOW(m_pWindow), X11SalData::getFrameResName( m_nExtStyle ).getStr(), pResClass ); @@ -1916,6 +1948,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(); @@ -2007,6 +2040,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 +2239,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 +2253,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 +2284,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 +2341,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 +2377,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 +2391,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 +2434,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,6 +2554,8 @@ 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); @@ -2557,9 +2617,9 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc if( m_pWindow ) gtk_widget_destroy( m_pWindow ); if( m_pForeignParent ) - g_object_unref( G_OBJECT(m_pForeignParent) ); + g_object_unref( G_OBJECT( m_pForeignParent ) ); if( m_pForeignTopLevel ) - g_object_unref( G_OBJECT(m_pForeignTopLevel) ); + g_object_unref( G_OBJECT( m_pForeignTopLevel ) ); // init new window m_bDefaultPos = m_bDefaultSize = false; @@ -2601,13 +2661,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 +2717,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 +2792,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) return bContinueDispatch; } +#endif void GtkSalFrame::SetBackgroundBitmap( SalBitmap* pBitmap ) { @@ -3158,6 +3225,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 ) @@ -3184,7 +3252,7 @@ IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG ) &aEvent ); } - +#endif return 0; } @@ -3216,12 +3284,16 @@ 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 ); @@ -3258,6 +3330,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 @@ -3324,6 +3397,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp else if( bSized ) pThis->CallCallback( SALEVENT_RESIZE, NULL ); +#endif return sal_False; } @@ -3702,7 +3776,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 ); } diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 41d268a7a437..3924f404b813 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -46,6 +46,8 @@ #include <saldatabasic.hxx> #include <vcl/solarmutex.hxx> +// FIXME: split off into a separate, standalone module to aid linking +#ifndef GTK3_INCLUDED // plugin factory function extern "C" { @@ -58,6 +60,7 @@ extern "C" return pInstance; } } +#endif bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const { @@ -188,6 +191,8 @@ void SvpSalInstance::Wakeup() OSL_VERIFY(write (m_pTimeoutFDS[1], "", 1) == 1); } +// FIXME: share this with unx/generic [!] .... +#ifndef GTK3_INCLUDED // -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= inline int operator >= ( const timeval &t1, const timeval &t2 ) { @@ -212,6 +217,7 @@ inline int operator > ( const timeval &t1, const timeval &t2 ) return t1.tv_usec > t2.tv_usec; return t1.tv_sec > t2.tv_sec; } +#endif bool SvpSalInstance::CheckTimeout( bool bExecuteTimers ) { |