Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,35 @@ static void set_wm_state( xwayland_ctx_t *ctx, Window win, uint32_t state )
sizeof(wmState) / sizeof(wmState[0]));
}

static void set_net_wm_state( xwayland_ctx_t *ctx, steamcompmgr_win_t *w )
{
Atom netWmState[4];
int count = 0;

if ( w->isFullscreen )
{
netWmState[count++] = ctx->atoms.netWMStateFullscreenAtom;
}

if ( w->skipTaskbar )
{
netWmState[count++] = ctx->atoms.netWMStateSkipTaskbarAtom;
}

if ( w->skipPager )
{
netWmState[count++] = ctx->atoms.netWMStateSkipPagerAtom;
}

if ( ctx->focus.focusWindow == w )
{
netWmState[count++] = ctx->atoms.netWMStateFocusedAtom;
}

XChangeProperty( ctx->dpy, w->xwayland().id, ctx->atoms.netWMStateAtom, XA_ATOM, 32,
PropModeReplace, (unsigned char *)netWmState, count );
}

void xwayland_ctx_t::DetermineAndApplyFocus( const std::vector< steamcompmgr_win_t* > &vecPossibleFocusWindows )
{
xwayland_ctx_t *ctx = this;
Expand Down Expand Up @@ -3783,6 +3812,12 @@ void xwayland_ctx_t::DetermineAndApplyFocus( const std::vector< steamcompmgr_win
* iconic, so never do that. Only take them out of iconic. */
set_wm_state( ctx, ctx->focus.focusWindow->xwayland().id, ICCCM_NORMAL_STATE );

if ( prevFocusWindow )
{
set_net_wm_state( ctx, prevFocusWindow );
}
set_net_wm_state( ctx, ctx->focus.focusWindow );

gpuvis_trace_printf( "determine_and_apply_focus focus %lu", ctx->focus.focusWindow->xwayland().id );

if ( debugFocus == true )
Expand Down Expand Up @@ -5316,12 +5351,15 @@ handle_net_wm_state(xwayland_ctx_t *ctx, steamcompmgr_win_t *w, XClientMessageEv
if (props[i] == ctx->atoms.netWMStateFullscreenAtom) {
update_net_wm_state(action, &w->isFullscreen);
MakeFocusDirty();
set_net_wm_state(ctx, w);
} else if (props[i] == ctx->atoms.netWMStateSkipTaskbarAtom) {
update_net_wm_state(action, &w->skipTaskbar);
MakeFocusDirty();
set_net_wm_state(ctx, w);
} else if (props[i] == ctx->atoms.netWMStateSkipPagerAtom) {
update_net_wm_state(action, &w->skipPager);
MakeFocusDirty();
set_net_wm_state(ctx, w);
} else if (props[i] != None) {
xwm_log.debugf("Unhandled NET_WM_STATE property change: %s", XGetAtomName(ctx->dpy, props[i]));
}
Expand Down