Skip to content

Commit

Permalink
windowButtons: optimize (un)maximize button code
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Sep 8, 2018
1 parent 9b434a3 commit d0007a2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions unite@hardpixel.eu/modules/windowButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const ExtensionUtils = imports.misc.extensionUtils;
const Unite = ExtensionUtils.getCurrentExtension();
const Helpers = Unite.imports.helpers;
const Convenience = Unite.imports.convenience;
const MAXIMIZED = Meta.MaximizeFlags.BOTH;

var WindowButtons = new Lang.Class({
Name: 'Unite.WindowButtons',
Expand Down Expand Up @@ -222,10 +221,13 @@ var WindowButtons = new Lang.Class({
},

_maximizeWindow: function () {
if (this._activeWindow.get_maximized() === MAXIMIZED) {
this._activeWindow.unmaximize(MAXIMIZED);
let bothMaximized = Meta.MaximizeFlags.BOTH;
let maximizeState = this._activeWindow.get_maximized();

if (maximizeState === bothMaximized) {
this._activeWindow.unmaximize(bothMaximized);
} else {
this._activeWindow.maximize(MAXIMIZED);
this._activeWindow.maximize(bothMaximized);
}
},

Expand Down

0 comments on commit d0007a2

Please # to comment.