• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

A generic touchscreen calibration program for X.Org


Commit MetaInfo

Révisionfaeca8a6d473d30592cf5184cbee130a06d6dc28 (tree)
l'heure2012-03-09 08:51:58
AuteurAntoine Hue <antoine@peti...>
CommiterTias Guns

Message de Log

Various remaining cleanups from Antoine

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

Modification

--- a/src/calibrator/Evdev.cpp
+++ b/src/calibrator/Evdev.cpp
@@ -26,7 +26,6 @@
2626
2727 #include <X11/Xlib.h>
2828 #include <X11/Xatom.h>
29-//#include <X11/Xutil.h>
3029 #include <ctype.h>
3130 #include <cstdio>
3231 #include <cstring>
@@ -39,6 +38,7 @@
3938 #define EXIT_FAILURE 0
4039 #endif
4140
41+// Constructor
4242 CalibratorEvdev::CalibratorEvdev(const char* const device_name0,
4343 const XYinfo& axys0,
4444 XID device_id,
@@ -56,12 +56,12 @@ CalibratorEvdev::CalibratorEvdev(const char* const device_name0,
5656
5757 // normaly, we already have the device id
5858 if (device_id == (XID)-1) {
59- info = xinput_find_device_info(display, device_name, False);
60- if (!info) {
59+ devInfo = xinput_find_device_info(display, device_name, False);
60+ if (!devInfo) {
6161 XCloseDisplay(display);
6262 throw WrongCalibratorException("Evdev: Unable to find device");
6363 }
64- device_id = info->id;
64+ device_id = devInfo->id;
6565 }
6666
6767 dev = XOpenDevice(display, device_id);
@@ -103,7 +103,7 @@ CalibratorEvdev::CalibratorEvdev(const char* const device_name0,
103103
104104 // No axis calibration set, set it to the default one
105105 // QUIRK: when my machine resumes from a sleep,
106- // the calibration property is no longer exported thourgh xinput, but still active
106+ // the calibration property is no longer exported through xinput, but still active
107107 // not setting the values here would result in a wrong first calibration
108108 (void) set_calibration(old_axys);
109109
@@ -161,11 +161,13 @@ CalibratorEvdev::CalibratorEvdev(const char* const device_name0,
161161
162162 }
163163
164+// Destructor
164165 CalibratorEvdev::~CalibratorEvdev () {
165166 XCloseDevice(display, dev);
166167 XCloseDisplay(display);
167168 }
168169
170+// Activate calibrated data and output it
169171 bool CalibratorEvdev::finish_data(const XYinfo new_axys)
170172 {
171173 bool success = true;
@@ -188,9 +190,7 @@ bool CalibratorEvdev::finish_data(const XYinfo new_axys)
188190 // close
189191 XSync(display, False);
190192
191-
192-
193- printf("\n\n--> Making the calibration permanent <--\n");
193+ printf("\t--> Making the calibration permanent <--\n");
194194 switch (output_type) {
195195 case OUTYPE_AUTO:
196196 // xorg.conf.d or alternatively xinput commands
@@ -298,7 +298,8 @@ bool CalibratorEvdev::set_calibration(const XYinfo new_axys)
298298 return (ret == EXIT_SUCCESS);
299299 }
300300
301-Atom CalibratorEvdev::xinput_parse_atom(Display *display, const char *name) {
301+Atom CalibratorEvdev::xinput_parse_atom(Display *display, const char *name)
302+{
302303 Bool is_atom = True;
303304 int i;
304305
@@ -345,9 +346,9 @@ Display *display, const char *name, Bool only_extended)
345346 (is_id && devices[loop].id == id))) {
346347 if (found) {
347348 fprintf(stderr,
348- "Warning: There are multiple devices named \"%s\".\n"
349- "To ensure the correct one is selected, please use "
350- "the device ID instead.\n\n", name);
349+ "Warning: There are multiple devices named \"%s\".\n"
350+ "To ensure the correct one is selected, please use "
351+ "the device ID instead.\n\n", name);
351352 return NULL;
352353 } else {
353354 found = &devices[loop];
--- a/src/calibrator/Evdev.hpp
+++ b/src/calibrator/Evdev.hpp
@@ -35,7 +35,7 @@ class CalibratorEvdev: public Calibrator
3535 {
3636 private:
3737 Display *display;
38- XDeviceInfo *info;
38+ XDeviceInfo *devInfo;
3939 XDevice *dev;
4040
4141 public:
--- a/src/calibrator/XorgPrint.cpp
+++ b/src/calibrator/XorgPrint.cpp
@@ -37,7 +37,7 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys)
3737 {
3838 bool success = true;
3939
40- printf("\n\n--> Making the calibration permanent <--\n");
40+ printf("\t--> Making the calibration permanent <--\n");
4141 switch (output_type) {
4242 case OUTYPE_AUTO:
4343 // xorg.conf.d or alternatively hal config
--- a/src/main_common.cpp
+++ b/src/main_common.cpp
@@ -314,7 +314,7 @@ Calibrator* Calibrator::make_calibrator(int argc, char** argv)
314314 // printed the list in find_device
315315 if (nr_found == 0)
316316 printf("No calibratable devices found.\n");
317- exit(0);
317+ exit(2);
318318 }
319319
320320 if (nr_found == 0) {