Merge branch 'main' into beta

This commit is contained in:
David Capello 2024-06-14 20:26:25 -03:00
commit f27fb00acf
12 changed files with 91 additions and 111 deletions

View File

@ -81,13 +81,18 @@ else()
set(REQUIRE_CURL OFF)
endif()
# Select libcurl's TLS backend according to target platform
if(REQUIRE_CURL AND ENABLE_DRM)
if(APPLE)
option(CMAKE_USE_SECTRANSP "enable Apple OS native SSL/TLS" ON)
endif()
# SSL/TLS support
if(REQUIRE_CURL AND NOT USE_SHARED_CURL)
# Disable OpenSSL (use native libraries only)
set(CMAKE_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental")
set(CMAKE_USE_LIBSSH2 OFF CACHE BOOL "Use libSSH2")
if(WIN32)
set(CMAKE_USE_SCHANNEL "enable Windows native SSL/TLS" ON)
set(CMAKE_USE_SCHANNEL ON CACHE BOOL "enable Windows native SSL/TLS")
elseif(APPLE)
set(CMAKE_USE_SECTRANSP ON CACHE BOOL "enable Apple OS native SSL/TLS")
else()
# TODO Linux?
endif()
endif()

2
laf

@ -1 +1 @@
Subproject commit d73dd6d5f2668574a46d8cb1393785021a306c69
Subproject commit 580fb8063057a33ebd171be4f66f78c4ce384e52

View File

@ -28,14 +28,6 @@ else()
add_definitions(-Wno-sign-compare)
endif()
if(ENABLE_NEWS)
add_definitions(-DENABLE_NEWS)
endif()
if(ENABLE_UPDATER)
add_definitions(-DENABLE_UPDATER)
endif()
if(WIN32)
# Needed to include icons in win32 .rc file
include_directories(..)
@ -48,45 +40,6 @@ if(REQUIRE_CURL AND NOT USE_SHARED_CURL AND CURL_STATICLIB)
add_definitions(-DCURL_STATICLIB)
endif()
######################################################################
# Special versions (full/trial, devmode, UI/CLI, etc.)
if(NOT ENABLE_TRIAL_MODE)
add_definitions(-DENABLE_SAVE)
else()
add_definitions(-DENABLE_TRIAL_MODE)
endif()
if(ENABLE_DRM)
add_definitions(-DENABLE_DRM)
add_definitions(-DENABLE_SAVE)
endif()
if(ENABLE_DEVMODE)
add_definitions(-DENABLE_DEVMODE)
endif()
if(ENABLE_UI)
add_definitions(-DENABLE_UI)
endif()
if(ENABLE_UI AND (NOT ENABLE_TRIAL_MODE OR ENABLE_DRM))
set(ENABLE_DATA_RECOVERY on)
add_definitions(-DENABLE_DATA_RECOVERY)
else()
set(ENABLE_DATA_RECOVERY off)
endif()
if(ENABLE_SCRIPTING)
# Needed for "app" and "main"
add_definitions(-DENABLE_SCRIPTING)
endif()
if(ENABLE_WEBSOCKET)
# Needed for "app" and "main"
add_definitions(-DENABLE_WEBSOCKET)
endif()
######################################################################
# Aseprite Libraries (in preferred order to be built)

View File

@ -87,14 +87,6 @@ add_custom_command(
DEPENDS ${GEN_DEP} ${widget_files} ${string_files} "${SOURCE_DATA_DIR}/gui.xml")
list(APPEND generated_files ${output_fn})
if(ENABLE_WEBP)
add_definitions(-DENABLE_WEBP)
endif()
if(ENABLE_PSD)
add_definitions(-DENABLE_PSD)
endif()
# libarchive definitions
add_definitions(-DLIBARCHIVE_STATIC)
@ -113,7 +105,21 @@ else()
target_sources(app-lib PRIVATE font_path_unix.cpp)
endif()
# Trial-version vs Full version (enable save command)
if(ENABLE_TRIAL_MODE)
target_compile_definitions(app-lib PUBLIC -DENABLE_TRIAL_MODE)
else()
target_compile_definitions(app-lib PUBLIC -DENABLE_SAVE)
endif()
# Data recovery
if(ENABLE_UI AND (NOT ENABLE_TRIAL_MODE OR ENABLE_DRM))
set(ENABLE_DATA_RECOVERY on)
else()
set(ENABLE_DATA_RECOVERY off)
endif()
if(ENABLE_DATA_RECOVERY)
target_compile_definitions(app-lib PUBLIC -DENABLE_DATA_RECOVERY)
target_sources(app-lib PRIVATE
crash/backup_observer.cpp
crash/data_recovery.cpp
@ -123,6 +129,7 @@ if(ENABLE_DATA_RECOVERY)
ui/data_recovery_view.cpp)
endif()
# File formats
target_sources(app-lib PRIVATE
file/ase_format.cpp
file/bmp_format.cpp
@ -137,15 +144,32 @@ target_sources(app-lib PRIVATE
file/svg_format.cpp
file/tga_format.cpp)
if(ENABLE_WEBP)
target_compile_definitions(app-lib PUBLIC -DENABLE_WEBP)
target_sources(app-lib PRIVATE
file/webp_format.cpp)
endif()
if(ENABLE_PSD)
target_link_libraries(app-lib psd)
target_compile_definitions(app-lib PUBLIC -DENABLE_PSD)
target_sources(app-lib PRIVATE
file/psd_format.cpp)
endif()
# Extras
if(ENABLE_DEVMODE)
target_compile_definitions(app-lib PUBLIC -DENABLE_DEVMODE)
endif()
# Enable "Check for updates" info
if(ENABLE_UPDATER)
target_compile_definitions(app-lib PUBLIC -DENABLE_UPDATER)
endif()
# Scripting
if(ENABLE_SCRIPTING)
target_link_libraries(app-lib lua lauxlib lualib)
target_compile_definitions(app-lib PUBLIC -DENABLE_SCRIPTING)
if(ENABLE_UI)
target_sources(app-lib PRIVATE
commands/cmd_developer_console.cpp
@ -153,10 +177,14 @@ if(ENABLE_SCRIPTING)
commands/debugger.cpp
ui/devconsole_view.cpp)
endif()
if(ENABLE_WEBSOCKET)
target_link_libraries(app-lib ixwebsocket)
target_compile_definitions(app-lib PUBLIC -DENABLE_WEBSOCKET)
target_sources(app-lib PRIVATE
script/websocket_class.cpp)
endif()
target_sources(app-lib PRIVATE
commands/cmd_run_script.cpp
script/app_command_object.cpp
@ -220,7 +248,9 @@ if(ENABLE_SCRIPTING)
shell.cpp)
endif()
# UI-only files
if(ENABLE_UI)
target_compile_definitions(app-lib PUBLIC -DENABLE_UI)
target_sources(app-lib PRIVATE
app_brushes.cpp
app_menus.cpp
@ -431,23 +461,23 @@ if(ENABLE_UI)
ui_context.cpp
widget_loader.cpp)
if(ENABLE_NEWS)
target_compile_definitions(app-lib PUBLIC -DENABLE_NEWS)
target_sources(app-lib PRIVATE
res/http_loader.cpp
ui/news_listbox.cpp)
endif()
if(ENABLE_DRM)
target_link_libraries(app-lib drm-lib)
target_compile_definitions(app-lib PUBLIC
-DENABLE_DRM
-DENABLE_SAVE)
target_sources(app-lib PRIVATE
ui/enter_license.cpp
ui/aseprite_update.cpp)
endif()
endif()
if(ENABLE_SENTRY)
target_sources(app-lib PRIVATE sentry_wrapper.cpp)
else()
target_sources(app-lib PRIVATE send_crash.cpp)
endif()
# Main app sources
target_sources(app-lib PRIVATE
active_site_handler.cpp
app.cpp
@ -735,14 +765,6 @@ target_link_libraries(app-lib
tinyexpr
qoi)
if(ENABLE_PSD)
target_link_libraries(app-lib psd)
endif()
if(ENABLE_DRM)
target_link_libraries(app-lib drm-lib)
endif()
# Directory where generated files by "gen" utility will stay.
target_include_directories(app-lib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
@ -750,14 +772,7 @@ if(REQUIRE_CURL)
target_link_libraries(app-lib net-lib)
endif()
if(ENABLE_SCRIPTING)
target_link_libraries(app-lib lua lauxlib lualib)
if(ENABLE_WEBSOCKET)
target_link_libraries(app-lib ixwebsocket)
endif()
endif()
# Enable loading Steam API
if(ENABLE_STEAM)
# We need the ENABLE_STEAM flag in main module too so AppOptions are
# equal in both modules, app-lib and main (that's why this flag is
@ -766,6 +781,7 @@ if(ENABLE_STEAM)
target_link_libraries(app-lib steam-lib)
endif()
# Report crashes using Sentry
if(ENABLE_SENTRY)
target_compile_definitions(app-lib PUBLIC
-DENABLE_SENTRY
@ -774,4 +790,7 @@ if(ENABLE_SENTRY)
-DSENTRY_ENV="${SENTRY_ENV}")
add_subdirectory(${SENTRY_DIR} sentry)
target_link_libraries(app-lib sentry)
target_sources(app-lib PRIVATE sentry_wrapper.cpp)
else()
target_sources(app-lib PRIVATE send_crash.cpp)
endif()

View File

@ -396,19 +396,20 @@ int App::initialize(const AppOptions& options)
m_mainWindow->openWindow();
#if LAF_LINUX // TODO check why this is required and we cannot call
// updateAllDisplaysWithNewScale() on Linux/X11
// updateAllDisplays() on Linux/X11
// Redraw the whole screen.
manager->invalidate();
#else
// To know the initial manager size we call to
// Manager::updateAllDisplaysWithNewScale(...) so we receive a
// Manager::updateAllDisplays(...) so we receive a
// Manager::onNewDisplayConfiguration() (which will update the
// bounds of the manager for first time). This is required so if
// the OpenFileCommand (called when we're processing the CLI with
// OpenBatchOfFiles) shows a dialog to open a sequence of files,
// the dialog is centered correctly to the manager bounds.
const int scale = Preferences::instance().general.screenScale();
manager->updateAllDisplaysWithNewScale(scale);
const bool gpu = Preferences::instance().general.gpuAcceleration();
manager->updateAllDisplays(scale, gpu);
#endif
}
#endif // ENABLE_UI

View File

@ -868,13 +868,13 @@ public:
ui::set_mouse_cursor_scale(m_pref.cursor.cursorScale());
bool reset_screen = false;
int newScreenScale = base::convert_to<int>(screenScale()->getValue());
const int newScreenScale = base::convert_to<int>(screenScale()->getValue());
if (newScreenScale != m_pref.general.screenScale()) {
m_pref.general.screenScale(newScreenScale);
reset_screen = true;
}
int newUIScale = base::convert_to<int>(uiScale()->getValue());
const int newUIScale = base::convert_to<int>(uiScale()->getValue());
if (newUIScale != m_pref.general.uiScale()) {
m_pref.general.uiScale(newUIScale);
ui::set_theme(ui::get_theme(),
@ -882,7 +882,7 @@ public:
reset_screen = true;
}
bool newGpuAccel = gpuAcceleration()->isSelected();
const bool newGpuAccel = gpuAcceleration()->isSelected();
if (newGpuAccel != m_pref.general.gpuAcceleration()) {
m_pref.general.gpuAcceleration(newGpuAccel);
reset_screen = true;
@ -1018,8 +1018,8 @@ private:
void updateScreenScaling() {
ui::Manager* manager = ui::Manager::getDefault();
m_system->setGpuAcceleration(m_pref.general.gpuAcceleration());
manager->updateAllDisplaysWithNewScale(m_pref.general.screenScale());
manager->updateAllDisplays(m_pref.general.screenScale(),
m_pref.general.gpuAcceleration());
}
void onApply() {

View File

@ -128,8 +128,6 @@ static bool create_main_window(bool gpuAccel,
int scale = Preferences::instance().general.screenScale();
const os::SystemRef system = os::System::instance();
system->setGpuAcceleration(gpuAccel);
try {
if (!spec.frame().isEmpty() ||
!spec.contentRect().isEmpty()) {
@ -165,6 +163,8 @@ static bool create_main_window(bool gpuAccel,
if (scale == 0)
Preferences::instance().general.screenScale(main_window->scale());
main_window->setGpuAcceleration(gpuAccel);
if (main_window->isMinimized())
main_window->maximize();
}
@ -658,7 +658,7 @@ bool CustomizedGuiManager::onProcessDevModeKeyDown(KeyMessage* msg)
ui::set_theme(ui::get_theme(), uiScale);
}
if (screenScale != window->scale()) {
updateAllDisplaysWithNewScale(screenScale);
updateAllDisplays(screenScale, window->gpuAcceleration());
}
}
catch (const std::exception& ex) {

View File

@ -77,7 +77,8 @@ public:
ui::set_theme(ui::get_theme(), newUIScale);
Manager::getDefault()
->updateAllDisplaysWithNewScale(newScreenScale);
->updateAllDisplays(newScreenScale,
pref.general.gpuAcceleration());
}
};

View File

@ -1,5 +1,5 @@
# Aseprite Document IO Library
# Copyright (c) 2022-2023 Igara Studio S.A.
# Copyright (c) 2022-2024 Igara Studio S.A.
# Copyright (c) 2016-2018 David Capello
add_library(dio-lib
@ -10,6 +10,10 @@ add_library(dio-lib
detect_format.cpp
stdio.cpp)
if(ENABLE_DEVMODE)
target_compile_definitions(dio-lib PUBLIC -DENABLE_DEVMODE)
endif()
target_link_libraries(dio-lib
${ZLIB_LIBRARIES}
fmt

View File

@ -311,10 +311,11 @@ void Manager::flipAllDisplays()
}
}
void Manager::updateAllDisplaysWithNewScale(int scale)
void Manager::updateAllDisplays(int scale, bool gpu)
{
os::Window* nativeWindow = m_display.nativeWindow();
nativeWindow->setScale(scale);
nativeWindow->setGpuAcceleration(gpu);
if (get_multiple_displays()) {
for (auto child : children()) {
@ -322,6 +323,7 @@ void Manager::updateAllDisplaysWithNewScale(int scale)
if (window->ownDisplay()) {
Display* display = static_cast<Window*>(child)->display();
display->nativeWindow()->setScale(scale);
display->nativeWindow()->setGpuAcceleration(gpu);
onNewDisplayConfiguration(display);
}
}
@ -1390,6 +1392,7 @@ void Manager::_openWindow(Window* window, bool center)
if (get_multiple_displays()
&& window->shouldCreateNativeWindow()) {
const int scale = parentDisplay->nativeWindow()->scale();
const int gpu = parentDisplay->nativeWindow()->gpuAcceleration();
os::WindowSpec spec;
gfx::Rect frame;
@ -1437,6 +1440,9 @@ void Manager::_openWindow(Window* window, bool center)
// Set native title bar text
newNativeWindow->setTitle(window->text());
// Same GPU acceleration flag that the parent display
newNativeWindow->setGpuAcceleration(gpu);
// Activate only non-floating windows
if (!spec.floating())
newNativeWindow->activate();

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2018-2023 Igara Studio S.A.
// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
@ -46,7 +46,9 @@ namespace ui {
// Refreshes all real displays with the UI content.
void flipAllDisplays();
void updateAllDisplaysWithNewScale(int scale);
// Updates the scale and GPU acceleration flag of all native
// windows.
void updateAllDisplays(int scale, bool gpu);
// Adds the given "msg" message to the queue of messages to be
// dispached. "msg" cannot be used after this function, it'll be

View File

@ -58,17 +58,6 @@ if(REQUIRE_CURL AND NOT USE_SHARED_CURL)
set(BUILD_RELEASE_DEBUG_DIRS ON BOOL)
set(BUILD_CURL_EXE OFF CACHE BOOL "Set to ON to build curl executable.")
# SSL/TLS support (use native libraries only)
set(CMAKE_USE_OPENSSL OFF CACHE BOOL "Use OpenSSL code. Experimental")
set(CMAKE_USE_LIBSSH2 OFF CACHE BOOL "Use libSSH2")
if(WIN32)
set(CMAKE_USE_SCHANNEL ON CACHE BOOL "enable Windows native SSL/TLS")
elseif(APPLE)
set(CMAKE_USE_SECTRANSP ON CACHE BOOL "enable Apple OS native SSL/TLS")
else()
# TODO Linux?
endif()
add_subdirectory(curl)
endif()