[client,sdl] hide connection dialog
if another dialog is shown hide the connection dialog.
This commit is contained in:
parent
caac867c79
commit
b89f025c5b
@ -84,6 +84,12 @@ bool SDLConnectionDialog::showError(const char* fmt, ...)
|
||||
return setTimer();
|
||||
}
|
||||
|
||||
bool SDLConnectionDialog::show()
|
||||
{
|
||||
std::lock_guard lock(_mux);
|
||||
return show(_type_active);
|
||||
}
|
||||
|
||||
bool SDLConnectionDialog::hide()
|
||||
{
|
||||
std::lock_guard lock(_mux);
|
||||
@ -105,6 +111,7 @@ bool SDLConnectionDialog::update()
|
||||
case MSG_WARN:
|
||||
case MSG_ERROR:
|
||||
createWindow();
|
||||
_type_active = _type;
|
||||
break;
|
||||
case MSG_DISCARD:
|
||||
resetTimer();
|
||||
@ -365,3 +372,48 @@ Uint32 SDLConnectionDialog::timeout(Uint32 intervalMS, void* pvthis)
|
||||
ths->_running = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDLConnectionDialogHider::SDLConnectionDialogHider(freerdp* instance)
|
||||
: SDLConnectionDialogHider(get(instance))
|
||||
{
|
||||
}
|
||||
|
||||
SDLConnectionDialogHider::SDLConnectionDialogHider(rdpContext* context)
|
||||
: SDLConnectionDialogHider(get(context))
|
||||
{
|
||||
}
|
||||
|
||||
SDLConnectionDialogHider::SDLConnectionDialogHider(SDLConnectionDialog* dialog) : _dialog(dialog)
|
||||
{
|
||||
if (_dialog)
|
||||
{
|
||||
_visible = _dialog->visible();
|
||||
if (_visible)
|
||||
{
|
||||
_dialog->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDLConnectionDialogHider::~SDLConnectionDialogHider()
|
||||
{
|
||||
if (_dialog && _visible)
|
||||
{
|
||||
_dialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
SDLConnectionDialog* SDLConnectionDialogHider::get(freerdp* instance)
|
||||
{
|
||||
if (!instance)
|
||||
return nullptr;
|
||||
return get(instance->context);
|
||||
}
|
||||
|
||||
SDLConnectionDialog* SDLConnectionDialogHider::get(rdpContext* context)
|
||||
{
|
||||
auto sdl = get_context(context);
|
||||
if (!sdl)
|
||||
return nullptr;
|
||||
return sdl->connection_dialog.get();
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ class SDLConnectionDialog
|
||||
bool showInfo(const char* fmt, ...);
|
||||
bool showWarn(const char* fmt, ...);
|
||||
bool showError(const char* fmt, ...);
|
||||
|
||||
bool show();
|
||||
bool hide();
|
||||
|
||||
bool running() const;
|
||||
@ -90,8 +92,28 @@ class SDLConnectionDialog
|
||||
std::string _title;
|
||||
std::string _msg;
|
||||
MsgType _type = MSG_NONE;
|
||||
MsgType _type_active = MSG_NONE;
|
||||
SDL_TimerID _timer = -1;
|
||||
bool _running = false;
|
||||
std::vector<SdlWidget> _list;
|
||||
SdlButtonList _buttons;
|
||||
};
|
||||
|
||||
class SDLConnectionDialogHider
|
||||
{
|
||||
public:
|
||||
SDLConnectionDialogHider(freerdp* instance);
|
||||
SDLConnectionDialogHider(rdpContext* context);
|
||||
|
||||
SDLConnectionDialogHider(SDLConnectionDialog* dialog);
|
||||
|
||||
~SDLConnectionDialogHider();
|
||||
|
||||
private:
|
||||
SDLConnectionDialog* get(freerdp* instance);
|
||||
SDLConnectionDialog* get(rdpContext* context);
|
||||
|
||||
private:
|
||||
SDLConnectionDialog* _dialog;
|
||||
bool _visible;
|
||||
};
|
||||
|
@ -91,6 +91,8 @@ BOOL sdl_authenticate_ex(freerdp* instance, char** username, char** password, ch
|
||||
SDL_Event event = { 0 };
|
||||
BOOL res = FALSE;
|
||||
|
||||
SDLConnectionDialogHider hider(instance);
|
||||
|
||||
const char* target = freerdp_settings_get_server_name(instance->context->settings);
|
||||
switch (reason)
|
||||
{
|
||||
@ -158,6 +160,7 @@ BOOL sdl_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list, DWOR
|
||||
{
|
||||
BOOL res = FALSE;
|
||||
|
||||
SDLConnectionDialogHider hider(instance);
|
||||
std::vector<std::string> strlist;
|
||||
std::vector<const char*> list;
|
||||
for (DWORD i = 0; i < count; i++)
|
||||
@ -274,6 +277,7 @@ BOOL sdl_present_gateway_message(freerdp* instance, UINT32 type, BOOL isDisplayM
|
||||
flags = SHOW_DIALOG_TIMED_ACCEPT;
|
||||
char* message = ConvertWCharNToUtf8Alloc(wmessage, length, nullptr);
|
||||
|
||||
SDLConnectionDialogHider hider(instance);
|
||||
const int rc = sdl_show_dialog(instance->context, title, message, flags);
|
||||
free(title);
|
||||
free(message);
|
||||
@ -293,6 +297,8 @@ int sdl_logon_error_info(freerdp* instance, UINT32 data, UINT32 type)
|
||||
if (type == LOGON_MSG_SESSION_CONTINUE)
|
||||
return 0;
|
||||
|
||||
SDLConnectionDialogHider hider(instance);
|
||||
|
||||
char* title = nullptr;
|
||||
size_t tlen = 0;
|
||||
winpr_asprintf(&title, &tlen, "[%s] info",
|
||||
@ -311,6 +317,7 @@ int sdl_logon_error_info(freerdp* instance, UINT32 data, UINT32 type)
|
||||
static DWORD sdl_show_ceritifcate_dialog(rdpContext* context, const char* title,
|
||||
const char* message)
|
||||
{
|
||||
SDLConnectionDialogHider hider(context);
|
||||
if (!sdl_push_user_event(SDL_USEREVENT_CERT_DIALOG, title, message))
|
||||
return 0;
|
||||
|
||||
@ -332,6 +339,7 @@ DWORD sdl_verify_changed_certificate_ex(freerdp* instance, const char* host, UIN
|
||||
WINPR_ASSERT(instance->context);
|
||||
WINPR_ASSERT(instance->context->settings);
|
||||
|
||||
SDLConnectionDialogHider hider(instance);
|
||||
/* Newer versions of FreeRDP allow exposing the whole PEM by setting
|
||||
* FreeRDP_CertificateCallbackPreferPEM to TRUE
|
||||
*/
|
||||
@ -448,6 +456,7 @@ DWORD sdl_verify_certificate_ex(freerdp* instance, const char* host, UINT16 port
|
||||
"Please look at the OpenSSL documentation on how to add a private CA to the store.\n",
|
||||
common_name, subject, issuer, fp_str);
|
||||
|
||||
SDLConnectionDialogHider hider(instance);
|
||||
const DWORD rc = sdl_show_ceritifcate_dialog(instance->context, title, message);
|
||||
free(fp_str);
|
||||
free(title);
|
||||
|
Loading…
x
Reference in New Issue
Block a user