diff --git a/src/calibrator.hh b/src/calibrator.hh index 150cc1f..a6f9504 100644 --- a/src/calibrator.hh +++ b/src/calibrator.hh @@ -193,7 +193,7 @@ protected: bool along_axis(int xy, int x0, int y0); /// Apply new calibration, implementation dependent - virtual bool finish_data(const XYinfo new_axys) =0; + virtual bool finish_data(const XYinfo &new_axys) =0; /// Check whether the given name is a sysfs device name bool is_sysfs_name(const char* name); diff --git a/src/calibrator/Evdev.cpp b/src/calibrator/Evdev.cpp index 9a56475..0889056 100644 --- a/src/calibrator/Evdev.cpp +++ b/src/calibrator/Evdev.cpp @@ -258,7 +258,7 @@ bool CalibratorEvdev::finish(int width, int height) } // Activate calibrated data and output it -bool CalibratorEvdev::finish_data(const XYinfo new_axys) +bool CalibratorEvdev::finish_data(const XYinfo &new_axys) { bool success = true; @@ -336,7 +336,7 @@ bool CalibratorEvdev::set_invert_xy(const int invert_x, const int invert_y) arr_cmd[0] = invert_x; arr_cmd[1] = invert_y; - int ret = xinput_do_set_int_prop("Evdev Axis Inversion", display, 8, 2, arr_cmd); + bool ret = xinput_do_set_int_prop("Evdev Axis Inversion", display, 8, 2, arr_cmd); if (verbose) { if (ret == true) @@ -359,7 +359,7 @@ bool CalibratorEvdev::set_calibration(const XYinfo new_axys) arr_cmd[2] = new_axys.y.min; arr_cmd[3] = new_axys.y.max; - int ret = xinput_do_set_int_prop("Evdev Axis Calibration", display, 32, 4, arr_cmd); + bool ret = xinput_do_set_int_prop("Evdev Axis Calibration", display, 32, 4, arr_cmd); if (verbose) { if (ret == true) diff --git a/src/calibrator/Evdev.hpp b/src/calibrator/Evdev.hpp index b243090..9efe7d6 100644 --- a/src/calibrator/Evdev.hpp +++ b/src/calibrator/Evdev.hpp @@ -64,7 +64,7 @@ class CalibratorEvdev: public Calibrator /// calculate and apply the calibration virtual bool finish(int width, int height); - virtual bool finish_data(const XYinfo new_axys); + virtual bool finish_data(const XYinfo &new_axys); bool set_swapxy(const int swap_xy); bool set_invert_xy(const int invert_x, const int invert_y); diff --git a/src/calibrator/EvdevTester.cpp b/src/calibrator/EvdevTester.cpp index 5022946..0197988 100644 --- a/src/calibrator/EvdevTester.cpp +++ b/src/calibrator/EvdevTester.cpp @@ -31,7 +31,7 @@ CalibratorEvdevTester::CalibratorEvdevTester(const char* const device_name0, con //printf("Starting test driver\n"); } -bool CalibratorEvdevTester::finish_data(const XYinfo axis) +bool CalibratorEvdevTester::finish_data(const XYinfo &axis) { new_axis = axis; diff --git a/src/calibrator/EvdevTester.hpp b/src/calibrator/EvdevTester.hpp index e75f282..30bfae4 100644 --- a/src/calibrator/EvdevTester.hpp +++ b/src/calibrator/EvdevTester.hpp @@ -41,7 +41,7 @@ class CalibratorEvdevTester: public CalibratorTesterInterface, public Calibrator const int thr_misclick=0, const int thr_doubleclick=0, const OutputType output_type=OUTYPE_AUTO, const char* geometry=0); - virtual bool finish_data(const XYinfo new_axis); + virtual bool finish_data(const XYinfo &new_axis); // emulate the driver processing the coordinates in 'raw' virtual XYinfo emulate_driver(const XYinfo& raw, bool useNewAxis, const XYinfo& screen, const XYinfo& device); diff --git a/src/calibrator/Tester.cpp b/src/calibrator/Tester.cpp index 4b1d9cd..abd2376 100644 --- a/src/calibrator/Tester.cpp +++ b/src/calibrator/Tester.cpp @@ -30,7 +30,7 @@ CalibratorTester::CalibratorTester(const char* const device_name0, const XYinfo& //printf("Starting test driver\n"); } -bool CalibratorTester::finish_data(const XYinfo axis) +bool CalibratorTester::finish_data(const XYinfo &axis) { new_axis = axis; diff --git a/src/calibrator/Tester.hpp b/src/calibrator/Tester.hpp index 2bcad34..4532cd6 100644 --- a/src/calibrator/Tester.hpp +++ b/src/calibrator/Tester.hpp @@ -40,7 +40,7 @@ class CalibratorTester: public CalibratorTesterInterface, public Calibrator const int thr_misclick=0, const int thr_doubleclick=0, const OutputType output_type=OUTYPE_AUTO, const char* geometry=0); - virtual bool finish_data(const XYinfo new_axis); + virtual bool finish_data(const XYinfo &new_axis); // emulate the driver processing the coordinates in 'raw' virtual XYinfo emulate_driver(const XYinfo& raw, diff --git a/src/calibrator/Usbtouchscreen.cpp b/src/calibrator/Usbtouchscreen.cpp index 713b815..9bbafe3 100644 --- a/src/calibrator/Usbtouchscreen.cpp +++ b/src/calibrator/Usbtouchscreen.cpp @@ -77,7 +77,7 @@ CalibratorUsbtouchscreen::~CalibratorUsbtouchscreen() write_bool_parameter (p_swap_xy, val_swap_xy); } -bool CalibratorUsbtouchscreen::finish_data(const XYinfo new_axys) +bool CalibratorUsbtouchscreen::finish_data(const XYinfo &new_axys) { if (output_type != OUTYPE_AUTO) { fprintf(stderr, "ERROR: Usbtouchscreen Calibrator does not support the supplied --output-type\n"); diff --git a/src/calibrator/Usbtouchscreen.hpp b/src/calibrator/Usbtouchscreen.hpp index 287e5dd..1898bf1 100644 --- a/src/calibrator/Usbtouchscreen.hpp +++ b/src/calibrator/Usbtouchscreen.hpp @@ -38,7 +38,7 @@ class CalibratorUsbtouchscreen: public Calibrator const bool use_timeout=false, const char* output_filename = 0); virtual ~CalibratorUsbtouchscreen(); - virtual bool finish_data(const XYinfo new_axys); + virtual bool finish_data(const XYinfo &new_axys); protected: // Globals for kernel parameters from startup. diff --git a/src/calibrator/XorgPrint.cpp b/src/calibrator/XorgPrint.cpp index 582fa78..9ae04e5 100644 --- a/src/calibrator/XorgPrint.cpp +++ b/src/calibrator/XorgPrint.cpp @@ -33,7 +33,7 @@ CalibratorXorgPrint::CalibratorXorgPrint(const char* const device_name0, const X printf("\tIf these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).\n"); } -bool CalibratorXorgPrint::finish_data(const XYinfo new_axys) +bool CalibratorXorgPrint::finish_data(const XYinfo &new_axys) { bool success = true; diff --git a/src/calibrator/XorgPrint.hpp b/src/calibrator/XorgPrint.hpp index 0d7e4cf..1083e0d 100644 --- a/src/calibrator/XorgPrint.hpp +++ b/src/calibrator/XorgPrint.hpp @@ -37,7 +37,7 @@ class CalibratorXorgPrint: public Calibrator const OutputType output_type=OUTYPE_AUTO, const char* geometry=0, const bool use_timeout=false, const char* output_filename = 0); - virtual bool finish_data(const XYinfo new_axys); + virtual bool finish_data(const XYinfo &new_axys); protected: bool output_xorgconfd(const XYinfo new_axys); diff --git a/src/gui/gtkmm.hpp b/src/gui/gtkmm.hpp index 49e8878..ef83fad 100644 --- a/src/gui/gtkmm.hpp +++ b/src/gui/gtkmm.hpp @@ -36,7 +36,7 @@ class CalibrationArea : public Gtk::DrawingArea public: CalibrationArea(Calibrator* w); -protected: +private: // Data Calibrator* calibrator; double X[4], Y[4]; diff --git a/src/gui/x11.cpp b/src/gui/x11.cpp index 3d75e3b..4deaec1 100644 --- a/src/gui/x11.cpp +++ b/src/gui/x11.cpp @@ -270,14 +270,12 @@ void GuiCalibratorX11::redraw() } } -bool GuiCalibratorX11::on_expose_event() +void GuiCalibratorX11::on_expose_event() { redraw(); - - return true; } -bool GuiCalibratorX11::on_timer_signal() +void GuiCalibratorX11::on_timer_signal() { // Update clock if(calibrator->get_use_timeout()) { @@ -295,11 +293,9 @@ bool GuiCalibratorX11::on_timer_signal() clock_radius-clock_line_width, clock_radius-clock_line_width, 90*64, ((double)time_elapsed/(double)max_time) * -360 * 64); } - - return true; } -bool GuiCalibratorX11::on_button_press_event(XEvent event) +void GuiCalibratorX11::on_button_press_event(XEvent event) { // Clear window, maybe a bit overdone, but easiest for me atm. // (goal is to clear possible message and other clicks) @@ -329,8 +325,6 @@ bool GuiCalibratorX11::on_button_press_event(XEvent event) // Force a redraw redraw(); - - return true; } void GuiCalibratorX11::draw_message(const char* msg) diff --git a/src/gui/x11.hpp b/src/gui/x11.hpp index 02c8a4a..25c7f5e 100644 --- a/src/gui/x11.hpp +++ b/src/gui/x11.hpp @@ -35,7 +35,7 @@ class GuiCalibratorX11 static void make_instance(Calibrator* w); static void give_timer_signal(); -protected: +private: GuiCalibratorX11(Calibrator* w); ~GuiCalibratorX11(); @@ -63,16 +63,15 @@ class GuiCalibratorX11 unsigned long pixel[NUM_COLORS]; // Signal handlers - bool on_timer_signal(); - bool on_expose_event(); - bool on_button_press_event(XEvent event); + void on_timer_signal(); + void on_expose_event(); + void on_button_press_event(XEvent event); // Helper functions void set_display_size(int width, int height); void redraw(); void draw_message(const char* msg); -private: static GuiCalibratorX11* instance; }; diff --git a/src/tester.cpp b/src/tester.cpp index 532e27a..9cb014a 100644 --- a/src/tester.cpp +++ b/src/tester.cpp @@ -117,4 +117,6 @@ int main() { printf("\n"); } // loop over calibrators + + delete calib; }