Fix #1074: Window menu says Unmaximize when tiled (#1087)

This commit is contained in:
José Expósito 2021-03-29 13:39:11 +02:00 committed by GitHub
parent 1f6889ffbd
commit 92bc6b8a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View File

@ -218,7 +218,12 @@ namespace Gala {
maximize.visible = Gala.WindowFlags.CAN_MAXIMIZE in flags;
if (maximize.visible) {
var maximize_label = Gala.WindowFlags.IS_MAXIMIZED in flags ? _("Unmaximize") : _("Maximize");
unowned string maximize_label;
if (Gala.WindowFlags.IS_MAXIMIZED in flags) {
maximize_label = (Gala.WindowFlags.IS_TILED in flags) ? _("Untile") : _("Unmaximize");
} else {
maximize_label = _("Maximize");
}
maximize.get_child ().destroy ();
maximize.add (

View File

@ -46,7 +46,8 @@ namespace Gala {
ALLOWS_RESIZE,
ALWAYS_ON_TOP,
ON_ALL_WORKSPACES,
CAN_CLOSE
CAN_CLOSE,
IS_TILED
}
/**

View File

@ -770,7 +770,8 @@ namespace Gala {
if (current == null || current.window_type != Meta.WindowType.NORMAL)
break;
if (current.get_maximized () == (Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL))
var maximize_flags = current.get_maximized ();
if (Meta.MaximizeFlags.VERTICAL in maximize_flags || Meta.MaximizeFlags.HORIZONTAL in maximize_flags)
current.unmaximize (Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL);
else
current.maximize (Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL);
@ -909,9 +910,15 @@ namespace Gala {
if (window.can_maximize ())
flags |= WindowFlags.CAN_MAXIMIZE;
if (window.get_maximized () > 0)
var maximize_flags = window.get_maximized ();
if (maximize_flags > 0) {
flags |= WindowFlags.IS_MAXIMIZED;
if (Meta.MaximizeFlags.VERTICAL in maximize_flags && !(Meta.MaximizeFlags.HORIZONTAL in maximize_flags)) {
flags |= WindowFlags.IS_TILED;
}
}
if (window.allows_move ())
flags |= WindowFlags.ALLOWS_MOVE;