Skip to content

Commit c4d1e11

Browse files
Jeff Lasslettschnitzeltony
authored andcommitted
Prevent timeout exit when --no-timeout is used
Submitted tias#45 Signed-off-by: Jeff Lasslett <jeff.lasslett@gmail.com>
1 parent 6ca429f commit c4d1e11

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

src/gui/gtkmm.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,23 @@ void CalibrationArea::redraw()
204204

205205
bool CalibrationArea::on_timer_signal()
206206
{
207-
time_elapsed += time_step;
208-
if (time_elapsed > max_time) {
209-
exit(0);
210-
}
211-
212-
// Update clock
213-
Glib::RefPtr<Gdk::Window> win = get_window();
214-
if (win) {
215-
const Gdk::Rectangle rect(display_width/2 - clock_radius - clock_line_width,
216-
display_height/2 - clock_radius - clock_line_width,
217-
2 * clock_radius + 1 + 2 * clock_line_width,
218-
2 * clock_radius + 1 + 2 * clock_line_width);
219-
win->invalidate_rect(rect, false);
207+
if (calibrator->get_use_timeout()) {
208+
time_elapsed += time_step;
209+
if (time_elapsed > max_time) {
210+
exit(0);
211+
}
212+
213+
// Update clock
214+
Glib::RefPtr<Gdk::Window> win = get_window();
215+
if (win) {
216+
const Gdk::Rectangle rect(display_width/2 - clock_radius - clock_line_width,
217+
display_height/2 - clock_radius - clock_line_width,
218+
2 * clock_radius + 1 + 2 * clock_line_width,
219+
2 * clock_radius + 1 + 2 * clock_line_width);
220+
win->invalidate_rect(rect, false);
221+
}
220222
}
221-
223+
222224
return true;
223225
}
224226

src/gui/x11.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,14 @@ bool GuiCalibratorX11::on_expose_event()
293293

294294
bool GuiCalibratorX11::on_timer_signal()
295295
{
296-
time_elapsed += time_step;
297-
if (time_elapsed > max_time) {
298-
exit(0);
299-
}
300-
301296
// Update clock
302-
if(calibrator->get_use_timeout()){
297+
if(calibrator->get_use_timeout()) {
298+
299+
time_elapsed += time_step;
300+
if (time_elapsed > max_time) {
301+
exit(0);
302+
}
303+
303304
XSetForeground(display, gc, pixel[BLACK]);
304305
XSetLineAttributes(display, gc, clock_line_width,
305306
LineSolid, CapButt, JoinMiter);

0 commit comments

Comments
 (0)