mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[client,sdl] update to current sdl3-api
This commit is contained in:
@@ -35,7 +35,7 @@ static const Uint32 hpadding = 5;
|
||||
|
||||
SDLConnectionDialog::SDLConnectionDialog(rdpContext* context) : _context(context)
|
||||
{
|
||||
SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO);
|
||||
SDL_Init(SDL_INIT_EVENTS | SDL_INIT_VIDEO);
|
||||
hide();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ bool SDLConnectionDialog::setModal()
|
||||
|
||||
auto parent = sdl->windows.begin()->second.window();
|
||||
SDL_SetWindowParent(_window, parent);
|
||||
SDL_SetWindowModal(_window, SDL_TRUE);
|
||||
SDL_SetWindowModal(_window, true);
|
||||
SDL_RaiseWindow(_window);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -298,7 +298,7 @@ UINT sdlDispContext::sendLayout(const rdpMonitor* monitors, size_t nmonitors)
|
||||
|
||||
BOOL sdlDispContext::addTimer()
|
||||
{
|
||||
if (SDL_WasInit(SDL_INIT_TIMER) == 0)
|
||||
if (SDL_WasInit(SDL_INIT_EVENTS) == 0)
|
||||
return FALSE;
|
||||
|
||||
SDL_RemoveTimer(_timer);
|
||||
@@ -334,9 +334,7 @@ BOOL sdlDispContext::handle_window_event(const SDL_WindowEvent* ev)
|
||||
{
|
||||
WINPR_ASSERT(ev);
|
||||
|
||||
auto bordered = freerdp_settings_get_bool(_sdl->context()->settings, FreeRDP_Decorations)
|
||||
? SDL_TRUE
|
||||
: SDL_FALSE;
|
||||
auto bordered = freerdp_settings_get_bool(_sdl->context()->settings, FreeRDP_Decorations);
|
||||
|
||||
auto it = _sdl->windows.find(ev->windowID);
|
||||
if (it != _sdl->windows.end())
|
||||
@@ -365,11 +363,11 @@ BOOL sdlDispContext::handle_window_event(const SDL_WindowEvent* ev)
|
||||
|
||||
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
|
||||
WINPR_ASSERT(_sdl);
|
||||
_sdl->input.keyboard_grab(ev->windowID, SDL_FALSE);
|
||||
_sdl->input.keyboard_grab(ev->windowID, false);
|
||||
return TRUE;
|
||||
case SDL_EVENT_WINDOW_MOUSE_ENTER:
|
||||
WINPR_ASSERT(_sdl);
|
||||
_sdl->input.keyboard_grab(ev->windowID, SDL_TRUE);
|
||||
_sdl->input.keyboard_grab(ev->windowID, true);
|
||||
return _sdl->input.keyboard_focus_in();
|
||||
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
||||
return _sdl->input.keyboard_focus_in();
|
||||
@@ -443,7 +441,7 @@ BOOL sdlDispContext::uninit(DispClientContext* disp)
|
||||
|
||||
sdlDispContext::sdlDispContext(SdlContext* sdl) : _sdl(sdl)
|
||||
{
|
||||
SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO);
|
||||
SDL_Init(SDL_INIT_EVENTS | SDL_INIT_VIDEO);
|
||||
|
||||
WINPR_ASSERT(_sdl);
|
||||
WINPR_ASSERT(_sdl->context()->settings);
|
||||
|
||||
@@ -963,7 +963,7 @@ static int sdl_run(SdlContext* sdl)
|
||||
case SDL_EVENT_USER_WINDOW_RESIZEABLE:
|
||||
{
|
||||
auto window = static_cast<SdlWindow*>(windowEvent.user.data1);
|
||||
const SDL_bool use = windowEvent.user.code != 0 ? SDL_TRUE : SDL_FALSE;
|
||||
const bool use = windowEvent.user.code != 0;
|
||||
if (window)
|
||||
window->resizeable(use);
|
||||
}
|
||||
@@ -971,7 +971,7 @@ static int sdl_run(SdlContext* sdl)
|
||||
case SDL_EVENT_USER_WINDOW_FULLSCREEN:
|
||||
{
|
||||
auto window = static_cast<SdlWindow*>(windowEvent.user.data1);
|
||||
const SDL_bool enter = windowEvent.user.code != 0 ? SDL_TRUE : SDL_FALSE;
|
||||
const bool enter = windowEvent.user.code != 0;
|
||||
if (window)
|
||||
window->fullscreen(enter);
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev)
|
||||
if (ev->scancode == _hotkeyGrab)
|
||||
{
|
||||
_sdl->grab_kbd_enabled = !_sdl->grab_kbd_enabled;
|
||||
keyboard_grab(ev->windowID, _sdl->grab_kbd ? SDL_FALSE : SDL_TRUE);
|
||||
keyboard_grab(ev->windowID, _sdl->grab_kbd);
|
||||
return TRUE;
|
||||
}
|
||||
if (ev->scancode == _hotkeyDisconnect)
|
||||
@@ -570,7 +570,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev)
|
||||
_sdl->context()->input, ev->type == SDL_EVENT_KEY_DOWN, ev->repeat, scancode);
|
||||
}
|
||||
|
||||
BOOL sdlInput::keyboard_grab(Uint32 windowID, SDL_bool enable)
|
||||
BOOL sdlInput::keyboard_grab(Uint32 windowID, bool enable)
|
||||
{
|
||||
auto it = _sdl->windows.find(windowID);
|
||||
if (it == _sdl->windows.end())
|
||||
@@ -594,7 +594,7 @@ BOOL sdlInput::mouse_focus(Uint32 windowID)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL sdlInput::mouse_grab(Uint32 windowID, SDL_bool enable)
|
||||
BOOL sdlInput::mouse_grab(Uint32 windowID, bool enable)
|
||||
{
|
||||
auto it = _sdl->windows.find(windowID);
|
||||
if (it == _sdl->windows.end())
|
||||
|
||||
@@ -46,9 +46,9 @@ class sdlInput
|
||||
|
||||
BOOL keyboard_handle_event(const SDL_KeyboardEvent* ev);
|
||||
|
||||
BOOL keyboard_grab(Uint32 windowID, SDL_bool enable);
|
||||
BOOL keyboard_grab(Uint32 windowID, bool enable);
|
||||
BOOL mouse_focus(Uint32 windowID);
|
||||
BOOL mouse_grab(Uint32 windowID, SDL_bool enable);
|
||||
BOOL mouse_grab(Uint32 windowID, bool enable);
|
||||
|
||||
static BOOL keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
|
||||
static BOOL keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState,
|
||||
|
||||
@@ -99,7 +99,7 @@ bool SdlWindow::grabKeyboard(bool enable)
|
||||
{
|
||||
if (!_window)
|
||||
return false;
|
||||
SDL_SetWindowKeyboardGrab(_window, enable ? SDL_TRUE : SDL_FALSE);
|
||||
SDL_SetWindowKeyboardGrab(_window, enable);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -107,14 +107,14 @@ bool SdlWindow::grabMouse(bool enable)
|
||||
{
|
||||
if (!_window)
|
||||
return false;
|
||||
SDL_SetWindowMouseGrab(_window, enable ? SDL_TRUE : SDL_FALSE);
|
||||
SDL_SetWindowMouseGrab(_window, enable);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SdlWindow::setBordered(bool bordered)
|
||||
{
|
||||
if (_window)
|
||||
SDL_SetWindowBordered(_window, bordered ? SDL_TRUE : SDL_FALSE);
|
||||
SDL_SetWindowBordered(_window, bordered);
|
||||
}
|
||||
|
||||
void SdlWindow::raise()
|
||||
@@ -124,7 +124,7 @@ void SdlWindow::raise()
|
||||
|
||||
void SdlWindow::resizeable(bool use)
|
||||
{
|
||||
SDL_SetWindowResizable(_window, use ? SDL_TRUE : SDL_FALSE);
|
||||
SDL_SetWindowResizable(_window, use);
|
||||
}
|
||||
|
||||
void SdlWindow::fullscreen(bool enter)
|
||||
@@ -140,9 +140,9 @@ void SdlWindow::fullscreen(bool enter)
|
||||
|
||||
SDL_RestoreWindow(_window); // Maximize so we can see the caption and
|
||||
// bits
|
||||
SDL_SetWindowBordered(_window, SDL_FALSE);
|
||||
SDL_SetWindowBordered(_window, false);
|
||||
SDL_SetWindowPosition(_window, 0, 0);
|
||||
SDL_SetWindowAlwaysOnTop(_window, SDL_TRUE);
|
||||
SDL_SetWindowAlwaysOnTop(_window, true);
|
||||
SDL_RaiseWindow(_window);
|
||||
if (mode)
|
||||
SDL_SetWindowSize(_window, mode->w, mode->h);
|
||||
@@ -153,8 +153,8 @@ void SdlWindow::fullscreen(bool enter)
|
||||
if (curFlags & SDL_WINDOW_BORDERLESS)
|
||||
{
|
||||
|
||||
SDL_SetWindowBordered(_window, SDL_TRUE);
|
||||
SDL_SetWindowAlwaysOnTop(_window, SDL_FALSE);
|
||||
SDL_SetWindowBordered(_window, true);
|
||||
SDL_SetWindowAlwaysOnTop(_window, false);
|
||||
SDL_RaiseWindow(_window);
|
||||
SDL_MinimizeWindow(_window); // Maximize so we can see the caption and bits
|
||||
SDL_MaximizeWindow(_window); // Maximize so we can see the caption and bits
|
||||
|
||||
Reference in New Issue
Block a user