Merge pull request #10267 from akallabeth/sdl-fix

[client,SDL2] fix renderer height
This commit is contained in:
akallabeth 2024-06-08 09:43:00 +02:00 committed by GitHub
commit 711a6603f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 17 additions and 5 deletions

View File

@ -331,7 +331,7 @@ bool SDLConnectionDialog::createWindow()
const size_t total_height = 300;
auto flags = SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_INPUT_FOCUS;
auto rc = SDL_CreateWindowAndRenderer(widget_width, widget_height, flags, &_window, &_renderer);
auto rc = SDL_CreateWindowAndRenderer(widget_width, total_height, flags, &_window, &_renderer);
if (rc != 0)
{
widget_log_error(rc, "SDL_CreateWindowAndRenderer");

View File

@ -1693,6 +1693,8 @@ SdlContext::SdlContext(rdpContext* context)
: _context(context), log(WLog_Get(SDL_TAG)), update_complete(true), disp(this), input(this),
primary(nullptr, SDL_FreeSurface), primary_format(nullptr, SDL_FreeFormat)
{
WINPR_ASSERT(context);
grab_kbd_enabled = freerdp_settings_get_bool(context->settings, FreeRDP_GrabKeyboard);
}
rdpContext* SdlContext::context() const

View File

@ -58,6 +58,7 @@ class SdlContext
bool resizeable = false;
bool grab_mouse = false;
bool grab_kbd = false;
bool grab_kbd_enabled = true;
std::map<Uint32, SdlWindow> windows;

View File

@ -572,6 +572,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev)
if (ev->keysym.scancode == _hotkeyGrab)
{
_sdl->grab_kbd_enabled = !_sdl->grab_kbd_enabled;
keyboard_grab(ev->windowID, _sdl->grab_kbd ? SDL_FALSE : SDL_TRUE);
return TRUE;
}
@ -593,8 +594,10 @@ BOOL sdlInput::keyboard_grab(Uint32 windowID, SDL_bool enable)
auto it = _sdl->windows.find(windowID);
if (it == _sdl->windows.end())
return FALSE;
_sdl->grab_kbd = enable;
return it->second.grabKeyboard(enable);
auto status = enable && _sdl->grab_kbd_enabled;
_sdl->grab_kbd = status;
return it->second.grabKeyboard(status);
}
BOOL sdlInput::mouse_focus(Uint32 windowID)

View File

@ -1687,6 +1687,9 @@ SdlContext::SdlContext(rdpContext* context)
input(this), primary(nullptr, SDL_DestroySurface),
primary_format(nullptr, SDL_DestroyPixelFormat)
{
WINPR_ASSERT(context);
grab_kbd_enabled = freerdp_settings_get_bool(context->settings, FreeRDP_GrabKeyboard);
`: w
}
rdpContext* SdlContext::context() const

View File

@ -59,6 +59,7 @@ class SdlContext
bool resizeable = false;
bool grab_mouse = false;
bool grab_kbd = false;
bool grab_kbd_enabled = true;
std::map<Uint32, SdlWindow> windows;

View File

@ -558,6 +558,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev)
if (ev->keysym.scancode == _hotkeyGrab)
{
_sdl->grab_kbd_enabled = !_sdl->grab_kbd_enabled;
keyboard_grab(ev->windowID, _sdl->grab_kbd ? SDL_FALSE : SDL_TRUE);
return TRUE;
}
@ -579,8 +580,9 @@ BOOL sdlInput::keyboard_grab(Uint32 windowID, SDL_bool enable)
auto it = _sdl->windows.find(windowID);
if (it == _sdl->windows.end())
return FALSE;
_sdl->grab_kbd = enable;
return it->second.grabKeyboard(enable);
auto status = enable && _sdl->grab_kbd_enabled;
_sdl->grab_kbd = status;
return it->second.grabKeyboard(status);
}
BOOL sdlInput::mouse_focus(Uint32 windowID)