vcl/inc/unx/gtk/gtkdata.hxx     |   64 ++----
 vcl/inc/unx/gtk/gtkframe.hxx    |    1 
 vcl/inc/unx/gtk/gtkinst.hxx     |    1 
 vcl/unx/gtk/app/gtkdata.cxx     |  417 +++++++++++-----------------------------
 vcl/unx/gtk/app/gtkinst.cxx     |   12 +
 vcl/unx/gtk/window/gtkframe.cxx |   21 +-
 6 files changed, 168 insertions(+), 348 deletions(-)

New commits:
commit 14bc69f6da4c6eb3c3a750a69afcb152e73b8c6d
Author: Michael Meeks <michael.me...@suse.com>
Date:   Wed Sep 28 18:09:40 2011 +0100

    gtk3: substantial re-work and cleanup of event handling
    
    Implement SalTimer ourselves rather more cleanly
    Remove nasty GtkXLib cruft inherited from X backend
    Merge and cleanup most Yield / mainloop bits into GtkData

diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index b2c5127..22491f4 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -40,10 +40,10 @@
 #include <unx/gtk/gtksys.hxx>
 #include <vcl/ptrstyle.hxx>
 #include <osl/conditn.h>
+#include "saltimer.hxx"
 
 #include <list>
 
-class GtkXLib;
 class GtkSalDisplay;
 
 inline GdkWindow * widget_get_window(GtkWidget *widget)
@@ -79,45 +79,27 @@ inline void widget_set_can_default(GtkWidget *widget, 
gboolean can_default)
 #endif
 }
 
-class GtkXLib : public SalXLib
+class GtkSalTimer : public SalTimer
 {
-    GtkSalDisplay       *m_pGtkSalDisplay;
-    std::list<GSource *> m_aSources;
-    GSource             *m_pTimeout;
-    GSource                            *m_pUserEvent;
-    oslMutex             m_aDispatchMutex;
-    oslCondition         m_aDispatchCondition;
-    XIOErrorHandler      m_aOrigGTKXIOErrorHandler;
-
+    GSource *m_pTimeout;
 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();
+    GtkSalTimer();
+    ~GtkSalTimer();
+    sal_uLong m_nTimeoutMS;
+    virtual void Start( sal_uLong nMS );
+    virtual void Stop();
 };
 
-#if GTK_CHECK_VERSION(3,0,0)
 class GtkData : public SalData
-#else
-class GtkData : public X11SalData
-#endif
 {
+    oslMutex m_aDispatchMutex;
+    oslCondition m_aDispatchCondition;
+    GSource *m_pUserEvent;
+
+    GtkSalDisplay *m_pGtkSalDisplay;
+
 public:
-    GtkData() {}
+    GtkData();
     virtual ~GtkData();
 
     virtual void Init();
@@ -125,12 +107,12 @@ public:
     virtual void initNWF();
     virtual void deInitNWF();
 
-    GtkSalDisplay *pDisplay;
-    GtkSalDisplay *GetDisplay() { return pDisplay; }
-#if GTK_CHECK_VERSION(3,0,0)
-    GtkXLib *pXLib_;
-    SalXLib *GetLib() { return pXLib_; }
-#endif
+    static gboolean userEventFn( gpointer data );
+
+    void PostUserEvent();
+    void Yield( bool bWait, bool bHandleAllCurrentEvents );
+    GtkSalDisplay *GetDisplay() { return m_pGtkSalDisplay; }
+    inline GdkDisplay *GetGdkDisplay();
 };
 
 inline GtkData* GetGtkSalData()
@@ -210,10 +192,12 @@ public:
 
     oslMutex        hEventGuard_;
     std::list< SalUserEvent > m_aUserEvents;
-    guint32 GetLastUserEventTime( bool b ) { return GDK_CURRENT_TIME; } // 
horrible hack
+    guint32 GetLastUserEventTime( bool /* b */ ) { return GDK_CURRENT_TIME; } 
// horrible hack
 #endif
 };
 
+inline GdkDisplay *GtkData::GetGdkDisplay() { return 
m_pGtkSalDisplay->GetGdkDisplay(); }
+
 
 #endif // _VCL_GTKDATA_HXX
 
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 36a5c5d..2be3324 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -180,6 +180,7 @@ class GtkSalFrame : public SalFrame, 
basebmp::BitmapDeviceDamageTracker
 
     int                             m_nScreen;
     GtkWidget*                      m_pWindow;
