Repository: qtile/qtile

Issue:
Window isn't raised to the top on _NET_ACTIVE_WINDOW request
### Issue description

Hello,
I'm the author of [alttab windows switcher](https://github.com/sagb/alttab/), and I have confirmed [issue](https://github.com/sagb/alttab/issues/154) with qtile: in floating layout, qtile doesn't raise selected window to the top, despite of changing focus.

According to [freedesktop](https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.html), alttab sends a _NET_ACTIVE_WINDOW client message to the root window.

In the [documentation](https://docs.qtile.org/en/latest/manual/stacking.html) you claim that you follow freedesktop [spec](https://specifications.freedesktop.org/wm-spec/1.3/ar01s07.html#STACKINGORDER) about stacking order.
But this spec itself doesn't provide a way for window switcher to change the stacking order.
That's why most EWMH-compatible WMs in response to _NET_ACTIVE_WINDOW not only change focus, but *also* raise the window to the top of the stack.

Minority of WMs don't raise the window. For them, after _NET_ACTIVE_WINDOW alltab additionaly calls [XMapRaised](https://tronche.com/gui/x/xlib/window/XMapRaised.html). This covers [all WMs](https://github.com/sagb/alttab/blob/master/doc/wm-setup.md) tested to day, that claim to be EWMH-compatible. Except qtile.

I could try to detect qtile and abuse _NET_WM_STATE_ABOVE/BELOW specially for it, but this is obviously bad idea.

Could you please fix that or suggest what I'm missing?

### Version

0.24.0

### Backend

X11 (default)

### Config

```python
layouts = [
    layout.Floating(float_rules=[
        # Run the utility of `xprop` to see the wm class and name of an X client.
        *layout.Floating.default_float_rules,
        Match(wm_class='confirmreset'),  # gitk
        Match(wm_class='makebranch'),  # gitk
        Match(wm_class='maketag'),  # gitk
        Match(wm_class='ssh-askpass'),  # ssh-askpass
        Match(title='branchdialog'),  # gitk
        Match(title='pinentry'),  # GPG key password entry
    ]),
```


### Logs

_No response_

### Required

- [X] I have searched past issues to see if this bug has already been reported, and it hasn't been.
- [X] I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.


Discussion:
Hi @sagb 

Thanks for posting the issue. I'll look into fixing this in qtile as, I agree, there's no reason you should be implementing a qtile-specific solution in alttab.

I'll let you know if I have any questions.

Resolving patch:
diff --git a/libqtile/backend/x11/window.py b/libqtile/backend/x11/window.py
--- a/libqtile/backend/x11/window.py
+++ b/libqtile/backend/x11/window.py
@@ -2135,6 +2135,7 @@ def handle_ClientMessage(self, event):  # noqa: N802
                 logger.debug("Focusing window by pager")
                 self.qtile.current_screen.set_group(self.group)
                 self.group.focus(self)
+                self.bring_to_front()
             else:  # XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER
                 focus_behavior = self.qtile.config.focus_on_window_activation
                 if focus_behavior == "focus":


Test patch: