From 941f9937e0744d18de4cc0afa71e0caa925d82ac Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:25:11 +0200 Subject: Adding upstream version 3.5.0+dfsg1. Signed-off-by: Daniel Baumann --- client/SDL/dialogs/res/convert_res_to_c.cpp | 6 ++++++ client/SDL/dialogs/res/sdl_resource_manager.cpp | 2 +- client/SDL/dialogs/sdl_connection_dialog.cpp | 13 +++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'client/SDL/dialogs') diff --git a/client/SDL/dialogs/res/convert_res_to_c.cpp b/client/SDL/dialogs/res/convert_res_to_c.cpp index 07309d5..8ef828a 100644 --- a/client/SDL/dialogs/res/convert_res_to_c.cpp +++ b/client/SDL/dialogs/res/convert_res_to_c.cpp @@ -79,6 +79,10 @@ static int readwrite(std::ofstream& out, std::ifstream& ifs) { size_t pos = 0; char c = 0; + + std::ios backup(nullptr); + backup.copyfmt(out); + while (ifs.read(&c, 1) && ifs.good()) { unsigned val = c & 0xff; @@ -89,6 +93,8 @@ static int readwrite(std::ofstream& out, std::ifstream& ifs) out << std::endl; } + out.copyfmt(backup); + return 0; } diff --git a/client/SDL/dialogs/res/sdl_resource_manager.cpp b/client/SDL/dialogs/res/sdl_resource_manager.cpp index 90ccf31..0f0682a 100644 --- a/client/SDL/dialogs/res/sdl_resource_manager.cpp +++ b/client/SDL/dialogs/res/sdl_resource_manager.cpp @@ -49,7 +49,7 @@ SDL_RWops* SDLResourceManager::get(const std::string& type, const std::string& i << fs::absolute(path) << std::endl; std::cerr << "file not found, application will fail" << std::endl; } - return SDL_RWFromFile(path.native().c_str(), "rb"); + return SDL_RWFromFile(path.u8string().c_str(), "rb"); #endif } diff --git a/client/SDL/dialogs/sdl_connection_dialog.cpp b/client/SDL/dialogs/sdl_connection_dialog.cpp index cbb6349..56c3853 100644 --- a/client/SDL/dialogs/sdl_connection_dialog.cpp +++ b/client/SDL/dialogs/sdl_connection_dialog.cpp @@ -164,6 +164,7 @@ bool SDLConnectionDialog::clearWindow(SDL_Renderer* renderer) bool SDLConnectionDialog::update(SDL_Renderer* renderer) { + std::lock_guard lock(_mux); if (!renderer) return false; @@ -217,7 +218,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event) case SDL_KEYUP: if (visible()) { - auto ev = reinterpret_cast(event); + auto& ev = reinterpret_cast(event); update(_renderer); switch (event.key.keysym.sym) { @@ -244,7 +245,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event) case SDL_MOUSEMOTION: if (visible()) { - auto ev = reinterpret_cast(event); + auto& ev = reinterpret_cast(event); _buttons.set_mouseover(event.button.x, event.button.y); update(_renderer); @@ -255,7 +256,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event) case SDL_MOUSEBUTTONUP: if (visible()) { - auto ev = reinterpret_cast(event); + auto& ev = reinterpret_cast(event); update(_renderer); auto button = _buttons.get_selected(event.button); @@ -274,7 +275,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event) case SDL_MOUSEWHEEL: if (visible()) { - auto ev = reinterpret_cast(event); + auto& ev = reinterpret_cast(event); update(_renderer); return windowID == ev.windowID; } @@ -283,7 +284,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event) case SDL_FINGERDOWN: if (visible()) { - auto ev = reinterpret_cast(event); + auto& ev = reinterpret_cast(event); update(_renderer); #if SDL_VERSION_ATLEAST(2, 0, 18) return windowID == ev.windowID; @@ -294,7 +295,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event) return false; case SDL_WINDOWEVENT: { - auto ev = reinterpret_cast(event); + auto& ev = reinterpret_cast(event); switch (ev.event) { case SDL_WINDOWEVENT_CLOSE: -- cgit v1.2.3