mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 06:40:06 -04:00
Wayland, Windows, MacOS: Popup Implementation (#4543)
Implement proper decorationless popups by specifying the type of the child window with with_type() With this commit, different kind of child windows can be created - Popups: Special windows without any decoration which can be positioned relative to the parent - Window: Normal window with a parent or not The type can be specified during creation of the Window using the window_attributes and the with_type() function. As default a normal Window is used. If Popup is choosen a parent must be specified, otherwise the Popup creation fails with an Error returned by the new() function. Related issues: #403 and #4256
This commit is contained in:
@@ -769,9 +769,15 @@ pub struct Window {
|
||||
impl Window {
|
||||
pub(crate) fn new(
|
||||
el: &ActiveEventLoop,
|
||||
_window_attrs: window::WindowAttributes,
|
||||
window_attrs: window::WindowAttributes,
|
||||
) -> Result<Self, RequestError> {
|
||||
// FIXME this ignores requested window attributes
|
||||
if window_attrs.window_type() == window::WindowType::Popup {
|
||||
return Err(RequestError::NotSupported(NotSupportedError::new(
|
||||
"Popups are not implemented for Android",
|
||||
)));
|
||||
}
|
||||
|
||||
// FIXME this ignores the rest of the requested window attributes
|
||||
|
||||
Ok(Self {
|
||||
app: el.app.clone(),
|
||||
@@ -825,6 +831,10 @@ impl rwh_06::HasWindowHandle for Window {
|
||||
}
|
||||
|
||||
impl CoreWindow for Window {
|
||||
fn window_type(&self) -> window::WindowType {
|
||||
window::WindowType::Window
|
||||
}
|
||||
|
||||
fn id(&self) -> WindowId {
|
||||
GLOBAL_WINDOW
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user