A generic touchscreen calibration program for X.Org
Revisión | 6375ad29a7896def9f16d3585679b12ecbd9274c (tree) |
---|---|
Tiempo | 2010-01-08 07:04:30 |
Autor | Tias Guns <tias@ulys...> |
Commiter | Tias Guns |
add --fake option
@@ -959,10 +959,14 @@ CalibrationArea::CalibrationArea (int argc, char** argv) | ||
959 | 959 | XFreeDeviceList(slist); |
960 | 960 | XCloseDisplay(display); |
961 | 961 | |
962 | - // override min/maxX/Y from command line ? | |
962 | + // parse input, part 2 | |
963 | + bool fake = false; | |
964 | + bool precalib = false; | |
963 | 965 | if (argc > 1) { |
964 | 966 | for (int i=1; i!=argc; i++) { |
967 | + // Get pre-calibration ? | |
965 | 968 | if (strcmp("--precalib", argv[i]) == 0) { |
969 | + precalib = true; | |
966 | 970 | if (argc > i+1) |
967 | 971 | min_x = atoi(argv[i+1]); |
968 | 972 | if (argc > i+2) |
@@ -972,12 +976,26 @@ CalibrationArea::CalibrationArea (int argc, char** argv) | ||
972 | 976 | if (argc > i+4) |
973 | 977 | max_y = atoi(argv[i+4]); |
974 | 978 | } |
979 | + | |
980 | + // Fake calibratable device ? | |
981 | + if (strcmp("--fake", argv[i]) == 0) { | |
982 | + fake = true; | |
983 | + } | |
975 | 984 | } |
976 | 985 | } |
977 | 986 | |
978 | 987 | if (found == 0) { |
979 | - fprintf (stderr, "Error: No calibratable devices found.\n"); | |
980 | - quit (1); | |
988 | + if (fake) { | |
989 | + // Fake a calibratable device | |
990 | + drivername = "Fake_device"; | |
991 | + if (!precalib) { | |
992 | + min_x = 0; max_x = 0; | |
993 | + min_y = 0; max_y = 0; | |
994 | + } | |
995 | + } else { | |
996 | + fprintf (stderr, "Error: No calibratable devices found.\n"); | |
997 | + exit(1); | |
998 | + } | |
981 | 999 | } |
982 | 1000 | if (found > 1) |
983 | 1001 | printf ("Warning: multiples calibratable devices found, calibrating last one (%s)\n", drivername); |