1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

Merge pull request #108704 from wjt/xdg-portal-inhibit

Support XDG Inhibit portal
This commit is contained in:
Thaddeus Crews
2025-11-24 15:59:56 -06:00
4 changed files with 214 additions and 116 deletions

View File

@@ -688,7 +688,18 @@ void DisplayServerWayland::screen_set_keep_on(bool p_enable) {
wayland_thread.window_set_idle_inhibition(MAIN_WINDOW_ID, p_enable);
#ifdef DBUS_ENABLED
if (screensaver) {
if (portal_desktop && portal_desktop->is_inhibit_supported()) {
if (p_enable) {
// Attach the inhibit request to the main window, not the last focused window,
// on the basis that inhibiting the screensaver is global state for the application.
WindowID window_id = MAIN_WINDOW_ID;
WaylandThread::WindowState *ws = wayland_thread.wl_surface_get_window_state(wayland_thread.window_get_wl_surface(window_id));
screensaver_inhibited = portal_desktop->inhibit(ws ? ws->exported_handle : String());
} else {
portal_desktop->uninhibit();
screensaver_inhibited = false;
}
} else if (screensaver) {
if (p_enable) {
screensaver->inhibit();
} else {