Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
700 changes: 683 additions & 17 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ members = [
"examples/session-lock-standalone",
"examples/simple-popup",
"examples/surface-input-region",
"examples/multi-surface-compiled",
]

[workspace.package]
Expand Down Expand Up @@ -69,6 +70,7 @@ tracing = { version = "0.1.44", default-features = false, features = ["std"] }
wayland-client = "0.31.12"
wayland-protocols = { version = "0.32.10", features = ["client", "staging"] }
xkbcommon = { version = "0.9.0", features = ["wayland"] }
ordermap = "1.1.0"

layer-shika-domain = { version = "0.3.1", path = "crates/domain" }
layer-shika-adapters = { version = "0.3.1", path = "crates/adapters", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/adapters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ workspace = true
glutin.workspace = true
layer-shika-domain.workspace = true
log = { workspace = true, optional = true }
ordermap.workspace = true
raw-window-handle.workspace = true
slint.workspace = true
slint-interpreter.workspace = true
Expand Down
4 changes: 3 additions & 1 deletion crates/adapters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub(crate) mod wayland;

pub use rendering::femtovg::popup_window::PopupWindow;
pub use wayland::config::{MultiSurfaceConfig, ShellSurfaceConfig, WaylandSurfaceConfig};
pub use wayland::layer_shell_platform::{LayerShell, LayerShellWindow};
pub use wayland::ops::WaylandSystemOps;
pub use wayland::session_lock::{
LockSurfaceOutputContext, OutputFilter, create_lock_property_operation_with_output_filter,
Expand All @@ -26,7 +27,8 @@ pub(crate) mod logger {
}

pub mod platform {
pub use {slint, slint_interpreter};
pub use slint;
pub use slint_interpreter;

pub mod calloop {
pub use smithay_client_toolkit::reexports::calloop::generic::Generic;
Expand Down
16 changes: 14 additions & 2 deletions crates/adapters/src/rendering/femtovg/main_window.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use core::ops::Deref;
use std::cell::Cell;
use std::cell::{Cell, RefCell};
use std::rc::{Rc, Weak};

use slint::platform::femtovg_renderer::FemtoVGRenderer;
use slint::platform::{Renderer, WindowAdapter, WindowEvent};
use slint::platform::{Renderer, WindowAdapter, WindowEvent, WindowProperties};
use slint::{PhysicalSize, Window, WindowSize};

use super::renderable_window::{RenderState, RenderableWindow};
Expand All @@ -16,6 +16,7 @@ pub struct FemtoVGWindow {
render_state: Cell<RenderState>,
size: Cell<PhysicalSize>,
scale_factor: Cell<f32>,
window_properties_handler: RefCell<Option<Rc<dyn for<'a> Fn(WindowProperties<'a>)>>>,
}

impl FemtoVGWindow {
Expand All @@ -29,9 +30,14 @@ impl FemtoVGWindow {
render_state: Cell::new(RenderState::Clean),
size: Cell::new(PhysicalSize::default()),
scale_factor: Cell::new(1.),
window_properties_handler: RefCell::new(None),
}
})
}

pub fn set_window_properties_handler(&self, handler: Rc<dyn for<'a> Fn(WindowProperties<'a>)>) {
self.window_properties_handler.replace(Some(handler));
}
}

impl RenderableWindow for FemtoVGWindow {
Expand Down Expand Up @@ -89,6 +95,12 @@ impl WindowAdapter for FemtoVGWindow {
fn request_redraw(&self) {
RenderableWindow::request_redraw(self);
}

fn update_window_properties(&self, properties: WindowProperties<'_>) {
if let Some(handler) = self.window_properties_handler.borrow().as_ref() {
handler(properties);
}
}
}

impl Deref for FemtoVGWindow {
Expand Down
Loading
Loading