FreeRDP
SDL3/sdl_freerdp.hpp
1 
20 #pragma once
21 
22 #include <memory>
23 #include <thread>
24 #include <map>
25 #include <atomic>
26 
27 #include <freerdp/freerdp.h>
28 #include <freerdp/client/rdpei.h>
29 #include <freerdp/client/rail.h>
30 #include <freerdp/client/cliprdr.h>
31 #include <freerdp/client/rdpgfx.h>
32 
33 #include <SDL3/SDL.h>
34 #include <SDL3/SDL_video.h>
35 
36 #include "sdl_types.hpp"
37 #include "sdl_disp.hpp"
38 #include "sdl_kbd.hpp"
39 #include "sdl_clip.hpp"
40 #include "sdl_utils.hpp"
41 #include "sdl_window.hpp"
42 #include "dialogs/sdl_connection_dialog.hpp"
43 
44 using SDLSurfacePtr = std::unique_ptr<SDL_Surface, decltype(&SDL_DestroySurface)>;
45 
46 class SdlContext
47 {
48  public:
49  explicit SdlContext(rdpContext* context);
50  SdlContext(const SdlContext& other) = delete;
51  SdlContext(SdlContext&& other) = delete;
52 
53  SdlContext& operator=(const SdlContext& other) = delete;
54  SdlContext& operator=(SdlContext&& other) = delete;
55 
56  private:
57  rdpContext* _context;
58 
59  public:
60  wLog* log;
61 
62  /* SDL */
63  bool fullscreen = false;
64  bool resizeable = false;
65  bool grab_mouse = false;
66  bool grab_kbd = false;
67  bool grab_kbd_enabled = true;
68 
69  std::map<Uint32, SdlWindow> windows;
70 
71  CriticalSection critical;
72  std::thread thread;
73  WinPREvent initialize;
74  WinPREvent initialized;
75  WinPREvent update_complete;
76  WinPREvent windows_created;
77  int exit_code = -1;
78 
79  sdlDispContext disp;
80  sdlInput input;
81  sdlClip clip;
82 
83  SDLSurfacePtr primary;
84 
85  SDL_PixelFormat sdl_pixel_format = SDL_PIXELFORMAT_UNKNOWN;
86 
87  std::unique_ptr<SDLConnectionDialog> connection_dialog;
88 
89  std::atomic<bool> rdp_thread_running;
90 
91  BOOL update_resizeable(BOOL enable);
92  BOOL update_fullscreen(BOOL enter);
93  BOOL update_minimize();
94 
95  [[nodiscard]] rdpContext* context() const;
96  [[nodiscard]] rdpClientContext* common() const;
97 };
object that handles clipboard context for the SDL3 client
Definition: sdl_clip.hpp:89