Merge lp:~renatofilho/compiz/compiz-lp1033531 into lp:compiz/0.9.8
Proposed by
Renato Araujo Oliveira Filho
Status: | Merged |
---|---|
Approved by: | Daniel van Vugt |
Approved revision: | 3311 |
Merged at revision: | 3307 |
Proposed branch: | lp:~renatofilho/compiz/compiz-lp1033531 |
Merge into: | lp:compiz/0.9.8 |
Diff against target: |
296 lines (+221/-2) 8 files modified
plugins/expo/CMakeLists.txt (+5/-1) plugins/expo/src/click_threshold/CMakeLists.txt (+33/-0) plugins/expo/src/click_threshold/include/click-threshold.h (+38/-0) plugins/expo/src/click_threshold/src/click-threshold.cpp (+39/-0) plugins/expo/src/click_threshold/tests/CMakeLists.txt (+19/-0) plugins/expo/src/click_threshold/tests/test-expo-click-threshold.cpp (+79/-0) plugins/expo/src/expo.cpp (+7/-1) plugins/expo/src/expo.h (+1/-0) |
To merge this branch: | bzr merge lp:~renatofilho/compiz/compiz-lp1033531 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Approve | ||
Sam Spilsbury | Approve | ||
Review via email: mp+118973@code.launchpad.net |
Commit message
Implemented single click exit from expo screen. (LP: #1033531)
Description of the change
Implemented single click exit from expo screen.
To post a comment you must log in.
Looks good, and as I thought, this was pretty simple anyways.
+#define DND_THRESHOLD 5
Can you make this a const unsigned int? eg const unsigned int DND_THRESHOLD 5 . Makes things more debuggable.
26 + ((abs (prevClickPoint.x () - event->xbutton.x) <= DND_THRESHOLD) &&
27 + (abs (prevClickPoint.y () - event->xbutton.y) <= DND_THRESHOLD)))
These need to be aligned with the initial bracked after the else, and not the else itself, eg,
else (foo () ||
bar ())
not
else (foo () ||
bar ())
Major point:
This needs tests before it can go in. It should be fairly easy to get this code under test, since there's a single abstraction, eg
namespace compiz Threshold (const CompPoint &previousPoint,
const CompPoint ¤tPoint)
{
namespace expo
{
bool clickMovementIn
{
CompPoint distance = currentPoint - previousPoint;
distance.set (abs (distance.x ()), abs (distance.y ()));
if (distance.x () < DND_THRESHOLD &&
distance.y () < DND_THRESHOLD)
return true;
return false;
}
}
}
You can then put it in a different file and test it that way. There are examples around the codebase (eg, in decor, composite, wall) on how to do this. Testing == Awesome.