diff options
author | Sam Spilsbury <smspillaz@gmail.com> | 2009-09-05 11:31:05 +0800 |
---|---|---|
committer | Sam Spilsbury <smspillaz@gmail.com> | 2009-09-05 11:31:05 +0800 |
commit | d1ea7f1fe8835fb6cfa9f7f7ba805cdbe46d8132 (patch) | |
tree | 4e4dac80d258c517d8fa81d672d1ec9359488e2e | |
parent | a7fe4de96346049eaca6db16992e1b65a845ec8a (diff) | |
download | reflex-d1ea7f1fe8835fb6cfa9f7f7ba805cdbe46d8132.tar.gz reflex-d1ea7f1fe8835fb6cfa9f7f7ba805cdbe46d8132.tar.bz2 |
Fix drawing and only draw when necessary
-rw-r--r-- | src/reflex.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/reflex.cpp b/src/reflex.cpp index 3e992ad..5fdeff2 100644 --- a/src/reflex.cpp +++ b/src/reflex.cpp @@ -129,6 +129,10 @@ ReflexWindow::updateMatch () if (f_active != active) { active = f_active; + if (active) + gWindow->glDrawTextureSetEnabled (this, true); + else + gWindow->glDrawTextureSetEnabled (this, false); cWindow->addDamage (); } } @@ -167,6 +171,21 @@ ReflexScreen::optionChanged (CompOption *opt, cScreen->damageScreen (); break; + case ReflexOptions::Window: + case ReflexOptions::Decoration: + { + bool shouldEnable = (optionGetWindow () || + optionGetDecoration ()); + + foreach (CompWindow *w, screen->windows ()) + { + REFLEX_WINDOW (w); + shouldEnable |= optionGetMatch ().evaluate (w); + rw->gWindow->glDrawTextureSetEnabled (rw, shouldEnable); + } + cScreen->damageScreen (); + } + default: /* FIXME: this isn't right.... */ cScreen->damageScreen (); @@ -184,8 +203,6 @@ ReflexWindow::glDrawTexture (GLTexture *texture, bool enabled; bool windowTexture = false; - //fprintf (stderr, "drawing the window texture \n"); - foreach (GLTexture *tex, gWindow->textures ()) { if (tex == texture) @@ -247,6 +264,8 @@ ReflexWindow::glDrawTexture (GLTexture *texture, GL::programEnvParameter4f (GL_FRAGMENT_PROGRAM_ARB, param + 1, dx, 0.0f, rs->optionGetThreshold (), 0.0f); + + tex->disable (); } } @@ -263,7 +282,6 @@ ReflexWindow::glDrawTexture (GLTexture *texture, } else { - //fprintf (stderr, "called glDrawTex\n"); gWindow->glDrawTexture (texture, attrib, mask); } } @@ -336,7 +354,12 @@ ReflexWindow::ReflexWindow (CompWindow *window) : gWindow (GLWindow::get (window)), active (false) { - GLWindowInterface::setHandler (gWindow); + REFLEX_SCREEN (screen); + + GLWindowInterface::setHandler (gWindow, false); + + if (rs->optionGetWindow () || rs->optionGetDecoration ()) + gWindow->glDrawTextureSetEnabled (this, true); updateMatch (); } |