FreeRDP
Loading...
Searching...
No Matches
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 SDL_EVENT_USER_UPDATE_CONNECT_DIALOG
59};
60
61typedef struct
62{
63 Uint32 type;
64 Uint32 timestamp;
65 char* title;
66 char* user;
67 char* domain;
68 char* password;
69 Sint32 result;
71
72bool sdl_push_user_event(Uint32 type, ...);
73
74bool sdl_push_quit();
75
76std::string sdl_window_event_str(Uint32 ev);
77const char* sdl_event_type_str(Uint32 type);
78const char* sdl_error_string(Sint32 res);
79
80#define sdl_log_error(res, log, what) sdl_log_error_ex(res, log, what, __FILE__, __LINE__, __func__)
81BOOL sdl_log_error_ex(Sint32 res, wLog* log, const char* what, const char* file, size_t line,
82 const char* fkt);
83
84namespace sdl::utils
85{
86 std::string rdp_orientation_to_str(uint32_t orientation);
87 std::string sdl_orientation_to_str(SDL_DisplayOrientation orientation);
88 UINT32 orientaion_to_rdp(SDL_DisplayOrientation orientation);
89
90 std::string generate_uuid_v4();
91}