summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2009-01-13 00:21:26 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2009-01-13 00:21:26 +0900
commit6f76b0526b412fece71846fda3854be88eebdda9 (patch)
tree29ab454a9513aef803cd2344eddb777f1c70b40e
parentb78dcfe3c9a90ee2e7629b85d3189811b449d3c2 (diff)
downloadlazypointer-6f76b0526b412fece71846fda3854be88eebdda9.tar.gz
lazypointer-6f76b0526b412fece71846fda3854be88eebdda9.tar.bz2
Use boost::bind to wrap the callback function and add x, y args so we don't need the other functions
-rw-r--r--lazypointer.cpp90
-rw-r--r--lazypointer.h22
2 files changed, 57 insertions, 55 deletions
diff --git a/lazypointer.cpp b/lazypointer.cpp
index 2238c00..ec00436 100644
--- a/lazypointer.cpp
+++ b/lazypointer.cpp
@@ -252,44 +252,56 @@ LPScreen::screenInitiate (CompAction *action,
}
bool
-LPScreen::leftInitiate (CompAction *action,
- CompAction::State state,
- CompOption::Vector &options)
-{
- screen->warpPointer (-1, 0);
-
- return TRUE;
-}
-
-bool
-LPScreen::rightInitiate (CompAction *action,
- CompAction::State state,
- CompOption::Vector &options)
-{
- screen->warpPointer (1, 0);
-
- return TRUE;
-}
-
-bool
-LPScreen::upInitiate (CompAction *action,
- CompAction::State state,
- CompOption::Vector &options)
+LPScreen::directionInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options,
+ int dx,
+ int dy)
{
- screen->warpPointer (0, 1);
-
- return TRUE;
+ screen->warpPointer (dx, dy);
+
+ return true;
}
-bool
-LPScreen::downInitiate (CompAction *action,
- CompAction::State state,
- CompOption::Vector &options)
-{
- screen->warpPointer (0, -1);
-
- return TRUE;
-}
+//~ bool
+//~ LPScreen::leftInitiate (CompAction *action,
+ //~ CompAction::State state,
+ //~ CompOption::Vector &options)
+//~ {
+ //~ screen->warpPointer (-1, 0);
+
+ //~ return TRUE;
+//~ }
+
+//~ bool
+//~ LPScreen::rightInitiate (CompAction *action,
+ //~ CompAction::State state,
+ //~ CompOption::Vector &options)
+//~ {
+ //~ screen->warpPointer (1, 0);
+
+ //~ return TRUE;
+//~ }
+
+//~ bool
+//~ LPScreen::upInitiate (CompAction *action,
+ //~ CompAction::State state,
+ //~ CompOption::Vector &options)
+//~ {
+ //~ screen->warpPointer (0, 1);
+
+ //~ return TRUE;
+//~ }
+
+//~ bool
+//~ LPScreen::downInitiate (CompAction *action,
+ //~ CompAction::State state,
+ //~ CompOption::Vector &options)
+//~ {
+ //~ screen->warpPointer (0, -1);
+
+ //~ return TRUE;
+//~ }
/* Constructor */
@@ -306,10 +318,10 @@ LPScreen::LPScreen (CompScreen *screen) :
ScreenInterface::setHandler (screen);
CompositeScreenInterface::setHandler (cScreen);
- optionSetInitiateLeftKeyInitiate (leftInitiate);
- optionSetInitiateRightKeyInitiate (rightInitiate);
- optionSetInitiateUpKeyInitiate (upInitiate);
- optionSetInitiateDownKeyInitiate (downInitiate);
+ optionSetInitiateLeftKeyInitiate (boost::bind (directionInitiate, _1, _2, _3, -1, 0));
+ optionSetInitiateRightKeyInitiate (boost::bind (directionInitiate, _1, _2, _3, -1, 0));
+ optionSetInitiateUpKeyInitiate (boost::bind (directionInitiate, _1, _2, _3, -1, 0));
+ optionSetInitiateDownKeyInitiate (boost::bind (directionInitiate, _1, _2, _3, -1, 0));
optionSetInitiateWindowKeyInitiate (winInitiate);
optionSetInitiateScreenKeyInitiate (screenInitiate);
}
diff --git a/lazypointer.h b/lazypointer.h
index 1a3f080..3203cc9 100644
--- a/lazypointer.h
+++ b/lazypointer.h
@@ -55,22 +55,12 @@ class LPScreen :
winInitiate (CompAction *,
CompAction::State,
CompOption::Vector&);
- static bool
- leftInitiate (CompAction *,
- CompAction::State,
- CompOption::Vector&);
- static bool
- rightInitiate (CompAction *,
- CompAction::State,
- CompOption::Vector&);
- static bool
- upInitiate (CompAction *,
- CompAction::State,
- CompOption::Vector&);
- static bool
- downInitiate (CompAction *,
- CompAction::State,
- CompOption::Vector&);
+ static bool
+ directionInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&,
+ int dx,
+ int dy);
};
class LPWindow :