wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.87k stars 801 forks source link

Removing title bar not working correctly with tile manager #2788

Open sheeperino opened 1 year ago

sheeperino commented 1 year ago

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

Komorebi, GlazeWM

WezTerm version

wezterm 20221119-145034-49b9839f

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

When disabling the title bar window decoration, wezterm will have overflowing edges compared to other windows in the tiling manager.

To Reproduce

use the option: window_decorations = "RESIZE" - disable the title bar but enable the resizable border

Configuration

return {
    window_decorations = "RESIZE",
}

Expected Behavior

The wezterm window shouldn't have overflowing edges

Logs

No response

Anything else?

komorebi: image GlazeWM: image

NikGovorov commented 1 year ago

@sheeperino Assuming that you're on the latest update of Windows 10, please try to apply the following patch and see if it's working for you:

diff --git a/window/src/os/windows/window.rs b/window/src/os/windows/window.rs
index 30efff507..dbcfdcf7b 100644
--- a/window/src/os/windows/window.rs
+++ b/window/src/os/windows/window.rs
@@ -76,7 +76,7 @@ lazy_static! {
         };

         if unsafe { GetVersionExW(&osver as *const _ as _) } == winapi::shared::minwindef::TRUE {
-            osver.dwBuildNumber < 22000
+            false
         } else {
             true
         }
@@ -862,14 +862,14 @@ impl WindowOps for Window {
                 if *IS_WIN10 {
                     LinearRgba(0.01, 0.01, 0.01, 0.67)
                 } else {
-                    LinearRgba(0.026, 0.026, 0.026, 0.5)
+                    LinearRgba(0.031, 0.031, 0.031, 1.0)
                 }
             }
         } else {
             if *IS_WIN10 {
                 LinearRgba(0.024, 0.024, 0.024, 0.5)
             } else {
-                LinearRgba(0.028, 0.028, 0.028, 0.5)
+                LinearRgba(0.042, 0.044, 0.044, 1.0)
             }
         };

@@ -1020,7 +1020,7 @@ unsafe fn wm_nccalcsize(hwnd: HWND, _msg: UINT, wparam: WPARAM, lparam: LPARAM)
             requested_client_rect.bottom -= frame_y + padding;

             if is_maximized {
-                requested_client_rect.top += frame_y + padding;
+                requested_client_rect.top += frame_y + padding - 1;
             }
         }
     }
sheeperino commented 1 year ago

@NikGovorov yes, that seems to fix it! 😄

musjj commented 1 year ago

@NikGovorov Any chance of turning this into a PR?

NikGovorov commented 1 year ago

Hello @musjj, I'm currently in the process of transitioning my Windows machines from Windows 10 to Windows 11. If it's still an issue on Windows 11, I will gladly convert the patch into a pull request. However, if it is not an issue there, I would prefer to keep the patch as it is.

Applying the patch and building Wezterm from sources is a straightforward process. To apply the patch, simply execute the command git apply ./win10-window-border.patch after pulling the repository but before running cargo build --release. You can find more detailed instructions on how to install from sources here.