mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 21:30:03 -04:00
Add some missing Window getters
Implemented properly when it was easy for me, but a lot of places are stubbed out for now.
This commit is contained in:
@@ -6,6 +6,7 @@ use dpi::{
|
||||
LogicalInsets, LogicalPosition, LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize,
|
||||
Position, Size,
|
||||
};
|
||||
use tracing::warn;
|
||||
use web_sys::HtmlCanvasElement;
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
@@ -192,6 +193,11 @@ impl RootWindow for Window {
|
||||
})
|
||||
}
|
||||
|
||||
fn min_surface_size(&self) -> Option<PhysicalSize<u32>> {
|
||||
warn!("min_surface_size is not implemented on Web");
|
||||
None
|
||||
}
|
||||
|
||||
fn set_min_surface_size(&self, min_size: Option<Size>) {
|
||||
self.inner.dispatch(move |inner| {
|
||||
let dimensions = min_size.map(|min_size| min_size.to_logical(inner.scale_factor()));
|
||||
@@ -204,6 +210,11 @@ impl RootWindow for Window {
|
||||
})
|
||||
}
|
||||
|
||||
fn max_surface_size(&self) -> Option<PhysicalSize<u32>> {
|
||||
warn!("max_surface_size is not implemented on Web");
|
||||
None
|
||||
}
|
||||
|
||||
fn set_max_surface_size(&self, max_size: Option<Size>) {
|
||||
self.inner.dispatch(move |inner| {
|
||||
let dimensions = max_size.map(|dimensions| dimensions.to_logical(inner.scale_factor()));
|
||||
@@ -228,8 +239,16 @@ impl RootWindow for Window {
|
||||
self.inner.queue(|inner| inner.canvas.set_attribute("alt", title))
|
||||
}
|
||||
|
||||
fn is_transparent(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn set_transparent(&self, _: bool) {}
|
||||
|
||||
fn is_blurred(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn set_blur(&self, _: bool) {}
|
||||
|
||||
fn set_visible(&self, _: bool) {
|
||||
@@ -300,10 +319,18 @@ impl RootWindow for Window {
|
||||
true
|
||||
}
|
||||
|
||||
fn window_level(&self) -> WindowLevel {
|
||||
WindowLevel::default()
|
||||
}
|
||||
|
||||
fn set_window_level(&self, _: WindowLevel) {
|
||||
// Intentionally a no-op, no window ordering
|
||||
}
|
||||
|
||||
fn window_icon(&self) -> Option<Icon> {
|
||||
None
|
||||
}
|
||||
|
||||
fn set_window_icon(&self, _: Option<Icon>) {
|
||||
// Currently an intentional no-op
|
||||
}
|
||||
@@ -344,12 +371,21 @@ impl RootWindow for Window {
|
||||
})
|
||||
}
|
||||
|
||||
fn content_protected(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn set_content_protected(&self, _: bool) {}
|
||||
|
||||
fn title(&self) -> String {
|
||||
String::new()
|
||||
}
|
||||
|
||||
fn cursor(&self) -> Cursor {
|
||||
warn!("getting the cursor is not implemented on Web");
|
||||
Cursor::default()
|
||||
}
|
||||
|
||||
fn set_cursor(&self, cursor: Cursor) {
|
||||
self.inner.dispatch(move |inner| inner.canvas.cursor.set_cursor(cursor))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user