mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #10195 from akallabeth/sdl3-improve
[client,sdl] merge SDL2 and SDL3 projects
This commit is contained in:
commit
c755918e3a
|
@ -32,32 +32,9 @@ if(FREERDP_VENDOR AND WITH_CLIENT)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(WITH_CLIENT_SDL_VERSIONED "append sdl version to client binaries" OFF WITH_CLIENT_SDL OFF)
|
||||
cmake_dependent_option(WITH_CLIENT_SDL2 "[experimental] build experimental SDL2 client" ON WITH_CLIENT_SDL OFF)
|
||||
cmake_dependent_option(WITH_CLIENT_SDL3 "[experimental] build experimental SDL3 client" OFF WITH_CLIENT_SDL OFF)
|
||||
|
||||
if (WITH_CLIENT_SDL2 AND WITH_CLIENT_SDL3)
|
||||
message("Building both, SDL2 and SDL3 clients, forcing WITH_CLIENT_SDL_VERSIONED=ON")
|
||||
set(WITH_CLIENT_SDL_VERSIONED ON)
|
||||
endif()
|
||||
|
||||
if (WITH_CLIENT_SDL2)
|
||||
find_package(SDL2)
|
||||
if (SDL2_FOUND)
|
||||
add_subdirectory(SDL2)
|
||||
else()
|
||||
message(WARNING "SDL2 requested but not found, continuing build without SDL2 client")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WITH_CLIENT_SDL3)
|
||||
find_package(SDL3)
|
||||
if (SDL3_FOUND)
|
||||
add_subdirectory(SDL3)
|
||||
else()
|
||||
message(WARNING "SDL3 requested but not found, continuing build without SDL3 client")
|
||||
endif()
|
||||
endif()
|
||||
if (WITH_CLIENT_SDL)
|
||||
add_subdirectory(SDL)
|
||||
endif()
|
||||
|
||||
if(WITH_X11)
|
||||
add_subdirectory(X11)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP SDL Client
|
||||
#
|
||||
# Copyright 2022 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Thincast Technologies GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -14,7 +15,6 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
if(POLICY CMP0091)
|
||||
|
@ -24,7 +24,7 @@ if (NOT FREERDP_DEFAULT_PROJECT_VERSION)
|
|||
set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0")
|
||||
endif()
|
||||
|
||||
project(sdl3-freerdp
|
||||
project(sdl-freerdp
|
||||
LANGUAGES CXX
|
||||
VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}
|
||||
)
|
||||
|
@ -59,73 +59,35 @@ if (WITH_DEBUG_SDL_KBD_EVENTS)
|
|||
add_definitions(-DWITH_DEBUG_SDL_KBD_EVENTS)
|
||||
endif()
|
||||
|
||||
find_package(SDL3 REQUIRED COMPONENTS)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
cmake_dependent_option(WITH_CLIENT_SDL_VERSIONED "append sdl version to client binaries" OFF WITH_CLIENT_SDL OFF)
|
||||
cmake_dependent_option(WITH_CLIENT_SDL2 "[experimental] build experimental SDL2 client" ON WITH_CLIENT_SDL OFF)
|
||||
cmake_dependent_option(WITH_CLIENT_SDL3 "[experimental] build experimental SDL3 client" OFF WITH_CLIENT_SDL OFF)
|
||||
|
||||
add_subdirectory(dialogs)
|
||||
set(SRCS
|
||||
sdl_types.hpp
|
||||
sdl_utils.cpp
|
||||
sdl_utils.hpp
|
||||
sdl_kbd.cpp
|
||||
sdl_kbd.hpp
|
||||
sdl_touch.cpp
|
||||
sdl_touch.hpp
|
||||
sdl_pointer.cpp
|
||||
sdl_pointer.hpp
|
||||
sdl_disp.cpp
|
||||
sdl_disp.hpp
|
||||
sdl_monitor.cpp
|
||||
sdl_monitor.hpp
|
||||
sdl_freerdp.hpp
|
||||
sdl_freerdp.cpp
|
||||
sdl_channels.hpp
|
||||
sdl_channels.cpp
|
||||
sdl_window.hpp
|
||||
sdl_window.cpp
|
||||
sdl_clip.hpp
|
||||
sdl_clip.cpp
|
||||
)
|
||||
|
||||
add_library(sdl3-prefs STATIC
|
||||
sdl_prefs.hpp
|
||||
sdl_prefs.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(aad)
|
||||
list(APPEND LIBS
|
||||
winpr
|
||||
freerdp
|
||||
freerdp-client
|
||||
Threads::Threads
|
||||
sdl3_client_res
|
||||
sdl3-dialogs
|
||||
sdl3-aad-view
|
||||
sdl3-prefs
|
||||
)
|
||||
|
||||
if (NOT WITH_SDL_LINK_SHARED)
|
||||
list(APPEND LIBS ${SDL3_STATIC_LIBRARIES})
|
||||
else()
|
||||
list(APPEND LIBS ${SDL3_LIBRARIES})
|
||||
if (WITH_CLIENT_SDL2 AND WITH_CLIENT_SDL3)
|
||||
message("Building both, SDL2 and SDL3 clients, forcing WITH_CLIENT_SDL_VERSIONED=ON")
|
||||
set(WITH_CLIENT_SDL_VERSIONED ON)
|
||||
endif()
|
||||
|
||||
AddTargetWithResourceFile(${PROJECT_NAME} "${WIN32_GUI_FLAG}" "${PROJECT_VERSION}" SRCS)
|
||||
add_subdirectory(common)
|
||||
include_directories(common)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS})
|
||||
target_link_libraries(sdl3-prefs winpr)
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Client/SDL")
|
||||
if (NOT WITH_CLIENT_SDL_VERSIONED)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "sdl-freerdp"
|
||||
)
|
||||
if (WITH_CLIENT_SDL2)
|
||||
find_package(SDL2)
|
||||
if (SDL2_FOUND)
|
||||
add_subdirectory(SDL2)
|
||||
else()
|
||||
message(WARNING "SDL2 requested but not found, continuing build without SDL2 client")
|
||||
endif()
|
||||
endif()
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
|
||||
|
||||
add_subdirectory(man)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
if (WITH_CLIENT_SDL3)
|
||||
find_package(SDL3)
|
||||
if (SDL3_FOUND)
|
||||
add_subdirectory(SDL3)
|
||||
else()
|
||||
message(WARNING "SDL3 requested but not found, continuing build without SDL3 client")
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP SDL Client
|
||||
#
|
||||
# Copyright 2022 Armin Novak <anovak@thincast.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set(MODULE_NAME "sdl2-freerdp")
|
||||
|
||||
find_package(SDL2 REQUIRED COMPONENTS)
|
||||
include_directories(${SDL2_INCLUDE_DIR})
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_subdirectory(dialogs)
|
||||
set(SRCS
|
||||
sdl_types.hpp
|
||||
sdl_utils.cpp
|
||||
sdl_utils.hpp
|
||||
sdl_kbd.cpp
|
||||
sdl_kbd.hpp
|
||||
sdl_touch.cpp
|
||||
sdl_touch.hpp
|
||||
sdl_pointer.cpp
|
||||
sdl_pointer.hpp
|
||||
sdl_disp.cpp
|
||||
sdl_disp.hpp
|
||||
sdl_monitor.cpp
|
||||
sdl_monitor.hpp
|
||||
sdl_freerdp.hpp
|
||||
sdl_freerdp.cpp
|
||||
sdl_channels.hpp
|
||||
sdl_channels.cpp
|
||||
sdl_window.hpp
|
||||
sdl_window.cpp
|
||||
)
|
||||
|
||||
list(APPEND LIBS
|
||||
winpr
|
||||
freerdp
|
||||
freerdp-client
|
||||
Threads::Threads
|
||||
sdl2_client_res
|
||||
sdl2-dialogs
|
||||
sdl-common-aad-view
|
||||
sdl-common-prefs
|
||||
)
|
||||
|
||||
if (NOT WITH_SDL_LINK_SHARED)
|
||||
list(APPEND LIBS ${SDL2_STATIC_LIBRARIES})
|
||||
else()
|
||||
list(APPEND LIBS ${SDL2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
AddTargetWithResourceFile(${MODULE_NAME} "${WIN32_GUI_FLAG}" "${PROJECT_VERSION}" SRCS)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/SDL")
|
||||
|
||||
if (NOT WITH_CLIENT_SDL_VERSIONED)
|
||||
set_target_properties(${MODULE_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${PROJECT_NAME}
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
|
||||
|
||||
add_subdirectory(man)
|
|
@ -0,0 +1,35 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP SDL Client
|
||||
#
|
||||
# Copyright 2024 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Thincast Technologies GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(SRCS
|
||||
sdl2_resource_manager.cpp
|
||||
sdl2_resource_manager.hpp
|
||||
)
|
||||
|
||||
add_library(sdl2_client_res STATIC
|
||||
${SRCS}
|
||||
)
|
||||
|
||||
if (NOT WITH_SDL_LINK_SHARED)
|
||||
target_link_libraries(sdl2_client_res ${SDL2_STATIC_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(sdl2_client_res ${SDL2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set_property(TARGET sdl2_client_res PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
target_link_libraries(sdl2_client_res sdl-common-client-res)
|
|
@ -1,14 +1,13 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Popup browser for AAD authentication
|
||||
*
|
||||
* Copyright 2023 Isaac Klein <fifthdegree@protonmail.com>
|
||||
* Copyright 2023 Armin Novak <armin.novak@thincast.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -16,23 +15,20 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "sdl2_resource_manager.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
#include <sdl_config.hpp>
|
||||
|
||||
#if defined(WITH_WEBVIEW)
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
SDL_RWops* SDL2ResourceManager::get(const std::string& type, const std::string& id)
|
||||
{
|
||||
#endif
|
||||
if (useCompiledResources())
|
||||
{
|
||||
auto d = data(type, id);
|
||||
if (!d)
|
||||
return nullptr;
|
||||
|
||||
BOOL sdl_webview_get_access_token(freerdp* instance, AccessTokenType tokenType, char** token,
|
||||
size_t count, ...);
|
||||
return SDL_RWFromConstMem(d->data(), d->size());
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
auto name = filename(type, id);
|
||||
return SDL_RWFromFile(name.c_str(), "rb");
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -15,11 +15,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "sdl_resource_file.hpp"
|
||||
#include "sdl_resource_manager.hpp"
|
||||
#pragma once
|
||||
|
||||
SDLResourceFile::SDLResourceFile(const std::string& type, const std::string& id,
|
||||
const std::vector<unsigned char>& data)
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <res/sdl_resource_manager.hpp>
|
||||
|
||||
class SDL2ResourceManager : public SDLResourceManager
|
||||
{
|
||||
SDLResourceManager::insert(type, id, data);
|
||||
}
|
||||
public:
|
||||
static SDL_RWops* get(const std::string& type, const std::string& id);
|
||||
};
|
|
@ -22,7 +22,7 @@
|
|||
#include "sdl_connection_dialog.hpp"
|
||||
#include "../sdl_utils.hpp"
|
||||
#include "../sdl_freerdp.hpp"
|
||||
#include "res/sdl_resource_manager.hpp"
|
||||
#include "res/sdl2_resource_manager.hpp"
|
||||
|
||||
static const SDL_Color backgroundcolor = { 0x38, 0x36, 0x35, 0xff };
|
||||
static const SDL_Color textcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
|
@ -389,7 +389,7 @@ bool SDLConnectionDialog::createWindow()
|
|||
widget_cfg_t icon{ textcolor,
|
||||
res_bgcolor,
|
||||
{ _renderer, iconRect,
|
||||
SDLResourceManager::get(SDLResourceManager::typeImages(), res_name) } };
|
||||
SDL2ResourceManager::get(SDLResourceManager::typeImages(), res_name) } };
|
||||
_list.emplace_back(std::move(icon));
|
||||
|
||||
iconRect.y += height;
|
||||
|
@ -397,8 +397,8 @@ bool SDLConnectionDialog::createWindow()
|
|||
widget_cfg_t logo{ textcolor,
|
||||
backgroundcolor,
|
||||
{ _renderer, iconRect,
|
||||
SDLResourceManager::get(SDLResourceManager::typeImages(),
|
||||
"FreeRDP_Icon.svg") } };
|
||||
SDL2ResourceManager::get(SDLResourceManager::typeImages(),
|
||||
"FreeRDP_Icon.svg") } };
|
||||
_list.emplace_back(std::move(logo));
|
||||
|
||||
SDL_Rect rect = { widget_width / 4ul, vpadding, widget_width * 3ul / 4ul,
|
|
@ -27,7 +27,7 @@
|
|||
#include "sdl_widget.hpp"
|
||||
#include "../sdl_utils.hpp"
|
||||
|
||||
#include "res/sdl_resource_manager.hpp"
|
||||
#include "res/sdl2_resource_manager.hpp"
|
||||
|
||||
#include <freerdp/log.h>
|
||||
|
||||
|
@ -46,8 +46,8 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, bool input)
|
|||
{
|
||||
assert(renderer);
|
||||
|
||||
auto ops = SDLResourceManager::get(SDLResourceManager::typeFonts(),
|
||||
"OpenSans-VariableFont_wdth,wght.ttf");
|
||||
auto ops = SDL2ResourceManager::get(SDLResourceManager::typeFonts(),
|
||||
"OpenSans-VariableFont_wdth,wght.ttf");
|
||||
if (!ops)
|
||||
widget_log_error(-1, "SDLResourceManager::get");
|
||||
else
|
|
@ -5,4 +5,4 @@ set(DEPS
|
|||
sdl2-freerdp-envvar.1.xml
|
||||
)
|
||||
|
||||
generate_and_install_freerdp_man_from_xml(${PROJECT_NAME} "1" "${DEPS}")
|
||||
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}")
|
|
@ -8,7 +8,7 @@
|
|||
<para>The configuration file is stored per user.<sbr/>
|
||||
The <replaceable>XDG_CONFIG_HOME</replaceable> environment variable can be used to override the base directory.<sbr/>
|
||||
This defaults to <replaceable>~/.config</replaceable>
|
||||
The location relative to <replaceable>XDG_CONFIG_HOME</replaceable> is <replaceable>$XDG_CONFIG_HOME/@VENDOR@/@PRODUCT@/@PROJECT_NAME@.json</replaceable><sbr/>
|
||||
The location relative to <replaceable>XDG_CONFIG_HOME</replaceable> is <replaceable>$XDG_CONFIG_HOME/@VENDOR@/@PRODUCT@/@MODULE_NAME@.json</replaceable><sbr/>
|
||||
The configuration is stored in JSON format</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
|
@ -60,7 +60,7 @@
|
|||
#include "sdl_prefs.hpp"
|
||||
#include "dialogs/sdl_dialogs.hpp"
|
||||
|
||||
#include "aad/sdl_webview.hpp"
|
||||
#include <aad/sdl_webview.hpp>
|
||||
|
||||
#define SDL_TAG CLIENT_TAG("SDL")
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP SDL Client
|
||||
#
|
||||
# Copyright 2022 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Thincast Technologies GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set(MODULE_NAME "sdl3-freerdp")
|
||||
|
||||
find_package(SDL3 REQUIRED COMPONENTS)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_subdirectory(dialogs)
|
||||
set(SRCS
|
||||
sdl_types.hpp
|
||||
sdl_utils.cpp
|
||||
sdl_utils.hpp
|
||||
sdl_kbd.cpp
|
||||
sdl_kbd.hpp
|
||||
sdl_touch.cpp
|
||||
sdl_touch.hpp
|
||||
sdl_pointer.cpp
|
||||
sdl_pointer.hpp
|
||||
sdl_disp.cpp
|
||||
sdl_disp.hpp
|
||||
sdl_monitor.cpp
|
||||
sdl_monitor.hpp
|
||||
sdl_freerdp.hpp
|
||||
sdl_freerdp.cpp
|
||||
sdl_channels.hpp
|
||||
sdl_channels.cpp
|
||||
sdl_window.hpp
|
||||
sdl_window.cpp
|
||||
sdl_clip.hpp
|
||||
sdl_clip.cpp
|
||||
)
|
||||
|
||||
list(APPEND LIBS
|
||||
winpr
|
||||
freerdp
|
||||
freerdp-client
|
||||
Threads::Threads
|
||||
sdl3_client_res
|
||||
sdl3-dialogs
|
||||
sdl-common-aad-view
|
||||
sdl-common-prefs
|
||||
)
|
||||
|
||||
if (NOT WITH_SDL_LINK_SHARED)
|
||||
list(APPEND LIBS ${SDL3_STATIC_LIBRARIES})
|
||||
else()
|
||||
list(APPEND LIBS ${SDL3_LIBRARIES})
|
||||
endif()
|
||||
|
||||
AddTargetWithResourceFile(${MODULE_NAME} "${WIN32_GUI_FLAG}" "${PROJECT_VERSION}" SRCS)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/SDL")
|
||||
if (NOT WITH_CLIENT_SDL_VERSIONED)
|
||||
set_target_properties(${MODULE_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${PROJECT_NAME}
|
||||
)
|
||||
endif()
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
|
||||
|
||||
add_subdirectory(man)
|
|
@ -1,3 +1,20 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP SDL Client
|
||||
#
|
||||
# Copyright 2024 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Thincast Technologies GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set(SRCS
|
||||
sdl_button.hpp
|
||||
sdl_button.cpp
|
|
@ -0,0 +1,34 @@
|
|||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP SDL Client
|
||||
#
|
||||
# Copyright 2024 Armin Novak <anovak@thincast.com>
|
||||
# Copyright 2024 Thincast Technologies GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set(SRCS
|
||||
sdl3_resource_manager.cpp
|
||||
sdl3_resource_manager.hpp
|
||||
)
|
||||
|
||||
add_library(sdl3_client_res STATIC
|
||||
${SRCS}
|
||||
)
|
||||
if (NOT WITH_SDL_LINK_SHARED)
|
||||
target_link_libraries(sdl3_client_res ${SDL3_STATIC_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(sdl3_client_res ${SDL3_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(sdl3_client_res sdl-common-client-res)
|
||||
|
||||
set_property(TARGET sdl3_client_res PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
*
|
||||
* Copyright 2023 Armin Novak <armin.novak@thincast.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "sdl3_resource_manager.hpp"
|
||||
#include <iostream>
|
||||
#if __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#elif __has_include(<experimental/filesystem>)
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#else
|
||||
#error Could not find system header "<filesystem>" or "<experimental/filesystem>"
|
||||
#endif
|
||||
|
||||
SDL_IOStream* SDL3ResourceManager::get(const std::string& type, const std::string& id)
|
||||
{
|
||||
if (useCompiledResources())
|
||||
{
|
||||
auto d = data(type, id);
|
||||
if (!d)
|
||||
return nullptr;
|
||||
|
||||
return SDL_IOFromConstMem(d->data(), d->size());
|
||||
}
|
||||
|
||||
auto name = filename(type, id);
|
||||
return SDL_IOFromFile(name.c_str(), "rb");
|
||||
}
|
|
@ -18,16 +18,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
class SDLResourceFile
|
||||
#include <res/sdl_resource_manager.hpp>
|
||||
|
||||
class SDL3ResourceManager : public SDLResourceManager
|
||||
{
|
||||
public:
|
||||
SDLResourceFile(const std::string& type, const std::string& id,
|
||||
const std::vector<unsigned char>& data);
|
||||
virtual ~SDLResourceFile() = default;
|
||||
|
||||
private:
|
||||
SDLResourceFile(const SDLResourceFile& other) = delete;
|
||||
SDLResourceFile(const SDLResourceFile&& other) = delete;
|
||||
static SDL_IOStream* get(const std::string& type, const std::string& id);
|
||||
};
|
|
@ -22,7 +22,7 @@
|
|||
#include "sdl_connection_dialog.hpp"
|
||||
#include "../sdl_utils.hpp"
|
||||
#include "../sdl_freerdp.hpp"
|
||||
#include "res/sdl_resource_manager.hpp"
|
||||
#include "res/sdl3_resource_manager.hpp"
|
||||
|
||||
static const SDL_Color backgroundcolor = { 0x38, 0x36, 0x35, 0xff };
|
||||
static const SDL_Color textcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
|
@ -386,7 +386,7 @@ bool SDLConnectionDialog::createWindow()
|
|||
widget_cfg_t icon{ textcolor,
|
||||
res_bgcolor,
|
||||
{ _renderer, iconRect,
|
||||
SDLResourceManager::get(SDLResourceManager::typeImages(), res_name) } };
|
||||
SDL3ResourceManager::get(SDLResourceManager::typeImages(), res_name) } };
|
||||
_list.emplace_back(std::move(icon));
|
||||
|
||||
iconRect.y += height;
|
||||
|
@ -394,8 +394,8 @@ bool SDLConnectionDialog::createWindow()
|
|||
widget_cfg_t logo{ textcolor,
|
||||
backgroundcolor,
|
||||
{ _renderer, iconRect,
|
||||
SDLResourceManager::get(SDLResourceManager::typeImages(),
|
||||
"FreeRDP_Icon.svg") } };
|
||||
SDL3ResourceManager::get(SDLResourceManager::typeImages(),
|
||||
"FreeRDP_Icon.svg") } };
|
||||
_list.emplace_back(std::move(logo));
|
||||
|
||||
SDL_FRect rect = { widget_width / 4ul, vpadding, widget_width * 3ul / 4ul,
|
|
@ -27,7 +27,7 @@
|
|||
#include "sdl_widget.hpp"
|
||||
#include "../sdl_utils.hpp"
|
||||
|
||||
#include "res/sdl_resource_manager.hpp"
|
||||
#include "res/sdl3_resource_manager.hpp"
|
||||
|
||||
#include <freerdp/log.h>
|
||||
|
||||
|
@ -46,8 +46,8 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_FRect& rect, bool input)
|
|||
{
|
||||
assert(renderer);
|
||||
|
||||
auto ops = SDLResourceManager::get(SDLResourceManager::typeFonts(),
|
||||
"OpenSans-VariableFont_wdth,wght.ttf");
|
||||
auto ops = SDL3ResourceManager::get(SDLResourceManager::typeFonts(),
|
||||
"OpenSans-VariableFont_wdth,wght.ttf");
|
||||
if (!ops)
|
||||
widget_log_error(-1, "SDLResourceManager::get");
|
||||
else
|
|
@ -5,4 +5,4 @@ set(DEPS
|
|||
sdl3-freerdp-envvar.1.xml
|
||||
)
|
||||
|
||||
generate_and_install_freerdp_man_from_xml(${PROJECT_NAME} "1" "${DEPS}")
|
||||
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}")
|
|
@ -8,7 +8,7 @@
|
|||
<para>The configuration file is stored per user.<sbr/>
|
||||
The <replaceable>XDG_CONFIG_HOME</replaceable> environment variable can be used to override the base directory.<sbr/>
|
||||
This defaults to <replaceable>~/.config</replaceable>
|
||||
The location relative to <replaceable>XDG_CONFIG_HOME</replaceable> is <replaceable>$XDG_CONFIG_HOME/@VENDOR@/@PRODUCT@/@PROJECT_NAME@.json</replaceable><sbr/>
|
||||
The location relative to <replaceable>XDG_CONFIG_HOME</replaceable> is <replaceable>$XDG_CONFIG_HOME/@VENDOR@/@PRODUCT@/@MODULE_NAME@.json</replaceable><sbr/>
|
||||
The configuration is stored in JSON format</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
|
@ -60,7 +60,7 @@
|
|||
#include "sdl_prefs.hpp"
|
||||
#include "dialogs/sdl_dialogs.hpp"
|
||||
|
||||
#include "aad/sdl_webview.hpp"
|
||||
#include <aad/sdl_webview.hpp>
|
||||
|
||||
#define SDL_TAG CLIENT_TAG("SDL")
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue