diff options
author | Danny Baumann <dannybaumann@web.de> | 2010-11-09 21:11:29 +0800 |
---|---|---|
committer | Sam Spilsbury <sam.spilsbury@canonical.com> | 2010-11-09 21:13:21 +0800 |
commit | 267b9d12b6f8cc4218a761c2a7e92ca350b7f6a6 (patch) | |
tree | c51b378c2803b4edcf55e2ca507a56fb6be98e5d /src/event.cpp | |
parent | 46db42b1107f2ff3dd641ba3b5f8d18088a08bfb (diff) | |
download | unity-window-decorator-267b9d12b6f8cc4218a761c2a7e92ca350b7f6a6.tar.gz unity-window-decorator-267b9d12b6f8cc4218a761c2a7e92ca350b7f6a6.tar.bz2 |
[PATCH] Be a little bit more clever when handing option construction in handleActionEvent.
Previously we would have a static CompAction::Vector which we would resize to lower sizes (so that triggerFooBindings doesn't die) but this causes us to be reconstruction CompOptions all the time which is expensive.
Instead just reset the option to make it "dead" (eg keep it in memory for longer) but don't create and recreate them all the time
Also copy the active state of a CompAction on copy-construct
Diffstat (limited to 'src/event.cpp')
-rw-r--r-- | src/event.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/event.cpp b/src/event.cpp index 15768d1..34e3a34 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -618,7 +618,6 @@ PrivateScreen::handleActionEvent (XEvent *event) { static CompOption::Vector o (8); Window xid; - o.resize (8); o[0].setName ("event_window", CompOption::TypeInt); o[1].setName ("window", CompOption::TypeInt); @@ -626,6 +625,8 @@ PrivateScreen::handleActionEvent (XEvent *event) o[3].setName ("x", CompOption::TypeInt); o[4].setName ("y", CompOption::TypeInt); o[5].setName ("root", CompOption::TypeInt); + o[6].reset (); + o[7].reset (); switch (event->type) { case ButtonPress: @@ -764,8 +765,6 @@ PrivateScreen::handleActionEvent (XEvent *event) o[6].setName ("time", CompOption::TypeInt); o[6].value ().set ((int) event->xcrossing.time); - - o.resize (7); foreach (CompPlugin *p, CompPlugin::getPlugins ()) { @@ -801,8 +800,6 @@ PrivateScreen::handleActionEvent (XEvent *event) o[6].setName ("time", CompOption::TypeInt); o[6].value ().set ((int) event->xcrossing.time); - - o.resize (7); if (triggerEdgeEnter (edge, state, o)) return true; @@ -849,8 +846,6 @@ PrivateScreen::handleActionEvent (XEvent *event) o[3].value ().set ((int) 0); /* fixme */ o[4].value ().set ((int) 0); /* fixme */ o[5].value ().set ((int) root); - - o.resize (6); foreach (CompPlugin *p, CompPlugin::getPlugins ()) { @@ -895,8 +890,6 @@ PrivateScreen::handleActionEvent (XEvent *event) o[3].value ().set ((int) event->xclient.data.l[2] >> 16); o[4].value ().set ((int) event->xclient.data.l[2] & 0xffff); o[5].value ().set ((int) root); - - o.resize (6); if (triggerEdgeEnter (edge, state, o)) return true; @@ -918,10 +911,10 @@ PrivateScreen::handleActionEvent (XEvent *event) o[1].value ().set ((int) activeWindow); o[2].value ().set ((int) stateEvent->mods); - o[3] = CompOption ("time", CompOption::TypeInt); + o[3].setName ("time", CompOption::TypeInt); o[3].value ().set ((int) xkbEvent->time); - - o.resize (4); + o[4].reset (); + o[5].reset (); foreach (CompPlugin *p, CompPlugin::getPlugins ()) { @@ -935,10 +928,12 @@ PrivateScreen::handleActionEvent (XEvent *event) o[0].value ().set ((int) activeWindow); o[1].value ().set ((int) activeWindow); - o[2] = CompOption ("time", CompOption::TypeInt); + o[2].setName ("time", CompOption::TypeInt); o[2].value ().set ((int) xkbEvent->time); + o[3].reset (); + o[4].reset (); + o[5].reset (); - o.resize (3); foreach (CompPlugin *p, CompPlugin::getPlugins ()) { @@ -1734,7 +1729,7 @@ CompScreen::handleEvent (XEvent *event) { w = findWindow (((XShapeEvent *) event)->window); if (w) - { + { if (w->mapNum ()) w->priv->updateRegion (); } |