Skip to content

Commit

Permalink
Merge pull request #450 from kas-gui/work3
Browse files Browse the repository at this point in the history
Update winit, wgpu, resvg
  • Loading branch information
dhardy committed May 20, 2024
2 parents a86c39c + 1827320 commit bbff149
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 175 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
- name: Build docs
run: |
cargo doc --all --no-deps
cargo doc --all-features --all --no-deps
cargo doc --features nightly --all --no-deps
- name: Test kas-macros
run: |
cargo test --manifest-path crates/kas-macros/Cargo.toml
cargo test --manifest-path crates/kas-macros/Cargo.toml --all-features
- name: Test kas-core
run: |
cargo test --manifest-path crates/kas-core/Cargo.toml --features winit,x11
cargo test --manifest-path crates/kas-core/Cargo.toml --all-features
cargo test --manifest-path crates/kas-core/Cargo.toml --features minimal
cargo test --manifest-path crates/kas-core/Cargo.toml --features nightly
- name: Test kas-widgets
run: |
cargo test --manifest-path crates/kas-widgets/Cargo.toml --features kas/winit,kas/wayland
Expand All @@ -55,9 +55,9 @@ jobs:
cargo test --manifest-path crates/kas-dylib/Cargo.toml --features kas-core/winit,kas-core/wayland
cargo test --manifest-path crates/kas-dylib/Cargo.toml --all-features --features kas-core/winit,kas-core/x11
- name: Test kas
run: |
cargo test
cargo test --all-features
run: cargo test --features nightly
- name: Test kas (experimental)
run: cargo test --features nightly,experimental
- name: Test examples/mandlebrot
run: cargo test --manifest-path examples/mandlebrot/Cargo.toml

Expand Down
13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ rustdoc-args = ["--cfg", "doc_cfg"]
# markdown, resvg. Recommended also: clipboard, yaml (or some config format).
minimal = ["wgpu", "winit", "wayland"]
# All recommended features for optimal experience
default = ["minimal", "x11", "view", "image", "resvg", "clipboard", "markdown", "shaping", "spawn"]
default = ["minimal", "view", "image", "resvg", "clipboard", "markdown", "shaping", "spawn"]
# All standard test target features
# NOTE: dynamic is excluded due to linker problems on Windows
stable = ["default", "serde", "toml", "yaml", "json", "ron", "macros_log"]
# Enables "recommended" unstable features
nightly = ["min_spec"]
stable = ["default", "x11", "serde", "toml", "yaml", "json", "ron", "macros_log"]
# Enables all "recommended" features for nightly rustc
nightly = ["stable", "min_spec"]
# Additional, less recommendation-worthy features
experimental = ["dark-light", "recursive-layout-widgets", "unsafe_node"]

# Enable dynamic linking (faster linking via an extra run-time dependency):
dynamic = ["dep:kas-dylib"]
Expand Down Expand Up @@ -66,8 +67,6 @@ markdown = ["kas-core/markdown"]

# Enable text shaping
shaping = ["kas-core/shaping"]
# Alternative: use Harfbuzz library for shaping
harfbuzz = ["kas-core/harfbuzz"]

# Enable serde support (mainly config read/write)
serde = ["kas-core/serde"]
Expand Down
15 changes: 10 additions & 5 deletions crates/kas-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ features = ["stable"]
rustdoc-args = ["--cfg", "doc_cfg"]

[features]
# All features usable on stable rust
stable = ["winit", "x11", "wayland", "markdown", "yaml", "json", "ron", "shaping", "clipboard", "spawn", "dark-light", "serde"]
# The minimal feature set needed to build basic applications (with assumptions
# about target platforms).
minimal = ["winit", "wayland"]
# All standard test target features
stable = ["minimal", "clipboard", "markdown", "shaping", "spawn", "x11", "serde", "toml", "yaml", "json", "ron", "macros_log"]
# Enables all "recommended" features for nightly rustc
nightly = ["stable"]
# Additional, less recommendation-worthy features
experimental = ["dark-light", "recursive-layout-widgets", "unsafe_node"]

# Use full specialization
spec = []
Expand All @@ -34,8 +41,6 @@ markdown = ["kas-text/markdown"]

# Enable text shaping
shaping = ["kas-text/shaping"]
# Alternative: use Harfbuzz library for shaping
harfbuzz = ["kas-text/harfbuzz"]

# Enable support for YAML (de)serialisation
yaml = ["serde", "dep:serde_yaml"]
Expand Down Expand Up @@ -121,7 +126,7 @@ version = "0.5.0" # used in doc links

[dependencies.winit]
# Provides translations for several winit types
version = "0.29.2"
version = "0.30.0"
optional = true
default-features = false
features = ["rwh_06"]
12 changes: 6 additions & 6 deletions crates/kas-core/src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::util::warn_about_error;
use crate::{impl_scope, Window, WindowId};
use std::cell::{Ref, RefCell, RefMut};
use std::rc::Rc;
use winit::event_loop::{EventLoop, EventLoopBuilder, EventLoopProxy};
use winit::event_loop::{EventLoop, EventLoopProxy};

pub struct Application<Data: AppData, G: AppGraphicsBuilder, T: Theme<G::Shared>> {
el: EventLoop<ProxyAction>,
Expand Down Expand Up @@ -83,7 +83,7 @@ impl_scope! {
});
config.borrow_mut().init();

let el = EventLoopBuilder::with_user_event().build()?;
let el = EventLoop::with_user_event().build()?;

let mut draw_shared = self.graphical.build()?;
draw_shared.set_raster_config(config.borrow().font.raster());
Expand Down Expand Up @@ -211,8 +211,8 @@ where
/// Run the main loop.
#[inline]
pub fn run(self) -> Result<()> {
let mut el = super::EventLoop::new(self.windows, self.state);
self.el.run(move |event, elwt| el.handle(event, elwt))?;
let mut l = super::Loop::new(self.windows, self.state);
self.el.run_app(&mut l)?;
Ok(())
}
}
Expand All @@ -237,8 +237,8 @@ impl<'a> PlatformWrapper<'a> {
{
cfg_if::cfg_if! {
if #[cfg(all(feature = "wayland", feature = "x11"))] {
use winit::platform::wayland::EventLoopWindowTargetExtWayland;
return if self.0.is_wayland() {
use winit::platform::wayland::ActiveEventLoopExtWayland;
return if true /*FIXME: self.0.is_wayland()*/ {
Platform::Wayland
} else {
Platform::X11
Expand Down
Loading

0 comments on commit bbff149

Please sign in to comment.