A generic touchscreen calibration program for X.Org
Révision | e2a4c063f106fbd6e6921f751b6064f71e607ac2 (tree) |
---|---|
l'heure | 2010-08-16 06:52:23 |
Auteur | Tias Guns <tias@ulys...> |
Commiter | Tias Guns |
swap_xy, better document the difference between detecting the need to swap it, and the new swap_xy value
@@ -179,8 +179,8 @@ bool CalibratorEvdev::finish_data(const XYinfo new_axys, int swap_xy) | ||
179 | 179 | { |
180 | 180 | bool success = true; |
181 | 181 | |
182 | - // swap x and y: check if we need to swap with: if (swap_xy) | |
183 | - // value to swap too is inverse of previous swap value: in new_swap_xy | |
182 | + // swap x and y axis, indicated by swap_xy | |
183 | + // new value is old value (could have been 0 or 1) swapped: | |
184 | 184 | int new_swap_xy = 1 - old_swap_xy; |
185 | 185 | |
186 | 186 | printf("\nDoing dynamic recalibration:\n"); |
@@ -44,6 +44,10 @@ CalibratorXorgPrint::CalibratorXorgPrint(const char* const device_name0, const X | ||
44 | 44 | |
45 | 45 | bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy) |
46 | 46 | { |
47 | + // we suppose the previous 'swap_xy' value was 0 | |
48 | + // (unfortunately there is no way to verify this (yet)) | |
49 | + int new_swap_xy = swap_xy; | |
50 | + | |
47 | 51 | // TODO: detect which are applicable at runtime/in the makefile ? |
48 | 52 | printf("\n\n== Applying the calibration ==\n"); |
49 | 53 | printf("There are multiple ways to do this: the tranditional way (xorg.conf), the new way (xorg.conf.d snippet) and the soon deprecated way (HAL policy):\n"); |
@@ -59,7 +63,7 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy) | ||
59 | 63 | printf("\tOption\t\"MaxY\"\t\t\"%d\"\n", |
60 | 64 | new_axys.y_max); |
61 | 65 | if (swap_xy != 0) |
62 | - printf("\tOption\t\"SwapXY\"\t\"%d\" # unless it was already set to 1\n", swap_xy); | |
66 | + printf("\tOption\t\"SwapXY\"\t\"%d\" # unless it was already set to 1\n", new_swap_xy); | |
63 | 67 | |
64 | 68 | // xorg.conf.d snippet |
65 | 69 | printf("\nxorg.conf.d snippet (RECOMMENDED): copy the snippet below into /etc/X11/xorg.conf.d/99-calibration.conf\n"); |
@@ -71,7 +75,7 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy) | ||
71 | 75 | printf(" Option \"MinY\" \"%d\"\n", new_axys.y_min); |
72 | 76 | printf(" Option \"MaxY\" \"%d\"\n", new_axys.y_max); |
73 | 77 | if (swap_xy != 0) |
74 | - printf(" Option \"SwapXY\" \"%d\" # unless it was already set to 1\n", swap_xy); | |
78 | + printf(" Option \"SwapXY\" \"%d\" # unless it was already set to 1\n", new_swap_xy); | |
75 | 79 | printf("EndSection\n"); |
76 | 80 | |
77 | 81 | // HAL policy output |
@@ -83,7 +87,7 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy) | ||
83 | 87 | \t <merge key=\"input.x11_options.maxy\" type=\"string\">%d</merge>\n" |
84 | 88 | , new_axys.x_min, new_axys.x_max, new_axys.y_min, new_axys.y_max); |
85 | 89 | if (swap_xy != 0) |
86 | - printf("\t <merge key=\"input.x11_options.swapxy\" type=\"string\">%d</merge>\n", swap_xy); | |
90 | + printf("\t <merge key=\"input.x11_options.swapxy\" type=\"string\">%d</merge>\n", new_swap_xy); | |
87 | 91 | printf("\t</match>\n"); |
88 | 92 | |
89 | 93 | return true; |