[client,sdl] add function to context

This commit is contained in:
akallabeth 2023-04-14 11:55:29 +02:00 committed by akallabeth
parent 0627baa939
commit dd57de8e19
4 changed files with 21 additions and 25 deletions

View File

@ -126,7 +126,7 @@ BOOL sdlDispContext::sendResize()
BOOL sdlDispContext::set_window_resizable()
{
update_resizeable(_sdl, TRUE);
_sdl->update_resizeable(TRUE);
return TRUE;
}
@ -389,7 +389,7 @@ BOOL sdlDispContext::init(DispClientContext* disp)
disp->DisplayControlCaps = sdlDispContext::DisplayControlCaps;
}
update_resizeable(_sdl, TRUE);
_sdl->update_resizeable(TRUE);
return TRUE;
}
@ -399,7 +399,7 @@ BOOL sdlDispContext::uninit(DispClientContext* disp)
return FALSE;
_disp = nullptr;
update_resizeable(_sdl, FALSE);
_sdl->update_resizeable(FALSE);
return TRUE;
}

View File

@ -906,8 +906,8 @@ static BOOL sdl_post_connect(freerdp* instance)
context->update->SetKeyboardIndicators = sdlInput::keyboard_set_indicators;
context->update->SetKeyboardImeStatus = sdlInput::keyboard_set_ime_status;
update_resizeable(sdl, FALSE);
update_fullscreen(sdl, context->settings->Fullscreen || context->settings->UseMultimon);
sdl->update_resizeable(FALSE);
sdl->update_fullscreen(context->settings->Fullscreen || context->settings->UseMultimon);
return TRUE;
}
@ -1278,39 +1278,35 @@ int main(int argc, char* argv[])
return rc;
}
BOOL update_fullscreen(sdlContext* sdl, BOOL enter)
BOOL sdl_context::update_fullscreen(BOOL enter)
{
WINPR_ASSERT(sdl);
CriticalSectionLock lock(sdl->critical);
for (uint32_t x = 0; x < sdl->windowCount; x++)
CriticalSectionLock lock(critical);
for (uint32_t x = 0; x < windowCount; x++)
{
sdl_window_t* window = &sdl->windows[x];
sdl_window_t* window = &windows[x];
if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_FULLSCREEN, window->window, enter))
return FALSE;
}
sdl->fullscreen = enter;
fullscreen = enter;
return TRUE;
}
BOOL update_resizeable(sdlContext* sdl, BOOL enable)
BOOL sdl_context::update_resizeable(BOOL enable)
{
WINPR_ASSERT(sdl);
CriticalSectionLock lock(critical);
CriticalSectionLock lock(sdl->critical);
const rdpSettings* settings = sdl->common.context.settings;
const rdpSettings* settings = 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++)
for (uint32_t x = 0; x < windowCount; x++)
{
sdl_window_t* window = &sdl->windows[x];
sdl_window_t* window = &windows[x];
if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_RESIZEABLE, window->window, use))
return FALSE;
}
sdl->resizeable = use;
resizeable = use;
return TRUE;
}

View File

@ -68,7 +68,7 @@ struct sdl_context
Uint32 sdl_pixel_format;
wLog* log;
};
BOOL update_resizeable(sdlContext* sdl, BOOL enable);
BOOL update_fullscreen(sdlContext* sdl, BOOL enter);
BOOL update_resizeable(BOOL enable);
BOOL update_fullscreen(BOOL enter);
};

View File

@ -435,13 +435,13 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev)
case SDL_SCANCODE_RETURN:
if (ev->type == SDL_KEYDOWN)
{
update_fullscreen(_sdl, !_sdl->fullscreen);
_sdl->update_fullscreen(!_sdl->fullscreen);
}
return TRUE;
case SDL_SCANCODE_R:
if (ev->type == SDL_KEYDOWN)
{
update_resizeable(_sdl, !_sdl->resizeable);
_sdl->update_resizeable(!_sdl->resizeable);
}
return TRUE;
case SDL_SCANCODE_G: