-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Wayland: Popup Implementation #4543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
41379f1
c1b049e
0bdfd51
baf8202
7750bf0
1988825
568550a
7557189
d9340a8
81b39e5
322f8ed
263399e
f222cf6
b321ecf
cd2fbdd
7affc66
261194b
b84939c
10fd84f
977beb2
d006c17
e15dd13
1ba0470
5691967
54b0328
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,13 @@ impl fmt::Debug for WindowId { | |
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Copy, Default, PartialEq)] | ||
| pub enum WindowType { | ||
| #[default] | ||
| Window, | ||
| Popup, | ||
| } | ||
|
|
||
| /// Attributes used when creating a window. | ||
| #[derive(Debug)] | ||
| #[non_exhaustive] | ||
|
|
@@ -72,6 +79,7 @@ pub struct WindowAttributes { | |
| pub(crate) parent_window: Option<SendSyncRawWindowHandle>, | ||
| pub fullscreen: Option<Fullscreen>, | ||
| pub platform: Option<Box<dyn PlatformWindowAttributes>>, | ||
| pub window_type: WindowType, | ||
| } | ||
|
|
||
| impl WindowAttributes { | ||
|
|
@@ -145,6 +153,7 @@ impl WindowAttributes { | |
| /// position. There may be a small gap between this position and the window due to the | ||
| /// specifics of the Window Manager. | ||
| /// - **X11:** The top left corner of the window, the window's "outer" position. | ||
| /// - **Wayland:** The top left corner of the window if the window type is `WindowType::Popup` otherwise ignored | ||
| /// - **Others:** Ignored. | ||
| #[inline] | ||
| pub fn with_position<P: Into<Position>>(mut self, position: P) -> Self { | ||
|
|
@@ -378,6 +387,22 @@ impl WindowAttributes { | |
| self.platform = Some(platform); | ||
| self | ||
| } | ||
|
|
||
| /// Sets the window type of the object | ||
| /// | ||
| /// Currently only wayland is using this type. On X11 popups are also just normal windows | ||
| /// Note: If the type is set to `WindowType::Popup` the parent must be set as well with | ||
| /// `with_parent_window()`. | ||
| pub fn as_type(mut self, window_type: WindowType) -> Self { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be called |
||
| self.window_type = window_type; | ||
| self | ||
| } | ||
|
|
||
| /// Returns if the window type is a popup or a normal window | ||
| #[inline] | ||
| pub fn popup(&self) -> bool { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be replace with a |
||
| self.window_type == WindowType::Popup | ||
| } | ||
| } | ||
|
|
||
| impl Clone for WindowAttributes { | ||
|
|
@@ -405,6 +430,7 @@ impl Clone for WindowAttributes { | |
| parent_window: self.parent_window.clone(), | ||
| fullscreen: self.fullscreen.clone(), | ||
| platform: self.platform.as_ref().map(|platform| platform.box_clone()), | ||
| window_type: self.window_type, | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -435,6 +461,7 @@ impl Default for WindowAttributes { | |
| platform: Default::default(), | ||
| cursor: Cursor::default(), | ||
| blur: Default::default(), | ||
| window_type: Default::default(), | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
#[non_exhaustive]as i'm expecting more type will be added later