Skip to content

Commit

Permalink
libgui|Canvas: Cleanup and debug log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Apr 5, 2013
1 parent 704a493 commit 7210d01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doomsday/libgui/include/de/gui/canvas.h
Expand Up @@ -126,7 +126,7 @@ class Canvas : public QGLWidget, public KeyEventSource, public MouseEventSource
*/
bool isCursorVisible() const;

void copyAudiencesFrom(Canvas &other);
void copyAudiencesFrom(Canvas const &other);

protected:
void initializeGL();
Expand Down
18 changes: 15 additions & 3 deletions doomsday/libgui/src/canvas.cpp
Expand Up @@ -37,7 +37,6 @@

namespace de {

static const int MOUSE_TRACK_INTERVAL_MS = 1;
static const int MOUSE_WHEEL_CONTINUOUS_THRESHOLD_MS = 100;

DENG2_PIMPL(Canvas)
Expand Down Expand Up @@ -194,7 +193,7 @@ Canvas::Canvas(CanvasWindow* parent, QGLWidget* shared)
LOG_DEBUG("swap interval: ") << format().swapInterval();
LOG_DEBUG("multisample: %b") << format().sampleBuffers();
/*
TODO: needs to be moved to ClientWindow
TODO: needs to be moved to ClientWindow's GLInit
#ifdef __CLIENT__
// Update the capability flags.
GL_state.features.multisample = format().sampleBuffers();
Expand Down Expand Up @@ -257,7 +256,7 @@ bool Canvas::isCursorVisible() const
return !d->cursorHidden;
}

void Canvas::copyAudiencesFrom(Canvas &other)
void Canvas::copyAudiencesFrom(Canvas const &other)
{
audienceForGLReady = other.audienceForGLReady;
audienceForGLInit = other.audienceForGLInit;
Expand All @@ -274,6 +273,12 @@ void Canvas::copyAudiencesFrom(Canvas &other)

void Canvas::initializeGL()
{
LOG_AS("Canvas");
LOG_DEBUG("Notifying GL init");

/// @todo Can this be used instead of GLReady to notify when the
/// canvas is ready (on all platforms)?

DENG2_FOR_AUDIENCE(GLInit, i) i->canvasGLInit(*this);

/*
Expand All @@ -299,13 +304,17 @@ void Canvas::resizeGL(int w, int h)

void Canvas::showEvent(QShowEvent* ev)
{
LOG_AS("Canvas");

QGLWidget::showEvent(ev);

// The first time the window is shown, run the initialization callback. On
// some platforms, OpenGL is not fully ready to be used before the window
// actually appears on screen.
if(isVisible() && !d->initNotified)
{
LOG_DEBUG("Received first show event, scheduling GL ready notification");

QTimer::singleShot(1, this, SLOT(notifyInit()));
}
}
Expand All @@ -316,6 +325,9 @@ void Canvas::notifyInit()

d->initNotified = true;

LOG_AS("Canvas");
LOG_DEBUG("Notifying GL ready");

DENG2_FOR_AUDIENCE(GLReady, i) i->canvasGLReady(*this);

// The Canvas instance might have been destroyed now.
Expand Down

0 comments on commit 7210d01

Please sign in to comment.