Repository: electron/electron (language: cpp)

Issue:
[Bug]: with wayland & gnome, maximizing a window to the side results in margin around the window
### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

25.3.1 and 22.3.18


### What operating system are you using?

Other Linux

### Operating System Version

Linux jig 6.1.41-1-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Jul 25 09:17:30 UTC 2023 x86_64 GNU/Linux

### What arch are you using?

x64

### Expected Behavior

The demo app maximizes to the right or the left to take up half the screen, and the window extends to the top, bottom, and side all the way.

### Actual Behavior

The demo app maximizes to the right or the left to take up half the screen, but the borders of the app don't extend all the way to the side and bottom of the screen. The title-bar extends all the way to the top of the screen, but the title bar is double the height it should be, and it seems to only respond to clicks in the bottom half

![image](https://github.com/electron/electron/assets/133676745/d79fef6a-6db4-45c5-a0e9-036a9e6871da)

### Additional information

#### Reproduction steps

- Install Manjaro with GNOME Shell 44.3, use gnome with wayland

```
pamac install electron
electron --ozone-platform=wayland --enable-features=WaylandWindowDecorations
```

- Drag demo app to side of screen to maximize to the right or the left

[Screencast from 2023-08-11 12-25-01.webm](https://github.com/electron/electron/assets/133676745/7e2cec76-df18-4de1-aea3-06c095d8ab68)

Note: maximizing full screen works as intended, but this may be related to https://github.com/electron/electron/issues/33161



Discussion / hints:
I see this bug too on my setup (Gnome and Arch Linux).
I see this bug on my setup as well (GNOME, Arch Linux, Wayland and NVIDIA)

Fix patch:
diff --git a/shell/browser/ui/views/client_frame_view_linux.cc b/shell/browser/ui/views/client_frame_view_linux.cc
index 9a52533a5af26..04a41383e5922 100644
--- a/shell/browser/ui/views/client_frame_view_linux.cc
+++ b/shell/browser/ui/views/client_frame_view_linux.cc
@@ -150,7 +150,13 @@ void ClientFrameViewLinux::Init(NativeWindowViews* window,
 }
 
 gfx::Insets ClientFrameViewLinux::GetBorderDecorationInsets() const {
-  return frame_provider_->GetFrameThicknessDip();
+  const auto insets = frame_provider_->GetFrameThicknessDip();
+  // We shouldn't draw frame decorations for the tiled edges.
+  // See https://wayland.app/protocols/xdg-shell#xdg_toplevel:enum:state
+  return gfx::Insets::TLBR(tiled_edges().top ? 0 : insets.top(),
+                           tiled_edges().left ? 0 : insets.left(),
+                           tiled_edges().bottom ? 0 : insets.bottom(),
+                           tiled_edges().right ? 0 : insets.right());
 }
 
 gfx::Insets ClientFrameViewLinux::GetInputInsets() const {


Test patch: