X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/graphlib.git/blobdiff_plain/3e10a09338b1f21bfd28fd0a7ee90ffaebdd98bb..d36574805d09410419348c7ae3d65365a8fdd26d:/DrawingWindow.cpp diff --git a/DrawingWindow.cpp b/DrawingWindow.cpp index 5c918ba..3234441 100644 --- a/DrawingWindow.cpp +++ b/DrawingWindow.cpp @@ -665,11 +665,11 @@ bool DrawingWindow::waitMousePress(int &x, int &y, int &button, unsigned long time) { bool pressed; - safeLock(mouseMutex); + safeLock(inputMutex); if (terminateThread) { pressed = false; } else { - pressed = mouseCondition.wait(&mouseMutex, time) && !terminateThread; + pressed = inputCondition.wait(&inputMutex, time) && !terminateThread; if (pressed) { x = mousePos.x(); y = mousePos.y(); @@ -683,7 +683,7 @@ bool DrawingWindow::waitMousePress(int &x, int &y, int &button, button = 0; } } - safeUnlock(mouseMutex); + safeUnlock(inputMutex); return pressed; } @@ -745,6 +745,9 @@ void DrawingWindow::usleep(unsigned long usecs) DrawingThread::usleep(usecs); } +//--- DrawingWindow (protected methods) -------------------------------- +//! \cond show_protected + /*! * \see QWidget */ @@ -753,7 +756,7 @@ void DrawingWindow::closeEvent(QCloseEvent *ev) timer.stop(); thread->exit(); syncMutex.lock(); - mouseMutex.lock(); + inputMutex.lock(); terminateThread = true; // this flag is needed for the case // where the following wakeAll() call // occurs between the @@ -761,8 +764,8 @@ void DrawingWindow::closeEvent(QCloseEvent *ev) // mutex lock in safeLock() called // from sync() syncCondition.wakeAll(); - mouseCondition.wakeAll(); - mouseMutex.unlock(); + inputCondition.wakeAll(); + inputMutex.unlock(); syncMutex.unlock(); QWidget::closeEvent(ev); if (!thread->wait(250)) { @@ -797,12 +800,12 @@ void DrawingWindow::customEvent(QEvent *ev) */ void DrawingWindow::mousePressEvent(QMouseEvent *ev) { - mouseMutex.lock(); + inputMutex.lock(); mousePos = ev->pos(); mouseButton = ev->button(); ev->accept(); - mouseCondition.wakeAll(); - mouseMutex.unlock(); + inputCondition.wakeAll(); + inputMutex.unlock(); } /*! @@ -854,6 +857,8 @@ void DrawingWindow::timerEvent(QTimerEvent *ev) } } +// \endcond + //--- DrawingWindow (private methods) ---------------------------------- //! Fonction d'initialisation.