summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-07-17 04:08:29 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-07-17 04:08:29 +0800
commit6860fcc0ea562f04fe7de685980433ec41fb8c82 (patch)
tree52dba5ede8a37df8ca23ebb3351cfc6c40dbe1bc
parent3fb157ec9bb10f57d87b2cb3847cfa9dc1e5d216 (diff)
downloadlocker-6860fcc0ea562f04fe7de685980433ec41fb8c82.tar.gz
locker-6860fcc0ea562f04fe7de685980433ec41fb8c82.tar.bz2
Only unlock on pressing the box, as a demo.
This doesn't work in multimonitor cases
-rw-r--r--src/locker.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/locker.cpp b/src/locker.cpp
index 5dfcf56..180c417 100644
--- a/src/locker.cpp
+++ b/src/locker.cpp
@@ -115,35 +115,47 @@ 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 ();
+ CompPoint p;
+ CompRegion r;
+
+ r = CompRect (x () + width () / 2.0f - 150, y () + height () / 2.0f - 150, 300, 300);
+ p = CompPoint (xb->x_root, xb->y_root);
+
+ if (r.contains (p))
+ Lockable::Default ()->unlock ();
+
return true;
}
bool
SimpleLockerWindow::handleButtonRelease (XButtonEvent *xb)
{
- Lockable::Default ()->unlock ();
+ CompPoint p;
+ CompRegion r;
+
+ r = CompRect (x () + width () / 2.0f - 150, y () + height () / 2.0f - 150, 300, 300);
+ p = CompPoint (xb->x_root, xb->y_root);
+
+ if (r.contains (p))
+ Lockable::Default ()->unlock ();
return true;
}
bool
SimpleLockerWindow::handleMotion (XMotionEvent *xm)
{
- Lockable::Default ()->unlock ();
return true;
}