A generic touchscreen calibration program for X.Org
Revisão | 268bbc43cd3e1e05311248f3f1d104859639117d (tree) |
---|---|
Hora | 2011-06-14 18:52:25 |
Autor | Tias Guns <tias@ulys...> |
Commiter | Tias Guns |
add manpage and gui_gtkmm support for --geometry
@@ -59,6 +59,10 @@ type of config to ouput (auto=automatically detect, default: auto) | ||
59 | 59 | Emulate a fake driver (for testing purposes) |
60 | 60 | .br |
61 | 61 | Useful to test the calibrator without applying the values, and possibly even without having a touchscreen. |
62 | +.PP | |
63 | +.TP 8 | |
64 | +.B \-\-geometry \fIwidth\fPx\fIheight\fP | |
65 | +Manually provide the geometry (width and height) for the calibration window. | |
62 | 66 | .SH "USAGE" |
63 | 67 | Run xinput_calibrator in a terminal, as it prints out the calibration values and instructions on standard output. |
64 | 68 | .PP |
@@ -85,7 +85,20 @@ CalibrationArea::CalibrationArea(Calibrator* calibrator0) | ||
85 | 85 | add_events(Gdk::KEY_PRESS_MASK | Gdk::BUTTON_PRESS_MASK); |
86 | 86 | set_flags(Gtk::CAN_FOCUS); |
87 | 87 | |
88 | - set_display_size(get_width(), get_height()); | |
88 | + // parse geometry string | |
89 | + const char* geo = calibrator->get_geometry(); | |
90 | + if (geo != NULL) { | |
91 | + int gw,gh; | |
92 | + int res = sscanf(geo,"%dx%d",&gw,&gh); | |
93 | + if (res != 2) { | |
94 | + fprintf(stderr,"Warning: error parsing geometry string - using defaults.\n"); | |
95 | + geo = NULL; | |
96 | + } else { | |
97 | + set_display_size( gw, gh ); | |
98 | + } | |
99 | + } | |
100 | + if (geo == NULL) | |
101 | + set_display_size(get_width(), get_height()); | |
89 | 102 | |
90 | 103 | // Setup timer for animation |
91 | 104 | sigc::slot<bool> slot = sigc::mem_fun(*this, &CalibrationArea::on_timer_signal); |
@@ -110,9 +123,10 @@ void CalibrationArea::set_display_size(int width, int height) { | ||
110 | 123 | |
111 | 124 | bool CalibrationArea::on_expose_event(GdkEventExpose *event) |
112 | 125 | { |
113 | - // check that screensize did not change | |
114 | - if (display_width != get_width() || | |
115 | - display_height != get_height()) { | |
126 | + // check that screensize did not change (if no manually specified geometry) | |
127 | + if (calibrator->get_geometry() == NULL && | |
128 | + (display_width != get_width() || | |
129 | + display_height != get_height()) ) { | |
116 | 130 | set_display_size(get_width(), get_height()); |
117 | 131 | } |
118 | 132 |