Add borderless fullscreen mode for orbital (#4343)

This commit is contained in:
Jeremy Soller 2025-09-04 13:14:41 -07:00 committed by GitHub
parent 488c036a05
commit 4d9302b33c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 8 deletions

View file

@ -996,7 +996,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// separate spaces are not preferred.
///
/// The dock and the menu bar are disabled in exclusive fullscreen mode.
/// - **Wayland:** Does not support exclusive fullscreen mode and will no-op a request.
/// - **Orbital / Wayland:** Does not support exclusive fullscreen mode and will no-op a
/// request.
/// - **Windows:** Screen saver is disabled in fullscreen mode.
/// - **Web:** Passing a [`MonitorHandle`] or [`VideoMode`] that was not created with detailed
/// monitor permissions or calling without a [transient activation] does nothing.
@ -1009,9 +1010,9 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
///
/// ## Platform-specific
///
/// - **Android / Orbital:** Will always return `None`.
/// - **Android:** Will always return `None`.
/// - **Orbital / Web:** Can only return `None` or `Borderless(None)`.
/// - **Wayland:** Can return `Borderless(None)` when there are no monitors.
/// - **Web:** Can only return `None` or `Borderless(None)`.
fn fullscreen(&self) -> Option<Fullscreen>;
/// Turn window decorations on or off.

View file

@ -19,6 +19,7 @@ const ORBITAL_FLAG_FRONT: char = 'f';
const ORBITAL_FLAG_HIDDEN: char = 'h';
const ORBITAL_FLAG_BORDERLESS: char = 'l';
const ORBITAL_FLAG_MAXIMIZED: char = 'm';
const ORBITAL_FLAG_FULLSCREEN: char = 'M';
const ORBITAL_FLAG_RESIZABLE: char = 'r';
const ORBITAL_FLAG_TRANSPARENT: char = 't';
@ -55,7 +56,10 @@ impl Window {
// Async by default.
let mut flag_str = ORBITAL_FLAG_ASYNC.to_string();
if attrs.maximized {
// Fullscreen takes precedence over maximize
if let Some(Fullscreen::Borderless(_)) = attrs.fullscreen {
flag_str.push(ORBITAL_FLAG_FULLSCREEN);
} else if attrs.maximized {
flag_str.push(ORBITAL_FLAG_MAXIMIZED);
}
@ -63,8 +67,6 @@ impl Window {
flag_str.push(ORBITAL_FLAG_RESIZABLE);
}
// TODO: fullscreen
if attrs.transparent {
flag_str.push(ORBITAL_FLAG_TRANSPARENT);
}
@ -323,10 +325,28 @@ impl CoreWindow for Window {
self.get_flag(ORBITAL_FLAG_MAXIMIZED).unwrap_or(false)
}
fn set_fullscreen(&self, _monitor: Option<Fullscreen>) {}
fn set_fullscreen(&self, fullscreen: Option<Fullscreen>) {
match fullscreen {
Some(Fullscreen::Exclusive(..)) => {
// TODO: exclusive fullscreen not supported on orbital
},
Some(Fullscreen::Borderless(_monitor)) => {
// TODO: monitor selection not supported on orbital
let _ = self.set_flag(ORBITAL_FLAG_FULLSCREEN, true);
},
None => {
let _ = self.set_flag(ORBITAL_FLAG_FULLSCREEN, false);
},
}
}
fn fullscreen(&self) -> Option<Fullscreen> {
None
if self.get_flag(ORBITAL_FLAG_FULLSCREEN).unwrap_or(false) {
// TODO: monitor selection not supported on orbital
Some(Fullscreen::Borderless(None))
} else {
None
}
}
#[inline]

View file

@ -250,6 +250,7 @@ changelog entry.
### Fixed
- On Orbital, `MonitorHandle::name()` now returns `None` instead of a dummy name.
- On Orbital, implement `fullscreen`.
- On iOS, fixed `SurfaceResized` and `Window::surface_size` not reporting the size of the actual surface.
- On macOS, fixed the scancode conversion for audio volume keys.
- On macOS, fixed the scancode conversion for `IntlBackslash`.