Repository: qtile/qtile

Issue:
[Wayland] Session dying when trying to play a game using proton (Xwayland).
### The issue:

Qtile Version : 0.21.1.dev45+g3ce0db23
qtile logs : 
```
2022-05-22 13:36:01,477 libqtile core.py:__init__():L120  Starting core with WAYLAND_DISPLAY=wayland-0
2022-05-22 13:36:01,516 libqtile core.py:__init__():L215  Set up XWayland with DISPLAY=:0
2022-05-22 13:36:01,944 libqtile core.py:_on_new_input():L289  New KEYBOARD: Video Bus
2022-05-22 13:36:01,954 libqtile core.py:_on_new_input():L289  New KEYBOARD: Power Button
2022-05-22 13:36:01,955 libqtile core.py:_on_new_input():L289  New SWITCH: Lid Switch
2022-05-22 13:36:01,965 libqtile core.py:_on_new_input():L289  New KEYBOARD: SteelSeries SteelSeries Arctis 5
2022-05-22 13:36:01,965 libqtile core.py:_on_new_input():L289  New POINTER: Elan Touchpad
2022-05-22 13:36:01,975 libqtile core.py:_on_new_input():L289  New KEYBOARD: Ideapad extra buttons
2022-05-22 13:36:01,985 libqtile core.py:_on_new_input():L289  New KEYBOARD: AT Translated Set 2 keyboard
2022-05-22 13:36:02,219 libqtile utils.py:guess_terminal():L325  Terminal found: alacritty
2022-05-22 13:36:02,237 libqtile utils.py:guess_terminal():L325  Terminal found: alacritty
2022-05-22 13:36:02,343 libqtile bar.py:_configure():L316  The following widgets were renamed in qtile.widgets_map: textbox_1, spacer_1, textbox_2, textbox_3, textbox_4, spacer_2, textbox_5, textbox_6, spacer_3, textbox_7, textbox_8, spacer_4 To bind commands, rename the widget or use lazy.widget[new_name].
2022-05-22 13:36:03,477 libqtile loop.py:_handle_exception():L63  could not open dbus info file: /home/noen/.dbus/session-bus/a6ca2ab917c743f994d4e74a91e65afa-0
NoneType: None
2022-05-22 13:36:03,901 libqtile core.py:_on_new_layer_surface():L493  Managing new layer_shell window with window ID: 3
2022-05-22 13:36:26,304 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/output.py", line 112, in _on_frame
    with self.wlr_output as wlr_output:
  File "/usr/lib/python3.10/site-packages/wlroots/wlr_types/output.py", line 149, in __exit__
    self.commit()
  File "/usr/lib/python3.10/site-packages/wlroots/wlr_types/output.py", line 186, in commit
    raise RuntimeError("Unable to commit output")
RuntimeError: Unable to commit output
2022-05-22 13:37:44,363 libqtile window.py:__init__():L1797  No window found for pointer constraints. Please report.
2022-05-22 13:37:44,363 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/core.py", line 436, in _on_new_pointer_constraint
    constraint = window.PointerConstraint(self, wlr_constraint)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1798, in __init__
    raise RuntimeError
RuntimeError
2022-05-22 13:37:44,368 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1814, in _on_destroy
    self.finalize()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1806, in finalize
    self.core.pointer_constraints.remove(self)
KeyError: <libqtile.backend.wayland.window.PointerConstraint object at 0x7fb2e40f9150>
2022-05-22 13:37:44,369 libqtile window.py:__init__():L1797  No window found for pointer constraints. Please report.
2022-05-22 13:37:44,369 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/core.py", line 436, in _on_new_pointer_constraint
    constraint = window.PointerConstraint(self, wlr_constraint)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1798, in __init__
    raise RuntimeError
RuntimeError
2022-05-22 13:37:46,052 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,062 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,072 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,081 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,091 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,102 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,112 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,122 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,132 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,142 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,153 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,163 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,173 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,183 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,193 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,203 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,213 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,223 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,233 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,244 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,254 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,264 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,274 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,284 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,294 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,304 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,314 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,324 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,335 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,344 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,355 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,365 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,375 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,385 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,395 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,406 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,415 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,425 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,435 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,445 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,457 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,466 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,476 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,486 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,497 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,507 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,516 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,527 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,537 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,547 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,557 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,567 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,577 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,588 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,597 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,608 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,619 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,628 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,638 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,648 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,658 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
2022-05-22 13:37:46,669 pywayland.server listener.py:notify_func():L42  Exception in callback function
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1810, in _on_set_region
    self._get_region()
  File "/home/noen/repos/qtile/libqtile/backend/wayland/window.py", line 1825, in _get_region
    rect.x += self.window.x + self.window.borderwidth
AttributeError: 'PointerConstraint' object has no attribute 'window'
```
wephyr logs :
 ```
noen@none ~/repos/qtile (git)-[master] % ./scripts/wephyr > ~/qtile.log
registry: adding output 25
calculated sun trajectory: dawn 05:04, sunrise 05:47, sunset 19:22, dusk 20:05
setting temperature to 6500 K
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 708, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server
XDG_SESSION_ID  "" is not a valid integer, defaulting to 1
00:00:24.912 [backend/drm/atomic.c:34] connector HDMI-A-1: Atomic commit failed (pageflip): Device or resource busy
(EE) failed to read Wayland events: Connection reset by peer
The X11 connection broke (error 1). Did the X11 server die?
```
This only happens when i try to play a game using proton, other Xwayland applications works fine and don't cause qtile to crash.
The game works fine on qtile with the X11 backend.

