summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2009-03-13 16:51:59 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2009-03-13 16:51:59 +0900
commitd430856b3fcd362a9a1a2105a1569bec209f0403 (patch)
treebc8197f5cd84002ddc4baf4d95a38942a3091d17
parent917c5f45da26fa1a7d57d18a8c98629e704000ff (diff)
downloadmousepoll-d430856b3fcd362a9a1a2105a1569bec209f0403.tar.gz
mousepoll-d430856b3fcd362a9a1a2105a1569bec209f0403.tar.bz2
Safety check
-rw-r--r--mousepoll.cpp6
-rw-r--r--mousepoll.h6
2 files changed, 7 insertions, 5 deletions
diff --git a/mousepoll.cpp b/mousepoll.cpp
index c09d7c7..7bfbfae 100644
--- a/mousepoll.cpp
+++ b/mousepoll.cpp
@@ -66,7 +66,8 @@ MousepollScreen::updatePosition ()
MousePoller *poller = *it;
poller->mPoint = pos;
- poller->mCallback (pos);
+ if (poller->mCallback)
+ poller->mCallback (pos);
}
}
@@ -110,11 +111,12 @@ MousepollScreen::removeTimer (MousePoller *poller)
}
void
-MousePoller::setCallback (MousePoller::CallBack callback)
+MousePoller::setCallback (MousePoller::MPCallBack callback)
{
bool wasActive = mActive;
if (mActive)
stop ();
+
mCallback = callback;
if (wasActive)
diff --git a/mousepoll.h b/mousepoll.h
index 7061792..39d259c 100644
--- a/mousepoll.h
+++ b/mousepoll.h
@@ -27,13 +27,13 @@ class MousePoller
{
public:
- typedef boost::function<void (const CompPoint &)> CallBack;
+ typedef boost::function<void (const CompPoint &)> MPCallBack;
MousePoller ();
~MousePoller ();
void
- setCallback (CallBack callback);
+ setCallback (MPCallBack callback);
void
start ();
@@ -54,7 +54,7 @@ class MousePoller
bool mActive;
CompPoint mPoint;
- CallBack mCallback;
+ MPCallBack mCallback;
friend class MousepollScreen;
};