diff --git a/include/wx/gtk/glcanvas.h b/include/wx/gtk/glcanvas.h index 0c6c6c7dd8..d79bba0439 100644 --- a/include/wx/gtk/glcanvas.h +++ b/include/wx/gtk/glcanvas.h @@ -112,6 +112,9 @@ public: // implementation from now on virtual void GTKHandleRealized() wxOVERRIDE; +#ifdef __WXGTK3__ + wxSize m_size; +#endif #if WXWIN_COMPATIBILITY_2_8 wxGLContext *m_sharedContext; wxGLCanvas *m_sharedContextOf; diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index bf5f38f943..b320e00324 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -18,6 +18,27 @@ #include "wx/gtk/private/wrapgtk.h" #include +#ifdef __WXGTK3__ +extern "C" { +static gboolean draw(GtkWidget* widget, cairo_t* cr, wxGLCanvas* win) +{ + GtkAllocation a; + gtk_widget_get_allocation(widget, &a); + if (a.width > win->m_size.x || a.height > win->m_size.y) + { + // GLX buffers are apparently not reliably updated to the new size + // before the paint event occurs, resulting in newly exposed window + // areas sometimes not being painted at the end of a drag resize. + gdk_display_sync(gtk_widget_get_display(widget)); + } + win->m_size.Set(a.width, a.height); + + win->GTKSendPaintEvents(cr); + return false; +} +} +#endif // __WXGTK3__ + //----------------------------------------------------------------------------- // emission hook for "parent-set" //----------------------------------------------------------------------------- @@ -190,6 +211,7 @@ bool wxGLCanvas::Create(wxWindow *parent, m_nativeSizeEvent = true; #ifdef __WXGTK3__ + m_noExpose = true; m_backgroundStyle = wxBG_STYLE_PAINT; #endif @@ -203,6 +225,9 @@ bool wxGLCanvas::Create(wxWindow *parent, g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL); wxWindow::Create( parent, id, pos, size, style, name ); +#ifdef __WXGTK3__ + g_signal_connect(m_wxwindow, "draw", G_CALLBACK(draw), this); +#endif gtk_widget_set_double_buffered(m_wxwindow, false);