Skip to content

Commit

Permalink
Merge branch 'wayland-dbus-idle' of github.com:puffnfresh/RetroArch i…
Browse files Browse the repository at this point in the history
…nto wayland-dbus-idle
  • Loading branch information
zoltanvb committed Nov 1, 2023
2 parents 4cd68dd + e2432ec commit 1fd9be1
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions gfx/common/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "../../frontend/frontend_driver.h"
#include "../../verbosity.h"

#ifdef HAVE_DBUS
#include "dbus_common.h"
#endif

#define SPLASH_SHM_NAME "retroarch-wayland-vk-splash"

#define APP_ID "org.libretro.RetroArch"
Expand Down Expand Up @@ -277,11 +281,15 @@ void gfx_ctx_wl_destroy_resources_common(gfx_ctx_wayland_data_t *wl)
xdg_surface_destroy(wl->xdg_surface);
if (wl->surface)
wl_surface_destroy(wl->surface);

if (wl->deco_manager)
zxdg_decoration_manager_v1_destroy(wl->deco_manager);
if (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)
zwp_pointer_constraints_v1_destroy(wl->pointer_constraints);
if (wl->relative_pointer_manager)
Expand Down Expand Up @@ -659,6 +667,9 @@ bool gfx_ctx_wl_init_common(
if (!wl->idle_inhibit_manager)
{
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)
Expand Down Expand Up @@ -877,8 +888,14 @@ bool gfx_ctx_wl_suppress_screensaver(void *data, bool state)
{
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;
<<<<<<< HEAD
if (state != (!!wl->idle_inhibitor))
{
if (state)
Expand All @@ -894,6 +911,12 @@ bool gfx_ctx_wl_suppress_screensaver(void *data, bool state)
wl->idle_inhibitor = NULL;
}
}
=======
#endif
}
if (state == (!!wl->idle_inhibitor))
return true;
>>>>>>> e2432ecab8ad9d0d179ef3761dba0c121d58d568

return true;
}
Expand Down

0 comments on commit 1fd9be1

Please sign in to comment.