Skip to content
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

[bug] can resize only from top when no decorations #9268

Closed
thewh1teagle opened this issue Mar 25, 2024 · 4 comments
Closed

[bug] can resize only from top when no decorations #9268

thewh1teagle opened this issue Mar 25, 2024 · 4 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@thewh1teagle
Copy link
Contributor

thewh1teagle commented Mar 25, 2024

Describe the bug

When using latest tauri from dev branch with multiwebview and deocrations(false)
I can't resize the window from left / right / bottom. I can resize only from top edge.

Reproduction

add decorations(false) to multiwebview example

Run multiwebview example

cargo run --example multiwebview --features="unstable"

Expected behavior

We should be able to resize the window from left / right / bottom corners as well.

Full tauri info output

WARNING: no lock files found, defaulting to npm

[✔️] Environment
    - OS: Windows 10.0.22631 X64
    ✔️ WebView2: 122.0.2365.92
    ✔️ MSVC: Visual Studio Community 2022
    ✔️ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔️ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔️ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔️ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.17.1
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: git+https://github.com/thewh1teagle/tauri?branch=dev1#e9cb74ccf72b33d8dcf8d31ec12202bcff82dc4e (2.0.0-beta.13)
    - tauri-build [RUST]: no manifest (2.0.0-beta.10, 2.0.0-beta.10)
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.1
    - tauri-cli [RUST]: 1.5.9
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.1

[-] App
    - build-type: bundle
    - CSP: unset

Stack trace

No response

Additional context

It doesn't happen in helloworld example

@thewh1teagle thewh1teagle added status: needs triage This issue needs to triage, applied to new issues type: bug labels Mar 25, 2024
@amrbashir
Copy link
Member

when using multiwebview, you need to do the resizing yourself. You could also leave 1px around the edge so the underlying window could catch clicks there and provide resizing.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2024
@thewh1teagle
Copy link
Contributor Author

@amrbashir

when using multiwebview, you need to do the resizing yourself.

How should I handle resize myself from left / right bottom in multiwebview window?

You could also leave 1px around the edge so the underlying window could catch clicks there and provide resizing.

Sounds good, I understand that the webviews should leave some space (1px) in left / right / bottom edges.
Can I use auto_resize() (exposed from webviews) along with that? or I still need to handle resize myself?

@amrbashir
Copy link
Member

@amrbashir

when using multiwebview, you need to do the resizing yourself.

How should I handle resize myself from left / right bottom in multiwebview window?

you need to detect the clicks where you want to do resizing and then call https://docs.rs/tauri/2.0.0-beta.13/tauri/test/struct.MockWindowDispatcher.html#method.start_resize_dragging

You could also leave 1px around the edge so the underlying window could catch clicks there and provide resizing.

Sounds good, I understand that the webviews should leave some space (1px) in left / right / bottom edges. Can I use auto_resize() (exposed from webviews) along with that? or I still need to handle resize myself?

auto_resize should work in this case

@thewh1teagle
Copy link
Contributor Author

thewh1teagle commented Mar 30, 2024

I tried and created window with decoration(false) and kept 2px space around the webview for resizing,
But only top / left edges was resizable - right and bottom edges aren't.
Looks like some bug in windows, you can see the white space in left / top but not in right / bottom.

screenshot
main.rs
use std::str::FromStr;
use tauri::{LogicalPosition, LogicalSize, Url, WebviewBuilder};

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
  tauri::Builder::default()
    .setup(|app| {

      // Create main window
      let width = 800.;
      let height = 600.;
      let window = tauri::window::WindowBuilder::new(app, "main")
        .decorations(false)
        .inner_size(width, height)
        .build()?;

      // Create webviews  
      let webview = WebviewBuilder::new(
        "app", 
        tauri::WebviewUrl::External(Url::from_str("https://tauri.app/").unwrap())
      ).auto_resize();
      let edge_space = 2.;
      let size = LogicalSize::new(width - edge_space, height - edge_space);
      let position = LogicalPosition::new(0 + edge_space as u32, 0 + edge_space as u32);
      window.add_child(webview, position, size).unwrap();
      
      Ok(())
    })
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}
tauri info
WARNING: no lock files found, defaulting to npm

[] Environment
    - OS: Windows 10.0.22631 X64WebView2: 123.0.2420.65MSVC: Visual Studio Community 2022
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.17.1
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 2.0.0-beta.13
    - tauri-build [RUST]: 2.0.0-beta.10
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.2
    - tauri-cli [RUST]: 1.5.9
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.1

[-] App
    - build-type: bundle
    - CSP: unset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants