summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-14 15:49:56 +0100
committerDavid Tardon <dtardon@redhat.com>2015-06-15 13:56:11 +0000
commitbf89d2d86099d0c4032c56b75505f135e286db87 (patch)
tree58568cdf4fc03d07abfad1c94a22a08593dfefe1
parentdc5fb55f8211645ad5d6358625938e4bc015cb68 (diff)
Resolves: tdf#91393 autotext (etc) not fully drawn
the paint timer is activating after we ask gtk to size the window but before we/gtk get the ConfigureNotify that updates gtk knowledge of the size. So the gtk drawing calls are clipped to the previous ConfigureNotify size. So, lets try postponing paints if we have set a size but not received a configure notify yet (cherry picked from commit 8f324aebfb94c4b2023894121b954ad4f35eb395) Change-Id: If5e993f8e0e65053b59234fce0785398b93c1c46 another stab at tdf#91393 block paints only if the new requested size is larger than the original and unblock on explicit expose events as well as configure ones Change-Id: I72829a5b6e55d6bbdaf934af427ee3b50fe11fd4 (cherry picked from commit 6dc1d2706f519d91617ac1a12fc2051d97ef98c0) Reviewed-on: https://gerrit.libreoffice.org/16291 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r--vcl/inc/salframe.hxx5
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx9
-rw-r--r--vcl/source/app/salvtables.cxx7
-rw-r--r--vcl/source/window/paint.cxx11
-rw-r--r--vcl/unx/gtk/window/gtksalframe.cxx43
5 files changed, 64 insertions, 11 deletions
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 84cd1f53567c..4e52fe44e309 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -101,6 +101,9 @@ class VCL_PLUGIN_PUBLIC SalFrame
: public vcl::DeletionNotifier
, public SalGeometryProvider
{
+protected:
+ bool m_bPaintsBlocked;
+private:
// the VCL window corresponding to this frame
VclPtr<vcl::Window> m_pWindow;
SALFRAMEPROC m_pProc;
@@ -242,6 +245,8 @@ public:
// (e.g. input methods, printer update handlers).
long CallCallback( sal_uInt16 nEvent, const void* pEvent ) const
{ return m_pProc ? long(m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent )) : 0; }
+
+ bool PaintsBlocked() const { return m_bPaintsBlocked; }
};
#endif // INCLUDED_VCL_INC_SALFRAME_HXX
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index de8903e729c8..5792efa8a025 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -295,6 +295,15 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider
return (m_nStyle & nMask) != 0;
}
+ //call gtk_window_resize if the current size differs and
+ //block Paints until Configure is received and the size
+ //is valid again
+ void window_resize(long nWidth, long nHeight);
+ //call gtk_widget_set_size_request if the current size request differs and
+ //block Paints until Configure is received and the size
+ //is valid again
+ void widget_set_size_request(long nWidth, long nHeight);
+
void resizeWindow( long nWidth, long nHeight );
void moveWindow( long nX, long nY );
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c51f4f60d954..4c5636372a48 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -29,7 +29,12 @@
#include <salmenu.hxx>
-SalFrame::SalFrame() : m_pWindow( NULL ), m_pProc( NULL ) {}
+SalFrame::SalFrame()
+ : m_bPaintsBlocked(false)
+ , m_pWindow(NULL)
+ , m_pProc(NULL)
+{
+}
// this file contains the virtual destructors of the sal interface
// compilers usually put their vtables where the destructor is
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 0adb3eedae92..8fe3819bc559 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -584,12 +584,17 @@ IMPL_LINK_NOARG_TYPED(Window, ImplHandlePaintHdl, Idle *, void)
return;
}
- // save paint events until resizing is done
- if( !ImplDoTiledRendering() &&
- mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData->maResizeIdle.IsActive() )
+ // save paint events until resizing or initial sizing done
+ if (!ImplDoTiledRendering() && mpWindowImpl->mbFrame &&
+ (mpWindowImpl->mpFrameData->maResizeIdle.IsActive() ||
+ mpWindowImpl->mpFrame->PaintsBlocked()))
+ {
mpWindowImpl->mpFrameData->maPaintIdle.Start();
+ }
else if ( mpWindowImpl->mbReallyVisible )
+ {
ImplCallOverlapPaint();
+ }
}
IMPL_LINK_NOARG_TYPED(Window, ImplHandleResizeTimerHdl, Idle *, void)
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 3286267b8686..5ed6465b250e 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -933,12 +933,36 @@ void GtkSalFrame::moveWindow( long nX, long nY )
gtk_window_move( GTK_WINDOW(m_pWindow), nX, nY );
}
+void GtkSalFrame::widget_set_size_request(long nWidth, long nHeight)
+{
+ gint nOrigwidth, nOrigheight;
+ gtk_window_get_size(GTK_WINDOW(m_pWindow), &nOrigwidth, &nOrigheight);
+ if (nWidth > nOrigwidth || nHeight > nOrigheight)
+ {
+ m_bPaintsBlocked = true;
+ }
+ gtk_widget_set_size_request(m_pWindow, nWidth, nHeight );
+}
+
+void GtkSalFrame::window_resize(long nWidth, long nHeight)
+{
+ gint nOrigwidth, nOrigheight;
+ gtk_window_get_size(GTK_WINDOW(m_pWindow), &nOrigwidth, &nOrigheight);
+ if (nWidth > nOrigwidth || nHeight > nOrigheight)
+ {
+ m_bPaintsBlocked = true;
+ }
+ gtk_window_resize(GTK_WINDOW(m_pWindow), nWidth, nHeight);
+}
+
void GtkSalFrame::resizeWindow( long nWidth, long nHeight )
{
if( isChild( false, true ) )
- gtk_widget_set_size_request( m_pWindow, nWidth, nHeight );
+ {
+ widget_set_size_request(nWidth, nHeight);
+ }
else if( ! isChild( true, false ) )
- gtk_window_resize( GTK_WINDOW(m_pWindow), nWidth, nHeight );
+ window_resize(nWidth, nHeight);
}
/*
@@ -1459,7 +1483,7 @@ void GtkSalFrame::Init( SystemParentData* pSysData )
&aRoot, &x_ret, &y_ret, &w, &h, &bw, &d );
maGeometry.nWidth = w;
maGeometry.nHeight = h;
- gtk_window_resize( GTK_WINDOW(m_pWindow), w, h );
+ window_resize(w, h);
gtk_window_move( GTK_WINDOW(m_pWindow), 0, 0 );
if( ! m_bWindowIsGtkPlug )
{
@@ -1955,10 +1979,12 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE;
}
if( aHints )
+ {
gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
NULL,
&aGeo,
GdkWindowHints( aHints ) );
+ }
}
}
@@ -1979,7 +2005,7 @@ void GtkSalFrame::SetMinClientSize( long nWidth, long nHeight )
m_aMinSize = Size( nWidth, nHeight );
if( m_pWindow )
{
- gtk_widget_set_size_request( m_pWindow, nWidth, nHeight );
+ widget_set_size_request(nWidth, nHeight );
// Show does a setMinMaxSize
if( IS_WIDGET_MAPPED( m_pWindow ) )
setMinMaxSize();
@@ -2040,9 +2066,9 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u
maGeometry.nHeight = nHeight;
if( isChild( false, true ) )
- gtk_widget_set_size_request( m_pWindow, nWidth, nHeight );
+ widget_set_size_request(nWidth, nHeight);
else if( ! ( m_nState & GDK_WINDOW_STATE_MAXIMIZED ) )
- gtk_window_resize( GTK_WINDOW(m_pWindow), nWidth, nHeight );
+ window_resize(nWidth, nHeight);
setMinMaxSize();
}
else if( m_bDefaultSize )
@@ -2365,7 +2391,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
// temporarily re-sizeable
if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
- gtk_window_resize( GTK_WINDOW( m_pWindow ), maGeometry.nWidth, maGeometry.nHeight );
+ window_resize(maGeometry.nWidth, maGeometry.nHeight);
//I wonder if we should instead leave maGeometry alone and rely on
//configure-event to trigger signalConfigure and set it there
AllocateFrame();
@@ -3509,6 +3535,7 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect)
gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame )
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+ pThis->m_bPaintsBlocked = false;
cairo_save(cr);
@@ -3531,6 +3558,7 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame )
gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer frame )
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+ pThis->m_bPaintsBlocked = false;
struct SalPaintEvent aEvent( pEvent->area.x, pEvent->area.y, pEvent->area.width, pEvent->area.height );
@@ -3683,6 +3711,7 @@ gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame )
gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gpointer frame )
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+ pThis->m_bPaintsBlocked = false;
bool bMoved = false, bSized = false;
int x = pEvent->x, y = pEvent->y;