56 bool init(RailClientContext* rail);
57 bool uninit(RailClientContext* rail);
59 [[nodiscard]]
bool enabled()
const
66 [[nodiscard]]
bool desktopMayShow();
68 void noteLogonPrompt();
72 bool paint(SDL_Surface* primary, SDL_PixelFormat fallbackFormat,
73 const std::vector<SDL_Rect>& damage);
76 UINT updateWindowFromSurface(gdiGfxSurface* surface);
79 static UINT UpdateWindowFromSurface(RdpgfxClientContext* context, gdiGfxSurface* surface);
82 [[nodiscard]]
bool ownsWindow(SDL_WindowID
id);
84 void invalidateWindow(SDL_WindowID
id);
86 void handleMaximized(SDL_WindowID
id);
87 void handleMinimized(SDL_WindowID
id);
88 void handleRestored(SDL_WindowID
id);
89 void handleClose(SDL_WindowID
id);
91 void handleFocus(SDL_WindowID
id,
bool gained);
92 void handleDisplayChanged(SDL_WindowID
id, SDL_DisplayID display);
93 void updateCoordinates();
95 void ensureActive(SDL_WindowID
id);
97 bool translateToServer(SDL_WindowID
id,
float& x,
float& y);
98 void notePopupMoved(SDL_WindowID
id);
100 void noteLeftPress(
float x,
float y)
102 _lastPressServer = {
static_cast<int>(x),
static_cast<int>(y) };
103 _lastPointerServer = _lastPressServer;
106 void noteServerPointer(
float x,
float y)
108 _lastPointerServer = {
static_cast<int>(x),
static_cast<int>(y) };
111 bool dragActive(SDL_WindowID
id);
113 bool suppressServerMotion(SDL_WindowID
id);
116 void handleLocalMoveRequested(uint32_t windowId, uint16_t moveType);
118 void noteDragResize(SDL_WindowID
id,
int w,
int h);
120 void syncGeometry(SDL_WindowID
id);
122 void completeLocalMoveIfPending();
125 void completeWaylandResize(
bool definitive =
false);
127 void noteResizeGrab(SDL_WindowID
id);
128 void settleWaylandResize();
132 [[nodiscard]] SDL_Window* beginLocalMove(uint32_t windowId, uint16_t moveType);
135 [[nodiscard]]
SdlRailWindow* getWindowBySdlId(SDL_WindowID
id);
137 void sendClientActivate(uint32_t wid,
bool enabled);
141 [[nodiscard]]
SdlRailWindow* resolveParent(uint64_t ownerId);
143 [[nodiscard]]
bool isShadowFrame(
const SdlRailWindow& popup);
145 void enableRemoteAppMode(
bool enable);
148 void sendWorkArea(
const SDL_Rect& local);
152 void clampIntoDesktop(
const SdlRailWindow& appWindow,
int& x,
int& y,
int w,
int h)
const;
154 void sendSystemCommand(
SdlRailWindow* appWindow, uint16_t command);
159 SDL_Rect _sessionMargins = { 0, 0, 0, 0 };
160 SDL_Point _lastPressServer = { 0, 0 };
161 SDL_Point _lastPointerServer = { 0, 0 };
164 SDL_Point _displayShift = { 0, 0 };
165 SDL_Point _localShift = { 0, 0 };
166 SDL_Point _inputOrigin = { 0, 0 };
169 static UINT server_execute_result(RailClientContext* context,
171 static UINT server_local_move_size(RailClientContext* context,
173 static UINT server_min_max_info(RailClientContext* context,
177 void registerUpdateCallbacks(rdpUpdate* update);
178 static BOOL window_common(rdpContext* context,
const WINDOW_ORDER_INFO* orderInfo,
189 static BOOL window_cached_icon(rdpContext* context,
const WINDOW_ORDER_INFO* orderInfo,
191 static BOOL window_delete(rdpContext* context,
const WINDOW_ORDER_INFO* orderInfo);
192 static BOOL monitored_desktop(rdpContext* context,
const WINDOW_ORDER_INFO* orderInfo,
194 static BOOL non_monitored_desktop(rdpContext* context,
const WINDOW_ORDER_INFO* orderInfo);
196 static SdlRail* get(rdpContext* context);
200 void reportAndAdopt(
SdlRailWindow* appWindow,
int x,
int y,
int w,
int h);
202 void sendClientWindowMove(
SdlRailWindow* appWindow,
const SDL_Rect& serverRect);
204 void moveToDisplay(
SdlRailWindow* appWindow, SDL_DisplayID display);
208 [[nodiscard]]
SdlRailIcon* iconCacheLookup(uint32_t cacheId, uint32_t cacheEntry);
212 static void redrawDuringSizeMove(
void* userdata);
214 static void nativeResize(
void* userdata, SDL_WindowID
id,
int moveType,
bool end);
216 RailClientContext* _rail =
nullptr;
218 std::atomic<bool> _enabled =
false;
219 bool _refreshSent =
false;
220 std::atomic<bool> _appStarted =
false;
222 std::atomic<bool> _desktopReleased =
false;
223 std::atomic<uint64_t> _desktopHoldUntil = 0;
224 uint32_t _sizeMoveRedraws = 0;
225 SDL_WindowID _nativeResizeId = 0;
227 SDL_Rect _sentWorkArea = { 0, 0, 0, 0 };
230 mutable std::mutex _windowsLock;
231 std::map<uint64_t, SdlRailWindow> _windows;
233 std::multimap<uint64_t, SdlRailWindow> _deadWindows;
239 SDL_Point anchor = { 0, 0 };
240 SDL_Point pointer = { 0, 0 };
243 bool sawResize =
false;
244 Uint64 lastResize = 0;
247 bool serverEnded =
false;
249 bool wmSized =
false;
250 SDL_Point wmSize = { 0, 0 };
252 LocalMove _localMove;
257 SDL_DisplayID display = 0;
260 uint64_t _focusedAppId = 0;
262 std::vector<uint32_t> _zOrder;
263 std::vector<uint32_t> _appliedZOrder;
264 uint32_t _clientActiveId = 0;
265 bool _zOrderDirty =
false;
267 std::vector<SdlRailIcon> _iconCache;
269 uint32_t _iconCacheEntries = 0;