Fix X11 window activation better (#13604)

Conrad Irwin created

Release Notes:

- N/A

Change summary

README.md                                    |  4 ++--
crates/gpui/src/platform/linux/x11/window.rs | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)

Detailed changes

README.md 🔗

@@ -1,5 +1,5 @@
-# Zed
-
+a# Zed
+sasdaasdasdasdasd
 [![CI](https://github.com/zed-industries/zed/actions/workflows/ci.yml/badge.svg)](https://github.com/zed-industries/zed/actions/workflows/ci.yml)
 
 Welcome to Zed, a high-performance, multiplayer code editor from the creators of [Atom](https://github.com/atom/atom) and [Tree-sitter](https://github.com/tree-sitter/tree-sitter).

crates/gpui/src/platform/linux/x11/window.rs 🔗

@@ -47,6 +47,7 @@ x11rb::atom_manager! {
         _NET_WM_STATE_FULLSCREEN,
         _NET_WM_STATE_HIDDEN,
         _NET_WM_STATE_FOCUSED,
+        _NET_ACTIVE_WINDOW,
         _NET_WM_MOVERESIZE,
         _NET_WM_WINDOW_TYPE,
         _NET_WM_WINDOW_TYPE_NOTIFICATION,
@@ -801,10 +802,21 @@ impl PlatformWindow for X11Window {
     }
 
     fn activate(&self) {
-        let win_aux = xproto::ConfigureWindowAux::new().stack_mode(xproto::StackMode::ABOVE);
+        let data = [1, xproto::Time::CURRENT_TIME.into(), 0, 0, 0];
+        let message = xproto::ClientMessageEvent::new(
+            32,
+            self.0.x_window,
+            self.0.state.borrow().atoms._NET_ACTIVE_WINDOW,
+            data,
+        );
         self.0
             .xcb_connection
-            .configure_window(self.0.x_window, &win_aux)
+            .send_event(
+                false,
+                self.0.state.borrow().x_root_window,
+                xproto::EventMask::SUBSTRUCTURE_REDIRECT | xproto::EventMask::SUBSTRUCTURE_NOTIFY,
+                message,
+            )
             .log_err();
         self.0
             .xcb_connection