summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/wayland/display_server_wayland.h
diff options
context:
space:
mode:
authorRiteo <riteo@posteo.net>2024-01-07 08:35:40 +0100
committerRiteo <riteo@posteo.net>2024-02-15 23:48:56 +0100
commit2e07dcf1e7776fa9c068a690bfc51e385ff7501b (patch)
tree06105fa1fdda3d84b9dffac81dd92d863c70da95 /platform/linuxbsd/wayland/display_server_wayland.h
parenta9bb8509f2faac81bdb995c6c89a5347372f3498 (diff)
downloadredot-engine-2e07dcf1e7776fa9c068a690bfc51e385ff7501b.tar.gz
Wayland: suspend window after frame timeout or suspend state
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.
Diffstat (limited to 'platform/linuxbsd/wayland/display_server_wayland.h')
-rw-r--r--platform/linuxbsd/wayland/display_server_wayland.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/platform/linuxbsd/wayland/display_server_wayland.h b/platform/linuxbsd/wayland/display_server_wayland.h
index d4da80a55f..e42967eb7b 100644
--- a/platform/linuxbsd/wayland/display_server_wayland.h
+++ b/platform/linuxbsd/wayland/display_server_wayland.h
@@ -117,7 +117,7 @@ class DisplayServerWayland : public DisplayServer {
Context context;
- bool frame = false;
+ bool suspended = false;
bool emulate_vsync = false;
String rendering_driver;