Repository: tauri-apps/tauri
File: crates/tauri/src/webview/webview_window.rs (Rust)

Code before:
    self.window.set_size_constraints(constraints)
  }

  /// Sets this window's position.
  pub fn set_position<Pos: Into<Position>>(&self, position: Pos) -> crate::Result<()> {
    self.window.set_position(position)
  }

  /// Determines if this window should be fullscreen.
  pub fn set_fullscreen(&self, fullscreen: bool) -> crate::Result<()> {
    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)
  }

  /// 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()
  }

  /// Sets whether the window can be focused.
  ///
  /// ## Platform-specific
  ///
  /// - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`.
  ///   In this case, you might consider calling [`Window::set_focus`] but it will move the window to the back i.e. at the bottom in terms of z-order.

Review comment (suggestion):
Since we handle this in `set_simple_fullscreen` anyways, I think we just use a single function here that does the forwarding

Code after:
    self.window.set_size_constraints(constraints)
  }

  /// Sets this window's position.
  pub fn set_position<Pos: Into<Position>>(&self, position: Pos) -> crate::Result<()> {
    self.window.set_position(position)
  }

  /// Determines if this window should be fullscreen.
  pub fn set_fullscreen(&self, fullscreen: bool) -> crate::Result<()> {
    self.window.set_fullscreen(fullscreen)
  }

  /// Toggles a fullscreen mode that doesn't require a new macOS space.
  /// Returns a boolean indicating whether the transition was successful (this won't work if the window was already in the native fullscreen).
  ///
  /// This is how fullscreen used to work on macOS in versions before Lion.
  /// And 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`].
  pub fn set_simple_fullscreen(&self, enable: bool) -> crate::Result<()> {
    self.window.set_simple_fullscreen(enable)
  }

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

  /// Sets whether the window can be focused.
  ///
  /// ## Platform-specific
  ///
  /// - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`.
  ///   In this case, you might consider calling [`Window::set_focus`] but it will move the window to the back i.e. at the bottom in terms of z-order.
  pub fn set_focusable(&self, focusable: bool) -> crate::Result<()> {
    self.window.set_focusable(focusable)
  }

  /// Sets this window' icon.
  pub fn set_icon(&self, icon: Image<'_>) -> crate::Result<()> {
    self.window.set_icon(icon)
  }

  /// Sets the window background color.
  ///
  /// ## Platform-specific:
  ///