summaryrefslogtreecommitdiff
path: root/plugins/unityshell/src
diff options
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;