• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A generic touchscreen calibration program for X.Org


Commit MetaInfo

Revisionc8701d10faaa1389f7f56680b427981a7c12f73a (tree)
Time2012-03-09 08:51:57
AuthorAntoine Hue <antoine@peti...>
CommiterTias Guns

Log Message

Some refactoring of the Calibrator object

Make find_device a static function of Calibrator, and move some
functions around

This patch was originally part of Antoine Hue's commit with message
Managing correctly X/Y swap and X or Y inversion: - detect swap and
inversion modification - take into account for inversion in calibration
computation since Evdev is doing inversion after calibration. - Mainly
tested for Evdev based driver. To be tested for USB.

Signed-off-by: Tias Guns <tias@ulyssis.org>

Change Summary

Incremental Difference

--- a/src/calibrator.cpp
+++ b/src/calibrator.cpp
@@ -41,26 +41,6 @@ Calibrator::Calibrator(const char* const device_name0, const XYinfo& axys0,
4141 //clicked.y(NUM_POINTS);
4242 }
4343
44-void Calibrator::set_threshold_doubleclick(int t)
45-{
46- threshold_doubleclick = t;
47-}
48-
49-void Calibrator::set_threshold_misclick(int t)
50-{
51- threshold_misclick = t;
52-}
53-
54-int Calibrator::get_numclicks()
55-{
56- return clicked.num;
57-}
58-
59-const char* Calibrator::get_geometry()
60-{
61- return geometry;
62-}
63-
6444 bool Calibrator::add_click(int x, int y)
6545 {
6646 // Double-click detection
--- a/src/calibrator.hh
+++ b/src/calibrator.hh
@@ -122,16 +122,20 @@ public:
122122 ~Calibrator() {}
123123
124124 /// set the doubleclick treshold
125- void set_threshold_doubleclick(int t);
125+ void set_threshold_doubleclick(int t)
126+ { threshold_doubleclick = t; }
126127
127128 /// set the misclick treshold
128- void set_threshold_misclick(int t);
129+ void set_threshold_misclick(int t)
130+ { threshold_misclick = t; }
129131
130132 /// get the number of clicks already registered
131- int get_numclicks();
133+ int get_numclicks() const
134+ { return clicked.num; }
132135
133136 /// return geometry string or NULL
134- const char* get_geometry();
137+ const char* get_geometry() const
138+ { return geometry; }
135139
136140 /// reset clicks
137141 void reset()
@@ -146,17 +150,32 @@ public:
146150 const char* get_sysfs_name();
147151
148152 protected:
149- // check whether the coordinates are along the respective axis
153+ /// check whether the coordinates are along the respective axis
150154 bool along_axis(int xy, int x0, int y0);
151155
152- // overloaded function that applies the new calibration
156+ /// Apply new calibration, implementation dependent
153157 virtual bool finish_data(const XYinfo new_axys) =0;
154158
155- // name of the device (driver)
159+ /// Compute calibration on 1 axis
160+ void process_axys( int screen_dim, const AxisInfo &previous, std::vector<int> &clicked, AxisInfo &updated );
161+
162+ /// Check whether the given name is a sysfs device name
163+ bool is_sysfs_name(const char* name);
164+
165+ /// Check whether the X server has xorg.conf.d support
166+ bool has_xorgconfd_support(Display* display=NULL);
167+
168+ static int find_device(const char* pre_device, bool verbose, bool list_devices,
169+ XID& device_id, const char*& device_name, XYinfo& device_axys);
170+
171+protected:
172+ /// Name of the device (driver)
156173 const char* const device_name;
157- // original axys values
174+
175+ /// Original values
158176 XYinfo old_axys;
159- // be verbose or not
177+
178+ /// Be verbose or not
160179 bool verbose;
161180
162181 /// Clicked values (screen coordinates)
@@ -181,12 +200,6 @@ protected:
181200
182201 // manually specified geometry string
183202 const char* geometry;
184-
185- // Check whether the given name is a sysfs device name
186- bool is_sysfs_name(const char* name);
187-
188- // Check whether the X server has xorg.conf.d support
189- bool has_xorgconfd_support(Display* display=NULL);
190203 };
191204
192205 #endif
--- a/src/main_common.cpp
+++ b/src/main_common.cpp
@@ -54,7 +54,7 @@ static char* my_strdup(const char* s) {
5454 * retuns number of devices found,
5555 * the data of the device is returned in the last 3 function parameters
5656 */
57-static int find_device(const char* pre_device, bool verbose, bool list_devices,
57+int Calibrator::find_device(const char* pre_device, bool verbose, bool list_devices,
5858 XID& device_id, const char*& device_name, XYinfo& device_axys)
5959 {
6060 bool pre_device_is_id = true;