Fix wxGLCanvas painting glitch during resize with GTK3
Newly exposed window areas would sometimes not be painted after drag resize.
This commit is contained in:
@@ -112,6 +112,9 @@ public:
|
|||||||
// implementation from now on
|
// implementation from now on
|
||||||
virtual void GTKHandleRealized() wxOVERRIDE;
|
virtual void GTKHandleRealized() wxOVERRIDE;
|
||||||
|
|
||||||
|
#ifdef __WXGTK3__
|
||||||
|
wxSize m_size;
|
||||||
|
#endif
|
||||||
#if WXWIN_COMPATIBILITY_2_8
|
#if WXWIN_COMPATIBILITY_2_8
|
||||||
wxGLContext *m_sharedContext;
|
wxGLContext *m_sharedContext;
|
||||||
wxGLCanvas *m_sharedContextOf;
|
wxGLCanvas *m_sharedContextOf;
|
||||||
|
@@ -18,6 +18,27 @@
|
|||||||
#include "wx/gtk/private/wrapgtk.h"
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
|
#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"
|
// emission hook for "parent-set"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -190,6 +211,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_nativeSizeEvent = true;
|
m_nativeSizeEvent = true;
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
|
m_noExpose = true;
|
||||||
m_backgroundStyle = wxBG_STYLE_PAINT;
|
m_backgroundStyle = wxBG_STYLE_PAINT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -203,6 +225,9 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL);
|
g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL);
|
||||||
|
|
||||||
wxWindow::Create( parent, id, pos, size, style, name );
|
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);
|
gtk_widget_set_double_buffered(m_wxwindow, false);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user