summaryrefslogtreecommitdiff
path: root/plugins/unityshell/src
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-09-05 03:47:41 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-09-05 03:47:41 +0200
commitccc93cf2e9262be482d53824be336958de8ba4e4 (patch)
treec71eb40e75c9912ea4804cefd191651fa1f79190 /plugins/unityshell/src
parentfbc4d06b4b06ec9745664a7fba0bac385f0235f8 (diff)
UnityWindow: avoid unneeded damages on motion event, and keep pressed also on mouse-out
(bzr r2655.5.6)
Diffstat (limited to 'plugins/unityshell/src')
-rw-r--r--plugins/unityshell/src/unityshell.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 9fddcbf9f..bc79ed870 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -1222,17 +1222,25 @@ bool UnityWindow::handleEvent(XEvent *event)
if (event->type == MotionNotify)
{
- if (close_button_area_.contains(CompPoint(event->xbutton.x_root, event->xbutton.y_root)))
- {
- close_icon_state_ = panel::WindowState::PRELIGHT;
- }
- else
+ if (close_icon_state_ != panel::WindowState::PRESSED)
{
- close_icon_state_ = panel::WindowState::NORMAL;
- }
+ panel::WindowState old_state = close_icon_state_;
- if (CompositeWindow *cWindow = CompositeWindow::get(window))
- cWindow->addDamage();
+ if (close_button_area_.contains(CompPoint(event->xbutton.x_root, event->xbutton.y_root)))
+ {
+ close_icon_state_ = panel::WindowState::PRELIGHT;
+ }
+ else
+ {
+ close_icon_state_ = panel::WindowState::NORMAL;
+ }
+
+ if (old_state != close_icon_state_)
+ {
+ if (CompositeWindow *cWindow = CompositeWindow::get(window))
+ cWindow->addDamage();
+ }
+ }
}
else if (event->type == ButtonPress)
{
@@ -1247,10 +1255,13 @@ bool UnityWindow::handleEvent(XEvent *event)
}
else if (event->type == ButtonRelease)
{
- close_icon_state_ = panel::WindowState::NORMAL;
+ if (close_icon_state_ != panel::WindowState::NORMAL)
+ {
+ close_icon_state_ = panel::WindowState::NORMAL;
- if (CompositeWindow *cWindow = CompositeWindow::get(window))
- cWindow->addDamage();
+ if (CompositeWindow *cWindow = CompositeWindow::get(window))
+ cWindow->addDamage();
+ }
if (close_button_area_.contains(CompPoint(pointerX, pointerY)))
{