### Required:

- [X] I have searched past issues to see if this bug has already been reported.


Discussion:
Thanks for the report. Looks like it's the interaction with pointer constraints and XWayland that is causing a problem. Pointer constraints should work under XWayland, so hopefully it's an easy fix to make them compatible.

Resolving patch:
diff --git a/libqtile/backend/wayland/core.py b/libqtile/backend/wayland/core.py
--- a/libqtile/backend/wayland/core.py
+++ b/libqtile/backend/wayland/core.py
@@ -967,6 +967,11 @@ def remove_output(self, output: Output) -> None:
             self._current_output = self.outputs[0] if self.outputs else None
             self.stack_windows()
 
+    def remove_pointer_constraints(self, window: window.Window | window.Static) -> None:
+        for pc in self.pointer_constraints.copy():
+            if pc.window is window:
+                pc.finalize()
+
     def keysym_from_name(self, name: str) -> int:
         """Get the keysym for a key from its name"""
         return xkb.keysym_from_name(name, case_insensitive=True)
diff --git a/libqtile/backend/wayland/window.py b/libqtile/backend/wayland/window.py
--- a/libqtile/backend/wayland/window.py
+++ b/libqtile/backend/wayland/window.py
@@ -135,6 +135,7 @@ def __init__(self, core: Core, qtile: Qtile, surface: S):
     def finalize(self) -> None:
         self.finalize_listeners()
         self.ftm_handle.destroy()
+        self.core.remove_pointer_constraints(self)
 
     @property
     def wid(self) -> int:
@@ -647,10 +648,6 @@ def finalize(self) -> None:
         for subsurface in self.subsurfaces:
             subsurface.finalize()
 
-        for pc in self.core.pointer_constraints.copy():
-            if pc.window is self:
-                pc.finalize()
-
     def _on_map(self, _listener: Listener, _data: Any) -> None:
         logger.debug("Signal: xdgwindow map")
 
@@ -866,7 +863,6 @@ def cmd_static(
         for pc in self.core.pointer_constraints.copy():
             if pc.window is self:
                 pc.window = win
-                break
 
         hook.fire("client_managed", win)
 
@@ -1151,6 +1147,7 @@ def __init__(
 
     def finalize(self) -> None:
         self.finalize_listeners()
+        self.core.remove_pointer_constraints(self)
 
     @property
     def wid(self) -> int:
@@ -1300,10 +1297,6 @@ def finalize(self) -> None:
         for subsurface in self.subsurfaces:
             subsurface.finalize()
 
-        for pc in self.core.pointer_constraints.copy():
-            if pc.window is self:
-                pc.finalize()
-
     def kill(self) -> None:
         self.surface.send_close()
 
@@ -1458,10 +1451,6 @@ def finalize(self) -> None:
         for subsurface in self.subsurfaces:
             subsurface.finalize()
 
-        for pc in self.core.pointer_constraints.copy():
-            if pc.window is self:
-                pc.finalize()
-
     @property
     def mapped(self) -> bool:
         return self._mapped
@@ -1781,23 +1770,23 @@ def __init__(self, core: Core, wlr_constraint: PointerConstraintV1):
         self._warp_target: tuple[float, float] = (0, 0)
         self._needs_warp: bool = False
 
-        self.add_listener(wlr_constraint.set_region_event, self._on_set_region)
-        self.add_listener(wlr_constraint.destroy_event, self._on_destroy)
-
+        assert core.qtile is not None
         owner = None
 
-        if core.qtile and core.qtile.windows_map:
-            for win in core.qtile.windows_map.values():
-                if isinstance(win, (XdgWindow, XdgStatic)):
-                    if win.surface.surface == self.wlr_constraint.surface:
-                        owner = win
-                        break
+        for win in core.qtile.windows_map.values():
+            if isinstance(win, (Window | Static)):
+                if win.surface.surface == self.wlr_constraint.surface:
+                    owner = win
+                    break
 
         if owner is None:
             logger.error("No window found for pointer constraints. Please report.")
             raise RuntimeError
 
-        self.window: XdgWindow | XdgStatic = owner
+        self.window: Window | Static = owner
+
+        self.add_listener(wlr_constraint.set_region_event, self._on_set_region)
+        self.add_listener(wlr_constraint.destroy_event, self._on_destroy)
 
     def finalize(self) -> None:
         if self.core.active_pointer_constraint is self:


Test patch: