tdf#91301: Don't cache incomplete tabs.

After introduction of the Idle processing, something has changed so
that the underlying GetGdkWindow() does not update its size fast enough;
even though the gtk_window_resize() is called before the Window::Erase()
(that actually paints the background) etc.

The consequence of the not-yet-updated gdkDrawable is that we cache
something that has the correct background in the top left 200x200
pixels, but the rest is just copied from the screen.

Let's for now just not cache when the GetGdkWindow() is smaller than
what we actually paint; TODO find the root cause.

Change-Id: Ib6092668eb4613899f665bb0f12fc1eb15484e13
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 463d9fe..365dba8 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -2914,11 +2914,31 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
    }
    END_CACHE_PIXMAP_RENDER( pixmapRect, pixmap, mask )

    // tdf#91301 workaround
    //
    // After introduction of the Idle processing, something has changed so
    // that the underlying GetGdkWindow() does not update its size fast enough;
    // even though the gtk_window_resize is called before the Window::Erase()
    // (that actually paints the background) etc.
    //
    // The consequence of the not-yet-updated gdkDrawable is that we cache
    // something that has the correct background in the top left 200x200
    // pixels, but the rest is just copied from the screen.
    //
    // Let's for now just not cache when the GetGdkWindow() is smaller than
    // what we actually paint; TODO find the root cause.
    gint width, height;
    gdk_drawable_get_size(GetGdkWindow(), &width, &height);
    bool bAllowCaching = (pixmapRect.Right() < width) && (pixmapRect.Bottom() < height);

    // cache data
    if( nType == CTRL_TAB_ITEM )
        aCacheItems.Fill( nType, nState, pixmapRect, pixmap, mask );
    else
        aCachePage.Fill( nType, nState, pixmapRect, pixmap, mask );
    if (bAllowCaching)
    {
        if (nType == CTRL_TAB_ITEM)
            aCacheItems.Fill(nType, nState, pixmapRect, pixmap, mask);
        else
            aCachePage.Fill(nType, nState, pixmapRect, pixmap, mask);
    }

    return true;
}