+    guint                           m_nIdleFullScreen;
 #if GTK_CHECK_VERSION(3,0,0)
     basebmp::BitmapDeviceSharedPtr  m_aFrame;
 #endif
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 5e7eff7..d8602e3 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -100,6 +100,7 @@ public:
     virtual SalFrame*           CreateChildFrame( SystemParentData* pParent, 
sal_uLong nStyle );
     virtual SalObject*          CreateObject( SalFrame* pParent, 
SystemWindowData* pWindowData, sal_Bool bShow = sal_True );
     virtual SalSystem*          CreateSalSystem();
+    virtual SalTimer*           CreateSalTimer();
     virtual void                AddToRecentDocumentList(const rtl::OUString& 
rFileUrl, const rtl::OUString& rMimeType);
     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics*,
                                                      long nDX, long nDY,
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index f4322a3..4411406 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -128,20 +128,15 @@ GtkSalDisplay::~GtkSalDisplay()
 
 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 ();
+#if !GTK_CHECK_VERSION(3,0,0)
+    gdk_error_trap_pop ();
 #else
-    XSync( GetDisplay(), False );
-    GetXLib()->PopXErrorLevel();
+    gdk_error_trap_pop_ignored (); // faster
 #endif
 }
 
@@ -577,46 +572,92 @@ int GtkSalDisplay::CaptureMouse( SalFrame* pSFrame )
     return 1;
 }
 
-/***************************************************************************
- * class GtkXLib                                                           *
- ***************************************************************************/
 
-GtkXLib::GtkXLib()
+/**********************************************************************
+ * class GtkData                                                      *
+ **********************************************************************/
+
+GtkData::GtkData()
 {
-#if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "GtkXLib::GtkXLib()\n" );
-#endif
-    m_pGtkSalDisplay = NULL;
-    m_pTimeout = NULL;
-    m_nTimeoutMS = 0;
     m_pUserEvent = NULL;
-    m_aDispatchCondition = osl_createCondition();
     m_aDispatchMutex = osl_createMutex();
-    m_aOrigGTKXIOErrorHandler = NULL;
+    m_aDispatchCondition = osl_createCondition();
 }
 
-GtkXLib::~GtkXLib()
+GtkData::~GtkData()
 {
-#if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "GtkXLib::~GtkXLib()\n" );
-#endif
     Yield( true, true );
-    StopTimer();
+    g_warning ("TESTME: We used to have a stop-timer here, but the central 
code should do this");
+
+    if (m_pUserEvent)
+    {
+        g_source_destroy (m_pUserEvent);
+        g_source_unref (m_pUserEvent);
+    }
      // sanity check: at this point nobody should be yielding, but wake them
      // up anyway before the condition they're waiting on gets destroyed.
     osl_setCondition( m_aDispatchCondition );
     osl_destroyCondition( m_aDispatchCondition );
     osl_destroyMutex( m_aDispatchMutex );
+}
+
+void GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
+{
+    /* #i33212# only enter g_main_context_iteration in one thread at any one
+     * time, else one of them potentially will never end as long as there is
+     * another thread in in there. Having only one yieldin thread actually 
dispatch
+     * fits the vcl event model (see e.g. the generic plugin).
+     */
+    bool bDispatchThread = false;
+    gboolean wasEvent = FALSE;
+    {
+        // release YieldMutex (and re-acquire at block end)
+        YieldMutexReleaser aReleaser;
+        if( osl_tryToAcquireMutex( m_aDispatchMutex ) )
+            bDispatchThread = true;
+        else if( ! bWait )
+            return; // someone else is waiting already, return
+
+
+        if( bDispatchThread )
+        {
+            int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
+            gboolean wasOneEvent = TRUE;
+            while( nMaxEvents-- && wasOneEvent )
+            {
+                wasOneEvent = g_main_context_iteration( NULL, FALSE );
+                if( wasOneEvent )
+                    wasEvent = TRUE;
+            }
+            if( bWait && ! wasEvent )
+                wasEvent = g_main_context_iteration( NULL, TRUE );
+        }
+        else if( bWait )
+           {
+            /* #i41693# in case the dispatch thread hangs in join
+             * for this thread the condition will never be set
+             * workaround: timeout of 1 second a emergency exit
+             */
+            // we are the dispatch thread
+            osl_resetCondition( m_aDispatchCondition );
+            TimeValue aValue = { 1, 0 };
+            osl_waitCondition( m_aDispatchCondition, &aValue );
+        }
+    }
 
-    PopXErrorLevel();
-    XSetIOErrorHandler (m_aOrigGTKXIOErrorHandler);
+    if( bDispatchThread )
+    {
+        osl_releaseMutex( m_aDispatchMutex );
+        if( wasEvent )
+            osl_setCondition( m_aDispatchCondition ); // trigger non dispatch 
thread yields
+    }
 }
 
-void GtkXLib::Init()
+void GtkData::Init()
 {
     int i;
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "GtkXLib::Init()\n" );
+    fprintf( stderr, "GtkMainloop::Init()\n" );
 #endif
     XrmInitialize();
 
@@ -673,11 +714,6 @@ void GtkXLib::Init()
     // init gtk/gdk
     gtk_init_check( &nParams, &pCmdLineAry );
 
-#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 );
-#endif
-
     for (i = 0; i < nParams; i++ )
         g_free( pCmdLineAry[i] );
     delete [] pCmdLineAry;
@@ -718,16 +754,16 @@ void GtkXLib::Init()
     osl_setEnvironment(envVar.pData, envValue.pData);
 
     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();
+    gdk_error_trap_push();
     SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( 
pDisp );
-    XSync( pDisp, False );
-    pKbdExtension->UseExtension( ! HasXErrorOccurred() );
-    m_pGtkSalDisplay->errorTrapPop();
+    bool bErrorOccured = gdk_error_trap_pop() != 0;
+    gdk_error_trap_push();
+    pKbdExtension->UseExtension( bErrorOccured );
+    gdk_error_trap_pop();
     m_pGtkSalDisplay->SetKbdExtension( pKbdExtension );
 #else
 #  warning unwind keyboard extension bits
@@ -749,46 +785,39 @@ void GtkXLib::Init()
     }
 }
 
