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-18 12:44:35 -07:00
2024-06-21 18:47:38 +02:00
2024-06-27 14:36:44 -06:00
2024-07-05 14:52:45 +02:00
2024-06-21 11:48:52 +02:00
2024-05-12 04:47:19 -07:00
2024-05-29 18:06:45 -07:00
2024-06-20 15:00:54 +02:00
2024-06-18 12:16:54 -07:00
2024-06-22 16:07:36 -07:00
2024-06-22 16:07:36 -07:00
2024-06-26 13:00:52 -06:00
2024-07-02 13:59:26 -04:00
2024-06-27 09:30:21 +03:00
2024-07-03 19:03:49 -04:00
2024-07-03 11:28:09 -07:00
2024-03-29 17:09:49 -07:00
2024-05-16 13:30:04 -04:00
2024-03-26 13:28:06 +01:00
2024-06-18 12:22:37 -04:00
2024-06-18 12:22:37 -04:00
2024-06-22 16:07:36 -07:00
2024-06-27 21:54:03 -06:00
2024-07-01 23:58:10 +02:00
2024-07-03 11:10:51 -04:00
2024-07-02 19:49:20 -04:00
2024-06-14 20:13:31 -04:00
2024-06-17 18:14:37 -04:00
2024-07-02 11:47:11 +02:00
2024-06-13 08:35:22 +02:00
2024-06-23 07:39:01 -04:00
2024-05-29 18:06:45 -07:00
2024-06-18 12:22:37 -04:00
2024-04-30 23:31:59 -06:00
2024-06-12 23:22:52 +03:00
2024-06-12 23:22:52 +03:00
2024-05-10 15:50:20 -06:00
2024-06-18 12:16:54 -07:00
2024-06-23 14:10:31 -06:00
2024-07-05 15:02:14 +02:00
2024-06-13 18:45:28 -04:00
2024-06-22 16:07:36 -07:00
2024-07-01 17:18:58 -04:00
2024-05-22 20:40:31 -04:00
2024-05-29 18:06:45 -07:00
2024-07-03 17:04:08 -04:00
2024-06-18 12:22:37 -04:00
2024-03-11 10:45:57 +01:00
2024-04-08 19:17:12 -04:00
2024-07-01 15:59:19 +02:00
2024-03-05 12:01:17 -05:00
2024-06-17 18:14:37 -04:00
2024-07-04 12:49:17 +02:00
2024-06-14 20:13:31 -04:00
2024-05-10 14:18:40 -04:00
2024-06-22 15:59:53 -07:00
2024-06-27 14:36:44 -06:00
2024-06-13 08:35:22 +02:00
2024-04-02 13:12:38 -06:00
2024-03-26 16:10:09 -07:00
2024-06-23 22:20:10 -07:00
2024-06-25 14:59:29 +02:00
2024-06-22 16:07:36 -07:00
2024-06-14 10:33:28 -07:00
2024-07-03 11:07:11 -04:00
2024-06-18 12:16:54 -07:00
2024-07-01 19:36:20 +03:00
2024-06-21 18:39:14 +02:00
2024-06-23 09:36:52 +02:00
2024-06-29 11:37:22 +03:00
2024-07-01 15:59:19 +02:00
2024-06-25 14:20:37 +02:00
2024-06-18 12:16:54 -07:00
2024-06-17 17:58:47 -07:00
2024-06-24 15:34:22 -04:00
2024-06-27 14:36:44 -06:00
2024-03-05 12:01:17 -05:00
2024-06-20 15:00:54 +02:00
2024-06-25 15:12:45 +02:00
2024-04-23 16:23:26 -07:00
2024-05-23 15:50:59 +02:00
2024-06-21 16:32:32 -07:00
2024-07-01 09:45:01 -04:00
2024-06-07 12:53:01 -07:00
2024-03-29 12:11:57 -04:00
2024-06-18 12:22:37 -04:00
2024-05-20 17:00:27 +02:00
2024-06-21 16:32:32 -07:00
2024-06-21 16:32:32 -07:00
2024-05-09 11:03:33 +02:00
2024-06-27 19:14:13 -04:00
2024-05-21 20:23:37 +02:00
2024-05-17 16:37:17 -04:00
2024-06-18 12:22:37 -04:00
2024-05-14 13:48:36 +02:00
2024-05-29 11:40:43 +02:00
2024-06-03 12:52:44 +02:00
2024-06-25 16:47:55 -04:00
2024-07-01 20:53:56 +02:00
2024-07-02 10:57:54 +03:00
2024-06-13 08:35:22 +02:00
2024-07-03 11:28:09 -07:00
2024-06-11 15:31:55 -04:00
2024-05-16 13:30:04 -04:00
2024-04-15 14:21:52 +02:00
2024-07-03 11:28:09 -07:00
2024-07-05 14:27:53 +02:00
2024-05-26 23:06:58 -06:00
2024-06-27 17:03:47 -07:00
2024-06-04 19:13:21 +02:00
2024-07-03 09:03:39 -06:00
2024-06-11 11:43:12 -07:00
2024-07-05 15:02:14 +02:00
2024-06-25 10:03:29 -07:00
2024-07-03 11:28:09 -07:00
2024-06-18 12:16:54 -07:00