Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(webview): add set_simple_fullscreen to WebviewWindow
  • Loading branch information
NaamuKim committed Nov 29, 2025
commit 4d438659234d123d6a81b511d7d49da18fbb82af
21 changes: 21 additions & 0 deletions crates/tauri/src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2312,4 +2312,25 @@ mod tests {
crate::test_utils::assert_send::<super::Webview>();
crate::test_utils::assert_sync::<super::Webview>();
}

#[cfg(target_os = "macos")]
#[test]
fn test_webview_window_has_set_simple_fullscreen_method() {
use crate::test::{mock_builder, mock_context, noop_assets};

// Create a mock app with proper context
let app = mock_builder().build(mock_context(noop_assets())).unwrap();

// Get or create a webview window
let webview_window =
crate::WebviewWindowBuilder::new(&app, "test", crate::WebviewUrl::default())
.build()
.unwrap();

// This should compile if set_simple_fullscreen exists
let result = webview_window.set_simple_fullscreen(true);

// We expect this to work without panicking
assert!(result.is_ok(), "set_simple_fullscreen should succeed");
}
}
27 changes: 27 additions & 0 deletions crates/tauri/src/webview/webview_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,33 @@ impl<R: Runtime> WebviewWindow<R> {
self.window.set_fullscreen(fullscreen)
}

/// Toggles a fullscreen mode that doesn't require a new macOS space.
///
/// This is how fullscreen used to work on macOS in versions before Lion.
/// It allows the user to have a fullscreen window without using another space
/// or taking control over the entire monitor.
///
/// ## Platform-specific
///
/// - **macOS:** Uses native simple fullscreen mode.
/// - **Other platforms:** Falls back to [`Self::set_fullscreen`].
#[cfg(target_os = "macos")]
pub fn set_simple_fullscreen(&self, fullscreen: bool) -> crate::Result<()> {
self.window.set_simple_fullscreen(fullscreen)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we handle this in set_simple_fullscreen anyways, I think we just use a single function here that does the forwarding

}

/// Toggles a fullscreen mode that doesn't require a new macOS space.
///
/// On non-macOS platforms, this method falls back to regular fullscreen behavior.
///
/// ## Platform-specific
///
/// - **Other platforms:** Falls back to [`Self::set_fullscreen`].
#[cfg(not(target_os = "macos"))]
pub fn set_simple_fullscreen(&self, fullscreen: bool) -> crate::Result<()> {
self.set_fullscreen(fullscreen)
}

/// Bring the window to front and focus.
pub fn set_focus(&self) -> crate::Result<()> {
self.window.set_focus()
Expand Down