summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-07-19 03:22:13 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-07-19 03:22:13 +0200
commit1c390da168f3a0caa864437f5bf4bc2cb59d913e (patch)
tree8034f8c44936ebe4c83d295a107ea2701b713fb9
parentb2423522b6b1bca5c46d2d9b429b5868909e8a7c (diff)
PointerBarrier: make pointer barrier more testable
(bzr r2509.1.16)
-rw-r--r--launcher/PointerBarrier.cpp5
-rw-r--r--launcher/PointerBarrier.h19
2 files changed, 14 insertions, 10 deletions
diff --git a/launcher/PointerBarrier.cpp b/launcher/PointerBarrier.cpp
index a2da411b1..04b5e0819 100644
--- a/launcher/PointerBarrier.cpp
+++ b/launcher/PointerBarrier.cpp
@@ -41,6 +41,8 @@ PointerBarrierWrapper::PointerBarrierWrapper()
, smoothing(75)
, max_velocity_multiplier(1.0f)
, direction(BOTH)
+ , event_base_(0)
+ , barrier(0)
, smoothing_count_(0)
, smoothing_accum_(0)
{}
@@ -57,7 +59,8 @@ void PointerBarrierWrapper::ConstructBarrier()
Display *dpy = nux::GetGraphicsDisplay()->GetX11Display();
- XFixesQueryExtension(dpy, &event_base_, &error_base_);
+ int error_base;
+ XFixesQueryExtension(dpy, &event_base_, &error_base);
int maj,min;
XFixesQueryVersion(dpy, &maj, &min);
diff --git a/launcher/PointerBarrier.h b/launcher/PointerBarrier.h
index 47d75d65a..ecbb28d19 100644
--- a/launcher/PointerBarrier.h
+++ b/launcher/PointerBarrier.h
@@ -58,6 +58,9 @@ class PointerBarrierWrapper : public sigc::trackable
public:
typedef std::shared_ptr<PointerBarrierWrapper> Ptr;
+ PointerBarrierWrapper();
+ virtual ~PointerBarrierWrapper();
+
nux::Property<int> x1;
nux::Property<int> x2;
nux::Property<int> y1;
@@ -76,22 +79,20 @@ public:
nux::Property<BarrierDirection> direction;
- PointerBarrierWrapper();
- ~PointerBarrierWrapper();
-
- void ConstructBarrier();
- void DestroyBarrier();
- void ReleaseBarrier(int event_id);
+ virtual void ConstructBarrier();
+ virtual void DestroyBarrier();
+ virtual void ReleaseBarrier(int event_id);
sigc::signal<void, PointerBarrierWrapper*, BarrierEvent::Ptr> barrier_event;
-private:
+protected:
void EmitCurrentData(int event_id, int x, int y);
- bool HandleEvent (XEvent event);
+ bool HandleEvent(XEvent event);
+
+private:
static bool HandleEventWrapper(XEvent event, void* data);
int event_base_;
- int error_base_;
PointerBarrier barrier;
int smoothing_count_;