Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

steamcompmgr: Set WM_STATE property on map and unmap notify events. #1730

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
21 changes: 13 additions & 8 deletions src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3440,6 +3440,14 @@ found:;
return vecPossibleFocusWindows;
}

static void set_wm_state( xwayland_ctx_t *ctx, Window win, uint32_t state )
{
uint32_t wmState[] = { state, None };
XChangeProperty(ctx->dpy, win, ctx->atoms.WMStateAtom, ctx->atoms.WMStateAtom, 32,
PropModeReplace, (unsigned char *)wmState,
sizeof(wmState) / sizeof(wmState[0]));
}

void xwayland_ctx_t::DetermineAndApplyFocus( const std::vector< steamcompmgr_win_t* > &vecPossibleFocusWindows )
{
xwayland_ctx_t *ctx = this;
Expand Down Expand Up @@ -3503,10 +3511,7 @@ void xwayland_ctx_t::DetermineAndApplyFocus( const std::vector< steamcompmgr_win
{
/* Some games (e.g. DOOM Eternal) don't react well to being put back as
* iconic, so never do that. Only take them out of iconic. */
uint32_t wmState[] = { ICCCM_NORMAL_STATE, None };
XChangeProperty(ctx->dpy, ctx->focus.focusWindow->xwayland().id, ctx->atoms.WMStateAtom, ctx->atoms.WMStateAtom, 32,
PropModeReplace, (unsigned char *)wmState,
sizeof(wmState) / sizeof(wmState[0]));
set_wm_state( ctx, ctx->focus.focusWindow->xwayland().id, ICCCM_NORMAL_STATE );

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

Expand Down Expand Up @@ -4320,6 +4325,8 @@ map_win(xwayland_ctx_t* ctx, Window id, unsigned long sequence)
}

MakeFocusDirty();

set_wm_state( ctx, w->xwayland().id, ICCCM_NORMAL_STATE );
}

static void
Expand All @@ -4344,6 +4351,7 @@ unmap_win(xwayland_ctx_t *ctx, Window id, bool fade)
MakeFocusDirty();

finish_unmap_win(ctx, w);
set_wm_state( ctx, w->xwayland().id, ICCCM_WITHDRAWN_STATE );
}

uint32_t
Expand Down Expand Up @@ -4919,10 +4927,7 @@ handle_wm_change_state(xwayland_ctx_t *ctx, steamcompmgr_win_t *w, XClientMessag
* agreed on it; immediately revert to normal state to avoid being
* stuck in a paused state. */
xwm_log.debugf("Rejecting WM_CHANGE_STATE to ICONIC for window 0x%lx", w->xwayland().id);
uint32_t wmState[] = { ICCCM_NORMAL_STATE, None };
XChangeProperty(ctx->dpy, w->xwayland().id, ctx->atoms.WMStateAtom, ctx->atoms.WMStateAtom, 32,
PropModeReplace, (unsigned char *)wmState,
sizeof(wmState) / sizeof(wmState[0]));
set_wm_state( ctx, w->xwayland().id, ICCCM_NORMAL_STATE );
} else {
xwm_log.debugf("Unhandled WM_CHANGE_STATE to %ld for window 0x%lx", state, w->xwayland().id);
}
Expand Down