tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] It still doesn't display the window borders correctly on Windows 10.

Open noy1993 opened this issue 1 year ago • 5 comments

Describe the bug

When I set decorations to false, the initial window has no left or bottom border. However, when I resize the window, they appear. But it's noticeable that their color is different—slightly darker. screenshot_2024-11-12_10-24-31 BC923DE2-EF40-474e-8EC5-29831A75AEA1

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 x86_64 (X64)
    ✔ WebView2: 130.0.2849.80
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.13.1
    - pnpm: 9.12.3
    - yarn: 1.22.22
    - npm: 10.8.1

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - tauri-cli 🦀: 2.0.2
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.0.2 (outdated, latest: 2.1.0)

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: SolidJS
    - bundler: Vite

Stack trace

No response

Additional context

No response

noy1993 avatar Nov 12 '24 02:11 noy1993

I can't seem to reproduce on Windows 11, here is a comparison with windows settings app image image

I can't test on Windows 10 atm as I don't have it installed, but hopefully I can install it soon and test

amrbashir avatar Nov 12 '24 16:11 amrbashir

Also noticed this problem with the plugins' example on Windows 10 (changed the left bar's background color to white to better demonstrate the problem)

image

Legend-Master avatar Nov 13 '24 05:11 Legend-Master

+1

TheBlindM avatar Nov 29 '24 04:11 TheBlindM

Hello. I can confirm the same behaviour (in Windows10) as soon as I upgraded the app to Tauri v2. The "native" window/form border/decoration is somewhat still there, causing artifacts and messing with the custom border/decoration.

VassilisM avatar Nov 29 '24 06:11 VassilisM

+1 it reproduce on my environment (Windows 10 22H2 19045.5198). But I fixed this by set the window's shadow attribute to false in tauri.conf.json

Burial0268 avatar Dec 07 '24 08:12 Burial0268

If implementing the default system borders on Windows 10 is too difficult, could we simply hide the borders and only keep the shadow, just like in Electron? 1

xceyds avatar Dec 24 '24 06:12 xceyds

+1

Nolovenodie avatar Dec 25 '24 18:12 Nolovenodie

+1 it reproduce on my environment (Windows 10 22H2 19045.5198). But I fixed this by set the window's shadow attribute to false in tauri.conf.json

Great! Thanks. I can live with that. Though I left the tauri.conf.json unmodified (decorations and shadow are true) and I am using the setShadow() and setDecorations() of appWindow (in that order) to be able to modify dynamically without rebuilding.

VassilisM avatar Jan 06 '25 12:01 VassilisM

workaround

  1. change shadow in tauri.conf.json to false, like that:
"windows": [
  {
    "title": "Window",
    "width": "<width>",
    "height": "<height>",
    "shadow": false,
  }
],
  1. install os_info crate:
cd src-tauri
cargo add os_info
  1. add the following workaround to main.rs:
fn is_win10() -> bool {
  let info = os_info::get();
  
  if info.os_type() != os_info::Type::Windows {
    return false;
  }
  
  info.version()
    .to_string()
    .split('.')
    .last()
    .and_then(|s| s.parse::<u32>().ok())
    .map_or(false, |patch| patch < 22000)
}


// tauri builder in async fn main
.setup(|app| {
  let main_window = app.get_webview_window("main")
    .expect("no main window");
  
  if !is_win10() {
    let _ = main_window.set_shadow(true);
  }

  Ok(())
})

it's definitely not the best solution, its ugly, but it works

smokingplaya avatar Feb 11 '25 22:02 smokingplaya

this is fixed by https://github.com/tauri-apps/tao/pull/1052, and will be available in the next release

amrbashir avatar Feb 12 '25 04:02 amrbashir

closed by #12541 #12817

lucasfernog avatar Feb 26 '25 15:02 lucasfernog