-extern "C"
+GtkSalTimer::GtkSalTimer()
+    : m_pTimeout( 0 )
 {
-    gboolean call_timeoutFn(gpointer data)
-    {
-        return GtkXLib::timeoutFn(data);
-    }
 }
 
-gboolean GtkXLib::timeoutFn(gpointer data)
+GtkSalTimer::~GtkSalTimer()
 {
-    SalData *pSalData = GetSalData();
-    GtkXLib *pThis = (GtkXLib *) data;
-
-    pSalData->m_pInstance->GetYieldMutex()->acquire();
+    Stop();
+}
 
-    if( pThis->m_pTimeout )
+extern "C"
+{
+    gboolean call_timeoutFn( gpointer pData )
     {
-        g_source_unref (pThis->m_pTimeout);
-        pThis->m_pTimeout = NULL;
-    }
+        GtkSalTimer *pTimer = (GtkSalTimer *)pData;
+        SalData *pSalData = GetSalData();
 
-    // Auto-restart immediately
-    pThis->StartTimer( pThis->m_nTimeoutMS );
+        osl::SolarGuard aGuard( pSalData->m_pInstance->GetYieldMutex() );
 
-    GetX11SalData()->Timeout();
+        pTimer->Start( pTimer->m_nTimeoutMS );
 
-    pSalData->m_pInstance->GetYieldMutex()->release();
+        ImplSVData* pSVData = ImplGetSVData();
+        if( pSVData->mpSalTimer )
+            pSVData->mpSalTimer->CallCallback();
 
-    return FALSE;
+        return FALSE;
+    }
 }
 
-void GtkXLib::StartTimer( sal_uLong nMS )
+void GtkSalTimer::Start( sal_uLong nMS )
 {
     m_nTimeoutMS = nMS; // for restarting
-
-    if (m_pTimeout)
-    {
-        g_source_destroy (m_pTimeout);
-        g_source_unref (m_pTimeout);
-    }
+    Stop();
 
     m_pTimeout = g_timeout_source_new (m_nTimeoutMS);
     // #i36226# timers should be executed with lower priority
@@ -798,37 +827,24 @@ void GtkXLib::StartTimer( sal_uLong nMS )
     g_source_set_callback (m_pTimeout, call_timeoutFn,
                            (gpointer) this, NULL);
     g_source_attach (m_pTimeout, g_main_context_default ());
-
-    SalXLib::StartTimer( nMS );
 }
 
-void GtkXLib::StopTimer()
-{
-    SalXLib::StopTimer();
-
-    if (m_pTimeout)
-    {
-        g_source_destroy (m_pTimeout);
-        g_source_unref (m_pTimeout);
-        m_pTimeout = NULL;
-    }
-}
-
-extern "C"
+void GtkSalTimer::Stop()
 {
-    gboolean call_userEventFn( gpointer data )
+    if( m_pTimeout )
     {
-        return GtkXLib::userEventFn( data );
+        g_source_destroy( m_pTimeout );
+        g_source_unref( m_pTimeout );
     }
 }
 
