winge
This commit is contained in:
parent
95894168f3
commit
ed82d65c3e
|
|
@ -14,9 +14,7 @@
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PublishReadyToRun>true</PublishReadyToRun>
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
<AssemblyName>Layers</AssemblyName>
|
<AssemblyName>Layers</AssemblyName>
|
||||||
<!-- Baked by the GenerateAppIcon target below before every build. If neither rsvg-convert
|
<EnableMrtResourceIndexer>false</EnableMrtResourceIndexer>
|
||||||
nor magick are on PATH, the file never gets produced and this reference stays elided
|
|
||||||
via the Condition — .NET just uses its default exe icon, build still succeeds. -->
|
|
||||||
<ApplicationIcon Condition="Exists('Assets\app.ico')">Assets\app.ico</ApplicationIcon>
|
<ApplicationIcon Condition="Exists('Assets\app.ico')">Assets\app.ico</ApplicationIcon>
|
||||||
|
|
||||||
<LayersIconSvg>$(MSBuildProjectDirectory)\..\..\..\resources\Layers.svg</LayersIconSvg>
|
<LayersIconSvg>$(MSBuildProjectDirectory)\..\..\..\resources\Layers.svg</LayersIconSvg>
|
||||||
|
|
@ -25,15 +23,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- If NuGet complains "package not found", bump this to the newest 1.5.* or 1.6.* listed
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114002" />
|
||||||
on https://www.nuget.org/packages/Microsoft.WindowsAppSDK. -->
|
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Acord's pattern: let the build system generate the icon so there's no ordering concern
|
|
||||||
between build.bat and dotnet publish, and no separate icon-shuffling step. Runs before
|
|
||||||
the compiler needs to open app.ico. Every Exec has ContinueOnError=true so a missing
|
|
||||||
tool degrades to "no icon" instead of a build failure. -->
|
|
||||||
<Target Name="GenerateAppIcon"
|
<Target Name="GenerateAppIcon"
|
||||||
BeforeTargets="BeforeBuild"
|
BeforeTargets="BeforeBuild"
|
||||||
Condition="Exists('$(LayersIconSvg)') and !Exists('$(LayersIconOut)')">
|
Condition="Exists('$(LayersIconSvg)') and !Exists('$(LayersIconOut)')">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
// Suppress the console window on Windows release builds. The plugin launches from a GUI
|
|
||||||
// context (KiCad pcbnew's toolbar button), not a terminal — the black cmd window that
|
|
||||||
// `subsystem = "console"` would spawn is noise. Debug builds keep the console so stderr
|
|
||||||
// streams when launched from a terminal for diagnostics.
|
|
||||||
#![cfg_attr(all(target_os = "windows", not(debug_assertions)), windows_subsystem = "windows")]
|
#![cfg_attr(all(target_os = "windows", not(debug_assertions)), windows_subsystem = "windows")]
|
||||||
|
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
|
|
@ -209,10 +205,6 @@ impl ShellApp {
|
||||||
} else {
|
} else {
|
||||||
colors.window.alpha_idle
|
colors.window.alpha_idle
|
||||||
};
|
};
|
||||||
// winit 0.30 does not expose a per-platform runtime alpha setter for top-level windows;
|
|
||||||
// `with_transparent(true)` lets the compositor clear-colour carry alpha on Windows/Linux
|
|
||||||
// WMs that support it. The compositor clear is opaque-by-design, so fade happens through
|
|
||||||
// wgpu alpha mode when a translucent background is configured. Stubbed for now.
|
|
||||||
let _ = alpha;
|
let _ = alpha;
|
||||||
let _ = NonZeroU32::new(1);
|
let _ = NonZeroU32::new(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/ffi.rs
10
src/ffi.rs
|
|
@ -39,9 +39,6 @@ pub struct ViewportHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ViewportHandle {
|
impl ViewportHandle {
|
||||||
/// Construct a viewport around already-realised raw window/display handles.
|
|
||||||
/// Used by native shells (winit on Windows/Linux); the macOS FFI path wraps this
|
|
||||||
/// through `layers_create` with AppKit handles built from an NSView pointer.
|
|
||||||
pub fn new_from_raw(
|
pub fn new_from_raw(
|
||||||
raw_window: RawWindowHandle,
|
raw_window: RawWindowHandle,
|
||||||
raw_display: RawDisplayHandle,
|
raw_display: RawDisplayHandle,
|
||||||
|
|
@ -123,8 +120,6 @@ pub extern "C" fn layers_startup() -> i32 {
|
||||||
if init_logging().is_err() {
|
if init_logging().is_err() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
// Preload colours from the compiled-in default so everything works if Swift never calls
|
|
||||||
// `layers_set_plugin_root`. A subsequent call to that FFI will not replace the cache.
|
|
||||||
crate::ui::colors::init(None);
|
crate::ui::colors::init(None);
|
||||||
match single_instance::acquire_or_signal_existing() {
|
match single_instance::acquire_or_signal_existing() {
|
||||||
Ok(single_instance::AcquireOutcome::Primary(guard)) => {
|
Ok(single_instance::AcquireOutcome::Primary(guard)) => {
|
||||||
|
|
@ -139,8 +134,6 @@ pub extern "C" fn layers_startup() -> i32 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Point Rust at the installed plugin root so it can load resources/colors.toml.
|
|
||||||
/// Must be called BEFORE `layers_startup` to take effect; subsequent calls are ignored.
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn layers_set_plugin_root(path_utf8: *const std::os::raw::c_char) {
|
pub extern "C" fn layers_set_plugin_root(path_utf8: *const std::os::raw::c_char) {
|
||||||
if path_utf8.is_null() { return; }
|
if path_utf8.is_null() { return; }
|
||||||
|
|
@ -167,9 +160,6 @@ pub extern "C" fn layers_create(
|
||||||
Box::into_raw(Box::new(handle))
|
Box::into_raw(Box::new(handle))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Windows — create a viewport whose surface renders into a WinUI 3 SwapChainPanel.
|
|
||||||
/// `swap_chain_panel` is the native IInspectable / COM pointer of the XAML element,
|
|
||||||
/// obtained on the C# side via `SwapChainPanelNative.GetSwapChain` friends.
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "C" fn layers_create_from_swap_chain_panel(
|
pub extern "C" fn layers_create_from_swap_chain_panel(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue