mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #11426 from akallabeth/clean-warn
Clean warn, sdl dynamic sizes
This commit is contained in:
@@ -358,10 +358,12 @@ BOOL sdlDispContext::handle_window_event(const SDL_WindowEvent* ev)
|
||||
auto ctx = _sdl->context();
|
||||
if (ctx && ctx->gdi)
|
||||
gdi_send_suppress_output(ctx->gdi, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
/* fallthrough */
|
||||
WINPR_FALLTHROUGH
|
||||
case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED:
|
||||
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED:
|
||||
case SDL_EVENT_WINDOW_RESIZED:
|
||||
{
|
||||
if (freerdp_settings_get_bool(_sdl->context()->settings,
|
||||
FreeRDP_DynamicResolutionUpdate))
|
||||
@@ -370,7 +372,7 @@ BOOL sdlDispContext::handle_window_event(const SDL_WindowEvent* ev)
|
||||
const auto factor = SDL_GetWindowDisplayScale(window.window());
|
||||
_targetDesktopScaleFactor = static_cast<UINT32>(100 * factor);
|
||||
}
|
||||
assert(SDL_GetWindowSizeInPixels(it->second.window(), &_targetWidth, &_targetHeight));
|
||||
SDL_GetWindowSizeInPixels(it->second.window(), &_targetWidth, &_targetHeight);
|
||||
return addTimer();
|
||||
}
|
||||
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
|
||||
|
||||
@@ -33,6 +33,12 @@ SdlWindow::SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY,
|
||||
// SDL_SetProperty(props, SDL_PROP_WINDOW_CREATE_FL);
|
||||
_window = SDL_CreateWindowWithProperties(props);
|
||||
SDL_DestroyProperties(props);
|
||||
|
||||
auto scale = SDL_GetWindowPixelDensity(_window);
|
||||
const int iscale = static_cast<int>(scale * 100.0f);
|
||||
auto w = 100 * width / iscale;
|
||||
auto h = 100 * height / iscale;
|
||||
SDL_SetWindowSize(_window, w, h);
|
||||
}
|
||||
|
||||
SdlWindow::SdlWindow(SdlWindow&& other) noexcept
|
||||
|
||||
@@ -1451,25 +1451,29 @@ void gdi_free(freerdp* instance)
|
||||
|
||||
BOOL gdi_send_suppress_output(rdpGdi* gdi, BOOL suppress)
|
||||
{
|
||||
RECTANGLE_16 rect;
|
||||
rdpSettings* settings = NULL;
|
||||
rdpUpdate* update = NULL;
|
||||
|
||||
if (!gdi || !gdi->context->settings || !gdi->context->update)
|
||||
if (!gdi || !gdi->context)
|
||||
return FALSE;
|
||||
|
||||
if (gdi->suppressOutput == suppress)
|
||||
return TRUE;
|
||||
|
||||
gdi->suppressOutput = suppress;
|
||||
settings = gdi->context->settings;
|
||||
update = gdi->context->update;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
|
||||
rdpContext* context = gdi->context;
|
||||
rdpSettings* settings = context->settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
rdpUpdate* update = context->update;
|
||||
WINPR_ASSERT(update);
|
||||
|
||||
const UINT32 w = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
|
||||
const UINT32 h = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
|
||||
rect.right = WINPR_ASSERTING_INT_CAST(UINT16, w);
|
||||
rect.bottom = WINPR_ASSERTING_INT_CAST(UINT16, h);
|
||||
return update->SuppressOutput(gdi->context, !suppress, &rect);
|
||||
|
||||
const RECTANGLE_16 rect = { .left = 0,
|
||||
.top = 0,
|
||||
.right = WINPR_ASSERTING_INT_CAST(UINT16, w),
|
||||
.bottom = WINPR_ASSERTING_INT_CAST(UINT16, h) };
|
||||
|
||||
WINPR_ASSERT(update->SuppressOutput);
|
||||
return update->SuppressOutput(context, !suppress, &rect);
|
||||
}
|
||||
|
||||
@@ -796,13 +796,14 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
|
||||
previous_at = curName;
|
||||
while ((stop_at = stop_at_special_chars(previous_at)) != NULL)
|
||||
{
|
||||
char* tmp =
|
||||
strndup(previous_at, WINPR_ASSERTING_INT_CAST(size_t, stop_at - previous_at));
|
||||
const intptr_t diff = stop_at - previous_at;
|
||||
if (diff < 0)
|
||||
goto loop_fail;
|
||||
char* tmp = strndup(previous_at, WINPR_ASSERTING_INT_CAST(size_t, diff));
|
||||
if (!tmp)
|
||||
goto loop_fail;
|
||||
|
||||
rc = _snprintf(&dst[pos], WINPR_ASSERTING_INT_CAST(size_t, stop_at - previous_at + 1),
|
||||
"%s", tmp);
|
||||
rc = _snprintf(&dst[pos], WINPR_ASSERTING_INT_CAST(size_t, diff + 1), "%s", tmp);
|
||||
free(tmp);
|
||||
if (rc < 0)
|
||||
goto loop_fail;
|
||||
|
||||
@@ -675,7 +675,7 @@ static BOOL append(char* dst, size_t dstSize, const char* src)
|
||||
const size_t slen = strlen(src);
|
||||
if (dlen + slen >= dstSize)
|
||||
return FALSE;
|
||||
if (!strncat(dst, src, slen))
|
||||
if (!strncat(dst, src, dstSize - dlen))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user