Thorsten Ball
e69f9d6cf9
linux/x11: Fix gap when tiling windows side by side (#13859)
By leveraging the `_GTK_EDGE_CONSTRAINTS` atom we can get all four
booleans for the `Tiling` struct and figure out which side is free when
the window is tiled to half of the screen.
For the logic behind the `_GTK_EDGE_CONSTRAINTS` see:
-
https://github.com/GNOME/mutter/blob/8e9d13aa3b3baa099ca32bbcb10afb4d9eea4460/src/x11/window-x11.c#L65-L75
-
https://github.com/GNOME/mutter/blob/8e9d13aa3b3baa099ca32bbcb10afb4d9eea4460/src/x11/window-x11.c#L1205-L1231
(I used Claude 3.5 Sonnet with our code and these pieces from `mutter`
to generate the Rust code, that was pretty sweet)
This fixes the gap in the middle when a GPUI window is tiled to the left
and another window to the right.
It's not _perfect_ but it looks a lot better.
Here's a diff that makes it look better:
```diff
diff --git a/crates/gpui/examples/window_shadow.rs b/crates/gpui/examples/window_shadow.rs
index 122231f6b..7fa29dadc 100644
--- a/crates/gpui/examples/window_shadow.rs
+++ b/crates/gpui/examples/window_shadow.rs
@@ -72,8 +72,8 @@ impl Render for WindowShadow {
.when(!(tiling.top || tiling.left), |div| div.rounded_tl(rounding))
.when(!tiling.top, |div| div.pt(shadow_size))
.when(!tiling.bottom, |div| div.pb(shadow_size))
- .when(!tiling.left, |div| div.pl(shadow_size))
- .when(!tiling.right, |div| div.pr(shadow_size))
+ .when(!tiling.left, |div| div.pl(shadow_size - border_size))
+ .when(!tiling.right, |div| div.pr(shadow_size - border_size))
.on_mouse_move(|_e, cx| cx.refresh())
.on_mouse_down(MouseButton::Left, move |e, cx| {
let size = cx.window_bounds().get_bounds().size;
```
But that makes it look weird on Wayland, so I didn't do it.
I think it's fine for now. Chromium looks bad and has a gap, so we're
already better.
## Before


## After


Release Notes:
- N/A
2024-07-05 15:02:14 +02:00
..
2024-06-13 16:38:53 -07:00
2024-06-25 15:12:45 +02:00
2024-06-12 10:40:27 -06:00
2024-07-05 15:02:14 +02:00
2024-06-27 14:36:44 -06:00
2024-04-25 12:54:39 +02:00
2024-06-18 12:16:54 -07:00
2024-06-17 12:44:32 -06:00
2024-01-24 11:03:28 +01:00
2024-03-29 17:09:49 -07:00
2024-06-25 15:12:45 +02:00
2024-03-11 10:45:57 +01:00
2024-07-03 11:28:09 -07:00
2024-05-09 11:38:53 +02:00
2024-06-17 17:58:47 -07:00
2024-07-03 11:28:09 -07:00
2024-05-22 22:07:29 -07:00
2024-05-16 12:47:43 -04:00
2024-01-21 14:26:45 -08:00
2024-06-11 11:43:12 -07:00
2024-04-25 12:54:39 +02:00
2024-02-09 10:45:39 +02:00
2024-07-03 11:28:09 -07:00
2024-01-21 14:26:45 -08:00
2024-03-19 10:16:18 -07:00
2024-02-07 15:14:50 -05:00
2024-01-30 11:26:02 -05:00
2024-06-12 23:22:52 +03:00
2024-05-06 14:22:56 -07:00
2024-06-13 08:35:22 +02:00
2024-05-29 18:06:45 -07:00
2024-06-06 12:46:53 +02:00
2024-03-06 14:58:41 +01:00
2024-06-27 14:36:44 -06:00
2024-05-22 18:04:47 -04:00
2024-05-21 20:23:37 +02:00
2024-07-03 11:28:09 -07:00