From 49d116da51e3a75415b5a2884281b094cb35e18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 5 Sep 2012 04:37:24 +0200 Subject: UnityWindow: don't allow to close a scaled window by any mouse button (bzr r2655.5.9) --- plugins/unityshell/src/unityshell.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/unityshell/src') 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; -- cgit v1.2.3