Repository: tauri-apps/tauri
File: core/tauri-runtime-wry/src/lib.rs (Rust)

Code before:
    let y = (screen_size.height as i32 - window_size.height as i32) / 2;
    window.set_outer_position(TaoPhysicalPosition::new(
      monitor_pos.x + x,
      monitor_pos.y + y,
    ));
    Ok(())
  } else {
    Err(Error::FailedToGetMonitor)
  }
}

fn parse_proxy(url: &str) -> Result<ProxyConfig> {
  let proxy = Url::parse(url).unwrap();

  if proxy.scheme() == "http" && proxy.path() == "" {
    let host = proxy.host().unwrap();
    let port = proxy.port().unwrap();
    let config = ProxyConfig::Http(ProxyEndpoint {
      host: host.to_string(),
      port: port.to_string(),
    });

    Ok(config)
  } else if proxy.scheme() == "socks5" && proxy.path() == "" {
    let host = proxy.host().unwrap();
    let port = proxy.port().unwrap();
    let config = ProxyConfig::Socks5(ProxyEndpoint {
      host: host.to_string(),
      port: port.to_string(),
    });

    Ok(config)
  } else {
    Err(Error::InvalidProxyUrl)
  }
}

fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
  window_id: WebviewId,
  event_loop: &EventLoopWindowTarget<Message<T>>,
  web_context_store: &WebContextStore,
  context: Context<T>,
  pending: PendingWindow<T, Wry<T>>,
  before_webview_creation: Option<F>,
) -> Result<WindowWrapper> {
  #[allow(unused_mut)]
  let PendingWindow {
    webview_attributes,
    uri_scheme_protocols,
    mut window_builder,
    label,

Review comment (suggestion):
```suggestion
    let host = proxy.host().unwrap_or_default();
    let port = proxy.port().unwrap_or_default();
```

Code after:
          WebviewMessage::SetPosition(position) => {
            let mut bounds = webview.bounds();
            let position = position.to_logical(window.scale_factor());
            bounds.x = position.x;
            bounds.y = position.y;

            if let Some(b) = &webview.bounds {
              let window_size = window.inner_size();
              let mut bounds = b.lock().unwrap();
              bounds.width_rate = position.x as f32 / window_size.width as f32;
              bounds.height_rate = position.y as f32 / window_size.height as f32;
            }

            webview.set_bounds(bounds);
          }
          WebviewMessage::SetFocus => {
            webview.focus();
          }
          WebviewMessage::WebviewEvent(_event) => { /* already handled */ }
          WebviewMessage::WithWebview(f) => {
            #[cfg(any(
              target_os = "linux",
              target_os = "dragonfly",
              target_os = "freebsd",
              target_os = "netbsd",
              target_os = "openbsd"
            ))]
            {
              f(webview.webview());
            }
            #[cfg(target_os = "macos")]
            {
              use wry::WebViewExtMacOS;
              f(Webview {
                webview: webview.webview(),
                manager: webview.manager(),
                ns_window: webview.ns_window(),
              });
            }
            #[cfg(target_os = "ios")]
            {
              use tao::platform::ios::WindowExtIOS;
              use wry::WebViewExtIOS;

              f(Webview {
                webview: webview.inner.webview(),
                manager: webview.inner.manager(),
                view_controller: window.ui_view_controller() as cocoa::base::id,
              });
            }
            #[cfg(windows)]