Skip to content
Snippets Groups Projects
Commit 10d60495 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

lock drawing per openglWindow; this should fix bug #1

parent dc3afd3b
Branches
Tags
No related merge requests found
...@@ -38,12 +38,11 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl ...@@ -38,12 +38,11 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl
} }
openglWindow::openglWindow(int x, int y, int w, int h, const char *l) openglWindow::openglWindow(int x, int y, int w, int h, const char *l)
: Fl_Gl_Window(x, y, w, h, l) : Fl_Gl_Window(x, y, w, h, l), _lock(false),
_selection(ENT_NONE), _trySelection(0)
{ {
_ctx = new drawContext(); _ctx = new drawContext();
for(int i = 0; i < 3; i++) _point[i] = 0.; for(int i = 0; i < 3; i++) _point[i] = 0.;
_selection = ENT_NONE;
_trySelection = 0;
for(int i = 0; i < 4; i++) _trySelectionXYWH[i] = 0; for(int i = 0; i < 4; i++) _trySelectionXYWH[i] = 0;
_lassoXY[0] = _lassoXY[1] = 0; _lassoXY[0] = _lassoXY[1] = 0;
...@@ -110,9 +109,8 @@ void openglWindow::draw() ...@@ -110,9 +109,8 @@ void openglWindow::draw()
// some drawing routines can create data (STL triangulations, etc.): // some drawing routines can create data (STL triangulations, etc.):
// make sure that we don't fire draw() while we are already drawing // make sure that we don't fire draw() while we are already drawing
// (e.g. du to an impromptu Fl::check()) // (e.g. du to an impromptu Fl::check())
static bool busy = false; if(_lock) return;
if(busy) return; _lock = true;
busy = true;
Msg::Debug("openglWindow::draw()"); Msg::Debug("openglWindow::draw()");
...@@ -198,7 +196,7 @@ void openglWindow::draw() ...@@ -198,7 +196,7 @@ void openglWindow::draw()
drawBorder(); drawBorder();
} }
busy = false; _lock = false;
} }
openglWindow *openglWindow::_lastHandled = 0; openglWindow *openglWindow::_lastHandled = 0;
...@@ -522,9 +520,8 @@ bool openglWindow::processSelectionBuffer(int type, bool multipleSelection, ...@@ -522,9 +520,8 @@ bool openglWindow::processSelectionBuffer(int type, bool multipleSelection,
// some drawing routines can create data (STL triangulations, etc.): // some drawing routines can create data (STL triangulations, etc.):
// make sure that we don't fire redraw while we are already drawing // make sure that we don't fire redraw while we are already drawing
// (e.g. du to an impromptu Fl::check()) // (e.g. du to an impromptu Fl::check())
static bool busy = false; if(_lock) return false;
if(busy) return false; _lock = true;
busy = true;
make_current(); make_current();
GLuint *selectionBuffer = new GLuint[size]; GLuint *selectionBuffer = new GLuint[size];
...@@ -544,7 +541,7 @@ bool openglWindow::processSelectionBuffer(int type, bool multipleSelection, ...@@ -544,7 +541,7 @@ bool openglWindow::processSelectionBuffer(int type, bool multipleSelection,
GLint numhits = glRenderMode(GL_RENDER); GLint numhits = glRenderMode(GL_RENDER);
_ctx->render_mode = drawContext::GMSH_RENDER; _ctx->render_mode = drawContext::GMSH_RENDER;
busy = false; _lock = false;
if(!numhits){ // no hits if(!numhits){ // no hits
delete [] selectionBuffer; delete [] selectionBuffer;
......
...@@ -22,6 +22,7 @@ class openglWindow : public Fl_Gl_Window { ...@@ -22,6 +22,7 @@ class openglWindow : public Fl_Gl_Window {
private: private:
static openglWindow *_lastHandled; static openglWindow *_lastHandled;
static void _setLastHandled(openglWindow*); static void _setLastHandled(openglWindow*);
bool _lock;
mousePosition _click, _curr, _prev; mousePosition _click, _curr, _prev;
drawContext *_ctx; drawContext *_ctx;
double _point[3]; double _point[3];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment