[client,sdl] fix compiler warnings

This commit is contained in:
akallabeth
2026-01-25 13:18:04 +01:00
parent 947427a911
commit 57034f2294
3 changed files with 24 additions and 28 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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<INT32>(pointer->xPos);
auto iy = static_cast<INT32>(pointer->yPos);
auto isw = w = static_cast<INT32>(pointer->width);
auto ish = h = static_cast<INT32>(pointer->height);
auto ix = static_cast<float>(pointer->xPos);
auto iy = static_cast<float>(pointer->yPos);
auto isw = static_cast<float>(pointer->width);
auto ish = static_cast<float>(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<UINT32>(ptr->image->pitch), 0, 0,
static_cast<UINT32>(ptr->image->w), static_cast<UINT32>(ptr->image->h), data,
gdi->dstFormat, 0, 0, 0, static_cast<UINT32>(w), static_cast<UINT32>(h));
gdi->dstFormat, 0, 0, 0, static_cast<UINT32>(isw), static_cast<UINT32>(ish));
SDL_UnlockSurface(ptr->image);
if (!rc)
return FALSE;