chore: cleanup platform specific code
This commit is contained in:
parent
a11b828280
commit
3b7f0bec0e
18 changed files with 109 additions and 101 deletions
|
|
@ -118,8 +118,9 @@ winit = [
|
|||
"iced_accessibility?/accesskit_winit",
|
||||
"iced_program/winit",
|
||||
]
|
||||
wayland = ["iced_renderer/wayland", "iced_winit/wayland"]
|
||||
cctk = ["iced_winit/cctk", "iced_widget/cctk", "iced_core/cctk", "wayland"]
|
||||
# Enables the sctk shell.
|
||||
wayland = ["iced_widget/wayland", "iced_core/wayland", "iced_winit/wayland"]
|
||||
[dependencies]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ crisp = []
|
|||
basic-shaping = []
|
||||
advanced-shaping = []
|
||||
a11y = ["iced_accessibility"]
|
||||
wayland = ["cctk"]
|
||||
|
||||
[dependencies]
|
||||
palette = "0.7"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use crate::keyboard;
|
|||
use crate::mouse;
|
||||
use crate::touch;
|
||||
use crate::window;
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
/// A platform specific event for wayland
|
||||
pub mod wayland;
|
||||
/// A user interface event.
|
||||
|
|
@ -49,7 +49,7 @@ pub enum Event {
|
|||
/// A platform specific event
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum PlatformSpecific {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
/// A Wayland specific event
|
||||
Wayland(wayland::Event),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ workspace = true
|
|||
debug = []
|
||||
selector = ["dep:iced_selector"]
|
||||
a11y = ["iced_accessibility", "iced_core/a11y"]
|
||||
wayland = ["iced_core/wayland", "cctk"]
|
||||
cctk = ["iced_core/cctk", "dep:cctk"]
|
||||
|
||||
[dependencies]
|
||||
bytes.workspace = true
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
use std::fmt;
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
/// Platform specific actions defined for wayland
|
||||
pub mod wayland;
|
||||
|
||||
/// Platform specific actions defined for wayland
|
||||
pub enum Action {
|
||||
/// Wayland Specific Actions
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
Wayland(wayland::Action),
|
||||
}
|
||||
|
||||
impl fmt::Debug for Action {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
Action::Wayland(action) => action.fmt(_f),
|
||||
#[cfg(not(feature = "wayland"))]
|
||||
_ => Ok(()),
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ pub fn frames() -> Subscription<(Id, Instant)> {
|
|||
_ => None,
|
||||
})
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
/// Subscribes to the frames of the window of the running application.
|
||||
///
|
||||
/// The resulting [`Subscription`] will produce items at a rate equal to the
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ pub mod font {
|
|||
pub mod event {
|
||||
//! Handle events of a user interface.
|
||||
pub use crate::core::event::PlatformSpecific;
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
pub use crate::core::event::wayland;
|
||||
pub use crate::core::event::{Event, Status};
|
||||
pub use iced_futures::event::{listen, listen_raw, listen_with};
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ resvg.optional = true
|
|||
rustix = { version = "0.38" }
|
||||
raw-window-handle.workspace = true
|
||||
cctk.workspace = true
|
||||
cctk.optional = true
|
||||
wayland-protocols.workspace = true
|
||||
wayland-backend = { version = "0.3.3", features = ["client_system"] }
|
||||
wayland-client = { version = "0.31.2" }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
//! Display rendering results on windows.
|
||||
pub mod compositor;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
mod wayland;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
mod x11;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,12 @@ use crate::graphics::{self, Shell, Viewport};
|
|||
use crate::settings::{self, Settings};
|
||||
use crate::{Engine, Renderer};
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
use super::wayland::get_wayland_device_ids;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
use super::x11::get_x11_device_ids;
|
||||
|
|
@ -60,7 +65,12 @@ impl Compositor {
|
|||
compatible_window: Option<W>,
|
||||
shell: Shell,
|
||||
) -> Result<Self, Error> {
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
let ids = compatible_window.as_ref().and_then(|window| {
|
||||
get_wayland_device_ids(window)
|
||||
.or_else(|| get_x11_device_ids(window))
|
||||
|
|
@ -72,7 +82,12 @@ impl Compositor {
|
|||
// 3. and the user didn't set an adapter name,
|
||||
// 4. and the user didn't request the high power pref
|
||||
// => don't load the nvidia icd, as it might power on the gpu in hybrid setups causing severe delays
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
if !matches!(ids, Some((0x10de, _)))
|
||||
&& std::env::var_os("__NV_PRIME_RENDER_OFFLOAD")
|
||||
.is_none_or(|var| var == "0")
|
||||
|
|
@ -133,6 +148,7 @@ impl Compositor {
|
|||
if std::env::var_os("WGPU_ADAPTER_NAME").is_none() {
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use cctk::sctk::{
|
|||
};
|
||||
use raw_window_handle::{RawDisplayHandle, WaylandDisplayHandle};
|
||||
use wayland_client::{
|
||||
backend::Backend, globals::registry_queue_init, protocol::wl_buffer,
|
||||
Connection, QueueHandle,
|
||||
Connection, QueueHandle, backend::Backend, globals::registry_queue_init,
|
||||
protocol::wl_buffer,
|
||||
};
|
||||
use wayland_protocols::wp::linux_dmabuf::zv1::client::{
|
||||
zwp_linux_buffer_params_v1, zwp_linux_dmabuf_feedback_v1,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ highlighter = ["dep:iced_highlighter"]
|
|||
advanced = []
|
||||
crisp = []
|
||||
a11y = ["iced_accessibility"]
|
||||
wayland = ["cctk", "iced_runtime/wayland"]
|
||||
cctk = ["iced_runtime/cctk", "dep:cctk"]
|
||||
|
||||
[dependencies]
|
||||
iced_renderer.workspace = true
|
||||
|
|
|
|||
|
|
@ -14,18 +14,7 @@ keywords.workspace = true
|
|||
workspace = true
|
||||
|
||||
[features]
|
||||
wayland = [
|
||||
"winit/wayland",
|
||||
"cctk",
|
||||
"wayland-protocols",
|
||||
"raw-window-handle",
|
||||
"iced_runtime/wayland",
|
||||
"wayland-backend",
|
||||
"xkbcommon",
|
||||
"xkbcommon-dl",
|
||||
"xkeysym",
|
||||
"wayland-csd-adwaita",
|
||||
]
|
||||
wayland = ["winit/wayland", "wayland-csd-adwaita"]
|
||||
default = ["x11", "wayland-dlopen"]
|
||||
debug = ["iced_debug/enable"]
|
||||
sysinfo = ["dep:sysinfo"]
|
||||
|
|
@ -37,6 +26,17 @@ program = []
|
|||
wayland-dlopen = ["winit/wayland-dlopen"]
|
||||
wayland-csd-adwaita = ["winit/wayland-csd-adwaita"]
|
||||
a11y = ["iced_accessibility", "iced_runtime/a11y"]
|
||||
cctk = [
|
||||
"wayland",
|
||||
"wayland-protocols",
|
||||
"raw-window-handle",
|
||||
"iced_runtime/cctk",
|
||||
"wayland-backend",
|
||||
"xkbcommon",
|
||||
"xkbcommon-dl",
|
||||
"xkeysym",
|
||||
"dep:cctk",
|
||||
]
|
||||
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ pub fn window_attributes(
|
|||
),
|
||||
));
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
use winit::platform::wayland::WindowAttributesWayland;
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ pub fn window_event(
|
|||
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
|
||||
Some(Event::Window(window::Event::Rescaled(scale_factor as f32)))
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
WindowEvent::SuggestedBounds(bounds) => {
|
||||
let size = bounds.map(|bounds| {
|
||||
let size = bounds.to_logical(scale_factor);
|
||||
|
|
@ -437,7 +437,7 @@ pub fn window_event(
|
|||
),
|
||||
)))
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
WindowEvent::WindowStateChanged => {
|
||||
use cctk::sctk::reexports::csd_frame::WindowState;
|
||||
use winit::platform::wayland::WindowExtWayland;
|
||||
|
|
@ -1491,7 +1491,7 @@ pub fn winit_key_code(
|
|||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
fn winit_native_key_code(
|
||||
keycode: keyboard::key::NativeCode,
|
||||
) -> winit::keyboard::NativeKeyCode {
|
||||
|
|
@ -1515,7 +1515,7 @@ fn winit_native_key_code(
|
|||
}
|
||||
|
||||
/// Reconstruct the raw keycode
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
pub fn physical_to_scancode(physical: keyboard::key::Physical) -> Option<u32> {
|
||||
let Some(physical_key) = (match physical {
|
||||
keyboard::key::Physical::Code(code) => {
|
||||
|
|
|
|||
|
|
@ -98,10 +98,10 @@ where
|
|||
|
||||
let event_loop = EventLoop::new().expect("Create event loop");
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
let is_wayland =
|
||||
winit::platform::wayland::EventLoopExtWayland::is_wayland(&event_loop);
|
||||
#[cfg(not(feature = "wayland"))]
|
||||
#[cfg(not(all(feature = "cctk", target_os = "linux")))]
|
||||
let is_wayland = false;
|
||||
|
||||
// TODO this is new..
|
||||
|
|
@ -194,6 +194,9 @@ where
|
|||
system_theme: Option<oneshot::Sender<theme::Mode>>,
|
||||
control_sender: mpsc::UnboundedSender<Control>,
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters: std::collections::HashMap<window::Id, (u64, iced_accessibility::accesskit_winit::Adapter)>,
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
is_booted: std::rc::Rc<std::cell::RefCell<bool>>,
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
@ -216,6 +219,9 @@ where
|
|||
error: None,
|
||||
system_theme: Some(system_theme_sender),
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters: Default::default(),
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
canvas: None,
|
||||
};
|
||||
|
|
@ -257,7 +263,7 @@ where
|
|||
| winit::event::WindowEvent::Moved(_)
|
||||
);
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
if matches!(event, WindowEvent::RedrawRequested) {
|
||||
for id in
|
||||
|
|
@ -558,7 +564,7 @@ where
|
|||
.expect("Send event");
|
||||
}
|
||||
Control::Winit(id, e) => {
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
if matches!(e, WindowEvent::RedrawRequested)
|
||||
{
|
||||
|
|
@ -621,22 +627,23 @@ where
|
|||
proxy: self.control_sender.clone(),
|
||||
};
|
||||
|
||||
self.sender
|
||||
.start_send(Event::A11yAdapter(
|
||||
id,
|
||||
(
|
||||
node_id,
|
||||
Adapter::with_direct_handlers(
|
||||
event_loop,
|
||||
window.as_ref(),
|
||||
activation_handler,
|
||||
action_handler,
|
||||
deactivation_handler,
|
||||
),
|
||||
_ = self.adapters.insert(
|
||||
id,
|
||||
(
|
||||
node_id,
|
||||
Adapter::with_direct_handlers(
|
||||
event_loop,
|
||||
window.as_ref(),
|
||||
activation_handler,
|
||||
action_handler,
|
||||
deactivation_handler,
|
||||
),
|
||||
))
|
||||
.expect("send event");
|
||||
),
|
||||
);
|
||||
}
|
||||
Control::Cleanup(id) => {
|
||||
_ = self.adapters.remove(&id);
|
||||
},
|
||||
},
|
||||
_ => {
|
||||
break;
|
||||
|
|
@ -680,11 +687,11 @@ enum Event<Message: 'static> {
|
|||
Accessibility(window::Id, iced_accessibility::accesskit::ActionRequest),
|
||||
#[cfg(feature = "a11y")]
|
||||
AccessibilityEnabled(bool),
|
||||
#[cfg(feature = "a11y")]
|
||||
A11yAdapter(
|
||||
window::Id,
|
||||
(u64, iced_accessibility::accesskit_winit::Adapter),
|
||||
),
|
||||
// #[cfg(feature = "a11y")]
|
||||
// A11yAdapter(
|
||||
// window::Id,
|
||||
// (u64, iced_accessibility::accesskit_winit::Adapter),
|
||||
// ),
|
||||
Winit(winit::window::WindowId, winit::event::WindowEvent),
|
||||
AboutToWait,
|
||||
UserEvent(Action<Message>),
|
||||
|
|
@ -697,6 +704,7 @@ enum Control {
|
|||
ChangeFlow(winit::event_loop::ControlFlow),
|
||||
Exit,
|
||||
Crash(Error),
|
||||
Cleanup(window::Id),
|
||||
CreateWindow {
|
||||
id: window::Id,
|
||||
settings: window::Settings,
|
||||
|
|
@ -743,7 +751,7 @@ async fn run_instance<P>(
|
|||
|
||||
let mut platform_specific_handler =
|
||||
crate::platform_specific::PlatformSpecific::default();
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
if is_wayland {
|
||||
platform_specific_handler = platform_specific_handler.with_wayland(
|
||||
control_sender.clone(),
|
||||
|
|
@ -774,7 +782,7 @@ async fn run_instance<P>(
|
|||
let mut dnd_surface_id: Option<window::Id> = None;
|
||||
|
||||
#[cfg(feature = "a11y")]
|
||||
let (mut adapters, mut a11y_enabled) = (Default::default(), false);
|
||||
let mut a11y_enabled = false;
|
||||
|
||||
#[cfg(all(feature = "linux-theme-detection", target_os = "linux"))]
|
||||
let mut system_theme = {
|
||||
|
|
@ -836,7 +844,7 @@ async fn run_instance<P>(
|
|||
control_sender
|
||||
.start_send(Control::InitAdapter(id, window.clone()))
|
||||
.expect("Send control message");
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
platform_specific_handler.send_wayland(
|
||||
platform_specific::Action::TrackWindow(window.clone(), id),
|
||||
);
|
||||
|
|
@ -1012,7 +1020,7 @@ async fn run_instance<P>(
|
|||
continue;
|
||||
}
|
||||
// XX must force update to corner radius before the surface is committed.
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
if (window.surface_version != window.state.surface_version()
|
||||
|| window.logical_size() != window.state.logical_size()
|
||||
) && !crate::subsurface_widget::is_subsurface(window_id)
|
||||
|
|
@ -1382,7 +1390,7 @@ async fn run_instance<P>(
|
|||
}
|
||||
});
|
||||
let no_window_events = window_events.is_empty();
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
window_events.push(core::Event::PlatformSpecific(
|
||||
core::event::PlatformSpecific::Wayland(
|
||||
core::event::wayland::Event::RequestResize,
|
||||
|
|
@ -1646,8 +1654,6 @@ async fn run_instance<P>(
|
|||
&mut window_manager,
|
||||
&mut user_interfaces,
|
||||
&mut clipboard,
|
||||
#[cfg(feature = "a11y")]
|
||||
&mut adapters,
|
||||
CreateCompositor {
|
||||
proxy: &proxy,
|
||||
display_handle: &display_handle,
|
||||
|
|
@ -1884,10 +1890,6 @@ async fn run_instance<P>(
|
|||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "a11y")]
|
||||
Event::A11yAdapter(id, adapter) => {
|
||||
_ = adapters.insert(id, adapter);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -2124,8 +2126,9 @@ where
|
|||
window::Action::Close(id) => {
|
||||
let _ = ui_caches.remove(&id);
|
||||
let _ = interfaces.remove(&id);
|
||||
_ = control_sender.start_send(Control::Cleanup(id)).ok();
|
||||
let proxy = clipboard.proxy();
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
platform_specific
|
||||
.send_wayland(platform_specific::Action::RemoveWindow(id));
|
||||
if let Some(window) = window_manager.remove(id) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use std::{borrow::Cow, collections::HashMap, sync::Arc};
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
use cctk::sctk::reexports::client::Connection;
|
||||
use iced_graphics::{Compositor, compositor};
|
||||
use iced_runtime::{
|
||||
|
|
@ -12,12 +12,12 @@ use iced_runtime::{
|
|||
};
|
||||
use winit::raw_window_handle::HasWindowHandle;
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
pub mod wayland;
|
||||
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
pub use wayland::*;
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
use wayland_backend::client::Backend;
|
||||
|
||||
use crate::{CreateCompositor, Program, WindowManager};
|
||||
|
|
@ -35,7 +35,7 @@ pub type UserInterfaces<'a, P> = HashMap<
|
|||
|
||||
#[derive(Debug)]
|
||||
pub enum Event {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
Wayland(sctk_event::SctkEvent),
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ impl SurfaceIdWrapper {
|
|||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct PlatformSpecific {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
wayland: WaylandSpecific,
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ impl PlatformSpecific {
|
|||
action: iced_runtime::platform_specific::Action,
|
||||
) {
|
||||
match action {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
iced_runtime::platform_specific::Action::Wayland(a) => {
|
||||
self.send_wayland(wayland::Action::Action(a));
|
||||
}
|
||||
|
|
@ -82,14 +82,14 @@ impl PlatformSpecific {
|
|||
&mut self,
|
||||
keep: F,
|
||||
) {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
self.wayland.retain_subsurfaces(keep);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn clear_subsurface_list(&mut self) {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
self.wayland.clear_subsurface_list();
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ impl PlatformSpecific {
|
|||
id: window::Id,
|
||||
window: &dyn HasWindowHandle,
|
||||
) {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
use cctk::sctk::reexports::client::{
|
||||
Proxy, protocol::wl_surface::WlSurface,
|
||||
|
|
@ -151,7 +151,7 @@ impl PlatformSpecific {
|
|||
pub(crate) fn create_surface(
|
||||
&mut self,
|
||||
) -> Option<Box<dyn HasWindowHandle + Send + Sync + 'static>> {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
return self.wayland.create_surface();
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ impl PlatformSpecific {
|
|||
data: &[u8],
|
||||
offset: Vector,
|
||||
) {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
{
|
||||
return self.wayland.update_surface_shm(
|
||||
surface, width, height, scale, data, offset,
|
||||
|
|
@ -190,16 +190,12 @@ pub(crate) async fn handle_event<'a, 'b, P>(
|
|||
>,
|
||||
user_interfaces: &mut UserInterfaces<'a, P>,
|
||||
clipboard: &mut crate::Clipboard,
|
||||
#[cfg(feature = "a11y")] adapters: &mut std::collections::HashMap<
|
||||
window::Id,
|
||||
(u64, iced_accessibility::accesskit_winit::Adapter),
|
||||
>,
|
||||
create_compositor: CreateCompositor<'b, P>,
|
||||
) where
|
||||
P: Program,
|
||||
{
|
||||
match e {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
#[cfg(all(feature = "cctk", target_os = "linux"))]
|
||||
Event::Wayland(e) => {
|
||||
platform_specific
|
||||
.wayland
|
||||
|
|
@ -211,8 +207,6 @@ pub(crate) async fn handle_event<'a, 'b, P>(
|
|||
window_manager,
|
||||
user_interfaces,
|
||||
clipboard,
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters,
|
||||
create_compositor,
|
||||
)
|
||||
.await;
|
||||
|
|
|
|||
|
|
@ -164,10 +164,6 @@ impl WaylandSpecific {
|
|||
>,
|
||||
user_interfaces: &mut UserInterfaces<'a, P>,
|
||||
clipboard: &mut crate::Clipboard,
|
||||
#[cfg(feature = "a11y")] adapters: &mut HashMap<
|
||||
window::Id,
|
||||
(u64, iced_accessibility::accesskit_winit::Adapter),
|
||||
>,
|
||||
create_compositor: CreateCompositor<'b, P>,
|
||||
) where
|
||||
P: Program,
|
||||
|
|
@ -213,8 +209,6 @@ impl WaylandSpecific {
|
|||
events,
|
||||
clipboard,
|
||||
subsurface_state,
|
||||
#[cfg(feature = "a11y")]
|
||||
adapters,
|
||||
create_compositor,
|
||||
)
|
||||
.await;
|
||||
|
|
|
|||
|
|
@ -361,10 +361,6 @@ impl SctkEvent {
|
|||
events: &mut Vec<(Option<window::Id>, iced_runtime::core::Event)>,
|
||||
clipboard: &mut Clipboard,
|
||||
subsurface_state: &mut Option<SubsurfaceState>,
|
||||
#[cfg(feature = "a11y")] adapters: &mut HashMap<
|
||||
window::Id,
|
||||
(u64, iced_accessibility::accesskit_winit::Adapter),
|
||||
>,
|
||||
create_compositor_data: CreateCompositor<'b, P>,
|
||||
) where
|
||||
P: Program,
|
||||
|
|
@ -472,8 +468,7 @@ impl SctkEvent {
|
|||
x: -horizontal.value120 as f32 / 120.,
|
||||
y: -vertical.value120 as f32 / 120.,
|
||||
}
|
||||
} else if horizontal.discrete != 0
|
||||
|| vertical.discrete != 0
|
||||
} else if horizontal.discrete != 0 || vertical.discrete != 0
|
||||
{
|
||||
mouse::ScrollDelta::Lines {
|
||||
x: -horizontal.discrete as f32,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue