}
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- if (alertOnFatalError)
- fl_alert("%s", e.str());
- exit_vncviewer();
+ exit_vncviewer(_("Failed to connect to \"%s\":\n\n%s"),
+ vncServerName, e.str());
return;
}
}
cc->sock->outStream().flush();
} catch (rdr::EndOfStream& e) {
vlog.info("%s", e.str());
- exit_vncviewer();
+ if (!cc->desktop) {
+ vlog.error(_("The connection was dropped by the server before "
+ "the session could be established."));
+ exit_vncviewer(_("The connection was dropped by the server "
+ "before the session could be established."));
+ } else {
+ exit_vncviewer();
+ }
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- // Somebody might already have requested us to terminate, and
- // might have already provided an error message.
- if (!should_exit())
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
when = FL_READ | FL_EXCEPT;
cc->sendClipboardData(filtered);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
strFree(filtered);
cc->writer()->writePointerEvent(pos, buttonMask);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
} else {
if (!Fl::has_timeout(handlePointerTimeout, this))
self->cc->announceClipboard(true);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
}
cc->requestClipboard();
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
}
if (pendingClientClipboard) {
cc->announceClipboard(true);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
}
self->lastButtonMask);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
}
cc->writer()->writeKeyEvent(keySym, keyCode, true);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
}
cc->writer()->writeKeyEvent(iter->second, keyCode, false);
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ exit_vncviewer(_("An unexpected error occurred when communicating "
+ "with the server:\n\n%s"), e.str());
}
downKeySym.erase(iter);
return buffer;
}
-void exit_vncviewer(const char *error)
+void exit_vncviewer(const char *error, ...)
{
// Prioritise the first error we get as that is probably the most
// relevant one.
- if ((error != NULL) && (exitError == NULL))
- exitError = strdup(error);
+ if ((error != NULL) && (exitError == NULL)) {
+ va_list ap;
+
+ va_start(ap, error);
+ exitError = (char*)malloc(1024);
+ if (exitError)
+ (void) vsnprintf((char*)exitError, 1024, error, ap);
+ va_end(ap);
+ }
exitMainloop = true;
}
} catch (rfb::Exception& e) {
vlog.error("%s", e.str());
if (alertOnFatalError)
- fl_alert("%s", e.str());
+ fl_alert(_("Error reading configuration file \"%s\":\n\n%s"),
+ vncServerName, e.str());
exit(EXIT_FAILURE);
}
}
} catch (rfb::Exception& e) {
vlog.error("%s", e.str());
if (alertOnFatalError)
- fl_alert("%s", e.str());
+ fl_alert(_("Error reading default configuration:\n\n%s"), e.str());
}
for (int i = 1; i < argc;) {
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
if (alertOnFatalError)
- fl_alert("%s", e.str());
+ fl_alert(_("Failure waiting for incoming VNC connection:\n\n%s"), e.str());
exit_vncviewer();
return 1;
}
#define VNCSERVERNAMELEN 256
-void exit_vncviewer(const char *error = NULL);
+#ifdef __GNUC__
+# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
+#else
+# define __printf_attr(a, b)
+#endif // __GNUC__
+
+void exit_vncviewer(const char *error = NULL, ...) __printf_attr(1, 2);
bool should_exit();
void about_vncviewer();
void run_mainloop();