FreeRDP
Loading...
Searching...
No Matches
SDL2/sdl_disp.hpp
1
19#pragma once
20
21#include <freerdp/types.h>
22#include <freerdp/event.h>
23#include <freerdp/client/disp.h>
24
25#include "sdl_types.hpp"
26
27#include <SDL.h>
28
30{
31
32 public:
33 explicit sdlDispContext(SdlContext* sdl);
34 sdlDispContext(const sdlDispContext& other) = delete;
35 sdlDispContext(sdlDispContext&& other) = delete;
37
38 sdlDispContext& operator=(const sdlDispContext& other) = delete;
39 sdlDispContext& operator=(sdlDispContext&& other) = delete;
40
41 BOOL init(DispClientContext* disp);
42 BOOL uninit(DispClientContext* disp);
43
44#if SDL_VERSION_ATLEAST(2, 0, 10)
45 BOOL handle_display_event(const SDL_DisplayEvent* ev);
46#endif
47
48 BOOL handle_window_event(const SDL_WindowEvent* ev);
49
50 private:
51 UINT DisplayControlCaps(UINT32 maxNumMonitors, UINT32 maxMonitorAreaFactorA,
52 UINT32 maxMonitorAreaFactorB);
53 BOOL set_window_resizable();
54
55 BOOL sendResize();
56 BOOL settings_changed();
57 BOOL update_last_sent();
58 UINT sendLayout(const rdpMonitor* monitors, size_t nmonitors);
59
60 BOOL addTimer();
61
62 static UINT DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors,
63 UINT32 maxMonitorAreaFactorA, UINT32 maxMonitorAreaFactorB);
64 static void OnActivated(void* context, const ActivatedEventArgs* e);
65 static void OnGraphicsReset(void* context, const GraphicsResetEventArgs* e);
66 static Uint32 SDLCALL OnTimer(Uint32 interval, void* param);
67
68 SdlContext* _sdl = nullptr;
69 DispClientContext* _disp = nullptr;
70 int _lastSentWidth = -1;
71 int _lastSentHeight = -1;
72 UINT64 _lastSentDate = 0;
73 int _targetWidth = -1;
74 int _targetHeight = -1;
75 BOOL _activated = FALSE;
76 BOOL _waitingResize = FALSE;
77 UINT16 _lastSentDesktopOrientation = 0;
78 UINT32 _lastSentDesktopScaleFactor = 0;
79 UINT32 _lastSentDeviceScaleFactor = 0;
80 SDL_TimerID _timer = 0;
81 unsigned _timer_retries = 0;
82};