[client,sdl] move functions to proper place

This commit is contained in:
akallabeth 2023-04-14 11:50:17 +02:00 committed by akallabeth
parent 01293f4c3f
commit 0627baa939
4 changed files with 40 additions and 42 deletions

View File

@ -1277,3 +1277,40 @@ int main(int argc, char* argv[])
return rc;
}
BOOL update_fullscreen(sdlContext* sdl, BOOL enter)
{
WINPR_ASSERT(sdl);
CriticalSectionLock lock(sdl->critical);
for (uint32_t x = 0; x < sdl->windowCount; x++)
{
sdl_window_t* window = &sdl->windows[x];
if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_FULLSCREEN, window->window, enter))
return FALSE;
}
sdl->fullscreen = enter;
return TRUE;
}
BOOL update_resizeable(sdlContext* sdl, BOOL enable)
{
WINPR_ASSERT(sdl);
CriticalSectionLock lock(sdl->critical);
const rdpSettings* settings = sdl->common.context.settings;
const BOOL dyn = freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate);
const BOOL smart = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
BOOL use = (dyn && enable) || smart;
for (uint32_t x = 0; x < sdl->windowCount; x++)
{
sdl_window_t* window = &sdl->windows[x];
if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_RESIZEABLE, window->window, use))
return FALSE;
}
sdl->resizeable = use;
return TRUE;
}

View File

@ -69,3 +69,6 @@ struct sdl_context
wLog* log;
};
BOOL update_resizeable(sdlContext* sdl, BOOL enable);
BOOL update_fullscreen(sdlContext* sdl, BOOL enter);

View File

@ -173,40 +173,3 @@ BOOL sdl_push_user_event(Uint32 type, ...)
va_end(ap);
return SDL_PushEvent(&ev) == 1;
}
BOOL update_fullscreen(sdlContext* sdl, BOOL enter)
{
WINPR_ASSERT(sdl);
CriticalSectionLock lock(sdl->critical);
for (uint32_t x = 0; x < sdl->windowCount; x++)
{
sdl_window_t* window = &sdl->windows[x];
if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_FULLSCREEN, window->window, enter))
return FALSE;
}
sdl->fullscreen = enter;
return TRUE;
}
BOOL update_resizeable(sdlContext* sdl, BOOL enable)
{
WINPR_ASSERT(sdl);
CriticalSectionLock lock(sdl->critical);
const rdpSettings* settings = sdl->common.context.settings;
const BOOL dyn = freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate);
const BOOL smart = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
BOOL use = (dyn && enable) || smart;
for (uint32_t x = 0; x < sdl->windowCount; x++)
{
sdl_window_t* window = &sdl->windows[x];
if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_RESIZEABLE, window->window, use))
return FALSE;
}
sdl->resizeable = use;
return TRUE;
}

View File

@ -25,8 +25,6 @@
#include <stdbool.h>
#include <SDL.h>
#include "sdl_types.hpp"
class CriticalSectionLock
{
public:
@ -55,9 +53,6 @@ enum
SDL_USEREVENT_POINTER_SET
};
BOOL update_resizeable(sdlContext* sdl, BOOL enable);
BOOL update_fullscreen(sdlContext* sdl, BOOL enter);
BOOL sdl_push_user_event(Uint32 type, ...);
const char* sdl_event_type_str(Uint32 type);