From 57034f2294d1722f21926d9f361d2e58bc9a3c75 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Sun, 25 Jan 2026 13:18:04 +0100 Subject: [PATCH] [client,sdl] fix compiler warnings --- client/SDL/SDL3/sdl_context.cpp | 35 ++++++++++++++++----------------- client/SDL/SDL3/sdl_context.hpp | 2 +- client/SDL/SDL3/sdl_pointer.cpp | 15 ++++++-------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/client/SDL/SDL3/sdl_context.cpp b/client/SDL/SDL3/sdl_context.cpp index d99021e16..e311340ff 100644 --- a/client/SDL/SDL3/sdl_context.cpp +++ b/client/SDL/SDL3/sdl_context.cpp @@ -1013,7 +1013,7 @@ SDL_FPoint SdlContext::applyLocalScaling(const SDL_FPoint& val) const return rval; } -void SdlContext::removeLocalScaling(float& x, float& y) +void SdlContext::removeLocalScaling(float& x, float& y) const { if (!freerdp_settings_get_bool(context()->settings, FreeRDP_SmartSizing)) return; @@ -1059,43 +1059,42 @@ SDL_FRect SdlContext::pixelToScreen(SDL_WindowID id, const SDL_FRect& pos) return { fpos.x, fpos.y, size.x, size.y }; } -bool SdlContext::handleEvent(const SDL_Event& windowEvent) +bool SdlContext::handleEvent(const SDL_Event& ev) { - if ((windowEvent.type >= SDL_EVENT_DISPLAY_FIRST) && - (windowEvent.type <= SDL_EVENT_DISPLAY_LAST)) + if ((ev.type >= SDL_EVENT_DISPLAY_FIRST) && (ev.type <= SDL_EVENT_DISPLAY_LAST)) { - const auto& ev = windowEvent.display; - return handleEvent(ev); + const auto& dev = ev.display; + return handleEvent(dev); } - if ((windowEvent.type >= SDL_EVENT_WINDOW_FIRST) && (windowEvent.type <= SDL_EVENT_WINDOW_LAST)) + if ((ev.type >= SDL_EVENT_WINDOW_FIRST) && (ev.type <= SDL_EVENT_WINDOW_LAST)) { - const auto& ev = windowEvent.window; - return handleEvent(ev); + const auto& wev = ev.window; + return handleEvent(wev); } - switch (windowEvent.type) + switch (ev.type) { case SDL_EVENT_FINGER_DOWN: case SDL_EVENT_FINGER_UP: case SDL_EVENT_FINGER_MOTION: { - const auto& ev = windowEvent.tfinger; - return handleEvent(ev); + const auto& cev = ev.tfinger; + return handleEvent(cev); } case SDL_EVENT_MOUSE_MOTION: { - const auto& ev = windowEvent.motion; - return handleEvent(ev); + const auto& cev = ev.motion; + return handleEvent(cev); } case SDL_EVENT_MOUSE_BUTTON_DOWN: case SDL_EVENT_MOUSE_BUTTON_UP: { - const auto& ev = windowEvent.button; - return handleEvent(ev); + const auto& cev = ev.button; + return handleEvent(cev); } case SDL_EVENT_MOUSE_WHEEL: { - const auto& ev = windowEvent.wheel; - return handleEvent(ev); + const auto& cev = ev.wheel; + return handleEvent(cev); } default: return true; diff --git a/client/SDL/SDL3/sdl_context.hpp b/client/SDL/SDL3/sdl_context.hpp index ddab25f87..e83b1b0b2 100644 --- a/client/SDL/SDL3/sdl_context.hpp +++ b/client/SDL/SDL3/sdl_context.hpp @@ -143,7 +143,7 @@ class SdlContext [[nodiscard]] bool eventToPixelCoordinates(SDL_WindowID id, SDL_Event& ev); [[nodiscard]] SDL_FPoint applyLocalScaling(const SDL_FPoint& val) const; - void removeLocalScaling(float& x, float& y); + void removeLocalScaling(float& x, float& y) const; [[nodiscard]] bool handleEvent(const SDL_WindowEvent& ev); [[nodiscard]] bool handleEvent(const SDL_DisplayEvent& ev); diff --git a/client/SDL/SDL3/sdl_pointer.cpp b/client/SDL/SDL3/sdl_pointer.cpp index 55b90275e..292aec296 100644 --- a/client/SDL/SDL3/sdl_pointer.cpp +++ b/client/SDL/SDL3/sdl_pointer.cpp @@ -105,9 +105,6 @@ static void sdl_Pointer_Free(rdpContext* context, rdpPointer* pointer) BOOL sdl_Pointer_Set_Process(SdlContext* sdl) { - INT32 w = 0; - INT32 h = 0; - WINPR_ASSERT(sdl); auto context = sdl->context(); @@ -119,10 +116,10 @@ BOOL sdl_Pointer_Set_Process(SdlContext* sdl) rdpGdi* gdi = context->gdi; WINPR_ASSERT(gdi); - auto ix = static_cast(pointer->xPos); - auto iy = static_cast(pointer->yPos); - auto isw = w = static_cast(pointer->width); - auto ish = h = static_cast(pointer->height); + auto ix = static_cast(pointer->xPos); + auto iy = static_cast(pointer->yPos); + auto isw = static_cast(pointer->width); + auto ish = static_cast(pointer->height); SDL_Window* window = SDL_GetMouseFocus(); if (!window) @@ -130,7 +127,7 @@ BOOL sdl_Pointer_Set_Process(SdlContext* sdl) const Uint32 id = SDL_GetWindowID(window); - auto pos = sdl->pixelToScreen(id, SDL_FRect{ ix * 1.0f, iy * 1.0f, isw * 1.0f, ish * 1.0f }); + auto pos = sdl->pixelToScreen(id, SDL_FRect{ ix, iy, isw, ish }); sdl_Pointer_Clear(ptr); @@ -145,7 +142,7 @@ BOOL sdl_Pointer_Set_Process(SdlContext* sdl) const BOOL rc = freerdp_image_scale( pixels, gdi->dstFormat, static_cast(ptr->image->pitch), 0, 0, static_cast(ptr->image->w), static_cast(ptr->image->h), data, - gdi->dstFormat, 0, 0, 0, static_cast(w), static_cast(h)); + gdi->dstFormat, 0, 0, 0, static_cast(isw), static_cast(ish)); SDL_UnlockSurface(ptr->image); if (!rc) return FALSE;