steamcompmgr: Add GAMESCOPE_STEAM_MAX_HEIGHT

0 to disable, any other value sets the max height of Steam
This commit is contained in:
Joshua Ashton 2022-10-01 20:33:37 -02:30
parent 79ad108c41
commit 20062ec645
2 changed files with 30 additions and 6 deletions

View file

@ -210,6 +210,7 @@ struct commit_t
#define MWM_TEAROFF_WINDOW 1
int g_nAsyncFlipsEnabled = 0;
int g_nSteamMaxHeight = 0;
struct motif_hints_t
{
@ -2595,16 +2596,30 @@ determine_and_apply_focus(xwayland_ctx_t *ctx, std::vector<win*>& vecGlobalPossi
if (w->a.x != 0 || w->a.y != 0)
XMoveWindow(ctx->dpy, ctx->focus.focusWindow->id, 0, 0);
if ( window_is_fullscreen( ctx->focus.focusWindow ) && ( w->a.width != ctx->root_width || w->a.height != ctx->root_height || globalScaleRatio != 1.0f ) )
if ( window_is_fullscreen( ctx->focus.focusWindow ) )
{
XResizeWindow(ctx->dpy, ctx->focus.focusWindow->id, ctx->root_width, ctx->root_height);
bool bIsSteam = ctx->focus.focusWindow->appID == 769;
int fs_width = ctx->root_width;
int fs_height = ctx->root_height;
if ( bIsSteam && g_nSteamMaxHeight && ctx->root_height > g_nSteamMaxHeight )
{
float steam_height_scale = g_nSteamMaxHeight / (float)ctx->root_height;
fs_height = g_nSteamMaxHeight;
fs_width = ctx->root_width * steam_height_scale;
}
else if ( !window_is_fullscreen( ctx->focus.focusWindow ) && ctx->focus.focusWindow->sizeHintsSpecified &&
if ( w->a.width != fs_width || w->a.height != fs_height || globalScaleRatio != 1.0f )
XResizeWindow(ctx->dpy, ctx->focus.focusWindow->id, fs_width, fs_height);
}
else
{
if (ctx->focus.focusWindow->sizeHintsSpecified &&
((unsigned)ctx->focus.focusWindow->a.width != ctx->focus.focusWindow->requestedWidth ||
(unsigned)ctx->focus.focusWindow->a.height != ctx->focus.focusWindow->requestedHeight))
{
XResizeWindow(ctx->dpy, ctx->focus.focusWindow->id, ctx->focus.focusWindow->requestedWidth, ctx->focus.focusWindow->requestedHeight);
}
}
if ( inputFocus )
{
@ -4232,6 +4247,11 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev)
{
g_nAsyncFlipsEnabled = get_prop( ctx, ctx->root, ctx->atoms.gamescopeAllowTearing, 0 );
}
if ( ev->atom == ctx->atoms.gamescopeSteamMaxHeight )
{
g_nSteamMaxHeight = get_prop( ctx, ctx->root, ctx->atoms.gamescopeSteamMaxHeight, 0 );
focusDirty = true;
}
if ( ev->atom == ctx->atoms.gamescopeDisplayForceInternal )
{
if ( !BIsNested() )
@ -5193,6 +5213,8 @@ void init_xwayland_ctx(gamescope_xwayland_server_t *xwayland_server)
ctx->atoms.gamescopeCursorVisibleFeedback = XInternAtom( ctx->dpy, "GAMESCOPE_CURSOR_VISIBLE_FEEDBACK", false );
ctx->atoms.gamescopeSteamMaxHeight = XInternAtom( ctx->dpy, "GAMESCOPE_STEAM_MAX_HEIGHT", false );
ctx->atoms.wineHwndStyle = XInternAtom( ctx->dpy, "_WINE_HWND_STYLE", false );
ctx->atoms.wineHwndStyleEx = XInternAtom( ctx->dpy, "_WINE_HWND_EXSTYLE", false );

View file

@ -155,6 +155,8 @@ struct xwayland_ctx_t
Atom gamescopeCursorVisibleFeedback;
Atom gamescopeSteamMaxHeight;
Atom wineHwndStyle;
Atom wineHwndStyleEx;
} atoms;