diff --git a/src/event.rs b/src/event.rs
index 067e3ed0..0ca6e875 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -672,7 +672,7 @@ pub struct KeyEvent {
// Allowing `broken_intra_doc_links` for `logical_key`, because
// `key_without_modifiers` is not available on all platforms
#[cfg_attr(
- not(any(target_os = "macos", target_os = "windows", target_os = "linux")),
+ not(any(windows_platform, macos_platform, x11_platform, wayland_platform)),
allow(rustdoc::broken_intra_doc_links)
)]
/// This value is affected by all modifiers except Ctrl.
diff --git a/src/event_loop.rs b/src/event_loop.rs
index 38cc38d8..417c1d4c 100644
--- a/src/event_loop.rs
+++ b/src/event_loop.rs
@@ -374,9 +374,8 @@ impl EventLoopWindowTarget {
/// - **Wayland / macOS / iOS / Android / Orbital:** Unsupported.
///
/// [`DeviceEvent`]: crate::event::DeviceEvent
- pub fn listen_device_events(&self, _allowed: DeviceEvents) {
- #[cfg(any(x11_platform, wasm_platform, wayland_platform, windows))]
- self.p.listen_device_events(_allowed);
+ pub fn listen_device_events(&self, allowed: DeviceEvents) {
+ self.p.listen_device_events(allowed);
}
}
diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs
index 22f8cf9a..48699c7e 100644
--- a/src/platform_impl/android/mod.rs
+++ b/src/platform_impl/android/mod.rs
@@ -23,7 +23,7 @@ use crate::{
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
error,
event::{self, InnerSizeWriter, StartCause},
- event_loop::{self, ControlFlow, EventLoopWindowTarget as RootELW},
+ event_loop::{self, ControlFlow, DeviceEvents, EventLoopWindowTarget as RootELW},
platform::pump_events::PumpStatus,
window::{
self, CursorGrabMode, ImePurpose, ResizeDirection, Theme, WindowButtons, WindowLevel,
@@ -743,6 +743,9 @@ impl EventLoopWindowTarget {
v
}
+ #[inline]
+ pub fn listen_device_events(&self, _allowed: DeviceEvents) {}
+
pub fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::Android(AndroidDisplayHandle::empty())
}
@@ -995,6 +998,8 @@ impl Window {
None
}
+ pub fn set_content_protected(&self, _protected: bool) {}
+
pub fn has_focus(&self) -> bool {
*HAS_FOCUS.read().unwrap()
}
diff --git a/src/platform_impl/ios/event_loop.rs b/src/platform_impl/ios/event_loop.rs
index e3ad63b5..0f3dcb17 100644
--- a/src/platform_impl/ios/event_loop.rs
+++ b/src/platform_impl/ios/event_loop.rs
@@ -22,7 +22,8 @@ use crate::{
error::EventLoopError,
event::Event,
event_loop::{
- ControlFlow, EventLoopClosed, EventLoopWindowTarget as RootEventLoopWindowTarget,
+ ControlFlow, DeviceEvents, EventLoopClosed,
+ EventLoopWindowTarget as RootEventLoopWindowTarget,
},
platform::ios::Idiom,
};
@@ -45,6 +46,9 @@ impl EventLoopWindowTarget {
Some(MonitorHandle::new(UIScreen::main(self.mtm)))
}
+ #[inline]
+ pub fn listen_device_events(&self, _allowed: DeviceEvents) {}
+
pub fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::UiKit(UiKitDisplayHandle::empty())
}
diff --git a/src/platform_impl/ios/window.rs b/src/platform_impl/ios/window.rs
index 336d0191..f80ea9f6 100644
--- a/src/platform_impl/ios/window.rs
+++ b/src/platform_impl/ios/window.rs
@@ -342,6 +342,8 @@ impl Inner {
None
}
+ pub fn set_content_protected(&self, _protected: bool) {}
+
pub fn has_focus(&self) -> bool {
self.window.isKeyWindow()
}
diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs
index ff28701a..9eb15c8f 100644
--- a/src/platform_impl/linux/mod.rs
+++ b/src/platform_impl/linux/mod.rs
@@ -283,7 +283,7 @@ impl VideoMode {
#[inline]
pub fn monitor(&self) -> MonitorHandle {
- x11_or_wayland!(match self; VideoMode(m) => m.monitor())
+ x11_or_wayland!(match self; VideoMode(m) => m.monitor(); as MonitorHandle)
}
}
@@ -316,12 +316,7 @@ impl Window {
#[inline]
pub fn id(&self) -> WindowId {
- match self {
- #[cfg(wayland_platform)]
- Self::Wayland(window) => window.id(),
- #[cfg(x11_platform)]
- Self::X(window) => window.id(),
- }
+ x11_or_wayland!(match self; Window(w) => w.id())
}
#[inline]
@@ -500,23 +495,13 @@ impl Window {
}
#[inline]
- pub fn set_window_level(&self, _level: WindowLevel) {
- match self {
- #[cfg(x11_platform)]
- Window::X(ref w) => w.set_window_level(_level),
- #[cfg(wayland_platform)]
- Window::Wayland(_) => (),
- }
+ pub fn set_window_level(&self, level: WindowLevel) {
+ x11_or_wayland!(match self; Window(w) => w.set_window_level(level))
}
#[inline]
- pub fn set_window_icon(&self, _window_icon: Option) {
- match self {
- #[cfg(x11_platform)]
- Window::X(ref w) => w.set_window_icon(_window_icon),
- #[cfg(wayland_platform)]
- Window::Wayland(_) => (),
- }
+ pub fn set_window_icon(&self, window_icon: Option) {
+ x11_or_wayland!(match self; Window(w) => w.set_window_icon(window_icon.map(|icon| icon.inner)))
}
#[inline]
@@ -541,12 +526,7 @@ impl Window {
#[inline]
pub fn focus_window(&self) {
- match self {
- #[cfg(x11_platform)]
- Window::X(ref w) => w.focus_window(),
- #[cfg(wayland_platform)]
- Window::Wayland(_) => (),
- }
+ x11_or_wayland!(match self; Window(w) => w.focus_window())
}
pub fn request_user_attention(&self, request_type: Option) {
x11_or_wayland!(match self; Window(w) => w.request_user_attention(request_type))
@@ -564,18 +544,7 @@ impl Window {
#[inline]
pub fn current_monitor(&self) -> Option {
- match self {
- #[cfg(x11_platform)]
- Window::X(ref window) => {
- let current_monitor = MonitorHandle::X(window.current_monitor());
- Some(current_monitor)
- }
- #[cfg(wayland_platform)]
- Window::Wayland(ref window) => {
- let current_monitor = MonitorHandle::Wayland(window.current_monitor()?);
- Some(current_monitor)
- }
- }
+ Some(x11_or_wayland!(match self; Window(w) => w.current_monitor()?; as MonitorHandle))
}
#[inline]
@@ -598,15 +567,7 @@ impl Window {
#[inline]
pub fn primary_monitor(&self) -> Option {
- match self {
- #[cfg(x11_platform)]
- Window::X(ref window) => {
- let primary_monitor = MonitorHandle::X(window.primary_monitor());
- Some(primary_monitor)
- }
- #[cfg(wayland_platform)]
- Window::Wayland(ref window) => window.primary_monitor(),
- }
+ Some(x11_or_wayland!(match self; Window(w) => w.primary_monitor()?; as MonitorHandle))
}
#[inline]
@@ -629,6 +590,10 @@ impl Window {
x11_or_wayland!(match self; Window(window) => window.theme())
}
+ pub fn set_content_protected(&self, protected: bool) {
+ x11_or_wayland!(match self; Window(window) => window.set_content_protected(protected))
+ }
+
#[inline]
pub fn has_focus(&self) -> bool {
x11_or_wayland!(match self; Window(window) => window.has_focus())
@@ -843,41 +808,25 @@ impl EventLoopWindowTarget {
#[cfg(wayland_platform)]
EventLoopWindowTarget::Wayland(ref evlp) => evlp
.available_monitors()
- .into_iter()
.map(MonitorHandle::Wayland)
.collect(),
#[cfg(x11_platform)]
- EventLoopWindowTarget::X(ref evlp) => evlp
- .x_connection()
- .available_monitors()
- .into_iter()
- .flatten()
- .map(MonitorHandle::X)
- .collect(),
- }
- }
-
- #[inline]
- pub fn primary_monitor(&self) -> Option {
- match *self {
- #[cfg(wayland_platform)]
- EventLoopWindowTarget::Wayland(ref evlp) => evlp.primary_monitor(),
- #[cfg(x11_platform)]
EventLoopWindowTarget::X(ref evlp) => {
- let primary_monitor = MonitorHandle::X(evlp.x_connection().primary_monitor().ok()?);
- Some(primary_monitor)
+ evlp.available_monitors().map(MonitorHandle::X).collect()
}
}
}
#[inline]
- pub fn listen_device_events(&self, _allowed: DeviceEvents) {
- match *self {
- #[cfg(wayland_platform)]
- EventLoopWindowTarget::Wayland(_) => (),
- #[cfg(x11_platform)]
- EventLoopWindowTarget::X(ref evlp) => evlp.set_listen_device_events(_allowed),
- }
+ pub fn primary_monitor(&self) -> Option {
+ Some(
+ x11_or_wayland!(match self; EventLoopWindowTarget(evlp) => evlp.primary_monitor()?; as MonitorHandle),
+ )
+ }
+
+ #[inline]
+ pub fn listen_device_events(&self, allowed: DeviceEvents) {
+ x11_or_wayland!(match self; Self(evlp) => evlp.listen_device_events(allowed))
}
pub fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
diff --git a/src/platform_impl/linux/wayland/event_loop/mod.rs b/src/platform_impl/linux/wayland/event_loop/mod.rs
index 74271e62..83670854 100644
--- a/src/platform_impl/linux/wayland/event_loop/mod.rs
+++ b/src/platform_impl/linux/wayland/event_loop/mod.rs
@@ -19,7 +19,9 @@ use sctk::reexports::client::{Connection, Proxy, QueueHandle, WaylandSource};
use crate::dpi::{LogicalSize, PhysicalSize};
use crate::error::{EventLoopError, OsError as RootOsError};
use crate::event::{Event, InnerSizeWriter, StartCause, WindowEvent};
-use crate::event_loop::{ControlFlow, EventLoopWindowTarget as RootEventLoopWindowTarget};
+use crate::event_loop::{
+ ControlFlow, DeviceEvents, EventLoopWindowTarget as RootEventLoopWindowTarget,
+};
use crate::platform::pump_events::PumpStatus;
use crate::platform_impl::platform::min_timeout;
use crate::platform_impl::platform::sticky_exit_callback;
@@ -681,6 +683,9 @@ pub struct EventLoopWindowTarget {
}
impl EventLoopWindowTarget {
+ #[inline]
+ pub fn listen_device_events(&self, _allowed: DeviceEvents) {}
+
pub fn raw_display_handle(&self) -> RawDisplayHandle {
let mut display_handle = WaylandDisplayHandle::empty();
display_handle.display = self.connection.display().id().as_ptr() as *mut _;
diff --git a/src/platform_impl/linux/wayland/output.rs b/src/platform_impl/linux/wayland/output.rs
index a7878511..785526d9 100644
--- a/src/platform_impl/linux/wayland/output.rs
+++ b/src/platform_impl/linux/wayland/output.rs
@@ -4,25 +4,22 @@ use sctk::reexports::client::Proxy;
use sctk::output::OutputData;
use crate::dpi::{PhysicalPosition, PhysicalSize};
-use crate::platform_impl::platform::{
- MonitorHandle as PlatformMonitorHandle, VideoMode as PlatformVideoMode,
-};
+use crate::platform_impl::platform::VideoMode as PlatformVideoMode;
use super::event_loop::EventLoopWindowTarget;
impl EventLoopWindowTarget {
#[inline]
- pub fn available_monitors(&self) -> Vec {
+ pub fn available_monitors(&self) -> impl Iterator- {
self.state
.borrow()
.output_state
.outputs()
.map(MonitorHandle::new)
- .collect()
}
#[inline]
- pub fn primary_monitor(&self) -> Option {
+ pub fn primary_monitor(&self) -> Option {
// There's no primary monitor on Wayland.
None
}
@@ -157,7 +154,7 @@ impl VideoMode {
self.refresh_rate_millihertz
}
- pub fn monitor(&self) -> PlatformMonitorHandle {
- PlatformMonitorHandle::Wayland(self.monitor.clone())
+ pub fn monitor(&self) -> MonitorHandle {
+ self.monitor.clone()
}
}
diff --git a/src/platform_impl/linux/wayland/window/mod.rs b/src/platform_impl/linux/wayland/window/mod.rs
index 14085808..88f1437d 100644
--- a/src/platform_impl/linux/wayland/window/mod.rs
+++ b/src/platform_impl/linux/wayland/window/mod.rs
@@ -24,12 +24,12 @@ use crate::error::{ExternalError, NotSupportedError, OsError as RootOsError};
use crate::event::{Ime, WindowEvent};
use crate::event_loop::AsyncRequestSerial;
use crate::platform_impl::{
- Fullscreen, MonitorHandle as PlatformMonitorHandle, OsError,
+ Fullscreen, MonitorHandle as PlatformMonitorHandle, OsError, PlatformIcon,
PlatformSpecificWindowBuilderAttributes as PlatformAttributes,
};
use crate::window::{
CursorGrabMode, CursorIcon, ImePurpose, ResizeDirection, Theme, UserAttentionType,
- WindowAttributes, WindowButtons,
+ WindowAttributes, WindowButtons, WindowLevel,
};
use super::event_loop::sink::EventSink;
@@ -419,6 +419,12 @@ impl Window {
self.window_state.lock().unwrap().is_decorated()
}
+ #[inline]
+ pub fn set_window_level(&self, _level: WindowLevel) {}
+
+ #[inline]
+ pub(crate) fn set_window_icon(&self, _window_icon: Option) {}
+
#[inline]
pub fn set_minimized(&self, minimized: bool) {
// You can't unminimize the window on Wayland.
@@ -612,6 +618,9 @@ impl Window {
self.window_state.lock().unwrap().set_ime_purpose(purpose);
}
+ #[inline]
+ pub fn focus_window(&self) {}
+
#[inline]
pub fn surface(&self) -> &WlSurface {
self.window.wl_surface()
@@ -629,7 +638,7 @@ impl Window {
}
#[inline]
- pub fn primary_monitor(&self) -> Option {
+ pub fn primary_monitor(&self) -> Option {
// XXX there's no such concept on Wayland.
None
}
@@ -658,6 +667,8 @@ impl Window {
self.window_state.lock().unwrap().theme()
}
+ pub fn set_content_protected(&self, _protected: bool) {}
+
#[inline]
pub fn title(&self) -> String {
self.window_state.lock().unwrap().title().to_owned()
diff --git a/src/platform_impl/linux/x11/event_processor.rs b/src/platform_impl/linux/x11/event_processor.rs
index 03941201..81a816a4 100644
--- a/src/platform_impl/linux/x11/event_processor.rs
+++ b/src/platform_impl/linux/x11/event_processor.rs
@@ -1317,7 +1317,8 @@ impl EventProcessor {
for (window_id, window) in wt.windows.borrow().iter() {
if let Some(window) = window.upgrade() {
// Check if the window is on this monitor
- let monitor = window.current_monitor();
+ let monitor =
+ window.shared_state_lock().last_monitor.clone();
if monitor.name == new_monitor.name {
let (width, height) = window.inner_size_physical();
let (new_width, new_height) = window.adjust_for_dpi(
diff --git a/src/platform_impl/linux/x11/mod.rs b/src/platform_impl/linux/x11/mod.rs
index e67488aa..d1ed5ebb 100644
--- a/src/platform_impl/linux/x11/mod.rs
+++ b/src/platform_impl/linux/x11/mod.rs
@@ -706,7 +706,15 @@ impl EventLoopWindowTarget {
&self.xconn
}
- pub fn set_listen_device_events(&self, allowed: DeviceEvents) {
+ pub fn available_monitors(&self) -> impl Iterator
- {
+ self.xconn.available_monitors().into_iter().flatten()
+ }
+
+ pub fn primary_monitor(&self) -> Option {
+ self.xconn.primary_monitor().ok()
+ }
+
+ pub fn listen_device_events(&self, allowed: DeviceEvents) {
self.device_events.set(allowed);
}
diff --git a/src/platform_impl/linux/x11/monitor.rs b/src/platform_impl/linux/x11/monitor.rs
index 98adfa9e..7c708613 100644
--- a/src/platform_impl/linux/x11/monitor.rs
+++ b/src/platform_impl/linux/x11/monitor.rs
@@ -1,7 +1,7 @@
use super::{util, X11Error, XConnection};
use crate::{
dpi::{PhysicalPosition, PhysicalSize},
- platform_impl::{MonitorHandle as PlatformMonitorHandle, VideoMode as PlatformVideoMode},
+ platform_impl::VideoMode as PlatformVideoMode,
};
use x11rb::{
connection::RequestConnection,
@@ -47,8 +47,8 @@ impl VideoMode {
}
#[inline]
- pub fn monitor(&self) -> PlatformMonitorHandle {
- PlatformMonitorHandle::X(self.monitor.clone().unwrap())
+ pub fn monitor(&self) -> MonitorHandle {
+ self.monitor.clone().unwrap()
}
}
diff --git a/src/platform_impl/linux/x11/util/icon.rs b/src/platform_impl/linux/x11/util/icon.rs
index 3240a9f8..07b5fee6 100644
--- a/src/platform_impl/linux/x11/util/icon.rs
+++ b/src/platform_impl/linux/x11/util/icon.rs
@@ -1,7 +1,7 @@
#![allow(clippy::assertions_on_constants)]
use super::*;
-use crate::icon::{Icon, Pixel, PIXEL_SIZE};
+use crate::icon::{Pixel, RgbaIcon, PIXEL_SIZE};
impl Pixel {
pub fn to_packed_argb(&self) -> Cardinal {
@@ -18,16 +18,15 @@ impl Pixel {
}
}
-impl Icon {
+impl RgbaIcon {
pub(crate) fn to_cardinals(&self) -> Vec {
- let rgba_icon = &self.inner;
- assert_eq!(rgba_icon.rgba.len() % PIXEL_SIZE, 0);
- let pixel_count = rgba_icon.rgba.len() / PIXEL_SIZE;
- assert_eq!(pixel_count, (rgba_icon.width * rgba_icon.height) as usize);
+ assert_eq!(self.rgba.len() % PIXEL_SIZE, 0);
+ let pixel_count = self.rgba.len() / PIXEL_SIZE;
+ assert_eq!(pixel_count, (self.width * self.height) as usize);
let mut data = Vec::with_capacity(pixel_count);
- data.push(rgba_icon.width as Cardinal);
- data.push(rgba_icon.height as Cardinal);
- let pixels = rgba_icon.rgba.as_ptr() as *const Pixel;
+ data.push(self.width as Cardinal);
+ data.push(self.height as Cardinal);
+ let pixels = self.rgba.as_ptr() as *const Pixel;
for pixel_index in 0..pixel_count {
let pixel = unsafe { &*pixels.add(pixel_index) };
data.push(pixel.to_packed_argb());
diff --git a/src/platform_impl/linux/x11/window.rs b/src/platform_impl/linux/x11/window.rs
index 916aad01..8fc37311 100644
--- a/src/platform_impl/linux/x11/window.rs
+++ b/src/platform_impl/linux/x11/window.rs
@@ -23,11 +23,11 @@ use crate::{
event_loop::AsyncRequestSerial,
platform_impl::{
x11::{atoms::*, MonitorHandle as X11MonitorHandle, WakeSender, X11Error},
- Fullscreen, MonitorHandle as PlatformMonitorHandle, OsError,
+ Fullscreen, MonitorHandle as PlatformMonitorHandle, OsError, PlatformIcon,
PlatformSpecificWindowBuilderAttributes, VideoMode as PlatformVideoMode,
},
window::{
- CursorGrabMode, CursorIcon, Icon, ImePurpose, ResizeDirection, Theme, UserAttentionType,
+ CursorGrabMode, CursorIcon, ImePurpose, ResizeDirection, Theme, UserAttentionType,
WindowAttributes, WindowButtons, WindowLevel,
},
};
@@ -469,7 +469,7 @@ impl UnownedWindow {
// Set window icons
if let Some(icon) = window_attrs.window_icon {
- leap!(window.set_icon_inner(icon)).ignore_error();
+ leap!(window.set_icon_inner(icon.inner)).ignore_error();
}
// Opt into handling window close
@@ -778,7 +778,9 @@ impl UnownedWindow {
Fullscreen::Borderless(Some(PlatformMonitorHandle::X(monitor))) => {
(None, monitor)
}
- Fullscreen::Borderless(None) => (None, self.current_monitor()),
+ Fullscreen::Borderless(None) => {
+ (None, self.shared_state_lock().last_monitor.clone())
+ }
#[cfg(wayland_platform)]
_ => unreachable!(),
};
@@ -874,9 +876,8 @@ impl UnownedWindow {
}
}
- #[inline]
- pub fn current_monitor(&self) -> X11MonitorHandle {
- self.shared_state_lock().last_monitor.clone()
+ pub fn current_monitor(&self) -> Option {
+ Some(self.shared_state_lock().last_monitor.clone())
}
pub fn available_monitors(&self) -> Vec {
@@ -885,10 +886,12 @@ impl UnownedWindow {
.expect("Failed to get available monitors")
}
- pub fn primary_monitor(&self) -> X11MonitorHandle {
- self.xconn
- .primary_monitor()
- .expect("Failed to get primary monitor")
+ pub fn primary_monitor(&self) -> Option {
+ Some(
+ self.xconn
+ .primary_monitor()
+ .expect("Failed to get primary monitor"),
+ )
}
#[inline]
@@ -1077,7 +1080,7 @@ impl UnownedWindow {
.expect("Failed to set window-level state");
}
- fn set_icon_inner(&self, icon: Icon) -> Result, X11Error> {
+ fn set_icon_inner(&self, icon: PlatformIcon) -> Result, X11Error> {
let atoms = self.xconn.atoms();
let icon_atom = atoms[_NET_WM_ICON];
let data = icon.to_cardinals();
@@ -1104,7 +1107,7 @@ impl UnownedWindow {
}
#[inline]
- pub fn set_window_icon(&self, icon: Option) {
+ pub(crate) fn set_window_icon(&self, icon: Option) {
match icon {
Some(icon) => self.set_icon_inner(icon),
None => self.unset_icon_inner(),
@@ -1565,7 +1568,7 @@ impl UnownedWindow {
#[inline]
pub fn scale_factor(&self) -> f64 {
- self.current_monitor().scale_factor
+ self.shared_state_lock().last_monitor.scale_factor
}
pub fn set_cursor_position_physical(&self, x: i32, y: i32) -> Result<(), ExternalError> {
@@ -1806,6 +1809,8 @@ impl UnownedWindow {
None
}
+ pub fn set_content_protected(&self, _protected: bool) {}
+
#[inline]
pub fn has_focus(&self) -> bool {
self.shared_state_lock().has_focus
diff --git a/src/platform_impl/macos/event_loop.rs b/src/platform_impl/macos/event_loop.rs
index bd1ea070..9e9dc64e 100644
--- a/src/platform_impl/macos/event_loop.rs
+++ b/src/platform_impl/macos/event_loop.rs
@@ -27,7 +27,9 @@ use super::appkit::{NSApp, NSApplication, NSApplicationActivationPolicy, NSEvent
use crate::{
error::EventLoopError,
event::Event,
- event_loop::{ControlFlow, EventLoopClosed, EventLoopWindowTarget as RootWindowTarget},
+ event_loop::{
+ ControlFlow, DeviceEvents, EventLoopClosed, EventLoopWindowTarget as RootWindowTarget,
+ },
platform::{macos::ActivationPolicy, pump_events::PumpStatus},
platform_impl::platform::{
app::WinitApplication,
@@ -84,6 +86,9 @@ impl EventLoopWindowTarget {
Some(monitor)
}
+ #[inline]
+ pub fn listen_device_events(&self, _allowed: DeviceEvents) {}
+
#[inline]
pub fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::AppKit(AppKitDisplayHandle::empty())
diff --git a/src/platform_impl/orbital/event_loop.rs b/src/platform_impl/orbital/event_loop.rs
index 06df59c6..c62c2910 100644
--- a/src/platform_impl/orbital/event_loop.rs
+++ b/src/platform_impl/orbital/event_loop.rs
@@ -15,7 +15,7 @@ use raw_window_handle::{OrbitalDisplayHandle, RawDisplayHandle};
use crate::{
error::EventLoopError,
event::{self, Ime, Modifiers, StartCause},
- event_loop::{self, ControlFlow},
+ event_loop::{self, ControlFlow, DeviceEvents},
keyboard::{
Key, KeyCode, KeyLocation, ModifiersKeys, ModifiersState, NativeKey, NativeKeyCode,
},
@@ -765,6 +765,9 @@ impl EventLoopWindowTarget {
v
}
+ #[inline]
+ pub fn listen_device_events(&self, _allowed: DeviceEvents) {}
+
pub fn raw_display_handle(&self) -> RawDisplayHandle {
RawDisplayHandle::Orbital(OrbitalDisplayHandle::empty())
}
diff --git a/src/platform_impl/orbital/window.rs b/src/platform_impl/orbital/window.rs
index 47e11aa1..72538020 100644
--- a/src/platform_impl/orbital/window.rs
+++ b/src/platform_impl/orbital/window.rs
@@ -426,6 +426,8 @@ impl Window {
#[inline]
pub fn set_theme(&self, _theme: Option) {}
+
+ pub fn set_content_protected(&self, _protected: bool) {}
}
impl Drop for Window {
diff --git a/src/platform_impl/web/window.rs b/src/platform_impl/web/window.rs
index 97fa7ef2..39961039 100644
--- a/src/platform_impl/web/window.rs
+++ b/src/platform_impl/web/window.rs
@@ -379,6 +379,8 @@ impl Inner {
})
}
+ pub fn set_content_protected(&self, _protected: bool) {}
+
#[inline]
pub fn has_focus(&self) -> bool {
self.has_focus.load(Ordering::Relaxed)
diff --git a/src/window.rs b/src/window.rs
index db3ac055..e00ab19e 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -1273,10 +1273,9 @@ impl Window {
/// - **iOS / Android / x11 / Wayland / Web / Orbital:** Unsupported.
///
/// [`NSWindowSharingNone`]: https://developer.apple.com/documentation/appkit/nswindowsharingtype/nswindowsharingnone
- pub fn set_content_protected(&self, _protected: bool) {
- #[cfg(any(macos_platform, windows_platform))]
+ pub fn set_content_protected(&self, protected: bool) {
self.window
- .maybe_queue_on_main(move |w| w.set_content_protected(_protected))
+ .maybe_queue_on_main(move |w| w.set_content_protected(protected))
}
/// Gets the current title of the window.