-gboolean GtkXLib::userEventFn(gpointer data)
+gboolean GtkData::userEventFn( gpointer data )
 {
     gboolean bContinue = FALSE;
-    GtkXLib *pThis = (GtkXLib *) data;
+    GtkData *pThis = (GtkData *) data;
     X11SalData *pSalData = GetX11SalData();
 
-    pSalData->m_pInstance->GetYieldMutex()->acquire();
+    osl::SolarGuard aGuard( pSalData->m_pInstance->GetYieldMutex() );
 
     const SalDisplay *pDisplay = pSalData->GetDisplay();
     //GtkSalDisplay inherits from SalDisplay, SalDisplay's dtor deregisters
@@ -858,8 +874,6 @@ gboolean GtkXLib::userEventFn(gpointer data)
         pThis->m_pGtkSalDisplay->DispatchInternalEvent();
     }
 
-    pSalData->m_pInstance->GetYieldMutex()->release();
-
     return bContinue;
 }
 
@@ -894,15 +908,14 @@ bool GtkSalDisplay::DispatchInternalEvent()
     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();
+        // Notify GtkData::Yield() of a pending event.
+        GetGtkSalData()->PostUserEvent();
 
         osl_releaseMutex( hEventGuard_ );
     }
@@ -911,7 +924,6 @@ void GtkSalDisplay::SendInternalEvent( SalFrame* pFrame, 
void* pData, sal_uInt16
     }
 }
 
-// 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_ ) )
@@ -934,230 +946,33 @@ void GtkSalDisplay::CancelInternalEvent( SalFrame* 
pFrame, void* pData, sal_uInt
 
         osl_releaseMutex( hEventGuard_ );
     }
-    else {
+    else
         DBG_ASSERT( 1, "SalDisplay::CancelInternalEvent !acquireMutex\n" );
-    }
 }
 
 #endif
 
+extern "C" {
+    static gboolean call_userEventFn( void *data )
+    {
+        return GtkData::userEventFn( data );
+    }
+}
+
 // hEventGuard_ held during this invocation
-void GtkXLib::PostUserEvent()
+void GtkData::PostUserEvent()
 {
-    if( !m_pUserEvent ) // not pending anyway
+    if (m_pUserEvent)
+        g_main_context_wakeup (NULL); // really needed ?
+    else // nothing pending anyway
     {
         m_pUserEvent = g_idle_source_new();
-        g_source_set_priority( m_pUserEvent, G_PRIORITY_HIGH );
+        g_source_set_priority (m_pUserEvent, G_PRIORITY_HIGH);
         g_source_set_can_recurse (m_pUserEvent, TRUE);
         g_source_set_callback (m_pUserEvent, call_userEventFn,
                                (gpointer) this, NULL);
         g_source_attach (m_pUserEvent, g_main_context_default ());
     }
-    Wakeup();
-}
-
-void GtkXLib::Wakeup()
-{
-    g_main_context_wakeup( g_main_context_default () );
-}
-
-void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
-{
-    /* #i33212# only enter g_main_context_iteration in one thread at any one
-     * time, else one of them potentially will never end as long as there is
-     * another thread in in there. Having only one yieldin thread actually 
dispatch
-     * fits the vcl event model (see e.g. the generic plugin).
-     */
-
-    bool bDispatchThread = false;
-    gboolean wasEvent = FALSE;
-    {
-        // release YieldMutex (and re-acquire at block end)
-        YieldMutexReleaser aReleaser;
-        if( osl_tryToAcquireMutex( m_aDispatchMutex ) )
-            bDispatchThread = true;
-        else if( ! bWait )
-            return; // someone else is waiting already, return
-
-
-        if( bDispatchThread )
-        {
-            int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
-            gboolean wasOneEvent = TRUE;
-            while( nMaxEvents-- && wasOneEvent )
-            {
-                wasOneEvent = g_main_context_iteration( NULL, FALSE );
-                if( wasOneEvent )
-                    wasEvent = TRUE;
-            }
-            if( bWait && ! wasEvent )
-                wasEvent = g_main_context_iteration( NULL, TRUE );
-        }
-        else if( bWait )
-           {
-            /* #i41693# in case the dispatch thread hangs in join
-             * for this thread the condition will never be set
-             * workaround: timeout of 1 second a emergency exit
-             */
-            // we are the dispatch thread
-            osl_resetCondition( m_aDispatchCondition );
-            TimeValue aValue = { 1, 0 };
-            osl_waitCondition( m_aDispatchCondition, &aValue );
-        }
-    }
-
-    if( bDispatchThread )
-    {
-        osl_releaseMutex( m_aDispatchMutex );
-        if( wasEvent )
-            osl_setCondition( m_aDispatchCondition ); // trigger non dispatch 
thread yields
-    }
-}
-
-extern "C" {
-
-typedef struct {
-    GSource       source;
-
-    GPollFD       pollfd;
-    GIOCondition  condition;
-
-    YieldFunc     pending;
-    YieldFunc     handle;
-    gpointer      user_data;
-} SalWatch;
-
-static gboolean
-sal_source_prepare (GSource *source,
-                    gint    *timeout)
-{
-    SalWatch *watch = (SalWatch *)source;
-
-    *timeout = -1;
-
-    if (watch->pending &&
-        watch->pending (watch->pollfd.fd, watch->user_data)) {
-        watch->pollfd.revents |= watch->condition;
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-static gboolean
-sal_source_check (GSource *source)
-{
-    SalWatch *watch = (SalWatch *)source;
-
-    return watch->pollfd.revents & watch->condition;
-}
-
-static gboolean
-sal_source_dispatch (GSource    *source,
-                     GSourceFunc,
-                     gpointer)
-{
-    SalData *pSalData = GetSalData();
-    SalWatch *watch = (SalWatch *) source;
-
-    pSalData->m_pInstance->GetYieldMutex()->acquire();
-
-    watch->handle (watch->pollfd.fd, watch->user_data);
-
-    pSalData->m_pInstance->GetYieldMutex()->release();
-
-    return TRUE;
-}
-
-static void
-sal_source_finalize (GSource*)
-{
-}
-
-static GSourceFuncs sal_source_watch_funcs = {
-    sal_source_prepare,
-    sal_source_check,
-    sal_source_dispatch,
-    sal_source_finalize,
-    NULL,
-    NULL
-};
-
-static GSource *
-sal_source_create_watch (int           fd,
-                         GIOCondition  condition,
-                         YieldFunc     pending,
-                         YieldFunc     handle,
-                         gpointer      user_data)
-{
-    GSource      *source;
-    SalWatch     *watch;
-    GMainContext *context = g_main_context_default ();
-
-    source = g_source_new (&sal_source_watch_funcs,
-                   sizeof (SalWatch));
-    watch = (SalWatch *) source;
-
-    watch->pollfd.fd     = fd;
-    watch->pollfd.events = condition;
-    watch->condition = condition;
-    watch->pending   = pending;
-    watch->handle    = handle;
-    watch->user_data = user_data;
-
-    g_source_set_can_recurse (source, TRUE);
-    g_source_add_poll (source, &watch->pollfd);
-    g_source_attach (source, context);
-
-    return source;
-}
-
-} // extern "C"
-
-void GtkXLib::Insert( int       nFD,
-              void     *data,
-              YieldFunc pending,
-              YieldFunc,
-              YieldFunc handle )
-{
-    GSource *source = sal_source_create_watch
-        ( nFD, (GIOCondition) ((G_IO_IN|G_IO_PRI) |
-                       (G_IO_ERR|G_IO_HUP|G_IO_NVAL)),
-          pending, handle, data );
-    m_aSources.push_back( source );
-}
-
-void GtkXLib::Remove( int nFD )
-{
-    ::std::list< GSource * >::iterator it;
-
-    for (it = m_aSources.begin(); it != m_aSources.end(); ++it)
-    {
-        SalWatch *watch = (SalWatch *) *it;
-
-        if (watch->pollfd.fd == nFD)
-        {
-            m_aSources.erase( it );
-
-            g_source_destroy ((GSource *)watch);
-            g_source_unref   ((GSource *)watch);
-            return;
-        }
-    }
-}
-
-/**********************************************************************
- * class GtkData                                                      *
- **********************************************************************/
-
-GtkData::~GtkData()
-{
-}
-
-void GtkData::Init()
-{
-    pXLib_ = new GtkXLib();
-    pXLib_->Init();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 577953f..f483f1a 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -419,6 +419,7 @@ SalVirtualDevice* GtkInstance::CreateVirtualDevice( 
SalGraphics *pG,
                                                     const SystemGraphicsData 
*pGd )
 {
 #if GTK_CHECK_VERSION(3,0,0)
+    (void)pG; (void) pGd;
     SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice( nBitCount );
     pNew->SetSize( nDX, nDY );
     return pNew;
@@ -436,6 +437,15 @@ SalBitmap* GtkInstance::CreateSalBitmap()
 #endif
 }
 
+SalTimer* GtkInstance::CreateSalTimer()
+{
+#if GTK_CHECK_VERSION(3,0,0)
+    return new GtkSalTimer();
+#else
+    return X11SalInstance::CreateSalTimer();
+#endif
+}
+
 // FIXME: these should all be in a more generic, shared base of unix's 
salinst.cxx
 
 osl::SolarMutex* GtkInstance::GetYieldMutex()
@@ -486,7 +496,7 @@ bool GtkInstance::CheckYieldMutex()
 
 void GtkInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
 {
-    GetGtkSalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents );
+    GetGtkSalData()->Yield( bWait, bHandleAllCurrentEvents );
 }
 
 bool GtkInstance::AnyInput( sal_uInt16 nType )
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index f080e4f..2db0a84 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -441,6 +441,7 @@ GtkSalFrame::GtkSalFrame( SalFrame* pParent, sal_uLong 
nStyle )
 {
     m_nScreen = getDisplay()->GetDefaultScreenNumber();
     getDisplay()->registerFrame( this );
+    m_nIdleFullScreen   = 0;
     m_nDuringRender     = 0;
     m_bDefaultPos       = true;
     m_bDefaultSize      = ( (nStyle & SAL_FRAME_STYLE_SIZEABLE) && ! pParent );
@@ -457,11 +458,14 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
 #endif
     m_bDefaultPos       = true;
     m_bDefaultSize      = true;
+    m_nIdleFullScreen   = 0;
     Init( pSysData );
 }
 
 GtkSalFrame::~GtkSalFrame()
 {
+    g_idle_remove_by_data (this);
+
     for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); ++i )
     {
         if( !m_aGraphics[i].pGraphics )
@@ -640,9 +644,9 @@ void GtkSalFrame::InitCommon()
     gtk_widget_realize( m_pWindow );
 
     //system data
-    GtkSalDisplay* pDisp = GetGtkSalData()->GetDisplay();
     m_aSystemData.nSize         = sizeof( SystemChildData );
 #if !GTK_CHECK_VERSION(3,0,0)
+    GtkSalDisplay* pDisp = GetGtkSalData()->GetDisplay();
     m_aSystemData.pDisplay      = pDisp->GetDisplay();
     m_aSystemData.pVisual              = pDisp->GetVisual( m_nScreen 
).GetVisual();
     m_aSystemData.nDepth               = pDisp->GetVisual( m_nScreen 
).GetDepth();
@@ -2335,12 +2339,12 @@ String GtkSalFrame::GetKeyName( sal_uInt16 nKeyCode )
 
 GdkDisplay *GtkSalFrame::getGdkDisplay()
 {
-    return GetGtkSalData()->pDisplay->GetGdkDisplay();
+    return GetGtkSalData()->GetGdkDisplay();
 }
 
 GtkSalDisplay *GtkSalFrame::getDisplay()
 {
-    return GetGtkSalData()->pDisplay;
+    return GetGtkSalData()->GetDisplay();
 }
 
 SalFrame::SalPointerState GtkSalFrame::GetPointerState()
@@ -3180,8 +3184,11 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, 
GdkEventFocus* pEvent, gpointer f
     return sal_False;
 }
 
-IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG )
+extern "C" {
+gboolean implDelayedFullScreenHdl (void *)
 {
+    g_warning ("FIXME: nasty delayed full-screen hdl workaround !");
+#if 0
 #if !GTK_CHECK_VERSION(3,0,0)
     Atom nStateAtom = 
getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE);
     Atom nFSAtom = 
getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN
 );
@@ -3210,7 +3217,9 @@ IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, 
EMPTYARG )
                     );
     }
 #endif
-    return 0;
+#endif
+    return FALSE;
+}
 }
 
 gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
@@ -3224,7 +3233,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, 
gpointer frame )
         /* #i110881# workaorund a gtk issue (see 
https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
            gtk_window_fullscreen can run into a race condition with the 
window's showstate
         */
-        Application::PostUserEvent( LINK( pThis, GtkSalFrame, 
ImplDelayedFullScreenHdl ) );
+        g_idle_add_full( G_PRIORITY_HIGH, implDelayedFullScreenHdl, pThis, 
NULL );
     }
 
     bool bSetFocus = pThis->m_bSetFocusOnMap;
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to