mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Fallback to screensaver inhibit via D-Bus on Wayland (#15856)
Some Wayland compositors (e.g. Phoc) don't implement Wayland's Idle protocol. They instead rely on things like Gnome Screensaver.
This commit is contained in:
parent
4cd68ddfbe
commit
e7a10b2326
@ -28,6 +28,10 @@
|
|||||||
#include "../../frontend/frontend_driver.h"
|
#include "../../frontend/frontend_driver.h"
|
||||||
#include "../../verbosity.h"
|
#include "../../verbosity.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
|
#include "dbus_common.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SPLASH_SHM_NAME "retroarch-wayland-vk-splash"
|
#define SPLASH_SHM_NAME "retroarch-wayland-vk-splash"
|
||||||
|
|
||||||
#define APP_ID "org.libretro.RetroArch"
|
#define APP_ID "org.libretro.RetroArch"
|
||||||
@ -282,6 +286,13 @@ void gfx_ctx_wl_destroy_resources_common(gfx_ctx_wayland_data_t *wl)
|
|||||||
zxdg_decoration_manager_v1_destroy(wl->deco_manager);
|
zxdg_decoration_manager_v1_destroy(wl->deco_manager);
|
||||||
if (wl->idle_inhibit_manager)
|
if (wl->idle_inhibit_manager)
|
||||||
zwp_idle_inhibit_manager_v1_destroy(wl->idle_inhibit_manager);
|
zwp_idle_inhibit_manager_v1_destroy(wl->idle_inhibit_manager);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
|
dbus_screensaver_uninhibit();
|
||||||
|
dbus_close_connection();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
if (wl->pointer_constraints)
|
if (wl->pointer_constraints)
|
||||||
zwp_pointer_constraints_v1_destroy(wl->pointer_constraints);
|
zwp_pointer_constraints_v1_destroy(wl->pointer_constraints);
|
||||||
if (wl->relative_pointer_manager)
|
if (wl->relative_pointer_manager)
|
||||||
@ -659,6 +670,9 @@ bool gfx_ctx_wl_init_common(
|
|||||||
if (!wl->idle_inhibit_manager)
|
if (!wl->idle_inhibit_manager)
|
||||||
{
|
{
|
||||||
RARCH_LOG("[Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol\n");
|
RARCH_LOG("[Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol\n");
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
|
dbus_ensure_connection();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wl->deco_manager)
|
if (!wl->deco_manager)
|
||||||
@ -878,7 +892,13 @@ bool gfx_ctx_wl_suppress_screensaver(void *data, bool state)
|
|||||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||||
|
|
||||||
if (!wl->idle_inhibit_manager)
|
if (!wl->idle_inhibit_manager)
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
|
/* Some Wayland compositors (e.g. Phoc) don't implement Wayland's Idle protocol.
|
||||||
|
* They instead rely on things like Gnome Screensaver. */
|
||||||
|
return dbus_suspend_screensaver(state);
|
||||||
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
if (state != (!!wl->idle_inhibitor))
|
if (state != (!!wl->idle_inhibitor))
|
||||||
{
|
{
|
||||||
if (state)
|
if (state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user