Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
vm_tools: sommelier: Ignore additional X11 fullscreen state changes.
Browse files Browse the repository at this point in the history
Ignore additional X11 fullscreen state changes when window->fullscreen
is already 1. If compositor_fullscreen=0 and fullscreen=1 and the window
is iconified while containerized, the window goes back to fullscreen on
focus in instead of maintaining earlier state.

BUG=b:342633326
TEST=minimize window when compositor_fullscreen=0 and fullscreen=1

Change-Id: Ied1ae5b376623baca3fcb0b595dbe09a12912d00
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/5584707
Commit-Queue: Arjun Srinivasan <[email protected]>
Tested-by: Arjun Srinivasan <[email protected]>
Reviewed-by: Chloe Pelling <[email protected]>
  • Loading branch information
Arjun Srinivasan authored and Chromeos LUCI committed Jun 7, 2024
1 parent d3e8b8b commit 666e868
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions sommelier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1862,24 +1862,34 @@ void sl_handle_client_message(struct sl_context* ctx,
"action", net_wm_state_to_string(action), "window->name",
window->name);
if (action == NET_WM_STATE_ADD) {
window->fullscreen = 1;
LOG(VERBOSE) << window << " fullscreen=1";
if (window->xdg_toplevel && !window->iconified) {
xdg_toplevel_set_fullscreen(window->xdg_toplevel, nullptr);
} else {
window->pending_fullscreen_change = true;
// Ignore additional calls to change to fullscreen
// if X11 state is already fullscreen. Prevents issues when changing
// focus back to game and Exo/X11 state differ.
if (!window->fullscreen) {
window->fullscreen = 1;
LOG(VERBOSE) << window << " fullscreen=1";
if (window->xdg_toplevel && !window->iconified) {
xdg_toplevel_set_fullscreen(window->xdg_toplevel, nullptr);
} else {
window->pending_fullscreen_change = true;
}
}
} else if (action == NET_WM_STATE_REMOVE) {
// Preemptively ask Exo to remove fullscreen then check during surface
// commit (ie. after all states aggregated).
window->maybe_promote_to_fullscreen = true;

window->fullscreen = 0;
LOG(VERBOSE) << window << " fullscreen=0";
if (window->xdg_toplevel && !window->iconified) {
xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
} else {
window->pending_fullscreen_change = true;
// Ignore additional calls to change to windowed
// if X11 state is already windowed. Prevents issues when changing
// focus back to game and Exo/X11 state differ.
if (window->fullscreen) {
// Preemptively ask Exo to remove fullscreen then check during
// surface commit (ie. after all states aggregated).
window->maybe_promote_to_fullscreen = true;

window->fullscreen = 0;
LOG(VERBOSE) << window << " fullscreen=0";
if (window->xdg_toplevel && !window->iconified) {
xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
} else {
window->pending_fullscreen_change = true;
}
}
}
}
Expand Down

0 comments on commit 666e868

Please sign in to comment.