diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index 9c804be1f8..25f6133e46 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -199,11 +199,24 @@ static void xdg_screensaver_inhibit(Window wnd) { int ret; char cmd[64]; + char title[128]; cmd[0] = '\0'; + title[0] = '\0'; RARCH_LOG("[X11]: Suspending screensaver (X11, xdg-screensaver).\n"); + /* Make sure the window has a title, even if it's a bogus one, otherwise + * xdg-screensaver will fail and report to stderr, framing RA for its bug. + * A single space character is used so that the title bar stays visibly + * the same, as if there's no title at all. */ + video_driver_get_window_title(title, sizeof(title)); + if (strlen(title) == 0) + snprintf(title, sizeof(title), " "); + XChangeProperty(g_x11_dpy, g_x11_win, XA_WM_NAME, XA_STRING, + 8, PropModeReplace, (const unsigned char*) title, + strlen(title)); + snprintf(cmd, sizeof(cmd), "xdg-screensaver suspend 0x%x", (int)wnd); ret = system(cmd);