summaryrefslogtreecommitdiffstats
path: root/vncviewer
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
parent0560465250d352f21e85c94d80110502b1686a6d (diff)
downloadtigervnc-5102fa96876907adca3d0897d67108c60a2545b0.tar.gz
tigervnc-5102fa96876907adca3d0897d67108c60a2545b0.zip
Consolidate how to run the FLTK loop in one place
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/CConn.cxx8
-rw-r--r--vncviewer/vncviewer.cxx28
-rw-r--r--vncviewer/vncviewer.h1
3 files changed, 18 insertions, 19 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 78eadb54..fb136b5f 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -228,13 +228,7 @@ const char *CConn::connectionInfo()
void CConn::blockCallback()
{
- int next_timer;
-
- next_timer = Timer::checkTimeouts();
- if (next_timer == 0)
- next_timer = INT_MAX;
-
- Fl::wait((double)next_timer / 1000.0);
+ run_mainloop();
if (should_exit())
throw rdr::Exception("Termination requested");
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;
diff --git a/vncviewer/vncviewer.h b/vncviewer/vncviewer.h
index 4d0566bb..c98c2e94 100644
--- a/vncviewer/vncviewer.h
+++ b/vncviewer/vncviewer.h
@@ -24,5 +24,6 @@
void exit_vncviewer(const char *error = NULL);
bool should_exit();
void about_vncviewer();
+void run_mainloop();
#endif