further fixes for X window crashes.
This commit is contained in:
parent
7d55df052f
commit
e159344ce5
1 changed files with 15 additions and 24 deletions
|
@ -91,30 +91,7 @@ class Canvas: public wxGLCanvas
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template<class...Args>
|
template<class...Args>
|
||||||
Canvas(Args &&...args): wxGLCanvas(std::forward<Args>(args)...)
|
Canvas(Args &&...args): wxGLCanvas(std::forward<Args>(args)...) {}
|
||||||
{
|
|
||||||
Bind(wxEVT_PAINT, [this](wxPaintEvent &) {
|
|
||||||
// This is required even though dc is not used otherwise.
|
|
||||||
wxPaintDC dc(this);
|
|
||||||
|
|
||||||
// Set the OpenGL viewport according to the client size of this
|
|
||||||
// canvas. This is done here rather than in a wxSizeEvent handler
|
|
||||||
// because our OpenGL rendering context (and thus viewport
|
|
||||||
// setting) is used with multiple canvases: If we updated the
|
|
||||||
// viewport in the wxSizeEvent handler, changing the size of one
|
|
||||||
// canvas causes a viewport setting that is wrong when next
|
|
||||||
// another canvas is repainted.
|
|
||||||
const wxSize ClientSize = GetClientSize();
|
|
||||||
|
|
||||||
m_display->set_screen_size(ClientSize.x, ClientSize.y);
|
|
||||||
});
|
|
||||||
|
|
||||||
Bind(wxEVT_SIZE, [this](wxSizeEvent &) {
|
|
||||||
const wxSize ClientSize = GetClientSize();
|
|
||||||
m_display->set_screen_size(ClientSize.x, ClientSize.y);
|
|
||||||
m_display->repaint();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
shptr<Slic3r::GL::Display> get_display() const { return m_display; }
|
shptr<Slic3r::GL::Display> get_display() const { return m_display; }
|
||||||
|
|
||||||
|
@ -466,6 +443,20 @@ void MyFrame::activate_canvas_display()
|
||||||
m_canvas->get_display()->set_active(ClientSize.x, ClientSize.y);
|
m_canvas->get_display()->set_active(ClientSize.x, ClientSize.y);
|
||||||
enable_multisampling(m_ms_toggle->GetValue());
|
enable_multisampling(m_ms_toggle->GetValue());
|
||||||
|
|
||||||
|
m_canvas->Bind(wxEVT_PAINT, [this](wxPaintEvent &) {
|
||||||
|
// This is required even though dc is not used otherwise.
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
const wxSize csize = GetClientSize();
|
||||||
|
m_canvas->get_display()->set_screen_size(csize.x, csize.y);
|
||||||
|
m_canvas->get_display()->repaint();
|
||||||
|
});
|
||||||
|
|
||||||
|
m_canvas->Bind(wxEVT_SIZE, [this](wxSizeEvent &) {
|
||||||
|
const wxSize csize = GetClientSize();
|
||||||
|
m_canvas->get_display()->set_screen_size(csize.x, csize.y);
|
||||||
|
m_canvas->get_display()->repaint();
|
||||||
|
});
|
||||||
|
|
||||||
// Do the repaint continuously
|
// Do the repaint continuously
|
||||||
m_canvas->Bind(wxEVT_IDLE, [this](wxIdleEvent &evt) {
|
m_canvas->Bind(wxEVT_IDLE, [this](wxIdleEvent &evt) {
|
||||||
m_canvas->get_display()->repaint();
|
m_canvas->get_display()->repaint();
|
||||||
|
|
Loading…
Reference in a new issue