Skip to content

Commit

Permalink
Do not unmaximize windows that are not maximized or tiled - fixes Win…
Browse files Browse the repository at this point in the history
…e bug

Wine >= 5.16 updates the window state more often to fix problems in KDE [1],
and this leads to the unmaximize function being called in some Windows
applications.

This caused problems with windows suddenly moving back to their original
position at unexpected times using Marco or Muffin as window manager.
See also bug reports [2,3].

In the case of Muffin, windows were moved back if they were maximised or
either the tile type or tile mode was unset. This check would (almost)
always pass because the tile mode is unset when a window is shaken loose
in update_move before this function is called, and on an untiled window
both variables are set to none regardless.

This commit makes sure we are actually unmaximising a maximised window,
or untiling a tiled one.

[1] https://source.winehq.org/git/wine.git/commit/c5ec1585f6e5211a2b63e3435748210552250534
[2] https://bugs.winehq.org/show_bug.cgi?id=49779
[3] https://bugs.winehq.org/show_bug.cgi?id=50381
  • Loading branch information
AlbertJP authored and mtwebster committed May 26, 2021
1 parent ee9a615 commit 45c631c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/window.c
Expand Up @@ -3988,13 +3988,13 @@ meta_window_unmaximize_internal (MetaWindow *window,
if (unmaximize_horizontally && unmaximize_vertically)
window->saved_maximize = FALSE;

/* Only do something if the window isn't already maximized in the
/* Only do something if the window is tiled, or maximized in the
* given direction(s).
*/
if ((unmaximize_horizontally && window->maximized_horizontally) ||
(unmaximize_vertically && window->maximized_vertically) ||
window->tile_type == META_WINDOW_TILE_TYPE_NONE ||
window->tile_mode == META_TILE_NONE)
window->tile_type != META_WINDOW_TILE_TYPE_NONE ||
window->tile_mode != META_TILE_NONE)
{
MetaRectangle target_rect;
MetaRectangle work_area;
Expand Down

0 comments on commit 45c631c

Please sign in to comment.