summaryrefslogtreecommitdiffstats
path: root/vncviewer/vncviewer.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-11-18 16:23:21 +0100
committerPierre Ossman <ossman@cendio.se>2015-11-27 11:15:19 +0100
commit5102fa96876907adca3d0897d67108c60a2545b0 (patch)
tree57ee64df2556e08cd7d725b9ad61e0215bfd14ae /vncviewer/vncviewer.cxx
parent0560465250d352f21e85c94d80110502b1686a6d (diff)
downloadtigervnc-5102fa96876907adca3d0897d67108c60a2545b0.tar.gz
tigervnc-5102fa96876907adca3d0897d67108c60a2545b0.zip
Consolidate how to run the FLTK loop in one place
Diffstat (limited to 'vncviewer/vncviewer.cxx')
-rw-r--r--vncviewer/vncviewer.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index a2bc0297..d71cb7f9 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -128,6 +128,20 @@ void about_vncviewer()
fl_message("%s", about_text());
}
+void run_mainloop()
+{
+ int next_timer;
+
+ next_timer = Timer::checkTimeouts();
+ if (next_timer == 0)
+ next_timer = INT_MAX;
+
+ if (Fl::wait((double)next_timer / 1000.0) < 0.0) {
+ vlog.error(_("Internal FLTK error. Exiting."));
+ exit(-1);
+ }
+}
+
#ifdef __APPLE__
static void about_callback(Fl_Widget *widget, void *data)
{
@@ -590,18 +604,8 @@ int main(int argc, char** argv)
CConn *cc = new CConn(vncServerName, sock);
- while (!exitMainloop) {
- int next_timer;
-
- next_timer = Timer::checkTimeouts();
- if (next_timer == 0)
- next_timer = INT_MAX;
-
- if (Fl::wait((double)next_timer / 1000.0) < 0.0) {
- vlog.error(_("Internal FLTK error. Exiting."));
- break;
- }
- }
+ while (!exitMainloop)
+ run_mainloop();
delete cc;