# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.2 OR LicenseRef-Slint-commercial

[package]
name = "i-slint-backend-winit"
description = "Winit backend for Slint"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
build = "build.rs"

[lib]
path = "lib.rs"

# Note, these features need to be kept in sync (along with their defaults) in
# the C++ crate's CMakeLists.txt
[features]
wayland = ["winit/wayland", "winit/wayland-csd-adwaita", "glutin?/wayland", "glutin-winit?/wayland", "copypasta/wayland", "i-slint-renderer-skia?/wayland", "softbuffer?/wayland", "softbuffer?/wayland-dlopen"]
x11 = ["winit/x11", "glutin?/x11", "glutin?/glx", "glutin-winit?/x11", "glutin-winit?/glx", "copypasta/x11", "i-slint-renderer-skia?/x11", "softbuffer?/x11", "softbuffer?/x11-dlopen"]
renderer-femtovg = ["dep:i-slint-renderer-femtovg", "dep:glutin", "dep:glutin-winit"]
renderer-skia = ["i-slint-renderer-skia", "winit/rwh_05"]
renderer-skia-opengl = ["renderer-skia", "i-slint-renderer-skia/opengl"]
renderer-skia-vulkan = ["renderer-skia", "i-slint-renderer-skia/vulkan"]
renderer-software = ["dep:softbuffer", "dep:imgref", "dep:rgb", "i-slint-core/software-renderer-systemfonts", "dep:bytemuck", "winit/rwh_05"]
accessibility = ["dep:accesskit", "dep:accesskit_winit"]
raw-window-handle-06 = ["dep:raw-window-handle-06", "winit/rwh_06"]
default = []

[dependencies]
i-slint-core = { workspace = true, features = ["default"] }
i-slint-core-macros = { workspace = true, features = ["default"] }
i-slint-common = { workspace = true, features = ["default"] }

const-field-offset = { version = "0.1", path = "../../../helper_crates/const-field-offset" }

cfg-if = "1"
derive_more = "0.99.5"
lyon_path = "1.0"
once_cell = "1.5"
pin-weak = "1"
scoped-tls-hkt = "0.1"
winit = { version = "0.29.4", default-features = false }
raw-window-handle = { version = "0.5", features = ["alloc"] }
scopeguard =  { version = "1.1.0", default-features = false }

# For the FemtoVG renderer
i-slint-renderer-femtovg = { workspace = true, features = ["default"], optional = true }

# For the Skia renderer
i-slint-renderer-skia = {  workspace = true, features = ["default"], optional = true }

# For the software renderer
softbuffer = { workspace = true, optional = true, default-features = false }
imgref = { version = "1.6.1", optional = true }
rgb = { version = "0.8.27", optional = true }
bytemuck = { workspace = true, optional = true, features = ["derive"] }

raw-window-handle-06 = { workspace = true, optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features=["HtmlInputElement", "HtmlCanvasElement", "Window", "Document", "Event", "KeyboardEvent", "InputEvent", "CompositionEvent", "DomStringMap", "ClipboardEvent", "DataTransfer"] }
wasm-bindgen = { version = "0.2" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
glutin = { workspace = true, optional = true, default-features = false, features = ["egl", "wgl"] }
glutin-winit = { version = "0.4.2", optional = true, default-features = false, features = ["egl", "wgl"] }
accesskit = { version = "0.12.2", optional = true }
accesskit_winit = { version = "0.18.0", optional = true }
copypasta = { version = "0.10", default-features = false }

[target.'cfg(target_os = "macos")'.dependencies]
# For GL rendering
cocoa = { version = "0.25.0" }

[build-dependencies]
cfg_aliases = { workspace = true }

[dev-dependencies]
slint = { path = "../../../api/rs/slint", default-features = false, features = ["std", "compat-1-2", "backend-winit", "renderer-software", "raw-window-handle-06"] }

[package.metadata.docs.rs]
features = ["wayland", "renderer-software"]
