mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 10:23:32 +00:00
C++, remove the experimental flag
The platform namespace is now always enabled.
This commit is contained in:
parent
3a807e46c1
commit
fd7fc5ab9b
12 changed files with 41 additions and 55 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
@ -214,7 +214,7 @@ jobs:
|
|||
with:
|
||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||
cmakeListsTxtPath: CMakeLists.txt
|
||||
cmakeAppendedArgs: '-DSLINT_BUILD_TESTING=ON -DSLINT_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Debug -DSLINT_FEATURE_EXPERIMENTAL=ON'
|
||||
cmakeAppendedArgs: '-DSLINT_BUILD_TESTING=ON -DSLINT_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Debug -DSLINT_FEATURE_RENDERER_SKIA=ON'
|
||||
buildDirectory: ${{ runner.workspace }}/cppbuild
|
||||
buildWithCMakeArgs: '--config Debug'
|
||||
- name: ctest
|
||||
|
|
|
@ -32,6 +32,7 @@ All notable changes to this project are documented in this file.
|
|||
|
||||
### C++
|
||||
|
||||
- Added Platform API to write your own platform that drives its own event loop.
|
||||
- Added `SLINT_TARGET_CARGO_FLAGS` cmake variable
|
||||
- Added `ReverseModel`
|
||||
- Added functions in Window to dispatch pointer events
|
||||
|
|
|
@ -143,7 +143,6 @@ define_cargo_feature(renderer-software "Enable support for the software renderer
|
|||
|
||||
define_cargo_dependent_feature(backend-qt "Enable Qt based rendering backend" ON SLINT_FEATURE_STD)
|
||||
|
||||
define_cargo_feature(experimental "Enable experimental features (no compatibility guarantees)" OFF)
|
||||
define_cargo_dependent_feature(gettext "Enable support of translations using gettext" OFF SLINT_FEATURE_STD)
|
||||
define_cargo_dependent_feature(accessibility "Enable integration with operating system provided accessibility APIs" ON SLINT_FEATURE_STD)
|
||||
|
||||
|
@ -155,10 +154,6 @@ if (NOT SLINT_FEATURE_STD)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (SLINT_FEATURE_STD AND SLINT_FEATURE_EXPERIMENTAL)
|
||||
list(APPEND features experimental-skia)
|
||||
endif()
|
||||
|
||||
set_property(
|
||||
TARGET slint-cpp
|
||||
PROPERTY CORROSION_FEATURES
|
||||
|
|
|
@ -31,19 +31,16 @@ backend-winit = ["i-slint-backend-selector/backend-winit", "std"]
|
|||
backend-winit-x11 = ["i-slint-backend-selector/backend-winit-x11", "std"]
|
||||
backend-winit-wayland = ["i-slint-backend-selector/backend-winit-wayland", "std"]
|
||||
renderer-femtovg = ["i-slint-backend-selector/renderer-femtovg"]
|
||||
renderer-skia = ["i-slint-backend-selector/renderer-skia"]
|
||||
renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl"]
|
||||
renderer-skia-vulkan = ["i-slint-backend-selector/renderer-skia-vulkan"]
|
||||
renderer-skia = ["i-slint-backend-selector/renderer-skia", "i-slint-renderer-skia", "raw-window-handle"]
|
||||
renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl", "renderer-skia"]
|
||||
renderer-skia-vulkan = ["i-slint-backend-selector/renderer-skia-vulkan", "renderer-skia"]
|
||||
renderer-software = ["i-slint-backend-selector/renderer-software"]
|
||||
gettext = ["i-slint-core/gettext-rs"]
|
||||
accessibility = ["i-slint-backend-selector/accessibility"]
|
||||
|
||||
experimental = []
|
||||
experimental-skia = ["i-slint-renderer-skia", "raw-window-handle", "experimental"]
|
||||
|
||||
std = ["image", "i-slint-core/default", "i-slint-backend-selector"]
|
||||
|
||||
default = ["std", "backend-winit", "renderer-femtovg", "backend-qt", "experimental"]
|
||||
default = ["std", "backend-winit", "renderer-femtovg", "backend-qt"]
|
||||
|
||||
[dependencies]
|
||||
i-slint-backend-selector = { version = "=1.2.0", path="../../internal/backends/selector", optional = true }
|
||||
|
|
|
@ -23,10 +23,10 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
|
||||
let enabled_features = EnabledFeatures {
|
||||
interpreter: std::env::var("CARGO_FEATURE_SLINT_INTERPRETER").is_ok(),
|
||||
experimental: std::env::var("CARGO_FEATURE_EXPERIMENTAL").is_ok(),
|
||||
backend_qt: std::env::var("CARGO_FEATURE_BACKEND_QT").is_ok(),
|
||||
std: std::env::var("CARGO_FEATURE_STD").is_ok(),
|
||||
renderer_software: std::env::var("CARGO_FEATURE_RENDERER_SOFTWARE").is_ok(),
|
||||
renderer_skia: std::env::var("CARGO_FEATURE_RENDERER_SKIA").is_ok(),
|
||||
};
|
||||
|
||||
let dependencies = cbindgen::gen_all(&root_dir, &output_dir, enabled_features)?;
|
||||
|
|
|
@ -722,10 +722,10 @@ fn gen_interpreter(
|
|||
#[derive(Clone, Copy)]
|
||||
pub struct EnabledFeatures {
|
||||
pub interpreter: bool,
|
||||
pub experimental: bool,
|
||||
pub backend_qt: bool,
|
||||
pub std: bool,
|
||||
pub renderer_software: bool,
|
||||
pub renderer_skia: bool,
|
||||
}
|
||||
|
||||
impl EnabledFeatures {
|
||||
|
@ -735,9 +735,6 @@ impl EnabledFeatures {
|
|||
if self.interpreter {
|
||||
defines += "#define SLINT_FEATURE_INTERPRETER\n";
|
||||
}
|
||||
if self.experimental {
|
||||
defines += "#define SLINT_FEATURE_EXPERIMENTAL\n";
|
||||
}
|
||||
if self.backend_qt {
|
||||
defines += "#define SLINT_FEATURE_BACKEND_QT\n";
|
||||
}
|
||||
|
@ -747,6 +744,9 @@ impl EnabledFeatures {
|
|||
if self.renderer_software {
|
||||
defines += "#define SLINT_FEATURE_RENDERER_SOFTWARE\n";
|
||||
}
|
||||
if self.renderer_skia {
|
||||
defines += "#define SLINT_FEATURE_RENDERER_SKIA\n";
|
||||
}
|
||||
defines
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,26 +5,22 @@
|
|||
|
||||
#include "slint.h"
|
||||
|
||||
#ifndef SLINT_FEATURE_EXPERIMENTAL
|
||||
# warning "slint-platform.h API only available when SLINT_FEATURE_EXPERIMENTAL is activated"
|
||||
#else
|
||||
|
||||
# include <utility>
|
||||
# include <cassert>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
struct xcb_connection_t;
|
||||
struct wl_surface;
|
||||
struct wl_display;
|
||||
|
||||
# if defined(__APPLE__) && !defined(_WIN32) && !defined(_WIN64)
|
||||
# ifdef __OBJC__
|
||||
#if defined(__APPLE__) && !defined(_WIN32) && !defined(_WIN64)
|
||||
# ifdef __OBJC__
|
||||
@class NSView;
|
||||
@class NSWindow;
|
||||
# else
|
||||
# else
|
||||
typedef struct objc_object NSView;
|
||||
typedef struct objc_object NSWindow;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace slint {
|
||||
|
||||
|
@ -139,12 +135,15 @@ public:
|
|||
/// Returns a new WindowAdapter
|
||||
virtual std::unique_ptr<WindowAdapter> create_window_adapter() = 0;
|
||||
|
||||
# ifndef SLINT_FEATURE_STD
|
||||
#ifndef SLINT_FEATURE_STD
|
||||
/// Returns the amount of milliseconds since start of the application.
|
||||
///
|
||||
/// This function should only be implemented if the runtime is compiled with no_std
|
||||
virtual std::chrono::milliseconds duration_since_start() const { return {}; }
|
||||
# endif
|
||||
virtual std::chrono::milliseconds duration_since_start() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Spins an event loop and renders the visible windows.
|
||||
virtual void run_event_loop() { }
|
||||
|
@ -173,7 +172,9 @@ public:
|
|||
}
|
||||
Task(const Task &) = delete;
|
||||
Task &operator=(const Task &) = delete;
|
||||
/// Move constructor. A moved from Task can no longer be run.
|
||||
Task(Task &&other) : inner(other.inner) { other.inner = { nullptr, nullptr }; }
|
||||
/// Move operator.
|
||||
Task &operator=(Task &&other)
|
||||
{
|
||||
std::swap(other.inner, inner);
|
||||
|
@ -216,11 +217,11 @@ inline void set_platform(std::unique_ptr<Platform> platform)
|
|||
(void)w.release();
|
||||
},
|
||||
[]([[maybe_unused]] void *p) -> uint64_t {
|
||||
# ifdef SLINT_FEATURE_STD
|
||||
#ifdef SLINT_FEATURE_STD
|
||||
return 0;
|
||||
# else
|
||||
#else
|
||||
return reinterpret_cast<const Platform *>(p)->duration_since_start().count();
|
||||
# endif
|
||||
#endif
|
||||
},
|
||||
[](void *p) { return reinterpret_cast<Platform *>(p)->run_event_loop(); },
|
||||
[](void *p) { return reinterpret_cast<Platform *>(p)->quit_event_loop(); },
|
||||
|
@ -229,7 +230,7 @@ inline void set_platform(std::unique_ptr<Platform> platform)
|
|||
});
|
||||
}
|
||||
|
||||
# ifdef SLINT_FEATURE_RENDERER_SOFTWARE
|
||||
#ifdef SLINT_FEATURE_RENDERER_SOFTWARE
|
||||
/// Represents a region on the screen, used for partial rendering.
|
||||
///
|
||||
/// The region may be composed of multiple sub-regions.
|
||||
|
@ -359,8 +360,9 @@ public:
|
|||
return PhysicalRegion { r };
|
||||
}
|
||||
};
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef SLINT_FEATURE_RENDERER_SKIA
|
||||
/// An opaque, low-level window handle that internalizes everything necessary to exchange messages
|
||||
/// with the windowing system. This includes the connection to the display server, if necessary.
|
||||
///
|
||||
|
@ -467,6 +469,7 @@ public:
|
|||
|
||||
void render() const { cbindgen_private::slint_skia_renderer_render(inner); }
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Call this function at each iteration of the event loop to call the timer handler and advance
|
||||
/// the animations. This should be called before the rendering or processing input events
|
||||
|
@ -487,7 +490,5 @@ inline std::optional<std::chrono::milliseconds> duration_until_next_timer_update
|
|||
return std::chrono::milliseconds(val);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -605,7 +605,6 @@ public:
|
|||
inner.dispatch_pointer_event(event);
|
||||
}
|
||||
|
||||
#ifdef SLINT_FEATURE_EXPERIMENTAL
|
||||
/// Set the logical size of this window after a resize event
|
||||
///
|
||||
/// The backend must send this event to ensure that the `width` and `height` property of the
|
||||
|
@ -634,18 +633,11 @@ public:
|
|||
private_api::assert_main_thread();
|
||||
return cbindgen_private::slint_windowrc_has_active_animations(&inner.handle());
|
||||
}
|
||||
#endif
|
||||
|
||||
/// \private
|
||||
private_api::WindowAdapterRc &window_handle()
|
||||
{
|
||||
return inner;
|
||||
}
|
||||
private_api::WindowAdapterRc &window_handle() { return inner; }
|
||||
/// \private
|
||||
const private_api::WindowAdapterRc &window_handle() const
|
||||
{
|
||||
return inner;
|
||||
}
|
||||
const private_api::WindowAdapterRc &window_handle() const { return inner; }
|
||||
|
||||
private:
|
||||
private_api::WindowAdapterRc inner;
|
||||
|
|
|
@ -10,7 +10,6 @@ use alloc::rc::Rc;
|
|||
use core::ffi::c_void;
|
||||
use i_slint_core::window::{ffi::WindowAdapterRcOpaque, WindowAdapter};
|
||||
|
||||
#[cfg(feature = "experimental")]
|
||||
pub mod platform;
|
||||
|
||||
#[cfg(feature = "i-slint-backend-selector")]
|
||||
|
|
|
@ -249,6 +249,7 @@ pub unsafe extern "C" fn slint_platform_task_run(event: PlatformTaskOpaque) {
|
|||
mod software_renderer {
|
||||
use super::*;
|
||||
type SoftwareRendererOpaque = *const c_void;
|
||||
use i_slint_core::graphics::{IntRect, Rgb8Pixel};
|
||||
use i_slint_core::software_renderer::{RepaintBufferType, Rgb565Pixel, SoftwareRenderer};
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -310,7 +311,6 @@ mod software_renderer {
|
|||
#[cfg(all(feature = "i-slint-renderer-skia", feature = "raw-window-handle"))]
|
||||
pub mod skia {
|
||||
use super::*;
|
||||
use i_slint_core::graphics::{IntRect, IntSize, Rgb8Pixel};
|
||||
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||
|
||||
struct CppRawHandle(RawWindowHandle, RawDisplayHandle);
|
||||
|
|
|
@ -47,11 +47,12 @@ slint_test(models)
|
|||
|
||||
add_subdirectory(multiple-includes)
|
||||
|
||||
if(SLINT_FEATURE_EXPERIMENTAL)
|
||||
slint_test(platform_eventloop)
|
||||
target_link_libraries(test_platform_eventloop PRIVATE Threads::Threads)
|
||||
slint_test(platform_eventloop)
|
||||
target_link_libraries(test_platform_eventloop PRIVATE Threads::Threads)
|
||||
|
||||
if(SLINT_FEATURE_RENDER_SKIA OR SLINT_FEATURE_RENDER_SKIA_OPENGL OR SLINT_FEATURE_RENDER_SKIA_VULKAN)
|
||||
if(Qt6_FOUND)
|
||||
add_subdirectory(manual/platform_qt)
|
||||
endif(Qt6_FOUND)
|
||||
add_subdirectory(manual/platform_native)
|
||||
endif(SLINT_FEATURE_EXPERIMENTAL)
|
||||
endif()
|
||||
|
|
|
@ -89,10 +89,10 @@ pub fn generate(show_warnings: bool) -> Result<(), Box<dyn std::error::Error>> {
|
|||
let generated_headers_dir = docs_build_dir.join("generated_include");
|
||||
let enabled_features = cbindgen::EnabledFeatures {
|
||||
interpreter: true,
|
||||
experimental: false,
|
||||
backend_qt: false,
|
||||
std: true,
|
||||
renderer_software: true,
|
||||
renderer_skia: true,
|
||||
};
|
||||
cbindgen::gen_all(&root, &generated_headers_dir, enabled_features)?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue