summaryrefslogtreecommitdiffstats
path: root/client/SDL
diff options
context:
space:
mode:
Diffstat (limited to 'client/SDL')
-rw-r--r--client/SDL/CMakeLists.txt10
-rw-r--r--client/SDL/dialogs/res/convert_res_to_c.cpp6
-rw-r--r--client/SDL/dialogs/res/sdl_resource_manager.cpp2
-rw-r--r--client/SDL/dialogs/sdl_connection_dialog.cpp13
-rw-r--r--client/SDL/man/CMakeLists.txt6
-rw-r--r--client/SDL/man/sdl-freerdp.1.xml.in3
-rw-r--r--client/SDL/sdl_freerdp.cpp2
-rw-r--r--client/SDL/sdl_kbd.cpp2
-rw-r--r--client/SDL/sdl_monitor.cpp15
-rw-r--r--client/SDL/sdl_window.cpp4
10 files changed, 33 insertions, 30 deletions
diff --git a/client/SDL/CMakeLists.txt b/client/SDL/CMakeLists.txt
index 6d2b778..0b3aa1b 100644
--- a/client/SDL/CMakeLists.txt
+++ b/client/SDL/CMakeLists.txt
@@ -46,7 +46,7 @@ option(WITH_WIN_CONSOLE "Build ${PROJECT_NAME} with console support" ON)
option(WITH_SDL_LINK_SHARED "link SDL dynamic or static" ON)
if(WITH_WIN_CONSOLE)
- set(WIN32_GUI_FLAG "")
+ set(WIN32_GUI_FLAG "TRUE")
else()
set(WIN32_GUI_FLAG "WIN32")
endif()
@@ -113,14 +113,8 @@ else()
list(APPEND LIBS ${SDL2_LIBRARIES})
endif()
-add_executable(${PROJECT_NAME}
- ${WIN32_GUI_FLAG}
- ${SRCS}
- )
+AddTargetWithResourceFile(${PROJECT_NAME} "${WIN32_GUI_FLAG}" "${PROJECT_VERSION}" SRCS)
-if (WITH_BINARY_VERSIONING)
- set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}")
-endif()
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Client/SDL")
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
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<const SDL_KeyboardEvent&>(event);
+ auto& ev = reinterpret_cast<const SDL_KeyboardEvent&>(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<const SDL_MouseMotionEvent&>(event);
+ auto& ev = reinterpret_cast<const SDL_MouseMotionEvent&>(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<const SDL_MouseButtonEvent&>(event);
+ auto& ev = reinterpret_cast<const SDL_MouseButtonEvent&>(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<const SDL_MouseWheelEvent&>(event);
+ auto& ev = reinterpret_cast<const SDL_MouseWheelEvent&>(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<const SDL_TouchFingerEvent&>(event);
+ auto& ev = reinterpret_cast<const SDL_TouchFingerEvent&>(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<const SDL_WindowEvent&>(event);
+ auto& ev = reinterpret_cast<const SDL_WindowEvent&>(event);
switch (ev.event)
{
case SDL_WINDOWEVENT_CLOSE:
diff --git a/client/SDL/man/CMakeLists.txt b/client/SDL/man/CMakeLists.txt
index 1fb2adc..e2dfd7a 100644
--- a/client/SDL/man/CMakeLists.txt
+++ b/client/SDL/man/CMakeLists.txt
@@ -5,8 +5,4 @@ set(DEPS
sdl-freerdp-envvar.1.xml
)
-set(MANPAGE_NAME ${PROJECT_NAME})
-if (WITH_BINARY_VERSIONING)
- set(MANPAGE_NAME ${PROJECT_NAME}${PROJECT_VERSION_MAJOR})
-endif()
-generate_and_install_freerdp_man_from_xml(${PROJECT_NAME}.1 ${MANPAGE_NAME}.1 "${DEPS}")
+generate_and_install_freerdp_man_from_xml(${PROJECT_NAME} "1" "${FREERDP_API_VERSION}" "${DEPS}")
diff --git a/client/SDL/man/sdl-freerdp.1.xml.in b/client/SDL/man/sdl-freerdp.1.xml.in
index c4b9918..ba5b6cb 100644
--- a/client/SDL/man/sdl-freerdp.1.xml.in
+++ b/client/SDL/man/sdl-freerdp.1.xml.in
@@ -3,7 +3,6 @@
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "freerdp-argument.1.xml">
- <!ENTITY channels SYSTEM "sdl-freerdp-channels.1.xml">
<!ENTITY config SYSTEM "sdl-freerdp-config.1.xml">
<!ENTITY envvar SYSTEM "sdl-freerdp-envvar.1.xml">
<!ENTITY examples SYSTEM "sdl-freerdp-examples.1.xml">
@@ -50,8 +49,6 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
&syntax;
- &channels;
-
&config;
&envvar;
diff --git a/client/SDL/sdl_freerdp.cpp b/client/SDL/sdl_freerdp.cpp
index 890bf77..b157d3d 100644
--- a/client/SDL/sdl_freerdp.cpp
+++ b/client/SDL/sdl_freerdp.cpp
@@ -1301,7 +1301,7 @@ terminate:
default:
{
std::lock_guard<CriticalSection> lock(sdl->critical);
- if (sdl->connection_dialog)
+ if (sdl->connection_dialog && error_msg)
sdl->connection_dialog->showError(error_msg);
}
break;
diff --git a/client/SDL/sdl_kbd.cpp b/client/SDL/sdl_kbd.cpp
index 4d62389..984614e 100644
--- a/client/SDL/sdl_kbd.cpp
+++ b/client/SDL/sdl_kbd.cpp
@@ -380,7 +380,7 @@ BOOL sdlInput::keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32
uint32_t sdlInput::prefToMask()
{
- const std::map<std::string, SDL_Keymod> mapping = {
+ const std::map<std::string, uint32_t> mapping = {
{ "KMOD_LSHIFT", KMOD_LSHIFT },
{ "KMOD_RSHIFT", KMOD_RSHIFT },
{ "KMOD_LCTRL", KMOD_LCTRL },
diff --git a/client/SDL/sdl_monitor.cpp b/client/SDL/sdl_monitor.cpp
index e637b48..c857028 100644
--- a/client/SDL/sdl_monitor.cpp
+++ b/client/SDL/sdl_monitor.cpp
@@ -189,7 +189,7 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
for (UINT32 x = 0; x < numIds; x++)
{
- auto id = static_cast<const UINT32*>(
+ auto id = static_cast<const int*>(
freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorIds, x));
WINPR_ASSERT(id);
@@ -198,8 +198,17 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl)
float vdpi = 1.0f;
SDL_Rect rect = {};
- SDL_GetDisplayBounds(*id, &rect);
- SDL_GetDisplayDPI(*id, &ddpi, &hdpi, &vdpi);
+ if (SDL_GetDisplayBounds(*id, &rect) < 0)
+ return FALSE;
+
+ if (SDL_GetDisplayDPI(*id, &ddpi, &hdpi, &vdpi) < 0)
+ return FALSE;
+
+ WINPR_ASSERT(rect.w > 0);
+ WINPR_ASSERT(rect.h > 0);
+ WINPR_ASSERT(ddpi > 0);
+ WINPR_ASSERT(hdpi > 0);
+ WINPR_ASSERT(vdpi > 0);
bool highDpi = hdpi > 100;
diff --git a/client/SDL/sdl_window.cpp b/client/SDL/sdl_window.cpp
index c5437bc..1706d33 100644
--- a/client/SDL/sdl_window.cpp
+++ b/client/SDL/sdl_window.cpp
@@ -186,9 +186,9 @@ bool SdlWindow::blit(SDL_Surface* surface, const SDL_Rect& srcRect, SDL_Rect& ds
if (!screen || !surface)
return false;
if (!SDL_SetClipRect(surface, &srcRect))
- return false;
+ return true;
if (!SDL_SetClipRect(screen, &dstRect))
- return false;
+ return true;
auto rc = SDL_BlitScaled(surface, &srcRect, screen, &dstRect);
if (rc != 0)
{