summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-11-30 22:50:07 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-11-30 22:50:07 +0800
commit8feeb09e5d833e0d3e7fb2d924cda61a74962c65 (patch)
tree1a6ca0996a78af9e1289ca40a6f1cfd7bb734a9f
parentb551509659ec86c8dbdd03d35f63a2d38382f501 (diff)
downloadscalefilter-8feeb09e5d833e0d3e7fb2d924cda61a74962c65.tar.gz
scalefilter-8feeb09e5d833e0d3e7fb2d924cda61a74962c65.tar.bz2
Select the window immediately if we press enter and it is the last window remaining
-rw-r--r--src/scalefilter.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/scalefilter.cpp b/src/scalefilter.cpp
index 5c87090..2f55d92 100644
--- a/src/scalefilter.cpp
+++ b/src/scalefilter.cpp
@@ -253,10 +253,27 @@ ScalefilterScreen::handleSpecialKeyPress (XKeyEvent *event,
if (filterInfo && filterInfo->hasText ())
{
/* Return key - apply current filter persistently */
+ unsigned int count = 0;
persistentMatch = filterInfo->getMatch ();
matchApplied = true;
- drop = true;
- needRelayout = true;
+ drop = false;
+ needRelayout = false;
+
+ /* Check whether there is just one window remaining on
+ * this match, if so, no need to relayout */
+
+ foreach (ScaleWindow *sw, sScreen->getWindows ())
+ {
+ if (persistentMatch.evaluate (sw->window))
+ count++;
+
+ if (count > 1)
+ {
+ needRelayout = true;
+ drop = true;
+ break;
+ }
+ }
delete filterInfo;
filterInfo = NULL;