Before, the cursor kept updating for no good reason really.
It's also a bit neater and it ever-so-slightly makes `WAYLAND_DEBUG`
logs easier to read, although they're still spammed by the window's
frame logic (which is needed).
This code was already partially there, although heavily incomplete and
nowadays commented out.
It got broken after the `WaylandThread` refactor and I didn't bother to
bring it over, preferring to `#if 0` it into oblivion for the time
being as I don't have a tablet/pen which support an eraser and tilt
reporting.
This commit brings it back and adds proper multi-tool support (needed
for eraser detection) thanks to winston-yallow, who could test this code
with their more capable tablet.
This is a pretty popular approach that took a while for me to wrap my
head around and which only recently got "official" support through an
update (xdg_shell version 6), so I think that this is all-in-all a
better option than the overkill 2000Hz ticking we have now :P
Basically, we wait for a frame event and, if either too much time passes
or we get the new `suspended` state, we consider the window as "hidden"
and stop drawing, ticking by the low usage rate.
This should work great for KDE and Mutter, which support the new state,
but not yet for sway, which is still stuck at a very old xdg_shell
version and thus falls back to the timeout approach.
Be aware that if we rely on timing out the engine will have to stall for
the whole timeout, which _could_ be problematic but doensn't seem like
it. Further testing is needed.
Special thanks go to the guys over at #wayland on OFTC, who very
patiently explained me this approach way too many times.
Instead of hardcoding platform names that support C#, let platforms
set a flag indicating if they support it. All public platforms
except web already support it, and it's a pain to maintain a patch
for this list just to add additional names of proprietary console
platforms.
This makes adding new platforms or variants or existing platforms
much easier, as the platform can signal what it supports/doesn't
support directly, and we can avoid harcoding platform names.
Using 2.2.7.dev115+g0eb441d6.
Had to add `cancelled` to the ignore list, as it's a Wayland signal which
we're handling in our code, so we don't want codespell to fix that "typo".
Also includes the typo fix from #87927.
Co-authored-by: Divyanshu Shekhar <61140213+divshekhar@users.noreply.github.com>
This prevents a wayland-scanner message from appearing every build
when `wayland=yes` is used (the default). The error message when
wayland-scanner is still printed as it's not printed by
wayland-scanner itself.
This is a workaround for the most critical portion of the WM focus bug
described in #68305. On some specific X11 WM configurations, the
editor's main window and any popups it creates will fight for focus,
which causes a total system lockup due to mouse and keyboard input being
stolen as well. Getting out of this infinite loop requires force
restarting the system.
It can be tested with the following shell script:
```bash
!#/bin/sh
godot4 &
sleep 30
pkill -x godot4
```
The workaround identified in #68305 is to remove the call to
XSetInputFocus in the ConfigureNotify event handler, so I have removed
the conditional block that calls this as well as the setup code above it
since there is no need to allocate the memory for the variables if they
won't be used in that call anymore.
This is just a hack and is not a complete fix for #68305. Multiple
developers are collaborating on a proper fix in the discussion in that
issue, but time is a valuable resource that no one has enough of, so I
am committing this workaround as a stop-gap to prevent the most critical
problem while we work on a full solution for the underlying cause.