FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
SDL3/sdl_utils.hpp
1
20#pragma once
21
22#include <winpr/synch.h>
23#include <winpr/wlog.h>
24
25#include <SDL3/SDL.h>
26#include <string>
27#include <vector>
28#include <memory>
29#include <functional>
30
31#include <sdl_common_utils.hpp>
32
33template <typename T> using deleted_unique_ptr = std::unique_ptr<T, std::function<void(T*)>>;
34
35enum
36{
37 SDL_EVENT_USER_UPDATE = SDL_EVENT_USER + 1,
38 SDL_EVENT_USER_CREATE_WINDOWS,
39 SDL_EVENT_USER_WINDOW_RESIZEABLE,
40 SDL_EVENT_USER_WINDOW_FULLSCREEN,
41 SDL_EVENT_USER_WINDOW_MINIMIZE,
42 SDL_EVENT_USER_POINTER_NULL,
43 SDL_EVENT_USER_POINTER_DEFAULT,
44 SDL_EVENT_USER_POINTER_POSITION,
45 SDL_EVENT_USER_POINTER_SET,
46 SDL_EVENT_USER_QUIT,
47 SDL_EVENT_USER_CERT_DIALOG,
48 SDL_EVENT_USER_SHOW_DIALOG,
49 SDL_EVENT_USER_AUTH_DIALOG,
50 SDL_EVENT_USER_SCARD_DIALOG,
51 SDL_EVENT_USER_RETRY_DIALOG,
52
53 SDL_EVENT_USER_CERT_RESULT,
54 SDL_EVENT_USER_SHOW_RESULT,
55 SDL_EVENT_USER_AUTH_RESULT,
56 SDL_EVENT_USER_SCARD_RESULT
57};
58
59typedef struct
60{
61 Uint32 type;
62 Uint32 timestamp;
63 char* title;
64 char* user;
65 char* domain;
66 char* password;
67 Sint32 result;
69
70bool sdl_push_user_event(Uint32 type, ...);
71
72bool sdl_push_quit();
73
74std::string sdl_window_event_str(Uint32 ev);
75const char* sdl_event_type_str(Uint32 type);
76const char* sdl_error_string(Sint32 res);
77
78#define sdl_log_error(res, log, what) sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __func__)
79BOOL sdl_log_error_ex(Sint32 res, wLog* log, const char* what, const char* file, size_t line,
80 const char* fkt);
81
82namespace sdl::utils
83{
84 std::string rdp_orientation_to_str(uint32_t orientation);
85 std::string sdl_orientation_to_str(SDL_DisplayOrientation orientation);
86 UINT32 orientaion_to_rdp(SDL_DisplayOrientation orientation);
87
88 std::string generate_uuid_v4();
89}