2
* Copyright (C) 2009 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by Jason Smith <jason.smith@canonical.com>
22
public class Maximus : Object
24
public static string user_unmaximize_hint = "maximus-user-unmaximize";
26
static string[] default_exclude_classes =
29
"Bluetooth-properties",
31
"Download", /* Firefox Download Window */
33
"Extension", /* Firefox Add-Ons/Extension Window */
35
"Global", /* Firefox Error Console Window */
41
"Polkit-gnome-authorization",
44
"Toplevel", /* Firefox "Clear Private Data" Window */
56
bool window_is_excluded (Mutter.Window window)
58
Mutter.MetaCompWindowType type = window.get_window_type ();
60
if (type != Mutter.MetaCompWindowType.NORMAL)
63
unowned Mutter.MetaWindow meta = window.get_meta_window ();
65
if (Mutter.MetaWindow.is_maximized (meta) ||
66
!Mutter.MetaWindow.allows_resize (meta))
69
unowned string res_class = Mutter.MetaWindow.get_wm_class (meta);
70
foreach (string s in default_exclude_classes)
71
if (res_class.contains (s))
74
void *hint = window.get_data (user_unmaximize_hint);
79
Clutter.Actor stage = Clutter.Stage.get_default ();
81
if (window.width < stage.width * 0.6 || window.width > stage.width ||
82
window.height < stage.height * 0.6 || window.height > stage.height ||
83
window.width / window.height < 0.6 ||
84
window.width / window.height > 2.0)
94
public bool process_window (Mutter.Window window)
96
if (window_is_excluded (window))
99
Mutter.MetaWindow.maximize (window.get_meta_window (), Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL);