steamcompmgr: Handle being initially connected to external display
This commit is contained in:
parent
bf119ee44b
commit
4a308c97f7
2 changed files with 20 additions and 9 deletions
12
src/main.cpp
12
src/main.cpp
|
@ -212,10 +212,12 @@ static void handle_signal( int sig )
|
|||
}
|
||||
}
|
||||
|
||||
int g_nPreferredOutputWidth = 0;
|
||||
int g_nPreferredOutputHeight = 0;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int nPreferredOutputWidth = 0;
|
||||
int nPreferredOutputHeight = 0;
|
||||
|
||||
|
||||
static std::string optstring = build_optstring(gamescope_options);
|
||||
gamescope_optstring = optstring.c_str();
|
||||
|
@ -236,10 +238,10 @@ int main(int argc, char **argv)
|
|||
g_nNestedRefresh = atoi( optarg );
|
||||
break;
|
||||
case 'W':
|
||||
nPreferredOutputWidth = atoi( optarg );
|
||||
g_nPreferredOutputWidth = atoi( optarg );
|
||||
break;
|
||||
case 'H':
|
||||
nPreferredOutputHeight = atoi( optarg );
|
||||
g_nPreferredOutputHeight = atoi( optarg );
|
||||
break;
|
||||
case 'o':
|
||||
g_nNestedUnfocusedRefresh = atoi( optarg );
|
||||
|
@ -358,7 +360,7 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if ( !initOutput( nPreferredOutputWidth, nPreferredOutputHeight, g_nNestedRefresh ) )
|
||||
if ( !initOutput( g_nPreferredOutputWidth, g_nPreferredOutputHeight, g_nNestedRefresh ) )
|
||||
{
|
||||
fprintf( stderr, "Failed to initialize output\n" );
|
||||
return 1;
|
||||
|
|
|
@ -761,6 +761,12 @@ window_wants_no_focus_when_mouse_hidden( win *w )
|
|||
return w && w->appID == 769;
|
||||
}
|
||||
|
||||
static bool
|
||||
window_is_fullscreen( win *w )
|
||||
{
|
||||
return w && ( w->appID == 769 || w->isFullscreen );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a cursor. It is hidden in the beginning (normally until moved by user).
|
||||
*/
|
||||
|
@ -2259,11 +2265,11 @@ 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 ( ctx->focus.focusWindow->isFullscreen && ( w->a.width != ctx->root_width || w->a.height != ctx->root_height || globalScaleRatio != 1.0f ) )
|
||||
if ( window_is_fullscreen( ctx->focus.focusWindow ) && ( w->a.width != ctx->root_width || w->a.height != ctx->root_height || globalScaleRatio != 1.0f ) )
|
||||
{
|
||||
XResizeWindow(ctx->dpy, ctx->focus.focusWindow->id, ctx->root_width, ctx->root_height);
|
||||
}
|
||||
else if (!ctx->focus.focusWindow->isFullscreen && ctx->focus.focusWindow->sizeHintsSpecified &&
|
||||
else if ( !window_is_fullscreen( ctx->focus.focusWindow ) && ctx->focus.focusWindow->sizeHintsSpecified &&
|
||||
((unsigned)ctx->focus.focusWindow->a.width != ctx->focus.focusWindow->requestedWidth ||
|
||||
(unsigned)ctx->focus.focusWindow->a.height != ctx->focus.focusWindow->requestedHeight))
|
||||
{
|
||||
|
@ -4489,6 +4495,9 @@ void init_xwayland_ctx(gamescope_xwayland_server_t *xwayland_server)
|
|||
}
|
||||
}
|
||||
|
||||
extern int g_nPreferredOutputWidth;
|
||||
extern int g_nPreferredOutputHeight;
|
||||
|
||||
void
|
||||
steamcompmgr_main(int argc, char **argv)
|
||||
{
|
||||
|
@ -4568,8 +4577,8 @@ steamcompmgr_main(int argc, char **argv)
|
|||
alwaysComposite = true;
|
||||
}
|
||||
|
||||
currentOutputWidth = g_nOutputWidth;
|
||||
currentOutputHeight = g_nOutputHeight;
|
||||
currentOutputWidth = g_nPreferredOutputWidth;
|
||||
currentOutputHeight = g_nPreferredOutputHeight;
|
||||
|
||||
int vblankFD = vblank_init();
|
||||
assert( vblankFD >= 0 );
|
||||
|
|
Loading…
Reference in a new issue