Skip to content

Commit

Permalink
steamcompmgr: Add back GAMESCOPECTRL_DEBUG_REQUEST_SCREENSHOT
Browse files Browse the repository at this point in the history
Short term debugging
  • Loading branch information
misyltoad committed Jan 10, 2024
1 parent 58509f0 commit 20cac0d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3307,7 +3307,10 @@ paint_all(bool async)
}

if ( oScreenshotInfo->bX11PropertyRequested )
{
XDeleteProperty( root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeScreenShotAtom );
XDeleteProperty( root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeDebugScreenShotAtom );
}

if ( bScreenshotSuccess )
{
Expand All @@ -3326,7 +3329,10 @@ paint_all(bool async)
{
xwm_log.errorf( "Oh no, we ran out of screenshot images. Not actually writing a screenshot." );
if ( oScreenshotInfo->bX11PropertyRequested )
{
XDeleteProperty( root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeScreenShotAtom );
XDeleteProperty( root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeDebugScreenShotAtom );
}
}
}

Expand Down Expand Up @@ -5609,6 +5615,19 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev)
} );
}
}
if ( ev->atom == ctx->atoms.gamescopeDebugScreenShotAtom )
{
if ( ev->state == PropertyNewValue )
{
gamescope::CScreenshotManager::Get().TakeScreenshot( gamescope::GamescopeScreenshotInfo
{
.szScreenshotPath = "/tmp/gamescope.png",
.eScreenshotType = (gamescope_control_screenshot_type) get_prop( ctx, ctx->root, ctx->atoms.gamescopeDebugScreenShotAtom, None ),
.uScreenshotFlags = 0,
.bX11PropertyRequested = true,
} );
}
}
if (ev->atom == ctx->atoms.gameAtom)
{
steamcompmgr_win_t * w = find_win(ctx, ev->window);
Expand Down Expand Up @@ -7412,6 +7431,7 @@ void init_xwayland_ctx(uint32_t serverId, gamescope_xwayland_server_t *xwayland_
ctx->atoms.WMChangeStateAtom = XInternAtom(ctx->dpy, "WM_CHANGE_STATE", false);
ctx->atoms.gamescopeInputCounterAtom = XInternAtom(ctx->dpy, "GAMESCOPE_INPUT_COUNTER", false);
ctx->atoms.gamescopeScreenShotAtom = XInternAtom( ctx->dpy, "GAMESCOPECTRL_REQUEST_SCREENSHOT", false );
ctx->atoms.gamescopeDebugScreenShotAtom = XInternAtom( ctx->dpy, "GAMESCOPECTRL_DEBUG_REQUEST_SCREENSHOT", false );

ctx->atoms.gamescopeFocusDisplay = XInternAtom(ctx->dpy, "GAMESCOPE_FOCUS_DISPLAY", false);
ctx->atoms.gamescopeMouseFocusDisplay = XInternAtom(ctx->dpy, "GAMESCOPE_MOUSE_FOCUS_DISPLAY", false);
Expand Down
1 change: 1 addition & 0 deletions src/xwayland_ctx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ struct xwayland_ctx_t final : public gamescope::IWaitable
Atom gamescopeCtrlWindowAtom;
Atom gamescopeInputCounterAtom;
Atom gamescopeScreenShotAtom;
Atom gamescopeDebugScreenShotAtom;

Atom gamescopeFocusDisplay;
Atom gamescopeMouseFocusDisplay;
Expand Down

0 comments on commit 20cac0d

Please sign in to comment.