codestyle: Drop trailing spaces/tabs

This commit is contained in:
Rico Tzschichholz 2014-04-08 14:51:06 +02:00
parent ec6b839e5e
commit 0257a23691
27 changed files with 907 additions and 907 deletions

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2014 Tom Beckmann // Copyright (C) 2014 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -129,14 +129,14 @@ namespace Gala
/** /**
* This method is currently not called in the code, however you should * This method is currently not called in the code, however you should
* still implement it to be compatible whenever we decide to use it. * still implement it to be compatible whenever we decide to use it.
* It should make sure that everything your plugin added to the stage * It should make sure that everything your plugin added to the stage
* is cleaned up. * is cleaned up.
*/ */
public abstract void destroy (); public abstract void destroy ();
/** /**
* Listen to changes to the allocation of actor and update the region * Listen to changes to the allocation of actor and update the region
* accordingly. You may add multiple actors, their shapes will be * accordingly. You may add multiple actors, their shapes will be
* combined when one of them changes. * combined when one of them changes.
* *
* @param actor The actor to be tracked * @param actor The actor to be tracked

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -23,13 +23,13 @@ namespace Gala
static Gee.HashMap<string, Gdk.Pixbuf> xid_pixbuf_cache; static Gee.HashMap<string, Gdk.Pixbuf> xid_pixbuf_cache;
static Gee.HashMap<string, Gdk.Pixbuf> icon_pixbuf_cache; static Gee.HashMap<string, Gdk.Pixbuf> icon_pixbuf_cache;
static uint cache_clear_timeout = 0; static uint cache_clear_timeout = 0;
static construct static construct
{ {
xid_pixbuf_cache = new Gee.HashMap<string, Gdk.Pixbuf> (); xid_pixbuf_cache = new Gee.HashMap<string, Gdk.Pixbuf> ();
icon_pixbuf_cache = new Gee.HashMap<string, Gdk.Pixbuf> (); icon_pixbuf_cache = new Gee.HashMap<string, Gdk.Pixbuf> ();
} }
/** /**
* Clean icon caches * Clean icon caches
*/ */
@ -53,12 +53,12 @@ namespace Gala
} }
} }
} }
public static void request_clean_icon_cache (uint32[] xids) public static void request_clean_icon_cache (uint32[] xids)
{ {
if (cache_clear_timeout > 0) if (cache_clear_timeout > 0)
GLib.Source.remove (cache_clear_timeout); GLib.Source.remove (cache_clear_timeout);
cache_clear_timeout = Timeout.add_seconds (30, () => { cache_clear_timeout = Timeout.add_seconds (30, () => {
cache_clear_timeout = 0; cache_clear_timeout = 0;
Idle.add (() => { Idle.add (() => {
@ -68,28 +68,28 @@ namespace Gala
return false; return false;
}); });
} }
/** /**
* returns a pixbuf for the application of this window or a default icon * returns a pixbuf for the application of this window or a default icon
**/ **/
public static Gdk.Pixbuf get_icon_for_window (Meta.Window window, int size) public static Gdk.Pixbuf get_icon_for_window (Meta.Window window, int size)
{ {
Gdk.Pixbuf? result = null; Gdk.Pixbuf? result = null;
var xid = (uint32)window.get_xwindow (); var xid = (uint32)window.get_xwindow ();
var xid_key = "%u::%i".printf (xid, size); var xid_key = "%u::%i".printf (xid, size);
if ((result = xid_pixbuf_cache.get (xid_key)) != null) if ((result = xid_pixbuf_cache.get (xid_key)) != null)
return result; return result;
var app = Bamf.Matcher.get_default ().get_application_for_xid (xid); var app = Bamf.Matcher.get_default ().get_application_for_xid (xid);
result = get_icon_for_application (app, size); result = get_icon_for_application (app, size);
xid_pixbuf_cache.set (xid_key, result); xid_pixbuf_cache.set (xid_key, result);
return result; return result;
} }
/** /**
* returns a pixbuf for this application or a default icon * returns a pixbuf for this application or a default icon
**/ **/
@ -97,10 +97,10 @@ namespace Gala
{ {
Gdk.Pixbuf? image = null; Gdk.Pixbuf? image = null;
bool not_cached = false; bool not_cached = false;
string? icon = null; string? icon = null;
string? icon_key = null; string? icon_key = null;
if (app != null && app.get_desktop_file () != null) { if (app != null && app.get_desktop_file () != null) {
try { try {
var appinfo = new DesktopAppInfo.from_filename (app.get_desktop_file ()); var appinfo = new DesktopAppInfo.from_filename (app.get_desktop_file ());
@ -116,7 +116,7 @@ namespace Gala
warning (e.message); warning (e.message);
} }
} }
if (image == null) { if (image == null) {
try { try {
unowned Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default (); unowned Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default ();
@ -130,7 +130,7 @@ namespace Gala
warning (e.message); warning (e.message);
} }
} }
if (image == null) { if (image == null) {
icon = ""; icon = "";
icon_key = "::%i".printf (size); icon_key = "::%i".printf (size);
@ -140,16 +140,16 @@ namespace Gala
not_cached = true; not_cached = true;
} }
} }
if (size != image.width || size != image.height) if (size != image.width || size != image.height)
image = Plank.Drawing.DrawingService.ar_scale (image, size, size); image = Plank.Drawing.DrawingService.ar_scale (image, size, size);
if (not_cached) if (not_cached)
icon_pixbuf_cache.set (icon_key, image); icon_pixbuf_cache.set (icon_key, image);
return image; return image;
} }
/** /**
* get the next window that should be active on a workspace right now * get the next window that should be active on a workspace right now
**/ **/
@ -157,16 +157,16 @@ namespace Gala
{ {
var screen = workspace.get_screen (); var screen = workspace.get_screen ();
var display = screen.get_display (); var display = screen.get_display ();
var window = display.get_tab_next (Meta.TabList.NORMAL, screen, var window = display.get_tab_next (Meta.TabList.NORMAL, screen,
screen.get_active_workspace (), null, backward); screen.get_active_workspace (), null, backward);
if (window == null) if (window == null)
window = display.get_tab_current (Meta.TabList.NORMAL, screen, workspace); window = display.get_tab_current (Meta.TabList.NORMAL, screen, workspace);
return window; return window;
} }
/** /**
* get the number of toplevel windows on a workspace * get the number of toplevel windows on a workspace
**/ **/
@ -181,12 +181,12 @@ namespace Gala
window.window_type == Meta.WindowType.MODAL_DIALOG) window.window_type == Meta.WindowType.MODAL_DIALOG)
n ++; n ++;
} }
return n; return n;
} }
static Gtk.CssProvider fallback_style = null; static Gtk.CssProvider fallback_style = null;
public static Gtk.CssProvider get_default_style () public static Gtk.CssProvider get_default_style ()
{ {
if (fallback_style == null) { if (fallback_style == null) {
@ -195,7 +195,7 @@ namespace Gala
fallback_style.load_from_path (Config.PKGDATADIR + "/gala.css"); fallback_style.load_from_path (Config.PKGDATADIR + "/gala.css");
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
} }
return fallback_style; return fallback_style;
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2014 Tom Beckmann // Copyright (C) 2014 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -28,7 +28,7 @@ namespace Gala
WINDOW_OVERVIEW, WINDOW_OVERVIEW,
WINDOW_OVERVIEW_ALL WINDOW_OVERVIEW_ALL
} }
public enum InputArea public enum InputArea
{ {
NONE, NONE,

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2014 Tom Beckmann // Copyright (C) 2014 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
/* /*
This is a template class showing some of the things that can be done This is a template class showing some of the things that can be done
@ -59,7 +59,7 @@ namespace Gala.Plugins.Template
// windows, we need to mark the region where the quad is located. // windows, we need to mark the region where the quad is located.
// The plugin class offers an utility function for this purpose, the track_actor // The plugin class offers an utility function for this purpose, the track_actor
// function. It will update the region with the allocation of the actor // function. It will update the region with the allocation of the actor
// whenever its allocation changes. Make sure to set freeze_track to // whenever its allocation changes. Make sure to set freeze_track to
// true while animating the actor to not make gala update the region // true while animating the actor to not make gala update the region
// every single frame. // every single frame.
// You can also handle the region manually by setting the custom_region // You can also handle the region manually by setting the custom_region
@ -105,7 +105,7 @@ public Gala.PluginInfo register_plugin ()
typeof (Gala.Plugins.Template.Main), // the type of your plugin class typeof (Gala.Plugins.Template.Main), // the type of your plugin class
Gala.PluginFunction.ADDITION, // the function which your plugin Gala.PluginFunction.ADDITION, // the function which your plugin
// fulfils, ADDITION means nothing // fulfils, ADDITION means nothing
// specific // specific
Gala.LoadPriority.IMMEDIATE // indicates whether your plugin's Gala.LoadPriority.IMMEDIATE // indicates whether your plugin's

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala.Plugins.Zoom namespace Gala.Plugins.Zoom
{ {
@ -70,9 +70,9 @@ namespace Gala.Plugins.Zoom
return; return;
else if (current_zoom >= 2.5f && @in) else if (current_zoom >= 2.5f && @in)
return; return;
var wins = wm.ui_group; var wins = wm.ui_group;
// Add timer to poll current mouse position to reposition window-group // Add timer to poll current mouse position to reposition window-group
// to show requested zoomed area // to show requested zoomed area
if (mouse_poll_timer == 0) { if (mouse_poll_timer == 0) {
@ -81,35 +81,35 @@ namespace Gala.Plugins.Zoom
client_pointer.get_position (null, out mx, out my); client_pointer.get_position (null, out mx, out my);
wins.scale_center_x = mx; wins.scale_center_x = mx;
wins.scale_center_y = my; wins.scale_center_y = my;
mouse_poll_timer = Timeout.add (MOUSE_POLL_TIME, () => { mouse_poll_timer = Timeout.add (MOUSE_POLL_TIME, () => {
client_pointer.get_position (null, out mx, out my); client_pointer.get_position (null, out mx, out my);
if (wins.scale_center_x == mx && wins.scale_center_y == my) if (wins.scale_center_x == mx && wins.scale_center_y == my)
return true; return true;
wins.animate (Clutter.AnimationMode.LINEAR, MOUSE_POLL_TIME, scale_center_x : mx, scale_center_y : my); wins.animate (Clutter.AnimationMode.LINEAR, MOUSE_POLL_TIME, scale_center_x : mx, scale_center_y : my);
return true; return true;
}); });
} }
current_zoom += (@in ? 0.5f : -0.5f); current_zoom += (@in ? 0.5f : -0.5f);
if (current_zoom <= 1.0f) { if (current_zoom <= 1.0f) {
current_zoom = 1.0f; current_zoom = 1.0f;
if (mouse_poll_timer > 0) if (mouse_poll_timer > 0)
Source.remove (mouse_poll_timer); Source.remove (mouse_poll_timer);
mouse_poll_timer = 0; mouse_poll_timer = 0;
wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : 1.0f, scale_y : 1.0f).completed.connect (() => { wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : 1.0f, scale_y : 1.0f).completed.connect (() => {
wins.scale_center_x = 0.0f; wins.scale_center_x = 0.0f;
wins.scale_center_y = 0.0f; wins.scale_center_y = 0.0f;
}); });
return; return;
} }
wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : current_zoom, scale_y : current_zoom); wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : current_zoom, scale_y : current_zoom);
} }
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -39,7 +39,7 @@ namespace Gala
{ {
Object (screen: screen, monitor: monitor, settings: settings); Object (screen: screen, monitor: monitor, settings: settings);
} }
construct construct
{ {
pattern = new Meta.BackgroundActor (); pattern = new Meta.BackgroundActor ();

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -37,7 +37,7 @@ namespace Gala
{ {
return instance; return instance;
} }
public Meta.Screen screen { get; construct; } public Meta.Screen screen { get; construct; }
Gee.HashMap<string,Meta.Background> image_cache; Gee.HashMap<string,Meta.Background> image_cache;
@ -48,7 +48,7 @@ namespace Gala
{ {
Object (screen: screen); Object (screen: screen);
} }
construct construct
{ {
image_cache = new Gee.HashMap<string,Meta.Background> (); image_cache = new Gee.HashMap<string,Meta.Background> ();

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -26,7 +26,7 @@ namespace Gala
{ {
Object (screen: screen); Object (screen: screen);
} }
construct construct
{ {
screen.monitors_changed.connect (update); screen.monitors_changed.connect (update);

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -76,7 +76,7 @@ namespace Gala
} catch (Error e) { } catch (Error e) {
warning (e.message); warning (e.message);
} }
return false; return false;
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -23,7 +23,7 @@ namespace Gala
{ {
Object (); Object ();
} }
construct construct
{ {
var cache = BackgroundCache.get_default (); var cache = BackgroundCache.get_default ();

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 - 2014 Tom Beckmann, Jacob Parker // Copyright (C) 2012 - 2014 Tom Beckmann, Jacob Parker
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -22,17 +22,17 @@ namespace Gala
{ {
static DBus? instance; static DBus? instance;
static WindowManager wm; static WindowManager wm;
[DBus (visibile = false)] [DBus (visibile = false)]
public static void init (WindowManager _wm) public static void init (WindowManager _wm)
{ {
wm = _wm; wm = _wm;
Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE, Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
(connection) => { (connection) => {
if (instance == null) if (instance == null)
instance = new DBus (); instance = new DBus ();
try { try {
connection.register_object ("/org/pantheon/gala", instance); connection.register_object ("/org/pantheon/gala", instance);
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
@ -40,7 +40,7 @@ namespace Gala
() => {}, () => {},
() => warning ("Could not acquire name\n") ); () => warning ("Could not acquire name\n") );
} }
private DBus () private DBus ()
{ {
if (wm.background_group != null) if (wm.background_group != null)
@ -48,7 +48,7 @@ namespace Gala
else else
assert_not_reached (); assert_not_reached ();
} }
public void perform_action (ActionType type) public void perform_action (ActionType type)
{ {
wm.perform_action (type); wm.perform_action (type);
@ -85,7 +85,7 @@ namespace Gala
/** /**
* Attaches a dummy offscreen effect to the background at monitor to get its * Attaches a dummy offscreen effect to the background at monitor to get its
* isolated color data. Then calculate the red, green and blue components of * isolated color data. Then calculate the red, green and blue components of
* the average color in that area and the mean color value and variance. All * the average color in that area and the mean color value and variance. All
* variables are returned as a tuple in that order. * variables are returned as a tuple in that order.
* *

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2013 Tom Beckmann // Copyright (C) 2013 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -47,7 +47,7 @@ namespace Gala
/** /**
* A drag action has successfully been finished. * A drag action has successfully been finished.
* *
* @param actor The actor on which the drag finished * @param actor The actor on which the drag finished
*/ */
public signal void drag_end (Clutter.Actor actor); public signal void drag_end (Clutter.Actor actor);
@ -63,7 +63,7 @@ namespace Gala
* Create a new DragDropAction * Create a new DragDropAction
* *
* @param type The type of this actor * @param type The type of this actor
* @param id An ID that marks which sources can be dragged on * @param id An ID that marks which sources can be dragged on
* which destinations. It has to be the same for all actors that * which destinations. It has to be the same for all actors that
* should be compatible with each other. * should be compatible with each other.
*/ */

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2014 Tom Beckmann // Copyright (C) 2014 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
// docs taken from unity indicator-session's // docs taken from unity indicator-session's
// src/backend-dbus/org.gnome.SessionManager.EndSessionDialog.xml // src/backend-dbus/org.gnome.SessionManager.EndSessionDialog.xml
@ -25,7 +25,7 @@ namespace Gala
SHUTDOWN = 1, SHUTDOWN = 1,
RESTART = 2 RESTART = 2
} }
/** /**
* Private class wrapping most of the Gtk part of this dialog * Private class wrapping most of the Gtk part of this dialog
*/ */
@ -68,7 +68,7 @@ namespace Gala
string icon_name, heading_text, button_text; string icon_name, heading_text, button_text;
// the restart type is currently used by the indicator for what is // the restart type is currently used by the indicator for what is
// labelled shutdown because of unity's implementation of it // labelled shutdown because of unity's implementation of it
// apparently. So we got to adjust to that until they fix this. // apparently. So we got to adjust to that until they fix this.
switch (dialog_type) { switch (dialog_type) {
case EndSessionDialogType.LOGOUT: case EndSessionDialogType.LOGOUT:

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Meta; using Meta;
@ -31,44 +31,44 @@ namespace Gala
var factory = ShadowFactory.get_default (); var factory = ShadowFactory.get_default ();
var settings = ShadowSettings.get_default (); var settings = ShadowSettings.get_default ();
Meta.ShadowParams shadow; Meta.ShadowParams shadow;
//normal focused //normal focused
shadow = settings.get_shadowparams ("normal_focused"); shadow = settings.get_shadowparams ("normal_focused");
factory.set_params ("normal", true, shadow); factory.set_params ("normal", true, shadow);
//normal unfocused //normal unfocused
shadow = settings.get_shadowparams ("normal_unfocused"); shadow = settings.get_shadowparams ("normal_unfocused");
factory.set_params ("normal", false, shadow); factory.set_params ("normal", false, shadow);
//menus //menus
shadow = settings.get_shadowparams ("menu"); shadow = settings.get_shadowparams ("menu");
factory.set_params ("menu", false, shadow); factory.set_params ("menu", false, shadow);
factory.set_params ("dropdown-menu", false, shadow); factory.set_params ("dropdown-menu", false, shadow);
factory.set_params ("popup-menu", false, shadow); factory.set_params ("popup-menu", false, shadow);
//dialog focused //dialog focused
shadow = settings.get_shadowparams ("dialog_focused"); shadow = settings.get_shadowparams ("dialog_focused");
factory.set_params ("dialog", true, shadow); factory.set_params ("dialog", true, shadow);
factory.set_params ("modal_dialog", false, shadow); factory.set_params ("modal_dialog", false, shadow);
//dialog unfocused //dialog unfocused
shadow = settings.get_shadowparams ("normal_unfocused"); shadow = settings.get_shadowparams ("normal_unfocused");
factory.set_params ("dialog", false, shadow); factory.set_params ("dialog", false, shadow);
factory.set_params ("modal_dialog", false, shadow); factory.set_params ("modal_dialog", false, shadow);
} }
/** /**
* set the area where clutter can receive events * set the area where clutter can receive events
**/ **/
public static void set_input_area (Screen screen, InputArea area) public static void set_input_area (Screen screen, InputArea area)
{ {
var display = screen.get_display (); var display = screen.get_display ();
X.Xrectangle[] rects = {}; X.Xrectangle[] rects = {};
int width, height; int width, height;
screen.get_size (out width, out height); screen.get_size (out width, out height);
var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ()); var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ());
switch (area) { switch (area) {
case InputArea.FULLSCREEN: case InputArea.FULLSCREEN:
X.Xrectangle rect = {0, 0, (ushort)width, (ushort)height}; X.Xrectangle rect = {0, 0, (ushort)width, (ushort)height};
@ -76,18 +76,18 @@ namespace Gala
break; break;
case InputArea.HOT_CORNER: case InputArea.HOT_CORNER:
var schema = BehaviorSettings.get_default ().schema; var schema = BehaviorSettings.get_default ().schema;
// if ActionType is NONE make it 0 sized // if ActionType is NONE make it 0 sized
ushort tl_size = (schema.get_enum ("hotcorner-topleft") != ActionType.NONE ? 1 : 0); ushort tl_size = (schema.get_enum ("hotcorner-topleft") != ActionType.NONE ? 1 : 0);
ushort tr_size = (schema.get_enum ("hotcorner-topright") != ActionType.NONE ? 1 : 0); ushort tr_size = (schema.get_enum ("hotcorner-topright") != ActionType.NONE ? 1 : 0);
ushort bl_size = (schema.get_enum ("hotcorner-bottomleft") != ActionType.NONE ? 1 : 0); ushort bl_size = (schema.get_enum ("hotcorner-bottomleft") != ActionType.NONE ? 1 : 0);
ushort br_size = (schema.get_enum ("hotcorner-bottomright") != ActionType.NONE ? 1 : 0); ushort br_size = (schema.get_enum ("hotcorner-bottomright") != ActionType.NONE ? 1 : 0);
X.Xrectangle topleft = {(short)geometry.x, (short)geometry.y, tl_size, tl_size}; X.Xrectangle topleft = {(short)geometry.x, (short)geometry.y, tl_size, tl_size};
X.Xrectangle topright = {(short)(geometry.x + geometry.width - 1), (short)geometry.y, tr_size, tr_size}; X.Xrectangle topright = {(short)(geometry.x + geometry.width - 1), (short)geometry.y, tr_size, tr_size};
X.Xrectangle bottomleft = {(short)geometry.x, (short)(geometry.y + geometry.height - 1), bl_size, bl_size}; X.Xrectangle bottomleft = {(short)geometry.x, (short)(geometry.y + geometry.height - 1), bl_size, bl_size};
X.Xrectangle bottomright = {(short)(geometry.x + geometry.width - 1), (short)(geometry.y + geometry.height - 1), br_size, br_size}; X.Xrectangle bottomright = {(short)(geometry.x + geometry.width - 1), (short)(geometry.y + geometry.height - 1), br_size, br_size};
rects = {topleft, topright, bottomleft, bottomright}; rects = {topleft, topright, bottomleft, bottomright};
break; break;
case InputArea.NONE: case InputArea.NONE:
@ -102,7 +102,7 @@ namespace Gala
rects += rect; rects += rect;
} }
} }
var xregion = X.Fixes.create_region (display.get_xdisplay (), rects); var xregion = X.Fixes.create_region (display.get_xdisplay (), rects);
Util.set_stage_input_region (screen, xregion); Util.set_stage_input_region (screen, xregion);
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -21,12 +21,12 @@ namespace Gala
{ "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null }, { "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null },
{ null } { null }
}; };
void print_version () { void print_version () {
stdout.printf ("Gala %s\n", Config.VERSION); stdout.printf ("Gala %s\n", Config.VERSION);
Meta.exit (Meta.ExitCode.SUCCESS); Meta.exit (Meta.ExitCode.SUCCESS);
} }
public static int main (string[] args) public static int main (string[] args)
{ {
unowned OptionContext ctx = Meta.get_option_context (); unowned OptionContext ctx = Meta.get_option_context ();
@ -37,11 +37,11 @@ namespace Gala
stderr.printf ("Error initializing: %s\n", e.message); stderr.printf ("Error initializing: %s\n", e.message);
Meta.exit (Meta.ExitCode.ERROR); Meta.exit (Meta.ExitCode.ERROR);
} }
Meta.Plugin.manager_set_plugin_type (new WindowManagerGala ().get_type ()); Meta.Plugin.manager_set_plugin_type (new WindowManagerGala ().get_type ());
Meta.set_wm_name ("Mutter(Gala)"); Meta.set_wm_name ("Mutter(Gala)");
/** /**
* Prevent Meta.init () from causing gtk to load gail and at-bridge * Prevent Meta.init () from causing gtk to load gail and at-bridge
* Taken from Gnome-Shell main.c * Taken from Gnome-Shell main.c
@ -51,13 +51,13 @@ namespace Gala
Meta.init (); Meta.init ();
GLib.Environment.unset_variable ("NO_GAIL"); GLib.Environment.unset_variable ("NO_GAIL");
GLib.Environment.unset_variable ("NO_AT_BRIDGE"); GLib.Environment.unset_variable ("NO_AT_BRIDGE");
Plank.Services.Paths.initialize ("plank", Config.DATADIR + "/plank"); Plank.Services.Paths.initialize ("plank", Config.DATADIR + "/plank");
// Force initialization of static fields in Utils class // Force initialization of static fields in Utils class
// https://bugzilla.gnome.org/show_bug.cgi?id=543189 // https://bugzilla.gnome.org/show_bug.cgi?id=543189
typeof (Gala.Utils).class_ref (); typeof (Gala.Utils).class_ref ();
return Meta.run (); return Meta.run ();
} }
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2014 Tom Beckmann // Copyright (C) 2014 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Jaap Broekhuizen // Copyright (C) 2012 Jaap Broekhuizen
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 GardenGnome, Rico Tzschichholz, Tom Beckmann // Copyright (C) 2012 GardenGnome, Rico Tzschichholz, Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -26,70 +26,70 @@ namespace Gala
public string overlay_action { get; set; } public string overlay_action { get; set; }
public string hotcorner_custom_command { get; set; } public string hotcorner_custom_command { get; set; }
public string[] dock_names { get; set; } public string[] dock_names { get; set; }
public WindowOverviewType window_overview_type { get; set; } public WindowOverviewType window_overview_type { get; set; }
public ActionType hotcorner_topleft { get; set; } public ActionType hotcorner_topleft { get; set; }
public ActionType hotcorner_topright { get; set; } public ActionType hotcorner_topright { get; set; }
public ActionType hotcorner_bottomleft { get; set; } public ActionType hotcorner_bottomleft { get; set; }
public ActionType hotcorner_bottomright { get; set; } public ActionType hotcorner_bottomright { get; set; }
static BehaviorSettings? instance = null; static BehaviorSettings? instance = null;
private BehaviorSettings () private BehaviorSettings ()
{ {
base (Config.SCHEMA + ".behavior"); base (Config.SCHEMA + ".behavior");
} }
public static BehaviorSettings get_default () public static BehaviorSettings get_default ()
{ {
if (instance == null) if (instance == null)
instance = new BehaviorSettings (); instance = new BehaviorSettings ();
return instance; return instance;
} }
} }
public class KeybindingSettings : Granite.Services.Settings public class KeybindingSettings : Granite.Services.Settings
{ {
static KeybindingSettings? instance = null; static KeybindingSettings? instance = null;
private KeybindingSettings () private KeybindingSettings ()
{ {
base (Config.SCHEMA + ".keybindings"); base (Config.SCHEMA + ".keybindings");
} }
public static KeybindingSettings get_default () public static KeybindingSettings get_default ()
{ {
if (instance == null) if (instance == null)
instance = new KeybindingSettings (); instance = new KeybindingSettings ();
return instance; return instance;
} }
} }
public class AppearanceSettings : Granite.Services.Settings public class AppearanceSettings : Granite.Services.Settings
{ {
public string button_layout { get; set; } public string button_layout { get; set; }
public bool attach_modal_dialogs { get; set; } public bool attach_modal_dialogs { get; set; }
public bool dim_parents { get; set; } public bool dim_parents { get; set; }
static AppearanceSettings? instance = null; static AppearanceSettings? instance = null;
private AppearanceSettings () private AppearanceSettings ()
{ {
base (Config.SCHEMA + ".appearance"); base (Config.SCHEMA + ".appearance");
} }
public static AppearanceSettings get_default () public static AppearanceSettings get_default ()
{ {
if (instance == null) if (instance == null)
instance = new AppearanceSettings (); instance = new AppearanceSettings ();
return instance; return instance;
} }
} }
public class ShadowSettings : Granite.Services.Settings public class ShadowSettings : Granite.Services.Settings
{ {
public string[] menu { get; set; } public string[] menu { get; set; }
@ -97,35 +97,35 @@ namespace Gala
public string[] normal_unfocused { get; set; } public string[] normal_unfocused { get; set; }
public string[] dialog_focused { get; set; } public string[] dialog_focused { get; set; }
public string[] dialog_unfocused { get; set; } public string[] dialog_unfocused { get; set; }
static ShadowSettings? instance = null; static ShadowSettings? instance = null;
private ShadowSettings () private ShadowSettings ()
{ {
base (Config.SCHEMA + ".shadows"); base (Config.SCHEMA + ".shadows");
} }
public static ShadowSettings get_default () public static ShadowSettings get_default ()
{ {
if (instance == null) if (instance == null)
instance = new ShadowSettings (); instance = new ShadowSettings ();
return instance; return instance;
} }
public Meta.ShadowParams get_shadowparams (string class_name) public Meta.ShadowParams get_shadowparams (string class_name)
{ {
string[] val; string[] val;
get (class_name, out val); get (class_name, out val);
if (val == null || int.parse (val[0]) < 1) if (val == null || int.parse (val[0]) < 1)
return Meta.ShadowParams () {radius = 1, top_fade = 0, x_offset = 0, y_offset = 0, opacity = 0}; return Meta.ShadowParams () {radius = 1, top_fade = 0, x_offset = 0, y_offset = 0, opacity = 0};
return Meta.ShadowParams () {radius = int.parse (val[0]), top_fade = int.parse (val[1]), return Meta.ShadowParams () {radius = int.parse (val[0]), top_fade = int.parse (val[1]),
x_offset = int.parse (val[2]), y_offset = int.parse (val[3]), opacity = (uint8)int.parse (val[4])}; x_offset = int.parse (val[2]), y_offset = int.parse (val[3]), opacity = (uint8)int.parse (val[4])};
} }
} }
public class AnimationSettings : Granite.Services.Settings public class AnimationSettings : Granite.Services.Settings
{ {
public bool enable_animations { get; set; } public bool enable_animations { get; set; }
@ -135,19 +135,19 @@ namespace Gala
public int minimize_duration { get; set; } public int minimize_duration { get; set; }
public int workspace_switch_duration { get; set; } public int workspace_switch_duration { get; set; }
public int menu_duration { get; set; } public int menu_duration { get; set; }
static AnimationSettings? instance = null; static AnimationSettings? instance = null;
private AnimationSettings () private AnimationSettings ()
{ {
base (Config.SCHEMA + ".animations"); base (Config.SCHEMA + ".animations");
} }
public static AnimationSettings get_default () public static AnimationSettings get_default ()
{ {
if (instance == null) if (instance == null)
instance = new AnimationSettings (); instance = new AnimationSettings ();
return instance; return instance;
} }
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
namespace Gala namespace Gala
{ {
@ -24,34 +24,34 @@ namespace Gala
get { return _offset_y; } get { return _offset_y; }
set { _offset_y = value; update (); } set { _offset_y = value; update (); }
} }
int _offset_x; int _offset_x;
public int offset_x { public int offset_x {
get { return _offset_x; } get { return _offset_x; }
set { _offset_x = value; update (); } set { _offset_x = value; update (); }
} }
uint8 _opacity; uint8 _opacity;
public uint8 opacity { public uint8 opacity {
get { return _opacity; } get { return _opacity; }
set { _opacity = value; update (); } set { _opacity = value; update (); }
} }
public TextShadowEffect (int offset_x, int offset_y, uint8 opacity) public TextShadowEffect (int offset_x, int offset_y, uint8 opacity)
{ {
_offset_x = offset_x; _offset_x = offset_x;
_offset_y = offset_y; _offset_y = offset_y;
_opacity = opacity; _opacity = opacity;
} }
public override bool pre_paint () public override bool pre_paint ()
{ {
var layout = ((Clutter.Text)get_actor ()).get_layout (); var layout = ((Clutter.Text)get_actor ()).get_layout ();
Cogl.pango_render_layout (layout, offset_x, offset_y, Cogl.Color.from_4ub (0, 0, 0, opacity), 0); Cogl.pango_render_layout (layout, offset_x, offset_y, Cogl.Color.from_4ub (0, 0, 0, opacity), 0);
return true; return true;
} }
public void update () public void update ()
{ {
if (get_actor () != null) if (get_actor () != null)

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann // Copyright (C) 2012 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Clutter; using Clutter;
using Meta; using Meta;
@ -23,28 +23,28 @@ namespace Gala
public class AppIcon : GtkClutter.Texture public class AppIcon : GtkClutter.Texture
{ {
const string DRAG_ACTION = "drag"; const string DRAG_ACTION = "drag";
Window window; Window window;
Bamf.Application app; Bamf.Application app;
public AppIcon (Window _window, Bamf.Application _app) public AppIcon (Window _window, Bamf.Application _app)
{ {
window = _window; window = _window;
app = _app; app = _app;
try { try {
set_from_pixbuf (Utils.get_icon_for_window (window, WorkspaceThumb.APP_ICON_SIZE)); set_from_pixbuf (Utils.get_icon_for_window (window, WorkspaceThumb.APP_ICON_SIZE));
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
var action = new DragDropAction (DragDropActionType.SOURCE, WorkspaceThumb.DRAG_ID); var action = new DragDropAction (DragDropActionType.SOURCE, WorkspaceThumb.DRAG_ID);
action.drag_begin.connect (drag_begin); action.drag_begin.connect (drag_begin);
action.drag_end.connect (drag_end); action.drag_end.connect (drag_end);
action.drag_canceled.connect (drag_canceled); action.drag_canceled.connect (drag_canceled);
add_action_with_name (DRAG_ACTION, action); add_action_with_name (DRAG_ACTION, action);
reactive = true; reactive = true;
} }
void drag_canceled () void drag_canceled ()
{ {
var action = get_action (DRAG_ACTION) as DragDropAction; var action = get_action (DRAG_ACTION) as DragDropAction;
@ -66,11 +66,11 @@ namespace Gala
WorkspaceThumb old = get_parent ().get_parent () as WorkspaceThumb; WorkspaceThumb old = get_parent ().get_parent () as WorkspaceThumb;
get_parent ().remove_child (this); get_parent ().remove_child (this);
opacity = 255; opacity = 255;
var dest_thumb = destination as WorkspaceThumb; var dest_thumb = destination as WorkspaceThumb;
var icons = dest_thumb.icons; var icons = dest_thumb.icons;
var wallpaper = dest_thumb.wallpaper; var wallpaper = dest_thumb.wallpaper;
icons.add_child (this); icons.add_child (this);
// get all the windows that belong to this app, if possible // get all the windows that belong to this app, if possible
@ -85,21 +85,21 @@ namespace Gala
} }
} else } else
window.change_workspace (dest_thumb.workspace); window.change_workspace (dest_thumb.workspace);
if (old != null) if (old != null)
old.icons.animate (AnimationMode.LINEAR, 100, x:Math.floorf (old.wallpaper.x + old.wallpaper.width / 2 - old.icons.width / 2)); old.icons.animate (AnimationMode.LINEAR, 100, x:Math.floorf (old.wallpaper.x + old.wallpaper.width / 2 - old.icons.width / 2));
icons.animate (AnimationMode.LINEAR, 100, x:Math.floorf (wallpaper.x + wallpaper.width / 2 - icons.width / 2)); icons.animate (AnimationMode.LINEAR, 100, x:Math.floorf (wallpaper.x + wallpaper.width / 2 - icons.width / 2));
} }
Clutter.Actor drag_begin () Clutter.Actor drag_begin ()
{ {
opacity = 0; opacity = 0;
var handle = new Clone (this); var handle = new Clone (this);
get_stage ().add_child (handle); get_stage ().add_child (handle);
return handle; return handle;
} }
} }
} }

View File

@ -1,89 +1,89 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Meta; using Meta;
using Clutter; using Clutter;
namespace Gala namespace Gala
{ {
public enum WindowOverviewType public enum WindowOverviewType
{ {
GRID = 0, GRID = 0,
NATURAL NATURAL
} }
public class WindowOverview : Actor public class WindowOverview : Actor
{ {
WindowManager wm; WindowManager wm;
Screen screen; Screen screen;
bool ready; bool ready;
//the workspaces which we expose right now //the workspaces which we expose right now
List<Workspace> workspaces; List<Workspace> workspaces;
static const int PADDING = 50; static const int PADDING = 50;
public WindowOverview (WindowManager _wm) public WindowOverview (WindowManager _wm)
{ {
wm = _wm; wm = _wm;
screen = wm.get_screen (); screen = wm.get_screen ();
screen.workspace_switched.connect (() => close (false)); screen.workspace_switched.connect (() => close (false));
visible = false; visible = false;
ready = true; ready = true;
reactive = true; reactive = true;
} }
public override bool key_press_event (Clutter.KeyEvent event) public override bool key_press_event (Clutter.KeyEvent event)
{ {
//FIXME need to figure out the actual keycombo, for now leave it by //FIXME need to figure out the actual keycombo, for now leave it by
// default and others will close it by selecting a window! // default and others will close it by selecting a window!
if (event.keyval == Clutter.Key.w || if (event.keyval == Clutter.Key.w ||
event.keyval == Clutter.Key.a || event.keyval == Clutter.Key.a ||
event.keyval == Clutter.Key.Escape) { event.keyval == Clutter.Key.Escape) {
close (true); close (true);
return true; return true;
} }
return false; return false;
} }
public override void key_focus_out () public override void key_focus_out ()
{ {
close (false); close (false);
} }
public override bool button_release_event (Clutter.ButtonEvent event) public override bool button_release_event (Clutter.ButtonEvent event)
{ {
if (event.button == 1) if (event.button == 1)
close (true); close (true);
return true; return true;
} }
/** /**
* Code ported from KWin present windows effect * Code ported from KWin present windows effect
* https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/kwin/effects/presentwindows/presentwindows.cpp * https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/kwin/effects/presentwindows/presentwindows.cpp
**/ **/
//constants, mainly for natural expo //constants, mainly for natural expo
const int GAPS = 10; const int GAPS = 10;
const int MAX_TRANSLATIONS = 100000; const int MAX_TRANSLATIONS = 100000;
@ -91,16 +91,16 @@ namespace Gala
const int BORDER = 10; const int BORDER = 10;
const int TOP_GAP = 20; const int TOP_GAP = 20;
const int BOTTOM_GAP = 100; const int BOTTOM_GAP = 100;
//some math utilities //some math utilities
int squared_distance (Gdk.Point a, Gdk.Point b) int squared_distance (Gdk.Point a, Gdk.Point b)
{ {
var k1 = b.x - a.x; var k1 = b.x - a.x;
var k2 = b.y - a.y; var k2 = b.y - a.y;
return k1*k1 + k2*k2; return k1*k1 + k2*k2;
} }
bool rect_is_overlapping_any (Meta.Rectangle rect, Meta.Rectangle[] rects, Meta.Rectangle border) bool rect_is_overlapping_any (Meta.Rectangle rect, Meta.Rectangle[] rects, Meta.Rectangle border)
{ {
if (!border.contains_rect (rect)) if (!border.contains_rect (rect))
@ -108,79 +108,79 @@ namespace Gala
foreach (var comp in rects) { foreach (var comp in rects) {
if (comp == rect) if (comp == rect)
continue; continue;
if (rect.overlap (comp)) if (rect.overlap (comp))
return true; return true;
} }
return false; return false;
} }
Meta.Rectangle rect_adjusted (Meta.Rectangle rect, int dx1, int dy1, int dx2, int dy2) Meta.Rectangle rect_adjusted (Meta.Rectangle rect, int dx1, int dy1, int dx2, int dy2)
{ {
return {rect.x + dx1, rect.y + dy1, rect.width + (-dx1 + dx2), rect.height + (-dy1 + dy2)}; return {rect.x + dx1, rect.y + dy1, rect.width + (-dx1 + dx2), rect.height + (-dy1 + dy2)};
} }
Gdk.Point rect_center (Meta.Rectangle rect) Gdk.Point rect_center (Meta.Rectangle rect)
{ {
return {rect.x + rect.width / 2, rect.y + rect.height / 2}; return {rect.x + rect.width / 2, rect.y + rect.height / 2};
} }
void calculate_places (List<Actor> windows) void calculate_places (List<Actor> windows)
{ {
var clones = windows.copy (); var clones = windows.copy ();
clones.sort ((a, b) => { clones.sort ((a, b) => {
return (int)(a as WindowThumb).window.get_stable_sequence () - return (int)(a as WindowThumb).window.get_stable_sequence () -
(int)(b as WindowThumb).window.get_stable_sequence (); (int)(b as WindowThumb).window.get_stable_sequence ();
}); });
//sort windows by monitor //sort windows by monitor
List<Actor>[] monitors = {}; List<Actor>[] monitors = {};
monitors.resize (screen.get_n_monitors ()); monitors.resize (screen.get_n_monitors ());
foreach (var clone in clones) { foreach (var clone in clones) {
// we had some crashes here so there's a reasonable suspicion // we had some crashes here so there's a reasonable suspicion
// that get_monitor() could be larger than get_n_monitors() // that get_monitor() could be larger than get_n_monitors()
var index = (clone as WindowThumb).window.get_monitor (); var index = (clone as WindowThumb).window.get_monitor ();
if (index >= screen.get_n_monitors ()) { if (index >= screen.get_n_monitors ()) {
critical ("Window '%s' has a monitor assigned that does not actually exists", critical ("Window '%s' has a monitor assigned that does not actually exists",
(clone as WindowThumb).window.get_title ()); (clone as WindowThumb).window.get_title ());
index = screen.get_n_monitors () - 1; index = screen.get_n_monitors () - 1;
} }
monitors[index].append (clone); monitors[index].append (clone);
} }
for (var i = 0; i < screen.get_n_monitors (); i++) { for (var i = 0; i < screen.get_n_monitors (); i++) {
if (monitors[i].length () == 0) if (monitors[i].length () == 0)
continue; continue;
// get the area used by the expo algorithms together // get the area used by the expo algorithms together
var geom = screen.get_monitor_geometry (i); var geom = screen.get_monitor_geometry (i);
Meta.Rectangle area = {(int)Math.floorf (geom.x + BORDER), Meta.Rectangle area = {(int)Math.floorf (geom.x + BORDER),
(int)Math.floorf (geom.y + TOP_GAP), (int)Math.floorf (geom.y + TOP_GAP),
(int)Math.floorf (geom.width - BORDER * 2), (int)Math.floorf (geom.width - BORDER * 2),
(int)Math.floorf (geom.height - BOTTOM_GAP)}; (int)Math.floorf (geom.height - BOTTOM_GAP)};
if (BehaviorSettings.get_default ().schema.get_enum ("window-overview-type") == WindowOverviewType.GRID) if (BehaviorSettings.get_default ().schema.get_enum ("window-overview-type") == WindowOverviewType.GRID)
grid_placement (area, monitors[i]); grid_placement (area, monitors[i]);
else else
natural_placement (area, monitors[i]); natural_placement (area, monitors[i]);
} }
} }
void grid_placement (Meta.Rectangle area, List<Actor> clones) void grid_placement (Meta.Rectangle area, List<Actor> clones)
{ {
int columns = (int)Math.ceil (Math.sqrt (clones.length ())); int columns = (int)Math.ceil (Math.sqrt (clones.length ()));
int rows = (int)Math.ceil (clones.length () / (double)columns); int rows = (int)Math.ceil (clones.length () / (double)columns);
// Assign slots // Assign slots
int slot_width = area.width / columns; int slot_width = area.width / columns;
int slot_height = area.height / rows; int slot_height = area.height / rows;
WindowThumb[] taken_slots = {}; WindowThumb[] taken_slots = {};
taken_slots.resize (rows * columns); taken_slots.resize (rows * columns);
// precalculate all slot centers // precalculate all slot centers
Gdk.Point[] slot_centers = {}; Gdk.Point[] slot_centers = {};
slot_centers.resize (rows * columns); slot_centers.resize (rows * columns);
@ -190,31 +190,31 @@ namespace Gala
area.y + slot_height * y + slot_height / 2}; area.y + slot_height * y + slot_height / 2};
} }
} }
// Assign each window to the closest available slot // Assign each window to the closest available slot
var tmplist = clones.copy (); var tmplist = clones.copy ();
var window_count = tmplist.length (); var window_count = tmplist.length ();
while (tmplist.length () > 0) { while (tmplist.length () > 0) {
var window = tmplist.nth_data (0) as WindowThumb; var window = tmplist.nth_data (0) as WindowThumb;
var rect = window.window.get_outer_rect (); var rect = window.window.get_outer_rect ();
var slot_candidate = -1; var slot_candidate = -1;
var slot_candidate_distance = int.MAX; var slot_candidate_distance = int.MAX;
var pos = rect_center (rect); var pos = rect_center (rect);
// all slots // all slots
for (int i = 0; i < columns * rows; i++) { for (int i = 0; i < columns * rows; i++) {
if (i > window_count - 1) if (i > window_count - 1)
break; break;
var dist = squared_distance (pos, slot_centers[i]); var dist = squared_distance (pos, slot_centers[i]);
if (dist < slot_candidate_distance) { if (dist < slot_candidate_distance) {
// window is interested in this slot // window is interested in this slot
WindowThumb occupier = taken_slots[i]; WindowThumb occupier = taken_slots[i];
if (occupier == window) if (occupier == window)
continue; continue;
if (occupier == null || dist < squared_distance (rect_center (occupier.window.get_outer_rect ()), slot_centers[i])) { if (occupier == null || dist < squared_distance (rect_center (occupier.window.get_outer_rect ()), slot_centers[i])) {
// either nobody lives here, or we're better - takeover the slot if it's our best // either nobody lives here, or we're better - takeover the slot if it's our best
slot_candidate = i; slot_candidate = i;
@ -222,35 +222,35 @@ namespace Gala
} }
} }
} }
if (slot_candidate == -1) if (slot_candidate == -1)
continue; continue;
if (taken_slots[slot_candidate] != null) if (taken_slots[slot_candidate] != null)
tmplist.prepend (taken_slots[slot_candidate]); tmplist.prepend (taken_slots[slot_candidate]);
tmplist.remove_all (window); tmplist.remove_all (window);
taken_slots[slot_candidate] = window; taken_slots[slot_candidate] = window;
} }
//see how many windows we have on the last row //see how many windows we have on the last row
int left_over = (int)clones.length () - columns * (rows - 1); int left_over = (int)clones.length () - columns * (rows - 1);
for (int slot = 0; slot < columns * rows; slot++) { for (int slot = 0; slot < columns * rows; slot++) {
var window = taken_slots[slot]; var window = taken_slots[slot];
// some slots might be empty // some slots might be empty
if (window == null) if (window == null)
continue; continue;
var rect = window.window.get_outer_rect (); var rect = window.window.get_outer_rect ();
// Work out where the slot is // Work out where the slot is
Meta.Rectangle target = {area.x + (slot % columns) * slot_width, Meta.Rectangle target = {area.x + (slot % columns) * slot_width,
area.y + (slot / columns) * slot_height, area.y + (slot / columns) * slot_height,
slot_width, slot_width,
slot_height}; slot_height};
target = rect_adjusted (target, 10, 10, -10, -10); target = rect_adjusted (target, 10, 10, -10, -10);
float scale; float scale;
if (target.width / (double)rect.width < target.height / (double)rect.height) { if (target.width / (double)rect.width < target.height / (double)rect.height) {
// Center vertically // Center vertically
@ -263,46 +263,46 @@ namespace Gala
target.x += (target.width - (int)(rect.width * scale)) / 2; target.x += (target.width - (int)(rect.width * scale)) / 2;
target.width = (int)Math.floorf (rect.width * scale); target.width = (int)Math.floorf (rect.width * scale);
} }
// Don't scale the windows too much // Don't scale the windows too much
if (scale > 1.0) { if (scale > 1.0) {
scale = 1.0f; scale = 1.0f;
target = {rect_center (target).x - (int)Math.floorf (rect.width * scale) / 2, target = {rect_center (target).x - (int)Math.floorf (rect.width * scale) / 2,
rect_center (target).y - (int)Math.floorf (rect.height * scale) / 2, rect_center (target).y - (int)Math.floorf (rect.height * scale) / 2,
(int)Math.floorf (scale * rect.width), (int)Math.floorf (scale * rect.width),
(int)Math.floorf (scale * rect.height)}; (int)Math.floorf (scale * rect.height)};
} }
//put the last row in the center, if necessary //put the last row in the center, if necessary
if (left_over != columns && slot >= columns * (rows - 1)) if (left_over != columns && slot >= columns * (rows - 1))
target.x += (columns - left_over) * slot_width / 2; target.x += (columns - left_over) * slot_width / 2;
place_window (window, target); place_window (window, target);
} }
} }
void natural_placement (Meta.Rectangle area, List<Actor> clones) void natural_placement (Meta.Rectangle area, List<Actor> clones)
{ {
Meta.Rectangle bounds = {area.x, area.y, area.width, area.height}; Meta.Rectangle bounds = {area.x, area.y, area.width, area.height};
var direction = 0; var direction = 0;
int[] directions = new int[clones.length ()]; int[] directions = new int[clones.length ()];
Meta.Rectangle[] rects = new Meta.Rectangle[clones.length ()]; Meta.Rectangle[] rects = new Meta.Rectangle[clones.length ()];
for (int i = 0; i < clones.length (); i++) { for (int i = 0; i < clones.length (); i++) {
// save rectangles into 4-dimensional arrays representing two corners of the rectangular: [left_x, top_y, right_x, bottom_y] // save rectangles into 4-dimensional arrays representing two corners of the rectangular: [left_x, top_y, right_x, bottom_y]
var rect = (clones.nth_data (i) as WindowThumb).window.get_outer_rect (); var rect = (clones.nth_data (i) as WindowThumb).window.get_outer_rect ();
rect = rect_adjusted(rect, -GAPS, -GAPS, GAPS, GAPS); rect = rect_adjusted(rect, -GAPS, -GAPS, GAPS, GAPS);
rects[i] = rect; rects[i] = rect;
bounds = bounds.union (rect); bounds = bounds.union (rect);
// This is used when the window is on the edge of the screen to try to use as much screen real estate as possible. // This is used when the window is on the edge of the screen to try to use as much screen real estate as possible.
directions[i] = direction; directions[i] = direction;
direction++; direction++;
if (direction == 4) if (direction == 4)
direction = 0; direction = 0;
} }
var loop_counter = 0; var loop_counter = 0;
var overlap = false; var overlap = false;
do { do {
@ -311,25 +311,25 @@ namespace Gala
for (var j = 0; j < rects.length; j++) { for (var j = 0; j < rects.length; j++) {
if (i == j) if (i == j)
continue; continue;
var rect = rects[i]; var rect = rects[i];
var comp = rects[j]; var comp = rects[j];
if (!rect.overlap (comp)) if (!rect.overlap (comp))
continue; continue;
loop_counter ++; loop_counter ++;
overlap = true; overlap = true;
// Determine pushing direction // Determine pushing direction
Gdk.Point i_center = rect_center (rect); Gdk.Point i_center = rect_center (rect);
Gdk.Point j_center = rect_center (comp); Gdk.Point j_center = rect_center (comp);
Gdk.Point diff = {j_center.x - i_center.x, j_center.y - i_center.y}; Gdk.Point diff = {j_center.x - i_center.x, j_center.y - i_center.y};
// Prevent dividing by zero and non-movement // Prevent dividing by zero and non-movement
if (diff.x == 0 && diff.y == 0) if (diff.x == 0 && diff.y == 0)
diff.x = 1; diff.x = 1;
// Approximate a vector of between 10px and 20px in magnitude in the same direction // Approximate a vector of between 10px and 20px in magnitude in the same direction
var length = Math.sqrtf (diff.x * diff.x + diff.y * diff.y); var length = Math.sqrtf (diff.x * diff.x + diff.y * diff.y);
diff.x = (int)Math.floorf (diff.x * ACCURACY / length); diff.x = (int)Math.floorf (diff.x * ACCURACY / length);
@ -339,7 +339,7 @@ namespace Gala
rect.y += -diff.y; rect.y += -diff.y;
comp.x += diff.x; comp.x += diff.x;
comp.y += diff.y; comp.y += diff.y;
// Try to keep the bounding rect the same aspect as the screen so that more // Try to keep the bounding rect the same aspect as the screen so that more
// screen real estate is utilised. We do this by splitting the screen into nine // screen real estate is utilised. We do this by splitting the screen into nine
// equal sections, if the window center is in any of the corner sections pull the // equal sections, if the window center is in any of the corner sections pull the
@ -352,7 +352,7 @@ namespace Gala
// (We are using an old bounding rect for this, hopefully it doesn't matter) // (We are using an old bounding rect for this, hopefully it doesn't matter)
var x_section = (int)Math.roundf ((rect.x - bounds.x) / (bounds.width / 3.0f)); var x_section = (int)Math.roundf ((rect.x - bounds.x) / (bounds.width / 3.0f));
var y_section = (int)Math.roundf ((comp.y - bounds.y) / (bounds.height / 3.0f)); var y_section = (int)Math.roundf ((comp.y - bounds.y) / (bounds.height / 3.0f));
i_center = rect_center (rect); i_center = rect_center (rect);
diff.x = 0; diff.x = 0;
diff.y = 0; diff.y = 0;
@ -385,27 +385,27 @@ namespace Gala
rect.x += diff.x; rect.x += diff.x;
rect.y += diff.y; rect.y += diff.y;
} }
// Update bounding rect // Update bounding rect
bounds = bounds.union(rect); bounds = bounds.union(rect);
bounds = bounds.union(comp); bounds = bounds.union(comp);
//we took copies from the rects from our list so we need to reassign them //we took copies from the rects from our list so we need to reassign them
rects[i] = rect; rects[i] = rect;
rects[j] = comp; rects[j] = comp;
} }
} }
} while (overlap && loop_counter < MAX_TRANSLATIONS); } while (overlap && loop_counter < MAX_TRANSLATIONS);
// Work out scaling by getting the most top-left and most bottom-right window coords. // Work out scaling by getting the most top-left and most bottom-right window coords.
float scale = Math.fminf (Math.fminf (area.width / (float)bounds.width, area.height / (float)bounds.height), 1.0f); float scale = Math.fminf (Math.fminf (area.width / (float)bounds.width, area.height / (float)bounds.height), 1.0f);
// Make bounding rect fill the screen size for later steps // Make bounding rect fill the screen size for later steps
bounds.x = (int)Math.floorf (bounds.x - (area.width - bounds.width * scale) / 2); bounds.x = (int)Math.floorf (bounds.x - (area.width - bounds.width * scale) / 2);
bounds.y = (int)Math.floorf (bounds.y - (area.height - bounds.height * scale) / 2); bounds.y = (int)Math.floorf (bounds.y - (area.height - bounds.height * scale) / 2);
bounds.width = (int)Math.floorf (area.width / scale); bounds.width = (int)Math.floorf (area.width / scale);
bounds.height = (int)Math.floorf (area.height / scale); bounds.height = (int)Math.floorf (area.height / scale);
// Move all windows back onto the screen and set their scale // Move all windows back onto the screen and set their scale
var index = 0; var index = 0;
foreach (var rect in rects) { foreach (var rect in rects) {
@ -413,26 +413,26 @@ namespace Gala
(int)Math.floorf ((rect.y - bounds.y) * scale + area.y), (int)Math.floorf ((rect.y - bounds.y) * scale + area.y),
(int)Math.floorf (rect.width * scale), (int)Math.floorf (rect.width * scale),
(int)Math.floorf (rect.height * scale)}; (int)Math.floorf (rect.height * scale)};
rects[index] = rect; rects[index] = rect;
index++; index++;
} }
// fill gaps by enlarging windows // fill gaps by enlarging windows
bool moved = false; bool moved = false;
Meta.Rectangle border = area; Meta.Rectangle border = area;
do { do {
moved = false; moved = false;
index = 0; index = 0;
foreach (var rect in rects) { foreach (var rect in rects) {
int width_diff = ACCURACY; int width_diff = ACCURACY;
int height_diff = (int)Math.floorf ((((rect.width + width_diff) - rect.height) / int height_diff = (int)Math.floorf ((((rect.width + width_diff) - rect.height) /
(float)rect.width) * rect.height); (float)rect.width) * rect.height);
int x_diff = width_diff / 2; int x_diff = width_diff / 2;
int y_diff = height_diff / 2; int y_diff = height_diff / 2;
//top right //top right
Meta.Rectangle old = rect; Meta.Rectangle old = rect;
rect = {rect.x + x_diff, rect.y - y_diff - height_diff, rect.width + width_diff, rect.height + width_diff}; rect = {rect.x + x_diff, rect.y - y_diff - height_diff, rect.width + width_diff, rect.height + width_diff};
@ -440,7 +440,7 @@ namespace Gala
rect = old; rect = old;
else else
moved = true; moved = true;
//bottom right //bottom right
old = rect; old = rect;
rect = {rect.x + x_diff, rect.y + y_diff, rect.width + width_diff, rect.height + width_diff}; rect = {rect.x + x_diff, rect.y + y_diff, rect.width + width_diff, rect.height + width_diff};
@ -448,7 +448,7 @@ namespace Gala
rect = old; rect = old;
else else
moved = true; moved = true;
//bottom left //bottom left
old = rect; old = rect;
rect = {rect.x - x_diff, rect.y + y_diff, rect.width + width_diff, rect.height + width_diff}; rect = {rect.x - x_diff, rect.y + y_diff, rect.width + width_diff, rect.height + width_diff};
@ -456,7 +456,7 @@ namespace Gala
rect = old; rect = old;
else else
moved = true; moved = true;
//top left //top left
old = rect; old = rect;
rect = {rect.x - x_diff, rect.y - y_diff - height_diff, rect.width + width_diff, rect.height + width_diff}; rect = {rect.x - x_diff, rect.y - y_diff - height_diff, rect.width + width_diff, rect.height + width_diff};
@ -464,20 +464,20 @@ namespace Gala
rect = old; rect = old;
else else
moved = true; moved = true;
rects[index] = rect; rects[index] = rect;
index++; index++;
} }
} while (moved); } while (moved);
index = 0; index = 0;
foreach (var rect in rects) { foreach (var rect in rects) {
var window = clones.nth_data (index) as WindowThumb; var window = clones.nth_data (index) as WindowThumb;
var window_rect = window.window.get_outer_rect (); var window_rect = window.window.get_outer_rect ();
rect = rect_adjusted(rect, GAPS, GAPS, -GAPS, -GAPS); rect = rect_adjusted(rect, GAPS, GAPS, -GAPS, -GAPS);
scale = rect.width / (float)window_rect.width; scale = rect.width / (float)window_rect.width;
if (scale > 2.0 || (scale > 1.0 && (window_rect.width > 300 || window_rect.height > 300))) { if (scale > 2.0 || (scale > 1.0 && (window_rect.width > 300 || window_rect.height > 300))) {
scale = (window_rect.width > 300 || window_rect.height > 300) ? 1.0f : 2.0f; scale = (window_rect.width > 300 || window_rect.height > 300) ? 1.0f : 2.0f;
rect = {rect_center (rect).x - (int)Math.floorf (window_rect.width * scale) / 2, rect = {rect_center (rect).x - (int)Math.floorf (window_rect.width * scale) / 2,
@ -485,22 +485,22 @@ namespace Gala
(int)Math.floorf (window_rect.width * scale), (int)Math.floorf (window_rect.width * scale),
(int)Math.floorf (window_rect.height * scale)}; (int)Math.floorf (window_rect.height * scale)};
} }
place_window (window, rect); place_window (window, rect);
index++; index++;
} }
} }
// animate a window to the given position // animate a window to the given position
void place_window (WindowThumb clone, Meta.Rectangle rect) void place_window (WindowThumb clone, Meta.Rectangle rect)
{ {
var fscale = rect.width / clone.width; var fscale = rect.width / clone.width;
//animate the windows and icons to the calculated positions //animate the windows and icons to the calculated positions
clone.icon.x = rect.x + Math.floorf (clone.width * fscale / 2.0f - clone.icon.width / 2.0f); clone.icon.x = rect.x + Math.floorf (clone.width * fscale / 2.0f - clone.icon.width / 2.0f);
clone.icon.y = rect.y + Math.floorf (clone.height * fscale - 50.0f); clone.icon.y = rect.y + Math.floorf (clone.height * fscale - 50.0f);
clone.icon.get_parent ().set_child_above_sibling (clone.icon, null); clone.icon.get_parent ().set_child_above_sibling (clone.icon, null);
float offset_x, offset_y, offset_width; float offset_x, offset_y, offset_width;
Utils.get_window_frame_offset (clone.window, out offset_x, out offset_y, out offset_width, null); Utils.get_window_frame_offset (clone.window, out offset_x, out offset_y, out offset_width, null);
float button_offset = clone.close_button.width * 0.25f; float button_offset = clone.close_button.width * 0.25f;
@ -516,46 +516,46 @@ namespace Gala
break; break;
} }
clone.close_button.y = rect.y - offset_y * fscale - button_offset; clone.close_button.y = rect.y - offset_y * fscale - button_offset;
clone.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 250, scale_x:fscale, scale_y:fscale, x:rect.x+0.0f, y:rect.y+0.0f) clone.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 250, scale_x:fscale, scale_y:fscale, x:rect.x+0.0f, y:rect.y+0.0f)
.completed.connect (() => ready = true ); .completed.connect (() => ready = true );
clone.icon.opacity = 0; clone.icon.opacity = 0;
clone.icon.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 350, scale_x:1.0f, scale_y:1.0f, opacity:255); clone.icon.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 350, scale_x:1.0f, scale_y:1.0f, opacity:255);
} }
public void open (bool animate = true, bool all_windows = false) public void open (bool animate = true, bool all_windows = false)
{ {
if (!ready) if (!ready)
return; return;
if (visible) { if (visible) {
close (true); close (true);
return; return;
} }
var used_windows = new SList<Window> (); var used_windows = new SList<Window> ();
workspaces = new List<Workspace> (); workspaces = new List<Workspace> ();
if (all_windows) { if (all_windows) {
foreach (var workspace in screen.get_workspaces ()) foreach (var workspace in screen.get_workspaces ())
workspaces.append (workspace); workspaces.append (workspace);
} else { } else {
workspaces.append (screen.get_active_workspace ()); workspaces.append (screen.get_active_workspace ());
} }
foreach (var workspace in workspaces) { foreach (var workspace in workspaces) {
foreach (var window in workspace.list_windows ()) { foreach (var window in workspace.list_windows ()) {
if (window.window_type != WindowType.NORMAL && if (window.window_type != WindowType.NORMAL &&
window.window_type != WindowType.DOCK && window.window_type != WindowType.DOCK &&
window.window_type != WindowType.DIALOG || window.window_type != WindowType.DIALOG ||
window.is_attached_dialog ()) { window.is_attached_dialog ()) {
(window.get_compositor_private () as Actor).hide (); (window.get_compositor_private () as Actor).hide ();
continue; continue;
} }
if (window.window_type == WindowType.DOCK) if (window.window_type == WindowType.DOCK)
continue; continue;
// skip windows that are on all workspace except we're currently // skip windows that are on all workspace except we're currently
// processing the workspace it actually belongs to // processing the workspace it actually belongs to
if (window.is_on_all_workspaces () && window.get_workspace () != workspace) if (window.is_on_all_workspaces () && window.get_workspace () != workspace)
@ -564,45 +564,45 @@ namespace Gala
used_windows.append (window); used_windows.append (window);
} }
} }
var n_windows = used_windows.length (); var n_windows = used_windows.length ();
if (n_windows == 0) if (n_windows == 0)
return; return;
ready = false; ready = false;
foreach (var workspace in workspaces) { foreach (var workspace in workspaces) {
workspace.window_added.connect (add_window); workspace.window_added.connect (add_window);
workspace.window_removed.connect (remove_window); workspace.window_removed.connect (remove_window);
} }
screen.window_left_monitor.connect (window_left_monitor); screen.window_left_monitor.connect (window_left_monitor);
// sort windows by stacking order // sort windows by stacking order
var windows = screen.get_display ().sort_windows_by_stacking (used_windows); var windows = screen.get_display ().sort_windows_by_stacking (used_windows);
grab_key_focus (); grab_key_focus ();
wm.begin_modal (); wm.begin_modal ();
visible = true; visible = true;
foreach (var window in windows) { foreach (var window in windows) {
var actor = window.get_compositor_private () as WindowActor; var actor = window.get_compositor_private () as WindowActor;
if (actor == null) if (actor == null)
return; return;
actor.hide (); actor.hide ();
var clone = new WindowThumb (window); var clone = new WindowThumb (window);
clone.x = actor.x; clone.x = actor.x;
clone.y = actor.y; clone.y = actor.y;
clone.selected.connect (thumb_selected); clone.selected.connect (thumb_selected);
clone.closed.connect (thumb_closed); clone.closed.connect (thumb_closed);
add_child (clone); add_child (clone);
} }
calculate_places (get_children ()); calculate_places (get_children ());
} }
@ -616,39 +616,39 @@ namespace Gala
} }
} }
} }
void add_window (Window window) void add_window (Window window)
{ {
if (!visible || window.get_workspace () != screen.get_active_workspace () if (!visible || window.get_workspace () != screen.get_active_workspace ()
|| (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG)) || (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG))
return; return;
var actor = window.get_compositor_private () as WindowActor; var actor = window.get_compositor_private () as WindowActor;
if (actor == null) { if (actor == null) {
//the window possibly hasn't reached the compositor yet //the window possibly hasn't reached the compositor yet
Idle.add (() => { Idle.add (() => {
if (window.get_compositor_private () != null && if (window.get_compositor_private () != null &&
window.get_workspace () == screen.get_active_workspace ()) window.get_workspace () == screen.get_active_workspace ())
add_window (window); add_window (window);
return false; return false;
}); });
return; return;
} }
actor.hide (); actor.hide ();
var clone = new WindowThumb (window); var clone = new WindowThumb (window);
clone.x = actor.x; clone.x = actor.x;
clone.y = actor.y; clone.y = actor.y;
clone.selected.connect (thumb_selected); clone.selected.connect (thumb_selected);
clone.closed.connect (thumb_closed); clone.closed.connect (thumb_closed);
add_child (clone); add_child (clone);
calculate_places (get_children ()); calculate_places (get_children ());
} }
void remove_window (Window window) void remove_window (Window window)
{ {
WindowThumb thumb = null; WindowThumb thumb = null;
@ -656,23 +656,23 @@ namespace Gala
if ((child as WindowThumb).window == window) if ((child as WindowThumb).window == window)
thumb = child as WindowThumb; thumb = child as WindowThumb;
} }
if (thumb != null) { if (thumb != null) {
thumb_closed (thumb); thumb_closed (thumb);
} }
} }
void thumb_closed (WindowThumb thumb) void thumb_closed (WindowThumb thumb)
{ {
thumb.destroy (); thumb.destroy ();
var children = get_children (); var children = get_children ();
if (children.length () > 0) if (children.length () > 0)
calculate_places (children); calculate_places (children);
else else
close (false); close (false);
} }
void thumb_selected (Window window) void thumb_selected (Window window)
{ {
if (window.get_workspace () == screen.get_active_workspace ()) { if (window.get_workspace () == screen.get_active_workspace ()) {
@ -687,45 +687,45 @@ namespace Gala
}); });
} }
} }
void close (bool animate) void close (bool animate)
{ {
if (!visible || !ready) if (!visible || !ready)
return; return;
foreach (var workspace in workspaces) { foreach (var workspace in workspaces) {
workspace.window_added.disconnect (add_window); workspace.window_added.disconnect (add_window);
workspace.window_removed.disconnect (remove_window); workspace.window_removed.disconnect (remove_window);
} }
screen.window_left_monitor.disconnect (window_left_monitor); screen.window_left_monitor.disconnect (window_left_monitor);
ready = false; ready = false;
wm.end_modal (); wm.end_modal ();
wm.update_input_area (); wm.update_input_area ();
foreach (var child in get_children ()) { foreach (var child in get_children ()) {
var exposed = child as WindowThumb; var exposed = child as WindowThumb;
exposed.close (animate); exposed.close (animate);
exposed.selected.disconnect (thumb_selected); exposed.selected.disconnect (thumb_selected);
} }
if (animate) { if (animate) {
Clutter.Threads.Timeout.add (300, () => { Clutter.Threads.Timeout.add (300, () => {
visible = false; visible = false;
ready = true; ready = true;
foreach (var window in screen.get_active_workspace ().list_windows ()) { foreach (var window in screen.get_active_workspace ().list_windows ()) {
if (window.showing_on_its_workspace ()) if (window.showing_on_its_workspace ())
(window.get_compositor_private () as Actor).show (); (window.get_compositor_private () as Actor).show ();
} }
return false; return false;
}); });
} else { } else {
ready = true; ready = true;
visible = false; visible = false;
foreach (var window in screen.get_active_workspace ().list_windows ()) foreach (var window in screen.get_active_workspace ().list_windows ())
if (window.showing_on_its_workspace ()) if (window.showing_on_its_workspace ())
(window.get_compositor_private () as Actor).show (); (window.get_compositor_private () as Actor).show ();

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Clutter; using Clutter;
using Granite.Drawing; using Granite.Drawing;
@ -23,11 +23,11 @@ namespace Gala
public class WindowSwitcher : Clutter.Actor public class WindowSwitcher : Clutter.Actor
{ {
Gala.WindowManager wm; Gala.WindowManager wm;
Gee.ArrayList<Clutter.Clone> window_clones = new Gee.ArrayList<Clutter.Clone> (); Gee.ArrayList<Clutter.Clone> window_clones = new Gee.ArrayList<Clutter.Clone> ();
Meta.Window? current_window; Meta.Window? current_window;
Meta.WindowActor? dock_window; Meta.WindowActor? dock_window;
Actor dock; Actor dock;
CairoTexture dock_background; CairoTexture dock_background;
@ -38,68 +38,68 @@ namespace Gala
BindConstraint h_constraint; BindConstraint h_constraint;
bool closing = false; bool closing = false;
//estimated value, if possible //estimated value, if possible
float dock_width = 0.0f; float dock_width = 0.0f;
public WindowSwitcher (Gala.WindowManager _wm) public WindowSwitcher (Gala.WindowManager _wm)
{ {
wm = _wm; wm = _wm;
//pull drawing methods from libplank //pull drawing methods from libplank
dock_settings = new Plank.DockPreferences.with_filename (Environment.get_user_config_dir () + "/plank/dock1/settings"); dock_settings = new Plank.DockPreferences.with_filename (Environment.get_user_config_dir () + "/plank/dock1/settings");
dock_settings.notify["Theme"].connect (load_dock_theme); dock_settings.notify["Theme"].connect (load_dock_theme);
dock = new Actor (); dock = new Actor ();
dock.layout_manager = new BoxLayout (); dock.layout_manager = new BoxLayout ();
dock.anchor_gravity = Clutter.Gravity.CENTER; dock.anchor_gravity = Clutter.Gravity.CENTER;
dock_background = new CairoTexture (100, dock_settings.IconSize); dock_background = new CairoTexture (100, dock_settings.IconSize);
dock_background.anchor_gravity = Clutter.Gravity.CENTER; dock_background.anchor_gravity = Clutter.Gravity.CENTER;
dock_background.auto_resize = true; dock_background.auto_resize = true;
dock_background.draw.connect (draw_dock_background); dock_background.draw.connect (draw_dock_background);
y_constraint = new BindConstraint (dock, BindCoordinate.Y, 0); y_constraint = new BindConstraint (dock, BindCoordinate.Y, 0);
h_constraint = new BindConstraint (dock, BindCoordinate.HEIGHT, 0); h_constraint = new BindConstraint (dock, BindCoordinate.HEIGHT, 0);
dock_background.add_constraint (new BindConstraint (dock, BindCoordinate.X, 0)); dock_background.add_constraint (new BindConstraint (dock, BindCoordinate.X, 0));
dock_background.add_constraint (y_constraint); dock_background.add_constraint (y_constraint);
dock_background.add_constraint (new BindConstraint (dock, BindCoordinate.WIDTH, 0)); dock_background.add_constraint (new BindConstraint (dock, BindCoordinate.WIDTH, 0));
dock_background.add_constraint (h_constraint); dock_background.add_constraint (h_constraint);
add_child (dock_background); add_child (dock_background);
add_child (dock); add_child (dock);
load_dock_theme (); load_dock_theme ();
visible = false; visible = false;
} }
void load_dock_theme () void load_dock_theme ()
{ {
if (dock_theme != null) if (dock_theme != null)
dock_theme.notify.disconnect (update_dock); dock_theme.notify.disconnect (update_dock);
dock_theme = new Plank.Drawing.DockTheme (dock_settings.Theme); dock_theme = new Plank.Drawing.DockTheme (dock_settings.Theme);
dock_theme.load ("dock"); dock_theme.load ("dock");
dock_theme.notify.connect (update_dock); dock_theme.notify.connect (update_dock);
update_dock (); update_dock ();
} }
//set the values which don't get set every time and need to be updated when the theme changes //set the values which don't get set every time and need to be updated when the theme changes
void update_dock () void update_dock ()
{ {
(dock.layout_manager as BoxLayout).spacing = (uint)(dock_theme.ItemPadding / 10.0 * dock_settings.IconSize); (dock.layout_manager as BoxLayout).spacing = (uint)(dock_theme.ItemPadding / 10.0 * dock_settings.IconSize);
dock.height = dock_settings.IconSize; dock.height = dock_settings.IconSize;
var top_offset = (int)(dock_theme.TopPadding / 10.0 * dock_settings.IconSize); var top_offset = (int)(dock_theme.TopPadding / 10.0 * dock_settings.IconSize);
var bottom_offset = (int)(dock_theme.BottomPadding / 10.0 * dock_settings.IconSize); var bottom_offset = (int)(dock_theme.BottomPadding / 10.0 * dock_settings.IconSize);
y_constraint.offset = -top_offset / 2 + bottom_offset / 2; y_constraint.offset = -top_offset / 2 + bottom_offset / 2;
h_constraint.offset = top_offset + bottom_offset; h_constraint.offset = top_offset + bottom_offset;
} }
bool draw_dock_background (Cairo.Context cr) bool draw_dock_background (Cairo.Context cr)
{ {
if (dock_surface == null || dock_surface.Width != dock_background.width) { if (dock_surface == null || dock_surface.Width != dock_background.width) {
@ -107,23 +107,23 @@ namespace Gala
(int)dock_background.height, Gtk.PositionType.BOTTOM, (int)dock_background.height, Gtk.PositionType.BOTTOM,
new Plank.Drawing.DockSurface.with_surface (1, 1, cr.get_target ())); new Plank.Drawing.DockSurface.with_surface (1, 1, cr.get_target ()));
} }
cr.set_source_surface (dock_surface.Internal, 0, 0); cr.set_source_surface (dock_surface.Internal, 0, 0);
cr.paint (); cr.paint ();
return false; return false;
} }
public override bool key_release_event (Clutter.KeyEvent event) public override bool key_release_event (Clutter.KeyEvent event)
{ {
if (((event.modifier_state & ModifierType.MOD1_MASK) == 0) || if (((event.modifier_state & ModifierType.MOD1_MASK) == 0) ||
event.keyval == Key.Alt_L) { event.keyval == Key.Alt_L) {
close (event.time); close (event.time);
} }
return true; return true;
} }
void close (uint time) void close (uint time)
{ {
if (closing) if (closing)
@ -133,52 +133,52 @@ namespace Gala
var screen = wm.get_screen (); var screen = wm.get_screen ();
var workspace = screen.get_active_workspace (); var workspace = screen.get_active_workspace ();
if (dock_window != null) if (dock_window != null)
dock_window.opacity = 0; dock_window.opacity = 0;
var dest_width = (dock_width > 0 ? dock_width : 600.0f); var dest_width = (dock_width > 0 ? dock_width : 600.0f);
dock_width = 0; dock_width = 0;
set_child_above_sibling (dock, null); set_child_above_sibling (dock, null);
dock_background.animate (AnimationMode.EASE_OUT_CUBIC, 250, opacity : 0); dock_background.animate (AnimationMode.EASE_OUT_CUBIC, 250, opacity : 0);
if (dock_window != null) { if (dock_window != null) {
dock_window.show (); dock_window.show ();
dock_window.animate (AnimationMode.LINEAR, 250, opacity : 255); dock_window.animate (AnimationMode.LINEAR, 250, opacity : 255);
} }
foreach (var clone in window_clones) { foreach (var clone in window_clones) {
//current window stays on top //current window stays on top
if ((clone.source as Meta.WindowActor).get_meta_window () == current_window) if ((clone.source as Meta.WindowActor).get_meta_window () == current_window)
continue; continue;
//reset order //reset order
clone.get_parent ().set_child_below_sibling (clone, null); clone.get_parent ().set_child_below_sibling (clone, null);
if (!(clone.source as Meta.WindowActor).get_meta_window ().minimized) if (!(clone.source as Meta.WindowActor).get_meta_window ().minimized)
clone.animate (AnimationMode.EASE_OUT_CUBIC, 150, depth : 0.0f, opacity : 255); clone.animate (AnimationMode.EASE_OUT_CUBIC, 150, depth : 0.0f, opacity : 255);
} }
if (current_window != null) { if (current_window != null) {
current_window.activate (time); current_window.activate (time);
current_window = null; current_window = null;
} }
wm.end_modal (); wm.end_modal ();
dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width:dest_width, opacity : 0). dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width:dest_width, opacity : 0).
completed.connect (() => { completed.connect (() => {
dock.remove_all_children (); dock.remove_all_children ();
if (dock_window != null) if (dock_window != null)
dock_window = null; dock_window = null;
visible = false; visible = false;
foreach (var clone in window_clones) foreach (var clone in window_clones)
remove_clone (clone); remove_clone (clone);
window_clones.clear (); window_clones.clear ();
//need to go through all the windows because of hidden dialogs //need to go through all the windows because of hidden dialogs
unowned List<Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (screen); unowned List<Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (screen);
warn_if_fail (window_actors != null); warn_if_fail (window_actors != null);
@ -195,7 +195,7 @@ namespace Gala
screen.window_left_monitor.disconnect (window_left_monitor); screen.window_left_monitor.disconnect (window_left_monitor);
}); });
} }
//used to figure out delays between switching when holding the tab key //used to figure out delays between switching when holding the tab key
uint last_time = -1; uint last_time = -1;
bool released = false; bool released = false;
@ -203,45 +203,45 @@ namespace Gala
{ {
var screen = wm.get_screen (); var screen = wm.get_screen ();
var display = screen.get_display (); var display = screen.get_display ();
if (event.get_type () == EventType.KEY_RELEASE) { if (event.get_type () == EventType.KEY_RELEASE) {
released = true; released = true;
return false; return false;
} }
if (!(event.get_type () == EventType.KEY_PRESS) || if (!(event.get_type () == EventType.KEY_PRESS) ||
(!released && display.get_current_time_roundtrip () < (last_time + 300))) (!released && display.get_current_time_roundtrip () < (last_time + 300)))
return false; return false;
released = false; released = false;
bool backward = (event.get_state () & X.KeyMask.ShiftMask) != 0; bool backward = (event.get_state () & X.KeyMask.ShiftMask) != 0;
var action = display.get_keybinding_action (event.get_key_code (), event.get_state ()); var action = display.get_keybinding_action (event.get_key_code (), event.get_state ());
var prev_win = current_window; var prev_win = current_window;
if (action == Meta.KeyBindingAction.SWITCH_GROUP || if (action == Meta.KeyBindingAction.SWITCH_GROUP ||
action == Meta.KeyBindingAction.SWITCH_WINDOWS || action == Meta.KeyBindingAction.SWITCH_WINDOWS ||
action == Meta.KeyBindingAction.SWITCH_APPLICATIONS || action == Meta.KeyBindingAction.SWITCH_APPLICATIONS ||
event.get_key_symbol () == Clutter.Key.Right) { event.get_key_symbol () == Clutter.Key.Right) {
current_window = display.get_tab_next (Meta.TabList.NORMAL, screen, current_window = display.get_tab_next (Meta.TabList.NORMAL, screen,
screen.get_active_workspace (), current_window, backward); screen.get_active_workspace (), current_window, backward);
last_time = display.get_current_time_roundtrip (); last_time = display.get_current_time_roundtrip ();
} else if (action == Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD || } else if (action == Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD ||
action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD || action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD ||
action == Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD || action == Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD ||
event.get_key_symbol () == Clutter.Key.Left) { event.get_key_symbol () == Clutter.Key.Left) {
current_window = display.get_tab_next (Meta.TabList.NORMAL, screen, current_window = display.get_tab_next (Meta.TabList.NORMAL, screen,
screen.get_active_workspace (), current_window, true); screen.get_active_workspace (), current_window, true);
last_time = display.get_current_time_roundtrip (); last_time = display.get_current_time_roundtrip ();
} }
if (prev_win != current_window) { if (prev_win != current_window) {
dim_windows (); dim_windows ();
} }
return true; return true;
} }
@ -251,10 +251,10 @@ namespace Gala
if (dock.get_child_at_index (index) == event.source) if (dock.get_child_at_index (index) == event.source)
break; break;
} }
var prev_window = current_window; var prev_window = current_window;
current_window = (window_clones.get (index).source as Meta.WindowActor).get_meta_window (); current_window = (window_clones.get (index).source as Meta.WindowActor).get_meta_window ();
if (prev_window != current_window) { if (prev_window != current_window) {
dim_windows (); dim_windows ();
// wait for the dimming to finish // wait for the dimming to finish
@ -268,7 +268,7 @@ namespace Gala
return true; return true;
} }
void dim_windows () void dim_windows ()
{ {
var current_actor = current_window.get_compositor_private () as Actor; var current_actor = current_window.get_compositor_private () as Actor;
@ -277,13 +277,13 @@ namespace Gala
if (current_actor == clone.source) { if (current_actor == clone.source) {
set_child_below_sibling (clone, dock_background); set_child_below_sibling (clone, dock_background);
clone.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, depth : 0.0f, opacity : 255); clone.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, depth : 0.0f, opacity : 255);
dock.get_child_at_index (i).animate (AnimationMode.LINEAR, 100, opacity : 255); dock.get_child_at_index (i).animate (AnimationMode.LINEAR, 100, opacity : 255);
} else { } else {
clone.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, depth : -200.0f, opacity : 0); clone.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, depth : -200.0f, opacity : 0);
dock.get_child_at_index (i).animate (AnimationMode.LINEAR, 100, opacity : 100); dock.get_child_at_index (i).animate (AnimationMode.LINEAR, 100, opacity : 100);
} }
i++; i++;
} }
} }
@ -296,14 +296,14 @@ namespace Gala
remove_window (window); remove_window (window);
} }
} }
void add_window (Meta.Window window) void add_window (Meta.Window window)
{ {
var screen = wm.get_screen (); var screen = wm.get_screen ();
if (window.get_workspace () != screen.get_active_workspace ()) if (window.get_workspace () != screen.get_active_workspace ())
return; return;
var actor = window.get_compositor_private () as Meta.WindowActor; var actor = window.get_compositor_private () as Meta.WindowActor;
if (actor == null) { if (actor == null) {
//the window possibly hasn't reached the compositor yet //the window possibly hasn't reached the compositor yet
@ -315,19 +315,19 @@ namespace Gala
}); });
return; return;
} }
if (actor.is_destroyed ()) if (actor.is_destroyed ())
return; return;
actor.hide (); actor.hide ();
var clone = new Clone (actor); var clone = new Clone (actor);
clone.x = actor.x; clone.x = actor.x;
clone.y = actor.y; clone.y = actor.y;
add_child (clone); add_child (clone);
window_clones.add (clone); window_clones.add (clone);
var icon = new GtkClutter.Texture (); var icon = new GtkClutter.Texture ();
icon.reactive = true; icon.reactive = true;
icon.button_release_event.connect (clicked_icon); icon.button_release_event.connect (clicked_icon);
@ -335,11 +335,11 @@ namespace Gala
var pix = Utils.get_icon_for_window (window, dock_settings.IconSize); var pix = Utils.get_icon_for_window (window, dock_settings.IconSize);
icon.set_from_pixbuf (pix); icon.set_from_pixbuf (pix);
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
icon.opacity = 100; icon.opacity = 100;
dock.add_child (icon); dock.add_child (icon);
(dock.layout_manager as BoxLayout).set_expand (icon, true); (dock.layout_manager as BoxLayout).set_expand (icon, true);
//if the window has been added while being in alt-tab, redim //if the window has been added while being in alt-tab, redim
if (visible) { if (visible) {
float dest_width; float dest_width;
@ -348,11 +348,11 @@ namespace Gala
dim_windows (); dim_windows ();
} }
} }
void remove_clone (Clone clone) void remove_clone (Clone clone)
{ {
var window = clone.source as Meta.WindowActor; var window = clone.source as Meta.WindowActor;
var meta_win = window.get_meta_window (); var meta_win = window.get_meta_window ();
if (meta_win != null && if (meta_win != null &&
!window.is_destroyed () && !window.is_destroyed () &&
@ -360,14 +360,14 @@ namespace Gala
(meta_win.get_workspace () == wm.get_screen ().get_active_workspace ()) || (meta_win.get_workspace () == wm.get_screen ().get_active_workspace ()) ||
meta_win.is_on_all_workspaces ()) meta_win.is_on_all_workspaces ())
window.show (); window.show ();
clone.destroy (); clone.destroy ();
float dest_width; float dest_width;
dock.layout_manager.get_preferred_width (dock, dock.height, null, out dest_width); dock.layout_manager.get_preferred_width (dock, dock.height, null, out dest_width);
dock.animate (AnimationMode.EASE_OUT_CUBIC, 400, width : dest_width); dock.animate (AnimationMode.EASE_OUT_CUBIC, 400, width : dest_width);
} }
void remove_window (Meta.Window window) void remove_window (Meta.Window window)
{ {
Clone found = null; Clone found = null;
@ -377,24 +377,24 @@ namespace Gala
break; break;
} }
} }
if (found == null) { if (found == null) {
warning ("No clone found for removed window"); warning ("No clone found for removed window");
return; return;
} }
var icon = dock.get_child_at_index (window_clones.index_of (found)); var icon = dock.get_child_at_index (window_clones.index_of (found));
icon.button_release_event.disconnect (clicked_icon); icon.button_release_event.disconnect (clicked_icon);
icon.destroy (); icon.destroy ();
window_clones.remove (found); window_clones.remove (found);
remove_clone (found); remove_clone (found);
} }
public override void key_focus_out () public override void key_focus_out ()
{ {
close (wm.get_screen ().get_display ().get_current_time ()); close (wm.get_screen ().get_display ().get_current_time ());
} }
public void handle_switch_windows (Meta.Display display, Meta.Screen screen, Meta.Window? window, public void handle_switch_windows (Meta.Display display, Meta.Screen screen, Meta.Window? window,
X.Event event, Meta.KeyBinding binding) X.Event event, Meta.KeyBinding binding)
{ {
@ -403,9 +403,9 @@ namespace Gala
close (screen.get_display ().get_current_time ()); close (screen.get_display ().get_current_time ());
return; return;
} }
var workspace = screen.get_active_workspace (); var workspace = screen.get_active_workspace ();
var metawindows = display.get_tab_list (Meta.TabList.NORMAL, screen, workspace); var metawindows = display.get_tab_list (Meta.TabList.NORMAL, screen, workspace);
if (metawindows.length () == 0) if (metawindows.length () == 0)
return; return;
@ -418,48 +418,48 @@ namespace Gala
return; return;
} }
} }
workspace.window_added.connect (add_window); workspace.window_added.connect (add_window);
workspace.window_removed.connect (remove_window); workspace.window_removed.connect (remove_window);
screen.window_left_monitor.connect (window_left_monitor); screen.window_left_monitor.connect (window_left_monitor);
//grab the windows to be switched //grab the windows to be switched
var layout = dock.layout_manager as BoxLayout; var layout = dock.layout_manager as BoxLayout;
window_clones.clear (); window_clones.clear ();
foreach (var win in metawindows) foreach (var win in metawindows)
add_window (win); add_window (win);
visible = true; visible = true;
//hide the others //hide the others
Meta.Compositor.get_window_actors (screen).foreach ((w) => { Meta.Compositor.get_window_actors (screen).foreach ((w) => {
var type = w.get_meta_window ().window_type; var type = w.get_meta_window ().window_type;
if (type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP && type != Meta.WindowType.NOTIFICATION) if (type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP && type != Meta.WindowType.NOTIFICATION)
w.hide (); w.hide ();
if (w.get_meta_window ().title in BehaviorSettings.get_default ().dock_names && type == Meta.WindowType.DOCK) { if (w.get_meta_window ().title in BehaviorSettings.get_default ().dock_names && type == Meta.WindowType.DOCK) {
dock_window = w; dock_window = w;
dock_window.hide (); dock_window.hide ();
} }
}); });
closing = false; closing = false;
wm.begin_modal (); wm.begin_modal ();
bool backward = (binding.get_name () == "switch-windows-backward"); bool backward = (binding.get_name () == "switch-windows-backward");
current_window = Utils.get_next_window (screen.get_active_workspace (), backward); current_window = Utils.get_next_window (screen.get_active_workspace (), backward);
if (current_window == null) if (current_window == null)
return; return;
if (binding.get_mask () == 0) { if (binding.get_mask () == 0) {
current_window.activate (display.get_current_time ()); current_window.activate (display.get_current_time ());
return; return;
} }
//plank type switcher thing //plank type switcher thing
var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ()); var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ());
dock.width = (dock_window != null ? dock_window.width : 300.0f); dock.width = (dock_window != null ? dock_window.width : 300.0f);
//FIXME do this better //FIXME do this better
//count the launcher items to get an estimate of the window size //count the launcher items to get an estimate of the window size
@ -470,34 +470,34 @@ namespace Gala
var children = launcher_folder.enumerate_children ("", 0); var children = launcher_folder.enumerate_children ("", 0);
while (children.next_file () != null) while (children.next_file () != null)
count ++; count ++;
if (count > 0) if (count > 0)
dock.width = count * (float)(dock_settings.IconSize + dock_theme.ItemPadding); dock.width = count * (float)(dock_settings.IconSize + dock_theme.ItemPadding);
dock_width = dock.width; dock_width = dock.width;
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
} }
var bottom_offset = (int)(dock_theme.BottomPadding / 10.0 * dock_settings.IconSize); var bottom_offset = (int)(dock_theme.BottomPadding / 10.0 * dock_settings.IconSize);
dock.opacity = 255; dock.opacity = 255;
dock.x = Math.ceilf (geometry.x + geometry.width / 2.0f); dock.x = Math.ceilf (geometry.x + geometry.width / 2.0f);
dock.y = Math.ceilf (geometry.y + geometry.height - dock.height / 2.0f) - bottom_offset; dock.y = Math.ceilf (geometry.y + geometry.height - dock.height / 2.0f) - bottom_offset;
//add spacing on outer most items //add spacing on outer most items
var horiz_padding = (float) Math.ceil (dock_theme.HorizPadding / 10.0 * dock_settings.IconSize + layout.spacing / 2.0); var horiz_padding = (float) Math.ceil (dock_theme.HorizPadding / 10.0 * dock_settings.IconSize + layout.spacing / 2.0);
dock.get_first_child ().margin_left = horiz_padding; dock.get_first_child ().margin_left = horiz_padding;
dock.get_last_child ().margin_right = horiz_padding; dock.get_last_child ().margin_right = horiz_padding;
float dest_width; float dest_width;
layout.get_preferred_width (dock, dock.height, null, out dest_width); layout.get_preferred_width (dock, dock.height, null, out dest_width);
set_child_above_sibling (dock_background, null); set_child_above_sibling (dock_background, null);
dock_background.opacity = 255; dock_background.opacity = 255;
dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width : dest_width); dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width : dest_width);
set_child_above_sibling (dock, null); set_child_above_sibling (dock, null);
dim_windows (); dim_windows ();
grab_key_focus (); grab_key_focus ();

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann // Copyright (C) 2012 Tom Beckmann
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Meta; using Meta;
using Clutter; using Clutter;
@ -28,28 +28,28 @@ namespace Gala
public GtkClutter.Texture close_button; public GtkClutter.Texture close_button;
const int WAIT_FOR_CONFIRMATION_DIALOG = 100; const int WAIT_FOR_CONFIRMATION_DIALOG = 100;
public signal void selected (Window window); public signal void selected (Window window);
public signal void closed (); public signal void closed ();
public WindowThumb (Window _window) public WindowThumb (Window _window)
{ {
window = _window; window = _window;
reactive = true; reactive = true;
var actor = window.get_compositor_private () as WindowActor; var actor = window.get_compositor_private () as WindowActor;
clone = new Clone (actor); clone = new Clone (actor);
icon = new GtkClutter.Texture (); icon = new GtkClutter.Texture ();
icon.scale_x = 0.0f; icon.scale_x = 0.0f;
icon.scale_y = 0.0f; icon.scale_y = 0.0f;
icon.scale_gravity = Gravity.CENTER; icon.scale_gravity = Gravity.CENTER;
try { try {
icon.set_from_pixbuf (Utils.get_icon_for_window (window, 64)); icon.set_from_pixbuf (Utils.get_icon_for_window (window, 64));
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
close_button = new GtkClutter.Texture (); close_button = new GtkClutter.Texture ();
close_button.reactive = true; close_button.reactive = true;
close_button.visible = false; close_button.visible = false;
@ -58,28 +58,28 @@ namespace Gala
close_button.scale_gravity = Gravity.CENTER; close_button.scale_gravity = Gravity.CENTER;
close_button.button_release_event.connect (close_button_clicked); close_button.button_release_event.connect (close_button_clicked);
close_button.leave_event.connect ((e) => leave_event (e)); close_button.leave_event.connect ((e) => leave_event (e));
try { try {
close_button.set_from_pixbuf (Granite.Widgets.Utils.get_close_pixbuf ()); close_button.set_from_pixbuf (Granite.Widgets.Utils.get_close_pixbuf ());
} catch (Error e) { warning (e.message); } } catch (Error e) { warning (e.message); }
add_child (clone); add_child (clone);
var stage = Compositor.get_stage_for_screen (window.get_screen ()); var stage = Compositor.get_stage_for_screen (window.get_screen ());
stage.add_child (icon); stage.add_child (icon);
stage.add_child (close_button); stage.add_child (close_button);
} }
bool close_button_clicked (ButtonEvent event) bool close_button_clicked (ButtonEvent event)
{ {
if (event.button != 1) if (event.button != 1)
return false; return false;
close_window (); close_window ();
return true; return true;
} }
public void close_window () public void close_window ()
{ {
get_parent ().set_child_below_sibling (this, null); get_parent ().set_child_below_sibling (this, null);
@ -102,44 +102,44 @@ namespace Gala
clone.destroy (); clone.destroy ();
close_button.destroy (); close_button.destroy ();
icon.destroy (); icon.destroy ();
base.destroy (); base.destroy ();
} }
public override bool enter_event (CrossingEvent event) public override bool enter_event (CrossingEvent event)
{ {
//if we're still animating don't show the close button //if we're still animating don't show the close button
if (get_animation () != null) if (get_animation () != null)
return false; return false;
close_button.visible = true; close_button.visible = true;
close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f); close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f);
return true; return true;
} }
public override bool motion_event (MotionEvent event) public override bool motion_event (MotionEvent event)
{ {
if (get_animation () != null) if (get_animation () != null)
return false; return false;
close_button.visible = true; close_button.visible = true;
close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f); close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f);
return true; return true;
} }
public override bool leave_event (CrossingEvent event) public override bool leave_event (CrossingEvent event)
{ {
if (event.related == close_button) if (event.related == close_button)
return false; return false;
close_button.animate (AnimationMode.EASE_IN_QUAD, 200, scale_x : 0.0f, scale_y : 0.0f) close_button.animate (AnimationMode.EASE_IN_QUAD, 200, scale_x : 0.0f, scale_y : 0.0f)
.completed.connect (() => close_button.visible = false ); .completed.connect (() => close_button.visible = false );
return true; return true;
} }
public override bool button_release_event (ButtonEvent event) public override bool button_release_event (ButtonEvent event)
{ {
switch (event.button) { switch (event.button) {
@ -151,32 +151,32 @@ namespace Gala
close_window (); close_window ();
break; break;
} }
return true; return true;
} }
public void close (bool do_animate = true) public void close (bool do_animate = true)
{ {
unowned Meta.Rectangle rect = window.get_outer_rect (); unowned Meta.Rectangle rect = window.get_outer_rect ();
//FIXME need to subtract 10 here to remove jump for most windows, but adds jump for maximized ones //FIXME need to subtract 10 here to remove jump for most windows, but adds jump for maximized ones
float delta = window.maximized_horizontally || window.maximized_vertically ? 0 : 10; float delta = window.maximized_horizontally || window.maximized_vertically ? 0 : 10;
float dest_x = rect.x - delta; float dest_x = rect.x - delta;
float dest_y = rect.y - delta; float dest_y = rect.y - delta;
//stop all running animations //stop all running animations
detach_animation (); detach_animation ();
icon.detach_animation (); icon.detach_animation ();
close_button.detach_animation (); close_button.detach_animation ();
bool dont_show = window.minimized || window.get_workspace () != window.get_screen ().get_active_workspace (); bool dont_show = window.minimized || window.get_workspace () != window.get_screen ().get_active_workspace ();
do_animate = do_animate && !dont_show; do_animate = do_animate && !dont_show;
if (do_animate) { if (do_animate) {
icon.animate (AnimationMode.EASE_IN_CUBIC, 100, scale_x:0.0f, scale_y:0.0f); icon.animate (AnimationMode.EASE_IN_CUBIC, 100, scale_x:0.0f, scale_y:0.0f);
close_button.animate (AnimationMode.EASE_IN_QUAD, 200, scale_x : 0.0f, scale_y : 0.0f); close_button.animate (AnimationMode.EASE_IN_QUAD, 200, scale_x : 0.0f, scale_y : 0.0f);
animate (AnimationMode.EASE_IN_OUT_CUBIC, 300, scale_x:1.0f, scale_y:1.0f, x:dest_x, y:dest_y).completed.connect (() => { animate (AnimationMode.EASE_IN_OUT_CUBIC, 300, scale_x:1.0f, scale_y:1.0f, x:dest_x, y:dest_y).completed.connect (() => {
clone.source.show (); clone.source.show ();
destroy (); destroy ();

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Meta; using Meta;
using Clutter; using Clutter;
@ -26,66 +26,66 @@ namespace Gala
internal static const int APP_ICON_SIZE = 32; internal static const int APP_ICON_SIZE = 32;
static const float THUMBNAIL_HEIGHT = 80.0f; static const float THUMBNAIL_HEIGHT = 80.0f;
static const uint CLOSE_BUTTON_DELAY = 500; static const uint CLOSE_BUTTON_DELAY = 500;
static const int PLUS_SIZE = 8; static const int PLUS_SIZE = 8;
static const int PLUS_WIDTH = 24; static const int PLUS_WIDTH = 24;
static const int PLUS_OFFSET = 8; static const int PLUS_OFFSET = 8;
public static const string DRAG_ID = "app-icon"; public static const string DRAG_ID = "app-icon";
const string DROP_ACTION = "drop"; const string DROP_ACTION = "drop";
public signal void clicked (); public signal void clicked ();
public signal void closed (); public signal void closed ();
public signal void window_on_last (); public signal void window_on_last ();
public unowned Workspace? workspace { get; set; } public unowned Workspace? workspace { get; set; }
unowned Screen screen; unowned Screen screen;
static Actor? plus = null; static Actor? plus = null;
static Plank.Drawing.DockSurface? buffer = null; static Plank.Drawing.DockSurface? buffer = null;
Gtk.StyleContext selector_style; Gtk.StyleContext selector_style;
Gtk.EventBox selector_style_widget; Gtk.EventBox selector_style_widget;
internal Actor wallpaper; internal Actor wallpaper;
Actor wallpaper_manager; Actor wallpaper_manager;
Clutter.Actor windows; Clutter.Actor windows;
internal Clutter.Actor icons; internal Clutter.Actor icons;
Actor indicator; Actor indicator;
GtkClutter.Texture close_button; GtkClutter.Texture close_button;
uint hover_timer = 0; uint hover_timer = 0;
public WorkspaceThumb (Workspace _workspace, Meta.BackgroundGroup _wallpaper) public WorkspaceThumb (Workspace _workspace, Meta.BackgroundGroup _wallpaper)
{ {
workspace = _workspace; workspace = _workspace;
screen = workspace.get_screen (); screen = workspace.get_screen ();
selector_style_widget = new Gtk.EventBox (); selector_style_widget = new Gtk.EventBox ();
selector_style_widget.show (); selector_style_widget.show ();
selector_style = selector_style_widget.get_style_context (); selector_style = selector_style_widget.get_style_context ();
selector_style.add_class ("gala-workspace-selected"); selector_style.add_class ("gala-workspace-selected");
selector_style.add_provider (Utils.get_default_style (), Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK); selector_style.add_provider (Utils.get_default_style (), Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
screen.workspace_switched.connect (handle_workspace_switched); screen.workspace_switched.connect (handle_workspace_switched);
screen.workspace_added.connect (workspace_added); screen.workspace_added.connect (workspace_added);
screen.monitors_changed.connect (resize); screen.monitors_changed.connect (resize);
workspace.window_added.connect (handle_window_added); workspace.window_added.connect (handle_window_added);
workspace.window_removed.connect (handle_window_removed); workspace.window_removed.connect (handle_window_removed);
screen.window_left_monitor.connect (window_left_monitor); screen.window_left_monitor.connect (window_left_monitor);
reactive = true; reactive = true;
indicator = new Actor (); indicator = new Actor ();
indicator.height = THUMBNAIL_HEIGHT + 2 * INDICATOR_BORDER; indicator.height = THUMBNAIL_HEIGHT + 2 * INDICATOR_BORDER;
indicator.opacity = 0; indicator.opacity = 0;
indicator.content = new Canvas (); indicator.content = new Canvas ();
(indicator.content as Canvas).draw.connect (draw_indicator); (indicator.content as Canvas).draw.connect (draw_indicator);
handle_workspace_switched (-1, screen.get_active_workspace_index (), MotionDirection.LEFT); handle_workspace_switched (-1, screen.get_active_workspace_index (), MotionDirection.LEFT);
wallpaper_manager = new BackgroundManager (screen); wallpaper_manager = new BackgroundManager (screen);
//FIXME apparently there are issues with scaling and animating the opacity. The wallpaper will //FIXME apparently there are issues with scaling and animating the opacity. The wallpaper will
// start flickering when the opacity changes. Wrapping it in a container solves this. // start flickering when the opacity changes. Wrapping it in a container solves this.
@ -94,7 +94,7 @@ namespace Gala
wallpaper.x = INDICATOR_BORDER; wallpaper.x = INDICATOR_BORDER;
wallpaper.y = INDICATOR_BORDER; wallpaper.y = INDICATOR_BORDER;
wallpaper.height = THUMBNAIL_HEIGHT; wallpaper.height = THUMBNAIL_HEIGHT;
close_button = new GtkClutter.Texture (); close_button = new GtkClutter.Texture ();
try { try {
close_button.set_from_pixbuf (Granite.Widgets.Utils.get_close_pixbuf ()); close_button.set_from_pixbuf (Granite.Widgets.Utils.get_close_pixbuf ());
@ -104,18 +104,18 @@ namespace Gala
close_button.scale_gravity = Clutter.Gravity.CENTER; close_button.scale_gravity = Clutter.Gravity.CENTER;
close_button.scale_x = 0; close_button.scale_x = 0;
close_button.scale_y = 0; close_button.scale_y = 0;
icons = new Actor (); icons = new Actor ();
icons.layout_manager = new BoxLayout (); icons.layout_manager = new BoxLayout ();
(icons.layout_manager as Clutter.BoxLayout).spacing = 6; (icons.layout_manager as Clutter.BoxLayout).spacing = 6;
icons.height = APP_ICON_SIZE; icons.height = APP_ICON_SIZE;
windows = new Actor (); windows = new Actor ();
windows.x = INDICATOR_BORDER; windows.x = INDICATOR_BORDER;
windows.y = INDICATOR_BORDER; windows.y = INDICATOR_BORDER;
windows.height = THUMBNAIL_HEIGHT; windows.height = THUMBNAIL_HEIGHT;
windows.clip_to_allocation = true; windows.clip_to_allocation = true;
add_child (indicator); add_child (indicator);
add_child (wallpaper); add_child (wallpaper);
add_child (windows); add_child (windows);
@ -125,18 +125,18 @@ namespace Gala
var click = new ClickAction (); var click = new ClickAction ();
add_action (click); add_action (click);
click.clicked.connect (pressed); click.clicked.connect (pressed);
//kill the workspace //kill the workspace
var close_click = new ClickAction (); var close_click = new ClickAction ();
close_button.add_action (close_click); close_button.add_action (close_click);
close_click.clicked.connect (close_workspace); close_click.clicked.connect (close_workspace);
if (plus == null) { if (plus == null) {
plus = new Actor (); plus = new Actor ();
var canvas = new Canvas (); var canvas = new Canvas ();
plus.content = canvas; plus.content = canvas;
canvas.draw.connect ((cr) => { canvas.draw.connect ((cr) => {
// putting the buffer inside here is not a problem performance-wise, // putting the buffer inside here is not a problem performance-wise,
// as the method will only be called once anyway // as the method will only be called once anyway
var buffer = new Granite.Drawing.BufferSurface (canvas.width, canvas.height); var buffer = new Granite.Drawing.BufferSurface (canvas.width, canvas.height);
@ -168,18 +168,18 @@ namespace Gala
plus.height = PLUS_WIDTH + 2 * PLUS_OFFSET; plus.height = PLUS_WIDTH + 2 * PLUS_OFFSET;
canvas.set_size ((int)plus.width, (int)plus.height); canvas.set_size ((int)plus.width, (int)plus.height);
} }
var drop_action = new DragDropAction (DragDropActionType.DESTINATION, DRAG_ID); var drop_action = new DragDropAction (DragDropActionType.DESTINATION, DRAG_ID);
add_action_with_name (DROP_ACTION, drop_action); add_action_with_name (DROP_ACTION, drop_action);
drop_action.crossed.connect (crossed); drop_action.crossed.connect (crossed);
check_last_workspace (); check_last_workspace ();
visible = false; visible = false;
var canvas = new Canvas (); var canvas = new Canvas ();
canvas.draw.connect (draw_background); canvas.draw.connect (draw_background);
content = canvas; content = canvas;
resize (screen); resize (screen);
@ -190,7 +190,7 @@ namespace Gala
{ {
int swidth, sheight; int swidth, sheight;
screen.get_size (out swidth, out sheight); screen.get_size (out swidth, out sheight);
// make sure we redraw the buffer // make sure we redraw the buffer
buffer = null; buffer = null;
@ -236,7 +236,7 @@ namespace Gala
Cogl.set_source_color4f (1, 1, 1, 0.3f); Cogl.set_source_color4f (1, 1, 1, 0.3f);
Cogl.Path.stroke (); Cogl.Path.stroke ();
} }
void crossed (bool over) void crossed (bool over)
{ {
// when draggin, the leave event isn't emitted // when draggin, the leave event isn't emitted
@ -249,7 +249,7 @@ namespace Gala
indicator.animate (AnimationMode.LINEAR, 100, opacity: over ? 200 : 0); indicator.animate (AnimationMode.LINEAR, 100, opacity: over ? 200 : 0);
} }
~WorkspaceThumb () ~WorkspaceThumb ()
{ {
screen.workspace_switched.disconnect (handle_workspace_switched); screen.workspace_switched.disconnect (handle_workspace_switched);
@ -257,7 +257,7 @@ namespace Gala
screen.monitors_changed.disconnect (resize); screen.monitors_changed.disconnect (resize);
screen.window_left_monitor.disconnect (window_left_monitor); screen.window_left_monitor.disconnect (window_left_monitor);
} }
void close_workspace (Clutter.Actor actor) void close_workspace (Clutter.Actor actor)
{ {
if (workspace == null) if (workspace == null)
@ -267,65 +267,65 @@ namespace Gala
if (window.window_type != WindowType.DOCK) if (window.window_type != WindowType.DOCK)
window.delete (screen.get_display ().get_current_time ()); window.delete (screen.get_display ().get_current_time ());
} }
Clutter.Threads.Timeout.add (250, () => { Clutter.Threads.Timeout.add (250, () => {
//wait for confirmation dialogs to popup //wait for confirmation dialogs to popup
if (Utils.get_n_windows (workspace) == 0) { if (Utils.get_n_windows (workspace) == 0) {
workspace.window_added.disconnect (handle_window_added); workspace.window_added.disconnect (handle_window_added);
workspace.window_removed.disconnect (handle_window_removed); workspace.window_removed.disconnect (handle_window_removed);
animate (Clutter.AnimationMode.LINEAR, 250, width : 0.0f, opacity : 0); animate (Clutter.AnimationMode.LINEAR, 250, width : 0.0f, opacity : 0);
closed (); closed ();
} else } else
workspace.activate (workspace.get_screen ().get_display ().get_current_time ()); workspace.activate (workspace.get_screen ().get_display ().get_current_time ());
return false; return false;
}); });
} }
bool draw_indicator (Cairo.Context cr) bool draw_indicator (Cairo.Context cr)
{ {
cr.set_operator (Cairo.Operator.CLEAR); cr.set_operator (Cairo.Operator.CLEAR);
cr.paint (); cr.paint ();
cr.set_operator (Cairo.Operator.OVER); cr.set_operator (Cairo.Operator.OVER);
selector_style.render_background (cr, 0, 0, indicator.width, indicator.height); selector_style.render_background (cr, 0, 0, indicator.width, indicator.height);
selector_style.render_frame (cr, 0, 0, indicator.width, indicator.height); selector_style.render_frame (cr, 0, 0, indicator.width, indicator.height);
return false; return false;
} }
bool draw_background (Cairo.Context cr) bool draw_background (Cairo.Context cr)
{ {
if (buffer == null) { if (buffer == null) {
buffer = new Plank.Drawing.DockSurface ((int)width, (int)height); buffer = new Plank.Drawing.DockSurface ((int)width, (int)height);
// some weird calculations are necessary here, we have to // some weird calculations are necessary here, we have to
// subtract the delta of the wallpaper and container size to make it fit // subtract the delta of the wallpaper and container size to make it fit
buffer.Context.rectangle (wallpaper.x, wallpaper.y, buffer.Context.rectangle (wallpaper.x, wallpaper.y,
wallpaper.width - (width - wallpaper.width), wallpaper.width - (width - wallpaper.width),
wallpaper.height - (height - wallpaper.height) - INDICATOR_BORDER); wallpaper.height - (height - wallpaper.height) - INDICATOR_BORDER);
buffer.Context.set_source_rgba (0, 0, 0, 1); buffer.Context.set_source_rgba (0, 0, 0, 1);
buffer.Context.fill (); buffer.Context.fill ();
buffer.exponential_blur (5); buffer.exponential_blur (5);
} }
cr.set_operator (Cairo.Operator.CLEAR); cr.set_operator (Cairo.Operator.CLEAR);
cr.paint (); cr.paint ();
cr.set_operator (Cairo.Operator.OVER); cr.set_operator (Cairo.Operator.OVER);
cr.set_source_surface (buffer.Internal, 0, 0); cr.set_source_surface (buffer.Internal, 0, 0);
cr.paint (); cr.paint ();
return false; return false;
} }
void workspace_added (int index) void workspace_added (int index)
{ {
check_last_workspace (); check_last_workspace ();
} }
void window_left_monitor (int num, Meta.Window window) void window_left_monitor (int num, Meta.Window window)
{ {
if (window.located_on_workspace (workspace)) if (window.located_on_workspace (workspace))
@ -337,10 +337,10 @@ namespace Gala
windows.remove_all_children (); windows.remove_all_children ();
if (workspace == null) if (workspace == null)
return; return;
int swidth, sheight; int swidth, sheight;
screen.get_size (out swidth, out sheight); screen.get_size (out swidth, out sheight);
// add window thumbnails // add window thumbnails
var aspect = windows.width / swidth; var aspect = windows.width / swidth;
@ -348,7 +348,7 @@ namespace Gala
var list = new SList<Window> (); var list = new SList<Window> ();
foreach (var window in unordered) { foreach (var window in unordered) {
if (!window.minimized && if (!window.minimized &&
(window.window_type == WindowType.NORMAL || (window.window_type == WindowType.NORMAL ||
window.window_type == WindowType.DIALOG || window.window_type == WindowType.DIALOG ||
window.window_type == WindowType.MODAL_DIALOG)) window.window_type == WindowType.MODAL_DIALOG))
list.prepend (window); list.prepend (window);
@ -365,55 +365,55 @@ namespace Gala
clone.height = aspect * clone.height; clone.height = aspect * clone.height;
clone.x = aspect * actor.x; clone.x = aspect * actor.x;
clone.y = aspect * actor.y; clone.y = aspect * actor.y;
windows.add_child (clone); windows.add_child (clone);
} }
} }
void update_icons () void update_icons ()
{ {
icons.remove_all_children (); icons.remove_all_children ();
if (workspace == null) if (workspace == null)
return; return;
//show each icon only once, so log the ones added //show each icon only once, so log the ones added
var shown_applications = new List<Bamf.Application> (); var shown_applications = new List<Bamf.Application> ();
workspace.list_windows ().foreach ((w) => { workspace.list_windows ().foreach ((w) => {
if (w.window_type != Meta.WindowType.NORMAL || w.minimized) if (w.window_type != Meta.WindowType.NORMAL || w.minimized)
return; return;
var app = Bamf.Matcher.get_default ().get_application_for_xid ((uint32)w.get_xwindow ()); var app = Bamf.Matcher.get_default ().get_application_for_xid ((uint32)w.get_xwindow ());
if (shown_applications.index (app) != -1) if (shown_applications.index (app) != -1)
return; return;
if (app != null) if (app != null)
shown_applications.append (app); shown_applications.append (app);
var icon = new AppIcon (w, app); var icon = new AppIcon (w, app);
icons.add_child (icon); icons.add_child (icon);
}); });
icons.x = Math.floorf (wallpaper.x + wallpaper.width / 2 - icons.width / 2); icons.x = Math.floorf (wallpaper.x + wallpaper.width / 2 - icons.width / 2);
icons.y = Math.floorf (wallpaper.y + wallpaper.height - 5); icons.y = Math.floorf (wallpaper.y + wallpaper.height - 5);
} }
void check_last_workspace () void check_last_workspace ()
{ {
if (!Prefs.get_dynamic_workspaces ()) if (!Prefs.get_dynamic_workspaces ())
return; return;
//last workspace, show plus button and so on //last workspace, show plus button and so on
//give the last one a different style //give the last one a different style
var index = screen.get_workspaces ().index (workspace); var index = screen.get_workspaces ().index (workspace);
if (index < 0) { if (index < 0) {
closed (); closed ();
return; return;
} }
if (index == screen.n_workspaces - 1) { if (index == screen.n_workspaces - 1) {
wallpaper.opacity = 127; wallpaper.opacity = 127;
if (plus.get_parent () != null) if (plus.get_parent () != null)
@ -425,21 +425,21 @@ namespace Gala
remove_child (plus); remove_child (plus);
} }
} }
void handle_workspace_switched (int index_old, int index_new, Meta.MotionDirection direction) void handle_workspace_switched (int index_old, int index_new, Meta.MotionDirection direction)
{ {
if (index_old == index_new) if (index_old == index_new)
return; return;
if (workspace == null) if (workspace == null)
return; return;
if (workspace.index () == index_old) if (workspace.index () == index_old)
indicator.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity : 0); indicator.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity : 0);
else if (workspace.index () == index_new) else if (workspace.index () == index_new)
indicator.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity : 255); indicator.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity : 255);
} }
void handle_window_added (Meta.Window window) void handle_window_added (Meta.Window window)
{ {
// wait till the window is ready // wait till the window is ready
@ -451,24 +451,24 @@ namespace Gala
}); });
return; return;
} }
if (visible) { if (visible) {
update_windows (); update_windows ();
update_icons (); update_icons ();
} }
if (!Prefs.get_dynamic_workspaces ()) if (!Prefs.get_dynamic_workspaces ())
return; return;
if (workspace != null && workspace.index () == screen.n_workspaces - 1 && Utils.get_n_windows (workspace) > 0) if (workspace != null && workspace.index () == screen.n_workspaces - 1 && Utils.get_n_windows (workspace) > 0)
window_on_last (); window_on_last ();
} }
void handle_window_removed (Meta.Window window) void handle_window_removed (Meta.Window window)
{ {
if (visible) if (visible)
update_windows (); update_windows ();
if (!Prefs.get_dynamic_workspaces () if (!Prefs.get_dynamic_workspaces ()
|| (window.window_type != WindowType.NORMAL || (window.window_type != WindowType.NORMAL
&& window.window_type != WindowType.DIALOG && window.window_type != WindowType.DIALOG
@ -477,106 +477,106 @@ namespace Gala
|| Utils.get_n_windows (workspace) > 0 || Utils.get_n_windows (workspace) > 0
|| workspace.index () == workspace.get_screen ().get_n_workspaces () - 1) || workspace.index () == workspace.get_screen ().get_n_workspaces () - 1)
return; return;
// we need to wait untill the animation ended, otherwise we get trouble with focus handling // we need to wait untill the animation ended, otherwise we get trouble with focus handling
Clutter.Threads.Timeout.add (AnimationSettings.get_default ().workspace_switch_duration + 10, () => { Clutter.Threads.Timeout.add (AnimationSettings.get_default ().workspace_switch_duration + 10, () => {
// check again, maybe something opened // check again, maybe something opened
if (workspace == null || Utils.get_n_windows (workspace) > 0) if (workspace == null || Utils.get_n_windows (workspace) > 0)
return false; return false;
workspace.window_added.disconnect (handle_window_added); workspace.window_added.disconnect (handle_window_added);
workspace.window_removed.disconnect (handle_window_removed); workspace.window_removed.disconnect (handle_window_removed);
closed (); closed ();
return false; return false;
}); });
} }
public override void hide () public override void hide ()
{ {
base.hide (); base.hide ();
icons.remove_all_children (); icons.remove_all_children ();
windows.remove_all_children (); windows.remove_all_children ();
} }
public override void show () public override void show ()
{ {
check_last_workspace (); check_last_workspace ();
update_icons (); update_icons ();
update_windows (); update_windows ();
base.show (); base.show ();
} }
public void pressed (Actor actor) public void pressed (Actor actor)
{ {
if (workspace == null) if (workspace == null)
return; return;
workspace.activate (screen.get_display ().get_current_time ()); workspace.activate (screen.get_display ().get_current_time ());
// wait for the animation to be finished before closing, for aesthetic reasons // wait for the animation to be finished before closing, for aesthetic reasons
Clutter.Threads.Timeout.add (AnimationSettings.get_default ().workspace_switch_duration, () => { Clutter.Threads.Timeout.add (AnimationSettings.get_default ().workspace_switch_duration, () => {
clicked (); clicked ();
return false; return false;
}); });
} }
public override bool enter_event (CrossingEvent event) public override bool enter_event (CrossingEvent event)
{ {
if (workspace == null) if (workspace == null)
return true; return true;
if (!Prefs.get_dynamic_workspaces ()) if (!Prefs.get_dynamic_workspaces ())
return false; return false;
if (workspace.index () == screen.n_workspaces - 1) { if (workspace.index () == screen.n_workspaces - 1) {
wallpaper.animate (AnimationMode.EASE_OUT_QUAD, 300, opacity : 210); wallpaper.animate (AnimationMode.EASE_OUT_QUAD, 300, opacity : 210);
return true; return true;
} }
//dont allow closing the tab if it's the last one used //dont allow closing the tab if it's the last one used
if (workspace.index () == 0 && screen.n_workspaces == 2) if (workspace.index () == 0 && screen.n_workspaces == 2)
return false; return false;
if (hover_timer > 0) if (hover_timer > 0)
GLib.Source.remove (hover_timer); GLib.Source.remove (hover_timer);
hover_timer = Clutter.Threads.Timeout.add (CLOSE_BUTTON_DELAY, () => { hover_timer = Clutter.Threads.Timeout.add (CLOSE_BUTTON_DELAY, () => {
close_button.visible = true; close_button.visible = true;
close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f); close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f);
return false; return false;
}); });
return true; return true;
} }
internal void hide_close_button () internal void hide_close_button ()
{ {
close_button.animate (AnimationMode.EASE_IN_QUAD, 400, scale_x : 0.0f, scale_y : 0.0f) close_button.animate (AnimationMode.EASE_IN_QUAD, 400, scale_x : 0.0f, scale_y : 0.0f)
.completed.connect (() => close_button.visible = false ); .completed.connect (() => close_button.visible = false );
} }
public override bool leave_event (CrossingEvent event) public override bool leave_event (CrossingEvent event)
{ {
if (contains (event.related)) if (contains (event.related))
return false; return false;
if (hover_timer > 0) { if (hover_timer > 0) {
GLib.Source.remove (hover_timer); GLib.Source.remove (hover_timer);
hover_timer = 0; hover_timer = 0;
} }
if (workspace == null) if (workspace == null)
return false; return false;
if (workspace.index () == screen.n_workspaces - 1) if (workspace.index () == screen.n_workspaces - 1)
wallpaper.animate (AnimationMode.EASE_OUT_QUAD, 400, opacity : 127); wallpaper.animate (AnimationMode.EASE_OUT_QUAD, 400, opacity : 127);
else else
hide_close_button (); hide_close_button ();
return false; return false;
} }
} }

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz // Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
using Meta; using Meta;
@ -23,72 +23,72 @@ namespace Gala
{ {
static const float VIEW_HEIGHT = 140.0f; static const float VIEW_HEIGHT = 140.0f;
static const float SCROLL_SPEED = 30.0f; static const float SCROLL_SPEED = 30.0f;
Gala.WindowManager wm; Gala.WindowManager wm;
Screen screen; Screen screen;
Clutter.Actor thumbnails; Clutter.Actor thumbnails;
Clutter.Actor scroll; Clutter.Actor scroll;
bool animating; // delay closing the popup bool animating; // delay closing the popup
bool wait_one_key_release; //called by shortcut, don't close it on first keyrelease bool wait_one_key_release; //called by shortcut, don't close it on first keyrelease
uint last_switch_time = 0; uint last_switch_time = 0;
Gtk.StyleContext background_style; Gtk.StyleContext background_style;
Gtk.EventBox background_style_widget; Gtk.EventBox background_style_widget;
public WorkspaceView (Gala.WindowManager _wm) public WorkspaceView (Gala.WindowManager _wm)
{ {
wm = _wm; wm = _wm;
screen = wm.get_screen (); screen = wm.get_screen ();
height = VIEW_HEIGHT; height = VIEW_HEIGHT;
reactive = true; reactive = true;
clip_to_allocation = true; clip_to_allocation = true;
background_style_widget = new Gtk.EventBox (); background_style_widget = new Gtk.EventBox ();
background_style_widget.show (); background_style_widget.show ();
background_style = background_style_widget.get_style_context (); background_style = background_style_widget.get_style_context ();
background_style.add_class ("gala-workspaces-background"); background_style.add_class ("gala-workspaces-background");
background_style.add_provider (Utils.get_default_style (), Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK); background_style.add_provider (Utils.get_default_style (), Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
thumbnails = new Clutter.Actor (); thumbnails = new Clutter.Actor ();
thumbnails.layout_manager = new Clutter.BoxLayout (); thumbnails.layout_manager = new Clutter.BoxLayout ();
(thumbnails.layout_manager as Clutter.BoxLayout).spacing = 12; (thumbnails.layout_manager as Clutter.BoxLayout).spacing = 12;
(thumbnails.layout_manager as Clutter.BoxLayout).homogeneous = true; (thumbnails.layout_manager as Clutter.BoxLayout).homogeneous = true;
content = new Clutter.Canvas (); content = new Clutter.Canvas ();
(content as Clutter.Canvas).draw.connect (draw_background); (content as Clutter.Canvas).draw.connect (draw_background);
scroll = new Clutter.Actor (); scroll = new Clutter.Actor ();
scroll.height = 12; scroll.height = 12;
scroll.content = new Clutter.Canvas (); scroll.content = new Clutter.Canvas ();
(scroll.content as Clutter.Canvas).draw.connect (draw_scroll); (scroll.content as Clutter.Canvas).draw.connect (draw_scroll);
add_child (thumbnails); add_child (thumbnails);
add_child (scroll); add_child (scroll);
//place it somewhere low, so it won't slide down on first open //place it somewhere low, so it won't slide down on first open
int swidth, sheight; int swidth, sheight;
screen.get_size (out swidth, out sheight); screen.get_size (out swidth, out sheight);
y = sheight; y = sheight;
screen.workspace_added.connect ((index) => { screen.workspace_added.connect ((index) => {
create_workspace_thumb (screen.get_workspace_by_index (index)); create_workspace_thumb (screen.get_workspace_by_index (index));
}); });
Prefs.add_listener ((pref) => { Prefs.add_listener ((pref) => {
if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) { if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) {
// if the last workspace has a window, we need to append a new workspace // if the last workspace has a window, we need to append a new workspace
if (Utils.get_n_windows (screen.get_workspaces ().nth_data (screen.get_n_workspaces () - 1)) > 0) if (Utils.get_n_windows (screen.get_workspaces ().nth_data (screen.get_n_workspaces () - 1)) > 0)
add_workspace (); add_workspace ();
} else if ((pref == Preference.DYNAMIC_WORKSPACES || } else if ((pref == Preference.DYNAMIC_WORKSPACES ||
pref == Preference.NUM_WORKSPACES) && pref == Preference.NUM_WORKSPACES) &&
!Prefs.get_dynamic_workspaces ()) { !Prefs.get_dynamic_workspaces ()) {
// only need to listen for the case when workspaces were removed. // only need to listen for the case when workspaces were removed.
// Any other case will be caught by the workspace_added signal. // Any other case will be caught by the workspace_added signal.
// For some reason workspace_removed is not emitted, when changing the workspace number // For some reason workspace_removed is not emitted, when changing the workspace number
if (Prefs.get_num_workspaces () < thumbnails.get_n_children ()) { if (Prefs.get_num_workspaces () < thumbnails.get_n_children ()) {
@ -98,10 +98,10 @@ namespace Gala
} }
} }
}); });
init_thumbnails (); init_thumbnails ();
} }
void init_thumbnails () void init_thumbnails ()
{ {
foreach (var workspace in screen.get_workspaces ()) { foreach (var workspace in screen.get_workspaces ()) {
@ -109,10 +109,10 @@ namespace Gala
thumb.clicked.connect (hide); thumb.clicked.connect (hide);
thumb.closed.connect (remove_workspace); thumb.closed.connect (remove_workspace);
thumb.window_on_last.connect (add_workspace); thumb.window_on_last.connect (add_workspace);
thumbnails.add_child (thumb); thumbnails.add_child (thumb);
} }
//if there went something wrong, we need to get the system back rolling //if there went something wrong, we need to get the system back rolling
if (Prefs.get_dynamic_workspaces () if (Prefs.get_dynamic_workspaces ()
&& screen.n_workspaces == 1 && screen.n_workspaces == 1
@ -125,13 +125,13 @@ namespace Gala
hide (); hide ();
return true; return true;
} }
bool draw_background (Cairo.Context cr) bool draw_background (Cairo.Context cr)
{ {
cr.set_operator (Cairo.Operator.CLEAR); cr.set_operator (Cairo.Operator.CLEAR);
cr.paint (); cr.paint ();
cr.set_operator (Cairo.Operator.OVER); cr.set_operator (Cairo.Operator.OVER);
background_style.render_background (cr, 0, 0, width, height); background_style.render_background (cr, 0, 0, width, height);
background_style.render_frame (cr, 0, 0, width, height); background_style.render_frame (cr, 0, 0, width, height);
@ -139,74 +139,74 @@ namespace Gala
pat.set_extend (Cairo.Extend.REPEAT); pat.set_extend (Cairo.Extend.REPEAT);
cr.set_source (pat); cr.set_source (pat);
cr.paint_with_alpha (0.6); cr.paint_with_alpha (0.6);
return false; return false;
} }
bool draw_scroll (Cairo.Context cr) bool draw_scroll (Cairo.Context cr)
{ {
cr.set_operator (Cairo.Operator.CLEAR); cr.set_operator (Cairo.Operator.CLEAR);
cr.paint (); cr.paint ();
cr.set_operator (Cairo.Operator.OVER); cr.set_operator (Cairo.Operator.OVER);
Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, 4, 4, scroll.width-32, 4, 2); Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, 4, 4, scroll.width-32, 4, 2);
cr.set_source_rgba (1, 1, 1, 0.8); cr.set_source_rgba (1, 1, 1, 0.8);
cr.fill (); cr.fill ();
return false; return false;
} }
void add_workspace () void add_workspace ()
{ {
var wp = screen.append_new_workspace (false, screen.get_display ().get_current_time ()); var wp = screen.append_new_workspace (false, screen.get_display ().get_current_time ());
if (wp == null) if (wp == null)
return; return;
} }
void create_workspace_thumb (Meta.Workspace workspace) void create_workspace_thumb (Meta.Workspace workspace)
{ {
var thumb = new WorkspaceThumb (workspace, wm.background_group); var thumb = new WorkspaceThumb (workspace, wm.background_group);
thumb.clicked.connect (hide); thumb.clicked.connect (hide);
thumb.closed.connect (remove_workspace); thumb.closed.connect (remove_workspace);
thumb.window_on_last.connect (add_workspace); thumb.window_on_last.connect (add_workspace);
thumbnails.insert_child_at_index (thumb, workspace.index ()); thumbnails.insert_child_at_index (thumb, workspace.index ());
thumb.show (); thumb.show ();
check_scrollbar (); check_scrollbar ();
} }
void remove_workspace (WorkspaceThumb thumb) void remove_workspace (WorkspaceThumb thumb)
{ {
//if there's only one used left, remove the second one to avoid rather confusing workspace movement //if there's only one used left, remove the second one to avoid rather confusing workspace movement
if (thumb.workspace.index () == 0 && screen.n_workspaces == 2) { if (thumb.workspace.index () == 0 && screen.n_workspaces == 2) {
return; return;
} }
thumb.clicked.disconnect (hide); thumb.clicked.disconnect (hide);
thumb.closed.disconnect (remove_workspace); thumb.closed.disconnect (remove_workspace);
thumb.window_on_last.disconnect (add_workspace); thumb.window_on_last.disconnect (add_workspace);
var workspace = thumb.workspace; var workspace = thumb.workspace;
//dont remove non existing workspaces //dont remove non existing workspaces
if (workspace != null && workspace.index () > -1) { if (workspace != null && workspace.index () > -1) {
var screen = workspace.get_screen (); var screen = workspace.get_screen ();
screen.remove_workspace (workspace, screen.get_display ().get_current_time ()); screen.remove_workspace (workspace, screen.get_display ().get_current_time ());
} }
thumb.workspace = null; thumb.workspace = null;
thumbnails.remove_child (thumb); thumbnails.remove_child (thumb);
thumb.destroy (); thumb.destroy ();
check_scrollbar (); check_scrollbar ();
} }
void check_scrollbar () void check_scrollbar ()
{ {
scroll.visible = thumbnails.width > width; scroll.visible = thumbnails.width > width;
if (scroll.visible) { if (scroll.visible) {
if (thumbnails.x + thumbnails.width < width) if (thumbnails.x + thumbnails.width < width)
thumbnails.x = width - thumbnails.width; thumbnails.x = width - thumbnails.width;
@ -217,41 +217,41 @@ namespace Gala
thumbnails.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, x : width / 2 - thumbnails.width / 2); thumbnails.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, x : width / 2 - thumbnails.width / 2);
} }
} }
public override void key_focus_out () public override void key_focus_out ()
{ {
hide (); hide ();
} }
public override bool key_press_event (Clutter.KeyEvent event) public override bool key_press_event (Clutter.KeyEvent event)
{ {
var display = screen.get_display (); var display = screen.get_display ();
var current_time = display.get_current_time_roundtrip (); var current_time = display.get_current_time_roundtrip ();
// Don't allow switching while another animation is still in progress to avoid visual disruptions // Don't allow switching while another animation is still in progress to avoid visual disruptions
if (current_time < (last_switch_time + AnimationSettings.get_default ().workspace_switch_duration)) if (current_time < (last_switch_time + AnimationSettings.get_default ().workspace_switch_duration))
return false; return false;
int switch_index = -1; int switch_index = -1;
switch (event.keyval) { switch (event.keyval) {
case Clutter.Key.Left: case Clutter.Key.Left:
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) != 0) if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) != 0)
wm.move_window (display.get_focus_window (), MotionDirection.LEFT); wm.move_window (display.get_focus_window (), MotionDirection.LEFT);
else else
wm.switch_to_next_workspace (MotionDirection.LEFT); wm.switch_to_next_workspace (MotionDirection.LEFT);
last_switch_time = current_time; last_switch_time = current_time;
return false; return false;
case Clutter.Key.Right: case Clutter.Key.Right:
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) != 0) if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) != 0)
wm.move_window (display.get_focus_window (), MotionDirection.RIGHT); wm.move_window (display.get_focus_window (), MotionDirection.RIGHT);
else else
wm.switch_to_next_workspace (MotionDirection.RIGHT); wm.switch_to_next_workspace (MotionDirection.RIGHT);
last_switch_time = current_time; last_switch_time = current_time;
return false; return false;
case Clutter.Key.@1: case Clutter.Key.@1:
switch_index = 1; switch_index = 1;
@ -290,16 +290,16 @@ namespace Gala
default: default:
break; break;
} }
if (switch_index > 0 && switch_index <= screen.n_workspaces) { if (switch_index > 0 && switch_index <= screen.n_workspaces) {
screen.get_workspace_by_index (switch_index - 1).activate (current_time); screen.get_workspace_by_index (switch_index - 1).activate (current_time);
last_switch_time = current_time; last_switch_time = current_time;
} }
return true; return true;
} }
public override bool key_release_event (Clutter.KeyEvent event) public override bool key_release_event (Clutter.KeyEvent event)
{ {
switch (event.keyval) { switch (event.keyval) {
@ -315,15 +315,15 @@ namespace Gala
wait_one_key_release = false; wait_one_key_release = false;
return false; return false;
} }
hide (); hide ();
return true; return true;
} }
return false; return false;
} }
public override bool scroll_event (Clutter.ScrollEvent event) public override bool scroll_event (Clutter.ScrollEvent event)
{ {
switch (event.direction) { switch (event.direction) {
@ -340,12 +340,12 @@ namespace Gala
default: default:
return false; return false;
} }
scroll.x = Math.floorf (width / thumbnails.width * -thumbnails.x); scroll.x = Math.floorf (width / thumbnails.width * -thumbnails.x);
return false; return false;
} }
/* /*
* if shortcut, wait one key release before closing * if shortcut, wait one key release before closing
*/ */
@ -355,31 +355,31 @@ namespace Gala
hide (); hide ();
return; return;
} }
wait_one_key_release = shortcut; wait_one_key_release = shortcut;
var screen = wm.get_screen (); var screen = wm.get_screen ();
visible = true; visible = true;
grab_key_focus (); grab_key_focus ();
wm.begin_modal (); wm.begin_modal ();
wm.ui_group.button_release_event.connect (outside_clicked); wm.ui_group.button_release_event.connect (outside_clicked);
var area = screen.get_monitor_geometry (screen.get_primary_monitor ()); var area = screen.get_monitor_geometry (screen.get_primary_monitor ());
y = area.height + area.y; y = area.height + area.y;
x = area.x; x = area.x;
width = area.width; width = area.width;
(content as Clutter.Canvas).set_size ((int)width, (int)height); (content as Clutter.Canvas).set_size ((int)width, (int)height);
thumbnails.get_children ().foreach ((thumb) => { thumbnails.get_children ().foreach ((thumb) => {
thumb.show (); thumb.show ();
}); });
thumbnails.x = width / 2 - thumbnails.width / 2; thumbnails.x = width / 2 - thumbnails.width / 2;
thumbnails.y = 15; thumbnails.y = 15;
scroll.visible = thumbnails.width > width; scroll.visible = thumbnails.width > width;
if (scroll.visible) { if (scroll.visible) {
scroll.y = height - 12; scroll.y = height - 12;
@ -387,37 +387,37 @@ namespace Gala
scroll.width = width / thumbnails.width * width; scroll.width = width / thumbnails.width * width;
thumbnails.x = 4.0f; thumbnails.x = 4.0f;
} }
int swidth, sheight; int swidth, sheight;
screen.get_size (out swidth, out sheight); screen.get_size (out swidth, out sheight);
animating = true; animating = true;
Clutter.Threads.Timeout.add (50, () => { Clutter.Threads.Timeout.add (50, () => {
animating = false; animating = false;
return false; return false;
}); //catch hot corner hiding problem }); //catch hot corner hiding problem
var wins = Compositor.get_window_group_for_screen (screen); var wins = Compositor.get_window_group_for_screen (screen);
wins.detach_animation (); wins.detach_animation ();
wins.x = 0.0f; wins.x = 0.0f;
animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : (area.height + area.y) - height); animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : (area.height + area.y) - height);
wins.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : -height + 1.01f); wins.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : -height + 1.01f);
} }
public new void hide () public new void hide ()
{ {
if (!visible || animating) if (!visible || animating)
return; return;
wm.ui_group.button_release_event.disconnect (outside_clicked); wm.ui_group.button_release_event.disconnect (outside_clicked);
float width, height; float width, height;
wm.get_screen ().get_size (out width, out height); wm.get_screen ().get_size (out width, out height);
wm.end_modal (); wm.end_modal ();
wm.update_input_area (); wm.update_input_area ();
animating = true; animating = true;
animate (Clutter.AnimationMode.EASE_OUT_EXPO, 500, y : height).completed.connect (() => { animate (Clutter.AnimationMode.EASE_OUT_EXPO, 500, y : height).completed.connect (() => {
thumbnails.get_children ().foreach ((thumb) => { thumbnails.get_children ().foreach ((thumb) => {
@ -426,7 +426,7 @@ namespace Gala
animating = false; animating = false;
visible = false; visible = false;
}); });
var wins = Compositor.get_window_group_for_screen (screen); var wins = Compositor.get_window_group_for_screen (screen);
wins.detach_animation (); wins.detach_animation ();
wins.x = 0.0f; wins.x = 0.0f;

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
// //
// Copyright (C) 2011 Robert Dyer, Rico Tzschichholz // Copyright (C) 2011 Robert Dyer, Rico Tzschichholz
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config namespace Config