summaryrefslogtreecommitdiff
path: root/src/locker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/locker.cpp')
-rw-r--r--src/locker.cpp51
1 files changed, 45 insertions, 6 deletions
diff --git a/src/locker.cpp b/src/locker.cpp
index 34355ca..a083473 100644
--- a/src/locker.cpp
+++ b/src/locker.cpp
@@ -7,6 +7,7 @@ COMPIZ_PLUGIN_20090315 (locker, LockerPluginVTable);
namespace {
static LockerLockWindow *mWindowDefault = NULL;
static LockerLockBackground *mBackgroundDefault = NULL;
+ static Lockable *mLockableDefault = NULL;
}
LockerLockWindow *
@@ -18,6 +19,9 @@ LockerLockWindow::Default ()
void
LockerLockWindow::SetDefault (LockerLockWindow *l)
{
+ if (mWindowDefault)
+ delete mWindowDefault;
+
mWindowDefault = l;
}
@@ -30,9 +34,28 @@ LockerLockBackground::Default ()
void
LockerLockBackground::SetDefault (LockerLockBackground *b)
{
+ if (mBackgroundDefault)
+ delete mBackgroundDefault;
+
mBackgroundDefault = b;
}
+Lockable *
+Lockable::Default ()
+{
+ return mLockableDefault;
+}
+
+void
+Lockable::SetDefault (Lockable *b)
+{
+ if (mLockableDefault)
+ delete mLockableDefault;
+
+ mLockableDefault = b;
+}
+
+
void
SimpleLockerWindow::hide ()
{
@@ -76,30 +99,35 @@ SimpleLockerWindow::paint (const GLMatrix &transform)
bool
SimpleLockerWindow::handleKeyPress (XKeyEvent *xk)
{
+ Lockable::Default ()->unlock ();
return true;
}
bool
SimpleLockerWindow::handleKeyRelease (XKeyEvent *xk)
{
+ Lockable::Default ()->unlock ();
return true;
}
bool
SimpleLockerWindow::handleButtonPress (XButtonEvent *xb)
{
+ Lockable::Default ()->unlock ();
return true;
}
bool
SimpleLockerWindow::handleButtonRelease (XButtonEvent *xb)
{
+ Lockable::Default ()->unlock ();
return true;
}
bool
SimpleLockerWindow::handleMotion (XMotionEvent *xm)
{
+ Lockable::Default ()->unlock ();
return true;
}
@@ -404,6 +432,8 @@ LockerScreen::unlock ()
mGrabIndex = 0;
}
+ mWaitTimer.setTimes (optionGetTimeout () * 1000, optionGetTimeout () * 1000);
+
return false;
}
@@ -444,22 +474,31 @@ LockerScreen::LockerScreen (CompScreen *s) :
gScreen (GLScreen::get (screen)),
mAnimationProgress (0.0f),
mAnimatedWindows (0),
- mAnimationState (AnimationStateIdle),
- mSLW (new SimpleLockerWindow ()),
- mSLB (new SimpleLockerBackground ())
+ mAnimationState (AnimationStateIdle)
{
+ Lockable::mLockerWindow = new SimpleLockerWindow ();
+ Lockable::mLockerBackground = new SimpleLockerBackground ();
+
ScreenInterface::setHandler (screen);
CompositeScreenInterface::setHandler (cScreen);
GLScreenInterface::setHandler (gScreen);
- LockerLockWindow::SetDefault (mSLW);
- LockerLockBackground::SetDefault (mSLB);
+ LockerLockWindow::SetDefault (mLockerWindow);
+ LockerLockBackground::SetDefault (mLockerBackground);
+ Lockable::SetDefault (this);
mWaitTimer.setCallback (boost::bind (&LockerScreen::lock, this));
- mWaitTimer.setTimes (optionGetTimeout () * 100, optionGetTimeout () * 100);
+ mWaitTimer.setTimes (optionGetTimeout () * 1000, optionGetTimeout () * 1000);
mWaitTimer.start ();
}
+LockerScreen::~LockerScreen ()
+{
+ LockerLockWindow::SetDefault (NULL);
+ LockerLockBackground::SetDefault (NULL);
+ Lockable::SetDefault (NULL);
+}
+
LockerWindow::LockerWindow (CompWindow *w) :
PluginClassHandler <LockerWindow, CompWindow> (w),
window (w),