• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
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

修订版42dc87f2ad6843a0998485bd2141984baee7f387 (tree)
时间2010-07-07 05:16:59
作者Tias Guns <tias@ulys...>
CommiterTias Guns

Log Message

add --misclick <nr of pixels> as runtime option

更改概述

差异

--- a/src/main_common.hpp
+++ b/src/main_common.hpp
@@ -220,14 +220,16 @@ int find_device(const char* pre_device, bool verbose, bool list_devices,
220220 return found;
221221 }
222222
223-static void usage(char* cmd)
223+static void usage(char* cmd, unsigned thr_misclick)
224224 {
225- fprintf(stderr, "Usage: %s [-h|--help] [-v|--verbose] [--list] [--device <device name or id>] [--precalib <minx> <maxx> <miny> <maxy>] [--fake]\n", cmd);
225+ fprintf(stderr, "Usage: %s [-h|--help] [-v|--verbose] [--list] [--device <device name or id>] [--precalib <minx> <maxx> <miny> <maxy>] [--misclick <nr of pixels>] [--fake]\n", cmd);
226226 fprintf(stderr, "\t-h, --help: print this help message\n");
227227 fprintf(stderr, "\t-v, --verbose: print debug messages during the process\n");
228228 fprintf(stderr, "\t--list: list calibratable input devices and quit\n");
229229 fprintf(stderr, "\t--device <device name or id>: select a specific device to calibrate\n");
230- fprintf(stderr, "\t--precalib: manually provide the current calibration setting (eg the values in xorg.conf)\n");
230+ fprintf(stderr, "\t--precalib: manually provide the current calibration setting (eg. the values in xorg.conf)\n");
231+ fprintf(stderr, "\t--misclick: set the misclick threshold (0=off, default: %i pixels)\n",
232+ thr_misclick);
231233 fprintf(stderr, "\t--fake: emulate a fake device (for testing purposes)\n");
232234 }
233235
@@ -250,7 +252,7 @@ Calibrator* main_common(int argc, char** argv)
250252 if (strcmp("-h", argv[i]) == 0 ||
251253 strcmp("--help", argv[i]) == 0) {
252254 fprintf(stderr, "xinput_calibratior, v%s\n\n", VERSION);
253- usage(argv[0]);
255+ usage(argv[0], thr_misclick);
254256 exit(0);
255257 } else
256258
@@ -271,7 +273,7 @@ Calibrator* main_common(int argc, char** argv)
271273 pre_device = argv[++i];
272274 else {
273275 fprintf(stderr, "Error: --device needs a device name or id as argument; use --list to list the calibratable input devices.\n\n");
274- usage(argv[0]);
276+ usage(argv[0], thr_misclick);
275277 exit(1);
276278 }
277279 } else
@@ -289,6 +291,17 @@ Calibrator* main_common(int argc, char** argv)
289291 pre_axys.y_max = atoi(argv[++i]);
290292 } else
291293
294+ // Get mis-click threshold ?
295+ if (strcmp("--misclick", argv[i]) == 0) {
296+ if (argc > i+1)
297+ thr_misclick = atoi(argv[++i]);
298+ else {
299+ fprintf(stderr, "Error: --misclick needs a number (the pixel threshold) as argument. Set to 0 to disable mis-click detection.\n\n");
300+ usage(argv[0], thr_misclick);
301+ exit(1);
302+ }
303+ } else
304+
292305 // Fake calibratable device ?
293306 if (strcmp("--fake", argv[i]) == 0) {
294307 fake = true;
@@ -297,7 +310,7 @@ Calibrator* main_common(int argc, char** argv)
297310 // unknown option
298311 else {
299312 fprintf(stderr, "Unknown option: %s\n\n", argv[i]);
300- usage(argv[0]);
313+ usage(argv[0], thr_misclick);
301314 exit(0);
302315 }
303316 }