Kaydet (Commit) bf89d2d8 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) David Tardon

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 8f324aeb)

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 6dc1d270)
Reviewed-on: https://gerrit.libreoffice.org/16291Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst dc5fb55f
...@@ -101,6 +101,9 @@ class VCL_PLUGIN_PUBLIC SalFrame ...@@ -101,6 +101,9 @@ class VCL_PLUGIN_PUBLIC SalFrame
: public vcl::DeletionNotifier : public vcl::DeletionNotifier
, public SalGeometryProvider , public SalGeometryProvider
{ {
protected:
bool m_bPaintsBlocked;
private:
// the VCL window corresponding to this frame // the VCL window corresponding to this frame
VclPtr<vcl::Window> m_pWindow; VclPtr<vcl::Window> m_pWindow;
SALFRAMEPROC m_pProc; SALFRAMEPROC m_pProc;
...@@ -242,6 +245,8 @@ public: ...@@ -242,6 +245,8 @@ public:
// (e.g. input methods, printer update handlers). // (e.g. input methods, printer update handlers).
long CallCallback( sal_uInt16 nEvent, const void* pEvent ) const long CallCallback( sal_uInt16 nEvent, const void* pEvent ) const
{ return m_pProc ? long(m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent )) : 0; } { 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 #endif // INCLUDED_VCL_INC_SALFRAME_HXX
......
...@@ -295,6 +295,15 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider ...@@ -295,6 +295,15 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider
return (m_nStyle & nMask) != 0; 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 resizeWindow( long nWidth, long nHeight );
void moveWindow( long nX, long nY ); void moveWindow( long nX, long nY );
......
...@@ -29,7 +29,12 @@ ...@@ -29,7 +29,12 @@
#include <salmenu.hxx> #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 // this file contains the virtual destructors of the sal interface
// compilers usually put their vtables where the destructor is // compilers usually put their vtables where the destructor is
......
...@@ -584,12 +584,17 @@ IMPL_LINK_NOARG_TYPED(Window, ImplHandlePaintHdl, Idle *, void) ...@@ -584,12 +584,17 @@ IMPL_LINK_NOARG_TYPED(Window, ImplHandlePaintHdl, Idle *, void)
return; return;
} }
// save paint events until resizing is done // save paint events until resizing or initial sizing done
if( !ImplDoTiledRendering() && if (!ImplDoTiledRendering() && mpWindowImpl->mbFrame &&
mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData->maResizeIdle.IsActive() ) (mpWindowImpl->mpFrameData->maResizeIdle.IsActive() ||
mpWindowImpl->mpFrame->PaintsBlocked()))
{
mpWindowImpl->mpFrameData->maPaintIdle.Start(); mpWindowImpl->mpFrameData->maPaintIdle.Start();
}
else if ( mpWindowImpl->mbReallyVisible ) else if ( mpWindowImpl->mbReallyVisible )
{
ImplCallOverlapPaint(); ImplCallOverlapPaint();
}
} }
IMPL_LINK_NOARG_TYPED(Window, ImplHandleResizeTimerHdl, Idle *, void) IMPL_LINK_NOARG_TYPED(Window, ImplHandleResizeTimerHdl, Idle *, void)
......
...@@ -933,12 +933,36 @@ void GtkSalFrame::moveWindow( long nX, long nY ) ...@@ -933,12 +933,36 @@ void GtkSalFrame::moveWindow( long nX, long nY )
gtk_window_move( GTK_WINDOW(m_pWindow), nX, 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 ) void GtkSalFrame::resizeWindow( long nWidth, long nHeight )
{ {
if( isChild( false, true ) ) if( isChild( false, true ) )
gtk_widget_set_size_request( m_pWindow, nWidth, nHeight ); {
widget_set_size_request(nWidth, nHeight);
}
else if( ! isChild( true, false ) ) 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 ) ...@@ -1459,7 +1483,7 @@ void GtkSalFrame::Init( SystemParentData* pSysData )
&aRoot, &x_ret, &y_ret, &w, &h, &bw, &d ); &aRoot, &x_ret, &y_ret, &w, &h, &bw, &d );
maGeometry.nWidth = w; maGeometry.nWidth = w;
maGeometry.nHeight = h; 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 ); gtk_window_move( GTK_WINDOW(m_pWindow), 0, 0 );
if( ! m_bWindowIsGtkPlug ) if( ! m_bWindowIsGtkPlug )
{ {
...@@ -1955,10 +1979,12 @@ void GtkSalFrame::setMinMaxSize() ...@@ -1955,10 +1979,12 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE; aHints |= GDK_HINT_MAX_SIZE;
} }
if( aHints ) if( aHints )
{
gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
NULL, NULL,
&aGeo, &aGeo,
GdkWindowHints( aHints ) ); GdkWindowHints( aHints ) );
}
} }
} }
...@@ -1979,7 +2005,7 @@ void GtkSalFrame::SetMinClientSize( long nWidth, long nHeight ) ...@@ -1979,7 +2005,7 @@ void GtkSalFrame::SetMinClientSize( long nWidth, long nHeight )
m_aMinSize = Size( nWidth, nHeight ); m_aMinSize = Size( nWidth, nHeight );
if( m_pWindow ) if( m_pWindow )
{ {
gtk_widget_set_size_request( m_pWindow, nWidth, nHeight ); widget_set_size_request(nWidth, nHeight );
// Show does a setMinMaxSize // Show does a setMinMaxSize
if( IS_WIDGET_MAPPED( m_pWindow ) ) if( IS_WIDGET_MAPPED( m_pWindow ) )
setMinMaxSize(); setMinMaxSize();
...@@ -2040,9 +2066,9 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u ...@@ -2040,9 +2066,9 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u
maGeometry.nHeight = nHeight; maGeometry.nHeight = nHeight;
if( isChild( false, true ) ) 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 ) ) else if( ! ( m_nState & GDK_WINDOW_STATE_MAXIMIZED ) )
gtk_window_resize( GTK_WINDOW(m_pWindow), nWidth, nHeight ); window_resize(nWidth, nHeight);
setMinMaxSize(); setMinMaxSize();
} }
else if( m_bDefaultSize ) else if( m_bDefaultSize )
...@@ -2365,7 +2391,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz ...@@ -2365,7 +2391,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
// temporarily re-sizeable // temporarily re-sizeable
if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); 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 //I wonder if we should instead leave maGeometry alone and rely on
//configure-event to trigger signalConfigure and set it there //configure-event to trigger signalConfigure and set it there
AllocateFrame(); AllocateFrame();
...@@ -3509,6 +3535,7 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect) ...@@ -3509,6 +3535,7 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect)
gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame )
{ {
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
pThis->m_bPaintsBlocked = false;
cairo_save(cr); cairo_save(cr);
...@@ -3531,6 +3558,7 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame ) ...@@ -3531,6 +3558,7 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame )
gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer frame ) gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer frame )
{ {
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(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 ); 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 ) ...@@ -3683,6 +3711,7 @@ gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame )
gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gpointer frame ) gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gpointer frame )
{ {
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
pThis->m_bPaintsBlocked = false;
bool bMoved = false, bSized = false; bool bMoved = false, bSized = false;
int x = pEvent->x, y = pEvent->y; int x = pEvent->x, y = pEvent->y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment