From f63bbfc88ca1cd4b22bda1d955704dfd5c844db9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Sep 2023 16:43:46 +0530 Subject: [PATCH] Wayland: Do not request idle inhibition for full screen windows Fixes #6613 --- docs/changelog.rst | 2 ++ glfw/source-info.json | 1 - glfw/wl_init.c | 9 --------- glfw/wl_platform.h | 4 ---- glfw/wl_window.c | 25 ------------------------- 5 files changed, 2 insertions(+), 39 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f4bd28ae4..80663a85a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -80,6 +80,8 @@ Detailed list of changes - diff kitten: Add support for files that are identical apart from mode changes (:iss:`6611`) +- Wayland: Do not request idle inhibition for full screen windows (:iss:`6613`) + 0.29.2 [2023-07-27] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/glfw/source-info.json b/glfw/source-info.json index 13bc84db4..cd5e88548 100644 --- a/glfw/source-info.json +++ b/glfw/source-info.json @@ -74,7 +74,6 @@ "stable/viewporter/viewporter.xml", "unstable/relative-pointer/relative-pointer-unstable-v1.xml", "unstable/pointer-constraints/pointer-constraints-unstable-v1.xml", - "unstable/idle-inhibit/idle-inhibit-unstable-v1.xml", "unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", "unstable/primary-selection/primary-selection-unstable-v1.xml", "unstable/text-input/text-input-unstable-v3.xml", diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 6994afe3e..1d6b54d61 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -692,13 +692,6 @@ static void registryHandleGlobal(void* data UNUSED, _glfwWaylandBindTextInput(registry, name); _glfwWaylandInitTextInput(); } - else if (strcmp(interface, "zwp_idle_inhibit_manager_v1") == 0) - { - _glfw.wl.idleInhibitManager = - wl_registry_bind(registry, name, - &zwp_idle_inhibit_manager_v1_interface, - 1); - } else if (strcmp(interface, "wl_data_device_manager") == 0) { _glfw.wl.dataDeviceManager = @@ -937,8 +930,6 @@ void _glfwPlatformTerminate(void) if (_glfw.wl.pointerConstraints) zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints); _glfwWaylandDestroyTextInput(); - if (_glfw.wl.idleInhibitManager) - zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager); if (_glfw.wl.dataSourceForClipboard) wl_data_source_destroy(_glfw.wl.dataSourceForClipboard); if (_glfw.wl.dataSourceForPrimarySelection) diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 8b98bfc89..6a5fa3589 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -56,7 +56,6 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR #include "wayland-xdg-decoration-unstable-v1-client-protocol.h" #include "wayland-relative-pointer-unstable-v1-client-protocol.h" #include "wayland-pointer-constraints-unstable-v1-client-protocol.h" -#include "wayland-idle-inhibit-unstable-v1-client-protocol.h" #include "wayland-primary-selection-unstable-v1-client-protocol.h" #include "wayland-primary-selection-unstable-v1-client-protocol.h" #include "wl_text_input.h" @@ -182,8 +181,6 @@ typedef struct _GLFWwindowWayland struct zwp_locked_pointer_v1* lockedPointer; } pointerLock; - struct zwp_idle_inhibitor_v1* idleInhibitor; - struct { bool serverSide, buffer_destroyed; _GLFWdecorationSideWayland focus; @@ -284,7 +281,6 @@ typedef struct _GLFWlibraryWayland struct zxdg_decoration_manager_v1* decorationManager; struct zwp_relative_pointer_manager_v1* relativePointerManager; struct zwp_pointer_constraints_v1* pointerConstraints; - struct zwp_idle_inhibit_manager_v1* idleInhibitManager; struct wl_data_source* dataSourceForClipboard; struct zwp_primary_selection_device_manager_v1* primarySelectionDeviceManager; struct zwp_primary_selection_device_v1* primarySelectionDevice; diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 519c2de2c..1674e8b75 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -410,24 +410,6 @@ static const struct wl_surface_listener surfaceListener = { surfaceHandleLeave }; -static void setIdleInhibitor(_GLFWwindow* window, bool enable) -{ - if (enable && !window->wl.idleInhibitor && _glfw.wl.idleInhibitManager) - { - window->wl.idleInhibitor = - zwp_idle_inhibit_manager_v1_create_inhibitor( - _glfw.wl.idleInhibitManager, window->wl.surface); - if (!window->wl.idleInhibitor) - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Idle inhibitor creation failed"); - } - else if (!enable && window->wl.idleInhibitor) - { - zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor); - window->wl.idleInhibitor = NULL; - } -} - static bool createSurface(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { @@ -488,7 +470,6 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, bool on) ensure_csd_resources(window); } } - setIdleInhibitor(window, on); } @@ -712,18 +693,15 @@ createXdgSurface(_GLFWwindow* window) { xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, window->monitor->wl.output); - setIdleInhibitor(window, true); } else if (window->wl.maximize_on_first_show) { window->wl.maximize_on_first_show = false; xdg_toplevel_set_maximized(window->wl.xdg.toplevel); - setIdleInhibitor(window, false); setXdgDecorations(window); } else { - setIdleInhibitor(window, false); setXdgDecorations(window); } if (strlen(window->wl.appId)) @@ -952,9 +930,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) _glfw.wl.keyRepeatInfo.keyboardFocusId = 0; } - if (window->wl.idleInhibitor) - zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor); - if (window->context.destroy) window->context.destroy(window);