diff --git a/client/SDL/SDL3/CMakeLists.txt b/client/SDL/SDL3/CMakeLists.txt index f0a6eaff3..3ccff8794 100644 --- a/client/SDL/SDL3/CMakeLists.txt +++ b/client/SDL/SDL3/CMakeLists.txt @@ -27,8 +27,8 @@ set(SRCS sdl_types.hpp sdl_utils.cpp sdl_utils.hpp - sdl_kbd.cpp - sdl_kbd.hpp + sdl_input.cpp + sdl_input.hpp sdl_touch.cpp sdl_touch.hpp sdl_pointer.cpp diff --git a/client/SDL/SDL3/sdl_context.hpp b/client/SDL/SDL3/sdl_context.hpp index 0cbee1c64..f5afffd41 100644 --- a/client/SDL/SDL3/sdl_context.hpp +++ b/client/SDL/SDL3/sdl_context.hpp @@ -36,7 +36,7 @@ #include "sdl_window.hpp" #include "sdl_disp.hpp" #include "sdl_clip.hpp" -#include "sdl_kbd.hpp" +#include "sdl_input.hpp" #include "dialogs/sdl_connection_dialog_wrapper.hpp" diff --git a/client/SDL/SDL3/sdl_disp.cpp b/client/SDL/SDL3/sdl_disp.cpp index a23034e7a..0bc8d486c 100644 --- a/client/SDL/SDL3/sdl_disp.cpp +++ b/client/SDL/SDL3/sdl_disp.cpp @@ -26,7 +26,7 @@ #include #include "sdl_disp.hpp" -#include "sdl_kbd.hpp" +#include "sdl_input.hpp" #include "sdl_utils.hpp" #include "sdl_context.hpp" diff --git a/client/SDL/SDL3/sdl_freerdp.cpp b/client/SDL/SDL3/sdl_freerdp.cpp index 0af737663..466e34e93 100644 --- a/client/SDL/SDL3/sdl_freerdp.cpp +++ b/client/SDL/SDL3/sdl_freerdp.cpp @@ -62,7 +62,7 @@ #include "sdl_disp.hpp" #include "sdl_freerdp.hpp" #include "sdl_context.hpp" -#include "sdl_kbd.hpp" +#include "sdl_input.hpp" #include "sdl_monitor.hpp" #include "sdl_pointer.hpp" #include "sdl_prefs.hpp" diff --git a/client/SDL/SDL3/sdl_kbd.cpp b/client/SDL/SDL3/sdl_input.cpp similarity index 97% rename from client/SDL/SDL3/sdl_kbd.cpp rename to client/SDL/SDL3/sdl_input.cpp index bd9ad14d9..7866f7798 100644 --- a/client/SDL/SDL3/sdl_kbd.cpp +++ b/client/SDL/SDL3/sdl_input.cpp @@ -17,7 +17,7 @@ * limitations under the License. */ -#include "sdl_kbd.hpp" +#include "sdl_input.hpp" #include "sdl_disp.hpp" #include "sdl_context.hpp" #include "sdl_utils.hpp" @@ -44,10 +44,7 @@ typedef struct } scancode_entry_t; #define STR(x) #x -#define ENTRY(x, y) \ - { \ - x, STR(x), y, #y \ - } +#define ENTRY(x, y) { x, STR(x), y, #y } static const scancode_entry_t map[] = { ENTRY(SDL_SCANCODE_UNKNOWN, RDP_SCANCODE_UNKNOWN), ENTRY(SDL_SCANCODE_A, RDP_SCANCODE_KEY_A), @@ -300,13 +297,13 @@ static const scancode_entry_t map[] = { return flags; } -BOOL sdlInput::keyboard_sync_state() +bool sdlInput::keyboard_sync_state() { const UINT32 syncFlags = sdl_get_kbd_flags(); return freerdp_input_send_synchronize_event(_sdl->context()->input, syncFlags); } -BOOL sdlInput::keyboard_focus_in() +bool sdlInput::keyboard_focus_in() { auto input = _sdl->context()->input; WINPR_ASSERT(input); @@ -561,7 +558,7 @@ bool sdlInput::extract(const std::string& token, uint32_t& key, uint32_t& value) return freerdp_extract_key_value(token.c_str(), &key, &value); } -BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev) +bool sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev) { WINPR_ASSERT(ev); const UINT32 rdp_scancode = scancode_to_rdp(ev->scancode); @@ -576,7 +573,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev) WLog_Print(_sdl->getWLog(), WLOG_INFO, "%s+<%s> pressed, toggling fullscreen state", masktostr(_hotkeyModmask).c_str(), sdl_scancode_name(_hotkeyFullscreen)); if (!keyboard_sync_state()) - return FALSE; + return false; return _sdl->toggleFullscreen(); } if (ev->scancode == _hotkeyResizable) @@ -584,7 +581,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev) WLog_Print(_sdl->getWLog(), WLOG_INFO, "%s+<%s> pressed, toggling resizeable state", masktostr(_hotkeyModmask).c_str(), sdl_scancode_name(_hotkeyResizable)); if (!keyboard_sync_state()) - return FALSE; + return false; return _sdl->toggleResizeable(); } @@ -593,7 +590,7 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev) WLog_Print(_sdl->getWLog(), WLOG_INFO, "%s+<%s> pressed, toggling grab state", masktostr(_hotkeyModmask).c_str(), sdl_scancode_name(_hotkeyGrab)); if (!keyboard_sync_state()) - return FALSE; + return false; return keyboard_grab(ev->windowID, !_sdl->grabKeyboard()); } if (ev->scancode == _hotkeyDisconnect) @@ -601,16 +598,16 @@ BOOL sdlInput::keyboard_handle_event(const SDL_KeyboardEvent* ev) WLog_Print(_sdl->getWLog(), WLOG_INFO, "%s+<%s> pressed, disconnecting RDP session", masktostr(_hotkeyModmask).c_str(), sdl_scancode_name(_hotkeyDisconnect)); if (!keyboard_sync_state()) - return FALSE; + return false; freerdp_abort_connect_context(_sdl->context()); - return TRUE; + return true; } if (ev->scancode == _hotkeyMinimize) { WLog_Print(_sdl->getWLog(), WLOG_INFO, "%s+<%s> pressed, minimizing client", masktostr(_hotkeyModmask).c_str(), sdl_scancode_name(_hotkeyMinimize)); if (!keyboard_sync_state()) - return FALSE; + return false; return _sdl->setMinimized(); } } @@ -641,11 +638,11 @@ 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, bool enable) +bool sdlInput::keyboard_grab(Uint32 windowID, bool enable) { const auto window = _sdl->getWindowForId(windowID); if (!window) - return FALSE; + return false; auto settings = _sdl->context()->settings; auto kbd_enabled = freerdp_settings_get_bool(settings, FreeRDP_GrabKeyboard); @@ -655,25 +652,25 @@ BOOL sdlInput::keyboard_grab(Uint32 windowID, bool enable) return window->grabKeyboard(status); } -BOOL sdlInput::mouse_focus(Uint32 windowID) +bool sdlInput::mouse_focus(Uint32 windowID) { if (_lastWindowID != windowID) { _lastWindowID = windowID; auto window = _sdl->getWindowForId(windowID); if (!window) - return FALSE; + return false; window->raise(); } - return TRUE; + return true; } -BOOL sdlInput::mouse_grab(Uint32 windowID, bool enable) +bool sdlInput::mouse_grab(Uint32 windowID, bool enable) { auto window = _sdl->getWindowForId(windowID); if (!window) - return FALSE; + return false; if (!_sdl->setGrabMouse(enable)) WLog_Print(_sdl->getWLog(), WLOG_WARN, "Failed to ungrab mouse"); return window->grabMouse(enable); @@ -695,7 +692,7 @@ sdlInput::~sdlInput() freerdp_keyboard_remap_free(_remapTable); } -BOOL sdlInput::initialize() +bool sdlInput::initialize() { auto settings = _sdl->context()->settings; WINPR_ASSERT(settings); @@ -705,7 +702,7 @@ BOOL sdlInput::initialize() auto list = freerdp_settings_get_string(settings, FreeRDP_KeyboardRemappingList); _remapTable = freerdp_keyboard_remap_string_to_list(list); if (!_remapTable) - return FALSE; + return false; } if (freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout) == 0) @@ -717,7 +714,7 @@ BOOL sdlInput::initialize() KeyboardLayout = ENGLISH_UNITED_STATES; if (!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, KeyboardLayout)) - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/client/SDL/SDL3/sdl_kbd.hpp b/client/SDL/SDL3/sdl_input.hpp similarity index 87% rename from client/SDL/SDL3/sdl_kbd.hpp rename to client/SDL/SDL3/sdl_input.hpp index 522def3b6..2e392c4e6 100644 --- a/client/SDL/SDL3/sdl_kbd.hpp +++ b/client/SDL/SDL3/sdl_input.hpp @@ -42,16 +42,16 @@ class sdlInput sdlInput& operator=(const sdlInput& other) = delete; sdlInput& operator=(sdlInput&& other) = delete; - [[nodiscard]] BOOL initialize(); + [[nodiscard]] bool initialize(); - [[nodiscard]] BOOL keyboard_sync_state(); - [[nodiscard]] BOOL keyboard_focus_in(); + [[nodiscard]] bool keyboard_sync_state(); + [[nodiscard]] bool keyboard_focus_in(); - [[nodiscard]] BOOL keyboard_handle_event(const SDL_KeyboardEvent* ev); + [[nodiscard]] bool keyboard_handle_event(const SDL_KeyboardEvent* ev); - [[nodiscard]] BOOL keyboard_grab(Uint32 windowID, bool enable); - [[nodiscard]] BOOL mouse_focus(Uint32 windowID); - [[nodiscard]] BOOL mouse_grab(Uint32 windowID, bool enable); + [[nodiscard]] bool keyboard_grab(Uint32 windowID, bool enable); + [[nodiscard]] bool mouse_focus(Uint32 windowID); + [[nodiscard]] bool mouse_grab(Uint32 windowID, bool enable); [[nodiscard]] static BOOL keyboard_set_indicators(rdpContext* context, UINT16 led_flags); [[nodiscard]] static BOOL keyboard_set_ime_status(rdpContext* context, UINT16 imeId,