summaryrefslogtreecommitdiff
path: root/plugins/unityshell/src
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-09-05 04:37:24 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-09-05 04:37:24 +0200
commit49d116da51e3a75415b5a2884281b094cb35e18f (patch)
tree2c2d40bead6f5169b260fdf47423b79820fe5502 /plugins/unityshell/src
parent6e37bc2f96496def8c33840b2c09806381f820db (diff)
UnityWindow: don't allow to close a scaled window by any mouse button
(bzr r2655.5.9)
Diffstat (limited to 'plugins/unityshell/src')
-rw-r--r--plugins/unityshell/src/unityshell.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 4189ea27d..c14325d7a 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -1244,7 +1244,8 @@ bool UnityWindow::handleEvent(XEvent *event)
}
else if (event->type == ButtonPress)
{
- if (close_button_area_.contains(CompPoint(event->xbutton.x_root, event->xbutton.y_root)))
+ if (event->xbutton.button == Button1 &&
+ close_button_area_.contains(CompPoint(event->xbutton.x_root, event->xbutton.y_root)))
{
close_icon_state_ = panel::WindowState::PRESSED;
handled = true;
@@ -1255,6 +1256,8 @@ bool UnityWindow::handleEvent(XEvent *event)
}
else if (event->type == ButtonRelease)
{
+ bool was_pressed = (close_icon_state_ == panel::WindowState::PRESSED);
+
if (close_icon_state_ != panel::WindowState::NORMAL)
{
close_icon_state_ = panel::WindowState::NORMAL;
@@ -1263,7 +1266,7 @@ bool UnityWindow::handleEvent(XEvent *event)
cWindow->addDamage();
}
- if (close_button_area_.contains(CompPoint(pointerX, pointerY)))
+ if (was_pressed && close_button_area_.contains(CompPoint(pointerX, pointerY)))
{
window->close(0);
handled = true;