22#include <winpr/synch.h>
23#include <winpr/wlog.h>
25#include <freerdp/settings.h>
33#include <sdl_common_utils.hpp>
35template <
typename T>
using deleted_unique_ptr = std::unique_ptr<T, std::function<void(T*)>>;
39 SDL_EVENT_USER_UPDATE = SDL_EVENT_USER + 1,
40 SDL_EVENT_USER_CREATE_WINDOWS,
41 SDL_EVENT_USER_WINDOW_RESIZEABLE,
42 SDL_EVENT_USER_WINDOW_FULLSCREEN,
43 SDL_EVENT_USER_WINDOW_MINIMIZE,
44 SDL_EVENT_USER_POINTER_NULL,
45 SDL_EVENT_USER_POINTER_DEFAULT,
46 SDL_EVENT_USER_POINTER_POSITION,
47 SDL_EVENT_USER_POINTER_SET,
48 SDL_EVENT_USER_RAIL_MOVE,
50 SDL_EVENT_USER_CERT_DIALOG,
51 SDL_EVENT_USER_SHOW_DIALOG,
52 SDL_EVENT_USER_AUTH_DIALOG,
53 SDL_EVENT_USER_SCARD_DIALOG,
54 SDL_EVENT_USER_RETRY_DIALOG,
56 SDL_EVENT_USER_CERT_RESULT,
57 SDL_EVENT_USER_SHOW_RESULT,
58 SDL_EVENT_USER_AUTH_RESULT,
59 SDL_EVENT_USER_SCARD_RESULT
73[[nodiscard]]
bool sdl_push_user_event(Uint32 type, ...);
75[[nodiscard]]
bool sdl_push_quit();
78[[nodiscard]]
bool sdl_push_update_after(Uint32 ms);
80[[nodiscard]]
const char* sdl_error_string(Sint32 res);
82#define sdl_log_error(res, log, what) sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __func__)
83[[nodiscard]] BOOL sdl_log_error_ex(Sint32 res, wLog* log,
const char* what,
const char* file,
84 size_t line,
const char* fkt);
88 [[nodiscard]] std::string touchFlagsToString(Uint32 flags);
89 [[nodiscard]] std::string toString(
enum FreeRDP_DesktopRotationFlags orientation);
90 [[nodiscard]] std::string toString(SDL_DisplayOrientation orientation);
91 [[nodiscard]] std::string toString(
const SDL_DisplayMode* mode);
92 [[nodiscard]] std::string toString(Uint32 type);
93 [[nodiscard]] std::string toString(SDL_Rect rect);
94 [[nodiscard]] std::string toString(SDL_FRect rect);
96 [[nodiscard]] UINT32 orientaion_to_rdp(SDL_DisplayOrientation orientation);
98 [[nodiscard]] std::string generate_uuid_v4();
100 enum HighDpiScaleMode
107 [[nodiscard]] HighDpiScaleMode platformScaleMode();
110 [[nodiscard]]
bool isWaylandDriver();
112 [[nodiscard]]
bool isX11Driver();
113 [[nodiscard]]
bool isWindowsDriver();
115 [[nodiscard]] std::string windowTitle(
const rdpSettings* settings);
132 CONN_DENIED_FIPS = 8,
134 FRESH_CREDENTIALS_REQUIRED = 10,
135 DISCONNECT_BY_USER = 11,
138 LICENSE_INTERNAL = 16,
139 LICENSE_NO_LICENSE_SERVER = 17,
140 LICENSE_NO_LICENSE = 18,
141 LICENSE_BAD_CLIENT_MSG = 19,
142 LICENSE_HWID_DOESNT_MATCH = 20,
143 LICENSE_BAD_CLIENT = 21,
144 LICENSE_CANT_FINISH_PROTOCOL = 22,
145 LICENSE_CLIENT_ENDED_PROTOCOL = 23,
146 LICENSE_BAD_CLIENT_ENCRYPTION = 24,
147 LICENSE_CANT_UPGRADE = 25,
148 LICENSE_NO_REMOTE_CONNECTIONS = 26,
154 PARSE_ARGUMENTS = 128,
161 ACCOUNT_LOCKED_OUT = 135,
162 PRE_CONNECT_FAILED = 136,
163 CONNECT_UNDEFINED = 137,
164 POST_CONNECT_FAILED = 138,
166 DNS_NAME_NOT_FOUND = 140,
167 CONNECT_FAILED = 141,
168 MCS_CONNECT_INITIAL_ERROR = 142,
169 TLS_CONNECT_FAILED = 143,
170 INSUFFICIENT_PRIVILEGES = 144,
171 CONNECT_CANCELLED = 145,
173 CONNECT_TRANSPORT_FAILED = 147,
174 CONNECT_PASSWORD_EXPIRED = 148,
175 CONNECT_PASSWORD_MUST_CHANGE = 149,
176 CONNECT_KDC_UNREACHABLE = 150,
177 CONNECT_ACCOUNT_DISABLED = 151,
178 CONNECT_PASSWORD_CERTAINLY_EXPIRED = 152,
179 CONNECT_CLIENT_REVOKED = 153,
180 CONNECT_WRONG_PASSWORD = 154,
181 CONNECT_ACCESS_DENIED = 155,
182 CONNECT_ACCOUNT_RESTRICTION = 156,
183 CONNECT_ACCOUNT_EXPIRED = 157,
184 CONNECT_LOGON_TYPE_NOT_GRANTED = 158,
185 CONNECT_NO_OR_MISSING_CREDENTIALS = 159,
186 CONNECT_TARGET_BOOTING = 160,
187 CONNECT_HYBRID_REQUIRED_BY_SERVER = 161,
192 [[nodiscard]]
int errorToExitCode(DWORD error);
193 [[nodiscard]]
const char* errorToExitCodeTag(UINT32 error);
194 [[nodiscard]]
const char* exitCodeToTag(
int code);