aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/UserDialog.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vncviewer/UserDialog.cxx')
-rw-r--r--vncviewer/UserDialog.cxx34
1 files changed, 21 insertions, 13 deletions
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx
index c6cc02f7..9b7c0b93 100644
--- a/vncviewer/UserDialog.cxx
+++ b/vncviewer/UserDialog.cxx
@@ -36,8 +36,9 @@
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Pixmap.H>
-#include <rdr/Exception.h>
+#include <core/Exception.h>
+#include <rfb/CConnection.h>
#include <rfb/Exception.h>
#include <rfb/obfuscate.h>
@@ -54,8 +55,6 @@
#include "../media/insecure.xpm"
#pragma GCC diagnostic pop
-using namespace rfb;
-
static Fl_Pixmap secure_icon(secure);
static Fl_Pixmap insecure_icon(insecure);
@@ -65,8 +64,16 @@ std::string UserDialog::savedPassword;
static long ret_val = 0;
static void button_cb(Fl_Widget *widget, long val) {
+ Fl_Window* win;
+
ret_val = val;
- widget->window()->hide();
+
+ assert(widget != nullptr);
+ win = dynamic_cast<Fl_Window*>(widget);
+ if (win == nullptr)
+ win = widget->window();
+ assert(win != nullptr);
+ win->hide();
}
UserDialog::UserDialog()
@@ -120,12 +127,12 @@ void UserDialog::getUserPasswd(bool secure_, std::string* user,
fp = fopen(passwordFileName, "rb");
if (!fp)
- throw rdr::posix_error(_("Opening password file failed"), errno);
+ throw core::posix_error(_("Opening password file failed"), errno);
obfPwd.resize(fread(obfPwd.data(), 1, obfPwd.size(), fp));
fclose(fp);
- *password = deobfuscate(obfPwd.data(), obfPwd.size());
+ *password = rfb::deobfuscate(obfPwd.data(), obfPwd.size());
return;
}
@@ -141,7 +148,7 @@ void UserDialog::getUserPasswd(bool secure_, std::string* user,
int x, y;
win = new Fl_Window(410, 0, _("VNC authentication"));
- win->callback(button_cb, 0);
+ win->callback(button_cb, 1);
banner = new Fl_Box(0, 0, win->w(), 20);
banner->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_IMAGE_NEXT_TO_TEXT);
@@ -254,7 +261,8 @@ void UserDialog::getUserPasswd(bool secure_, std::string* user,
throw rfb::auth_cancelled();
}
-bool UserDialog::showMsgBox(MsgBoxFlags flags, const char* title, const char* text)
+bool UserDialog::showMsgBox(rfb::MsgBoxFlags flags,
+ const char* title, const char* text)
{
char buffer[1024];
@@ -267,14 +275,14 @@ bool UserDialog::showMsgBox(MsgBoxFlags flags, const char* title, const char* te
fl_message_title(title);
switch (flags & 0xf) {
- case M_OKCANCEL:
+ case rfb::M_OKCANCEL:
return fl_choice("%s", nullptr, fl_ok, fl_cancel, buffer) == 1;
- case M_YESNO:
+ case rfb::M_YESNO:
return fl_choice("%s", nullptr, fl_yes, fl_no, buffer) == 1;
- case M_OK:
+ case rfb::M_OK:
default:
- if (((flags & 0xf0) == M_ICONERROR) ||
- ((flags & 0xf0) == M_ICONWARNING))
+ if (((flags & 0xf0) == rfb::M_ICONERROR) ||
+ ((flags & 0xf0) == rfb::M_ICONWARNING))
fl_alert("%s", buffer);
else
fl_message("%s", buffer);