diff --git a/lib/Plugin.vala b/lib/Plugin.vala
index ddf9ad59..b60642a0 100644
--- a/lib/Plugin.vala
+++ b/lib/Plugin.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2014 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -129,14 +129,14 @@ namespace Gala
/**
* This method is currently not called in the code, however you should
* 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.
*/
public abstract void destroy ();
/**
* 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.
*
* @param actor The actor to be tracked
diff --git a/lib/Utils.vala b/lib/Utils.vala
index d84ce45c..93b6b35d 100644
--- a/lib/Utils.vala
+++ b/lib/Utils.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -23,13 +23,13 @@ namespace Gala
static Gee.HashMap xid_pixbuf_cache;
static Gee.HashMap icon_pixbuf_cache;
static uint cache_clear_timeout = 0;
-
+
static construct
{
xid_pixbuf_cache = new Gee.HashMap ();
icon_pixbuf_cache = new Gee.HashMap ();
}
-
+
/**
* Clean icon caches
*/
@@ -53,12 +53,12 @@ namespace Gala
}
}
}
-
+
public static void request_clean_icon_cache (uint32[] xids)
{
if (cache_clear_timeout > 0)
GLib.Source.remove (cache_clear_timeout);
-
+
cache_clear_timeout = Timeout.add_seconds (30, () => {
cache_clear_timeout = 0;
Idle.add (() => {
@@ -68,28 +68,28 @@ namespace Gala
return false;
});
}
-
+
/**
* 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)
{
Gdk.Pixbuf? result = null;
-
+
var xid = (uint32)window.get_xwindow ();
var xid_key = "%u::%i".printf (xid, size);
-
+
if ((result = xid_pixbuf_cache.get (xid_key)) != null)
return result;
-
+
var app = Bamf.Matcher.get_default ().get_application_for_xid (xid);
result = get_icon_for_application (app, size);
-
+
xid_pixbuf_cache.set (xid_key, result);
-
+
return result;
}
-
+
/**
* returns a pixbuf for this application or a default icon
**/
@@ -97,10 +97,10 @@ namespace Gala
{
Gdk.Pixbuf? image = null;
bool not_cached = false;
-
+
string? icon = null;
string? icon_key = null;
-
+
if (app != null && app.get_desktop_file () != null) {
try {
var appinfo = new DesktopAppInfo.from_filename (app.get_desktop_file ());
@@ -116,7 +116,7 @@ namespace Gala
warning (e.message);
}
}
-
+
if (image == null) {
try {
unowned Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default ();
@@ -130,7 +130,7 @@ namespace Gala
warning (e.message);
}
}
-
+
if (image == null) {
icon = "";
icon_key = "::%i".printf (size);
@@ -140,16 +140,16 @@ namespace Gala
not_cached = true;
}
}
-
+
if (size != image.width || size != image.height)
image = Plank.Drawing.DrawingService.ar_scale (image, size, size);
-
+
if (not_cached)
icon_pixbuf_cache.set (icon_key, image);
-
+
return image;
}
-
+
/**
* 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 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);
-
+
if (window == null)
window = display.get_tab_current (Meta.TabList.NORMAL, screen, workspace);
-
+
return window;
}
-
+
/**
* get the number of toplevel windows on a workspace
**/
@@ -181,12 +181,12 @@ namespace Gala
window.window_type == Meta.WindowType.MODAL_DIALOG)
n ++;
}
-
+
return n;
}
-
+
static Gtk.CssProvider fallback_style = null;
-
+
public static Gtk.CssProvider get_default_style ()
{
if (fallback_style == null) {
@@ -195,7 +195,7 @@ namespace Gala
fallback_style.load_from_path (Config.PKGDATADIR + "/gala.css");
} catch (Error e) { warning (e.message); }
}
-
+
return fallback_style;
}
diff --git a/lib/WindowManager.vala b/lib/WindowManager.vala
index 478f2333..0e0449fb 100644
--- a/lib/WindowManager.vala
+++ b/lib/WindowManager.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2014 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -28,7 +28,7 @@ namespace Gala
WINDOW_OVERVIEW,
WINDOW_OVERVIEW_ALL
}
-
+
public enum InputArea
{
NONE,
diff --git a/plugins/template/Main.vala b/plugins/template/Main.vala
index b25d65e0..efa3ce3f 100644
--- a/plugins/template/Main.vala
+++ b/plugins/template/Main.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2014 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
/*
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.
// 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
- // 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
// every single frame.
// 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
Gala.PluginFunction.ADDITION, // the function which your plugin
- // fulfils, ADDITION means nothing
+ // fulfils, ADDITION means nothing
// specific
Gala.LoadPriority.IMMEDIATE // indicates whether your plugin's
diff --git a/plugins/zoom/Main.vala b/plugins/zoom/Main.vala
index ce631db0..bb3895b7 100644
--- a/plugins/zoom/Main.vala
+++ b/plugins/zoom/Main.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala.Plugins.Zoom
{
@@ -70,9 +70,9 @@ namespace Gala.Plugins.Zoom
return;
else if (current_zoom >= 2.5f && @in)
return;
-
+
var wins = wm.ui_group;
-
+
// Add timer to poll current mouse position to reposition window-group
// to show requested zoomed area
if (mouse_poll_timer == 0) {
@@ -81,35 +81,35 @@ namespace Gala.Plugins.Zoom
client_pointer.get_position (null, out mx, out my);
wins.scale_center_x = mx;
wins.scale_center_y = my;
-
+
mouse_poll_timer = Timeout.add (MOUSE_POLL_TIME, () => {
client_pointer.get_position (null, out mx, out my);
if (wins.scale_center_x == mx && wins.scale_center_y == my)
return true;
-
+
wins.animate (Clutter.AnimationMode.LINEAR, MOUSE_POLL_TIME, scale_center_x : mx, scale_center_y : my);
-
+
return true;
});
}
-
+
current_zoom += (@in ? 0.5f : -0.5f);
-
+
if (current_zoom <= 1.0f) {
current_zoom = 1.0f;
-
+
if (mouse_poll_timer > 0)
Source.remove (mouse_poll_timer);
mouse_poll_timer = 0;
-
+
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_y = 0.0f;
});
-
+
return;
}
-
+
wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : current_zoom, scale_y : current_zoom);
}
}
diff --git a/src/Background/Background.vala b/src/Background/Background.vala
index f3133a94..b025ea9e 100644
--- a/src/Background/Background.vala
+++ b/src/Background/Background.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -39,7 +39,7 @@ namespace Gala
{
Object (screen: screen, monitor: monitor, settings: settings);
}
-
+
construct
{
pattern = new Meta.BackgroundActor ();
diff --git a/src/Background/BackgroundCache.vala b/src/Background/BackgroundCache.vala
index fe4ed586..acbf80e0 100644
--- a/src/Background/BackgroundCache.vala
+++ b/src/Background/BackgroundCache.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -37,7 +37,7 @@ namespace Gala
{
return instance;
}
-
+
public Meta.Screen screen { get; construct; }
Gee.HashMap image_cache;
@@ -48,7 +48,7 @@ namespace Gala
{
Object (screen: screen);
}
-
+
construct
{
image_cache = new Gee.HashMap ();
diff --git a/src/Background/BackgroundManager.vala b/src/Background/BackgroundManager.vala
index 18d4a649..304baf55 100644
--- a/src/Background/BackgroundManager.vala
+++ b/src/Background/BackgroundManager.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -26,7 +26,7 @@ namespace Gala
{
Object (screen: screen);
}
-
+
construct
{
screen.monitors_changed.connect (update);
diff --git a/src/Background/SlideShow.vala b/src/Background/SlideShow.vala
index 53815a42..022d2f49 100644
--- a/src/Background/SlideShow.vala
+++ b/src/Background/SlideShow.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -76,7 +76,7 @@ namespace Gala
} catch (Error e) {
warning (e.message);
}
-
+
return false;
}
diff --git a/src/Background/SystemBackground.vala b/src/Background/SystemBackground.vala
index 0bb16ce8..5725d8e5 100644
--- a/src/Background/SystemBackground.vala
+++ b/src/Background/SystemBackground.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -23,7 +23,7 @@ namespace Gala
{
Object ();
}
-
+
construct
{
var cache = BackgroundCache.get_default ();
diff --git a/src/DBus.vala b/src/DBus.vala
index 9da3154c..1bc9f886 100644
--- a/src/DBus.vala
+++ b/src/DBus.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 - 2014 Tom Beckmann, Jacob Parker
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -22,17 +22,17 @@ namespace Gala
{
static DBus? instance;
static WindowManager wm;
-
+
[DBus (visibile = false)]
public static void init (WindowManager _wm)
{
wm = _wm;
-
+
Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
(connection) => {
if (instance == null)
instance = new DBus ();
-
+
try {
connection.register_object ("/org/pantheon/gala", instance);
} catch (Error e) { warning (e.message); }
@@ -40,7 +40,7 @@ namespace Gala
() => {},
() => warning ("Could not acquire name\n") );
}
-
+
private DBus ()
{
if (wm.background_group != null)
@@ -48,7 +48,7 @@ namespace Gala
else
assert_not_reached ();
}
-
+
public void perform_action (ActionType type)
{
wm.perform_action (type);
@@ -85,7 +85,7 @@ namespace Gala
/**
* 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
* variables are returned as a tuple in that order.
*
diff --git a/src/DragDropAction.vala b/src/DragDropAction.vala
index 13ef133a..f5c3055b 100644
--- a/src/DragDropAction.vala
+++ b/src/DragDropAction.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2013 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -47,7 +47,7 @@ namespace Gala
/**
* A drag action has successfully been finished.
- *
+ *
* @param actor The actor on which the drag finished
*/
public signal void drag_end (Clutter.Actor actor);
@@ -63,7 +63,7 @@ namespace Gala
* Create a new DragDropAction
*
* @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
* should be compatible with each other.
*/
diff --git a/src/EndSessionDialog.vala b/src/EndSessionDialog.vala
index a630430d..eaa9f35b 100644
--- a/src/EndSessionDialog.vala
+++ b/src/EndSessionDialog.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2014 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
// docs taken from unity indicator-session's
// src/backend-dbus/org.gnome.SessionManager.EndSessionDialog.xml
@@ -25,7 +25,7 @@ namespace Gala
SHUTDOWN = 1,
RESTART = 2
}
-
+
/**
* Private class wrapping most of the Gtk part of this dialog
*/
@@ -68,7 +68,7 @@ namespace Gala
string icon_name, heading_text, button_text;
// 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.
switch (dialog_type) {
case EndSessionDialogType.LOGOUT:
diff --git a/src/InternalUtils.vala b/src/InternalUtils.vala
index 47137645..e3fadb0c 100644
--- a/src/InternalUtils.vala
+++ b/src/InternalUtils.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Meta;
@@ -31,44 +31,44 @@ namespace Gala
var factory = ShadowFactory.get_default ();
var settings = ShadowSettings.get_default ();
Meta.ShadowParams shadow;
-
+
//normal focused
shadow = settings.get_shadowparams ("normal_focused");
factory.set_params ("normal", true, shadow);
-
+
//normal unfocused
shadow = settings.get_shadowparams ("normal_unfocused");
factory.set_params ("normal", false, shadow);
-
+
//menus
shadow = settings.get_shadowparams ("menu");
factory.set_params ("menu", false, shadow);
factory.set_params ("dropdown-menu", false, shadow);
factory.set_params ("popup-menu", false, shadow);
-
+
//dialog focused
shadow = settings.get_shadowparams ("dialog_focused");
factory.set_params ("dialog", true, shadow);
factory.set_params ("modal_dialog", false, shadow);
-
+
//dialog unfocused
shadow = settings.get_shadowparams ("normal_unfocused");
factory.set_params ("dialog", false, shadow);
factory.set_params ("modal_dialog", false, shadow);
}
-
+
/**
* set the area where clutter can receive events
**/
public static void set_input_area (Screen screen, InputArea area)
{
var display = screen.get_display ();
-
+
X.Xrectangle[] rects = {};
int width, height;
screen.get_size (out width, out height);
var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ());
-
+
switch (area) {
case InputArea.FULLSCREEN:
X.Xrectangle rect = {0, 0, (ushort)width, (ushort)height};
@@ -76,18 +76,18 @@ namespace Gala
break;
case InputArea.HOT_CORNER:
var schema = BehaviorSettings.get_default ().schema;
-
+
// if ActionType is NONE make it 0 sized
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 bl_size = (schema.get_enum ("hotcorner-bottomleft") != 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 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 bottomright = {(short)(geometry.x + geometry.width - 1), (short)(geometry.y + geometry.height - 1), br_size, br_size};
-
+
rects = {topleft, topright, bottomleft, bottomright};
break;
case InputArea.NONE:
@@ -102,7 +102,7 @@ namespace Gala
rects += rect;
}
}
-
+
var xregion = X.Fixes.create_region (display.get_xdisplay (), rects);
Util.set_stage_input_region (screen, xregion);
}
diff --git a/src/Main.vala b/src/Main.vala
index 7b1fb5a3..da07296b 100644
--- a/src/Main.vala
+++ b/src/Main.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -21,12 +21,12 @@ namespace Gala
{ "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null },
{ null }
};
-
+
void print_version () {
stdout.printf ("Gala %s\n", Config.VERSION);
Meta.exit (Meta.ExitCode.SUCCESS);
}
-
+
public static int main (string[] args)
{
unowned OptionContext ctx = Meta.get_option_context ();
@@ -37,11 +37,11 @@ namespace Gala
stderr.printf ("Error initializing: %s\n", e.message);
Meta.exit (Meta.ExitCode.ERROR);
}
-
+
Meta.Plugin.manager_set_plugin_type (new WindowManagerGala ().get_type ());
-
+
Meta.set_wm_name ("Mutter(Gala)");
-
+
/**
* Prevent Meta.init () from causing gtk to load gail and at-bridge
* Taken from Gnome-Shell main.c
@@ -51,13 +51,13 @@ namespace Gala
Meta.init ();
GLib.Environment.unset_variable ("NO_GAIL");
GLib.Environment.unset_variable ("NO_AT_BRIDGE");
-
+
Plank.Services.Paths.initialize ("plank", Config.DATADIR + "/plank");
-
+
// Force initialization of static fields in Utils class
// https://bugzilla.gnome.org/show_bug.cgi?id=543189
typeof (Gala.Utils).class_ref ();
-
+
return Meta.run ();
}
}
diff --git a/src/PluginManager.vala b/src/PluginManager.vala
index 7fb74bc5..81d91be8 100644
--- a/src/PluginManager.vala
+++ b/src/PluginManager.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2014 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
diff --git a/src/ScreenSaver.vala b/src/ScreenSaver.vala
index b2d6c738..c5e360a9 100644
--- a/src/ScreenSaver.vala
+++ b/src/ScreenSaver.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Jaap Broekhuizen
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
diff --git a/src/Settings.vala b/src/Settings.vala
index d7cbc443..b416c817 100644
--- a/src/Settings.vala
+++ b/src/Settings.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 GardenGnome, Rico Tzschichholz, Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -26,70 +26,70 @@ namespace Gala
public string overlay_action { get; set; }
public string hotcorner_custom_command { get; set; }
public string[] dock_names { get; set; }
-
+
public WindowOverviewType window_overview_type { get; set; }
-
+
public ActionType hotcorner_topleft { get; set; }
public ActionType hotcorner_topright { get; set; }
public ActionType hotcorner_bottomleft { get; set; }
public ActionType hotcorner_bottomright { get; set; }
-
+
static BehaviorSettings? instance = null;
-
+
private BehaviorSettings ()
{
base (Config.SCHEMA + ".behavior");
}
-
+
public static BehaviorSettings get_default ()
{
if (instance == null)
instance = new BehaviorSettings ();
-
+
return instance;
}
}
-
+
public class KeybindingSettings : Granite.Services.Settings
{
static KeybindingSettings? instance = null;
-
+
private KeybindingSettings ()
{
base (Config.SCHEMA + ".keybindings");
}
-
+
public static KeybindingSettings get_default ()
{
if (instance == null)
instance = new KeybindingSettings ();
-
+
return instance;
}
}
-
+
public class AppearanceSettings : Granite.Services.Settings
{
public string button_layout { get; set; }
public bool attach_modal_dialogs { get; set; }
public bool dim_parents { get; set; }
-
+
static AppearanceSettings? instance = null;
-
+
private AppearanceSettings ()
{
base (Config.SCHEMA + ".appearance");
}
-
+
public static AppearanceSettings get_default ()
{
if (instance == null)
instance = new AppearanceSettings ();
-
+
return instance;
}
}
-
+
public class ShadowSettings : Granite.Services.Settings
{
public string[] menu { get; set; }
@@ -97,35 +97,35 @@ namespace Gala
public string[] normal_unfocused { get; set; }
public string[] dialog_focused { get; set; }
public string[] dialog_unfocused { get; set; }
-
+
static ShadowSettings? instance = null;
-
+
private ShadowSettings ()
{
base (Config.SCHEMA + ".shadows");
}
-
+
public static ShadowSettings get_default ()
{
if (instance == null)
instance = new ShadowSettings ();
-
+
return instance;
}
-
+
public Meta.ShadowParams get_shadowparams (string class_name)
{
string[] val;
get (class_name, out val);
-
+
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 = 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])};
}
}
-
+
public class AnimationSettings : Granite.Services.Settings
{
public bool enable_animations { get; set; }
@@ -135,19 +135,19 @@ namespace Gala
public int minimize_duration { get; set; }
public int workspace_switch_duration { get; set; }
public int menu_duration { get; set; }
-
+
static AnimationSettings? instance = null;
-
+
private AnimationSettings ()
{
base (Config.SCHEMA + ".animations");
}
-
+
public static AnimationSettings get_default ()
{
if (instance == null)
instance = new AnimationSettings ();
-
+
return instance;
}
}
diff --git a/src/TextShadowEffect.vala b/src/TextShadowEffect.vala
index 2b529681..6aaadacb 100644
--- a/src/TextShadowEffect.vala
+++ b/src/TextShadowEffect.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
namespace Gala
{
@@ -24,34 +24,34 @@ namespace Gala
get { return _offset_y; }
set { _offset_y = value; update (); }
}
-
+
int _offset_x;
public int offset_x {
get { return _offset_x; }
set { _offset_x = value; update (); }
}
-
+
uint8 _opacity;
public uint8 opacity {
get { return _opacity; }
set { _opacity = value; update (); }
}
-
+
public TextShadowEffect (int offset_x, int offset_y, uint8 opacity)
{
_offset_x = offset_x;
_offset_y = offset_y;
_opacity = opacity;
}
-
+
public override bool pre_paint ()
{
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);
-
+
return true;
}
-
+
public void update ()
{
if (get_actor () != null)
diff --git a/src/Widgets/AppIcon.vala b/src/Widgets/AppIcon.vala
index 3f553959..0f98a9b9 100644
--- a/src/Widgets/AppIcon.vala
+++ b/src/Widgets/AppIcon.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Clutter;
using Meta;
@@ -23,28 +23,28 @@ namespace Gala
public class AppIcon : GtkClutter.Texture
{
const string DRAG_ACTION = "drag";
-
+
Window window;
Bamf.Application app;
-
+
public AppIcon (Window _window, Bamf.Application _app)
{
window = _window;
app = _app;
-
+
try {
set_from_pixbuf (Utils.get_icon_for_window (window, WorkspaceThumb.APP_ICON_SIZE));
} catch (Error e) { warning (e.message); }
-
+
var action = new DragDropAction (DragDropActionType.SOURCE, WorkspaceThumb.DRAG_ID);
action.drag_begin.connect (drag_begin);
action.drag_end.connect (drag_end);
action.drag_canceled.connect (drag_canceled);
-
+
add_action_with_name (DRAG_ACTION, action);
reactive = true;
}
-
+
void drag_canceled ()
{
var action = get_action (DRAG_ACTION) as DragDropAction;
@@ -66,11 +66,11 @@ namespace Gala
WorkspaceThumb old = get_parent ().get_parent () as WorkspaceThumb;
get_parent ().remove_child (this);
opacity = 255;
-
+
var dest_thumb = destination as WorkspaceThumb;
var icons = dest_thumb.icons;
var wallpaper = dest_thumb.wallpaper;
-
+
icons.add_child (this);
// get all the windows that belong to this app, if possible
@@ -85,21 +85,21 @@ namespace Gala
}
} else
window.change_workspace (dest_thumb.workspace);
-
+
if (old != null)
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));
}
-
+
Clutter.Actor drag_begin ()
{
opacity = 0;
-
+
var handle = new Clone (this);
-
+
get_stage ().add_child (handle);
return handle;
}
-
+
}
}
diff --git a/src/Widgets/WindowOverview.vala b/src/Widgets/WindowOverview.vala
index 3653592c..912670f5 100644
--- a/src/Widgets/WindowOverview.vala
+++ b/src/Widgets/WindowOverview.vala
@@ -1,89 +1,89 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Meta;
using Clutter;
namespace Gala
{
-
+
public enum WindowOverviewType
{
GRID = 0,
NATURAL
}
-
+
public class WindowOverview : Actor
{
WindowManager wm;
Screen screen;
-
+
bool ready;
-
+
//the workspaces which we expose right now
List workspaces;
-
+
static const int PADDING = 50;
-
+
public WindowOverview (WindowManager _wm)
{
wm = _wm;
screen = wm.get_screen ();
-
+
screen.workspace_switched.connect (() => close (false));
-
+
visible = false;
ready = true;
reactive = true;
}
-
+
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!
- if (event.keyval == Clutter.Key.w ||
- event.keyval == Clutter.Key.a ||
+ if (event.keyval == Clutter.Key.w ||
+ event.keyval == Clutter.Key.a ||
event.keyval == Clutter.Key.Escape) {
close (true);
-
+
return true;
}
-
+
return false;
}
-
+
public override void key_focus_out ()
{
close (false);
}
-
+
public override bool button_release_event (Clutter.ButtonEvent event)
{
if (event.button == 1)
close (true);
-
+
return true;
}
-
+
/**
* Code ported from KWin present windows effect
* https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/kwin/effects/presentwindows/presentwindows.cpp
**/
-
+
//constants, mainly for natural expo
const int GAPS = 10;
const int MAX_TRANSLATIONS = 100000;
@@ -91,16 +91,16 @@ namespace Gala
const int BORDER = 10;
const int TOP_GAP = 20;
const int BOTTOM_GAP = 100;
-
+
//some math utilities
int squared_distance (Gdk.Point a, Gdk.Point b)
{
var k1 = b.x - a.x;
var k2 = b.y - a.y;
-
+
return k1*k1 + k2*k2;
}
-
+
bool rect_is_overlapping_any (Meta.Rectangle rect, Meta.Rectangle[] rects, Meta.Rectangle border)
{
if (!border.contains_rect (rect))
@@ -108,79 +108,79 @@ namespace Gala
foreach (var comp in rects) {
if (comp == rect)
continue;
-
+
if (rect.overlap (comp))
return true;
}
-
+
return false;
}
-
+
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)};
}
-
+
Gdk.Point rect_center (Meta.Rectangle rect)
{
return {rect.x + rect.width / 2, rect.y + rect.height / 2};
}
-
-
+
+
void calculate_places (List windows)
{
var clones = windows.copy ();
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 ();
});
-
+
//sort windows by monitor
List[] monitors = {};
monitors.resize (screen.get_n_monitors ());
-
+
foreach (var clone in clones) {
// we had some crashes here so there's a reasonable suspicion
// that get_monitor() could be larger than get_n_monitors()
var index = (clone as WindowThumb).window.get_monitor ();
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 ());
index = screen.get_n_monitors () - 1;
}
monitors[index].append (clone);
}
-
+
for (var i = 0; i < screen.get_n_monitors (); i++) {
if (monitors[i].length () == 0)
continue;
-
+
// get the area used by the expo algorithms together
var geom = screen.get_monitor_geometry (i);
- Meta.Rectangle area = {(int)Math.floorf (geom.x + BORDER),
- (int)Math.floorf (geom.y + TOP_GAP),
- (int)Math.floorf (geom.width - BORDER * 2),
+ Meta.Rectangle area = {(int)Math.floorf (geom.x + BORDER),
+ (int)Math.floorf (geom.y + TOP_GAP),
+ (int)Math.floorf (geom.width - BORDER * 2),
(int)Math.floorf (geom.height - BOTTOM_GAP)};
-
+
if (BehaviorSettings.get_default ().schema.get_enum ("window-overview-type") == WindowOverviewType.GRID)
grid_placement (area, monitors[i]);
else
natural_placement (area, monitors[i]);
}
}
-
+
void grid_placement (Meta.Rectangle area, List clones)
{
int columns = (int)Math.ceil (Math.sqrt (clones.length ()));
int rows = (int)Math.ceil (clones.length () / (double)columns);
-
+
// Assign slots
int slot_width = area.width / columns;
int slot_height = area.height / rows;
-
+
WindowThumb[] taken_slots = {};
taken_slots.resize (rows * columns);
-
+
// precalculate all slot centers
Gdk.Point[] slot_centers = {};
slot_centers.resize (rows * columns);
@@ -190,31 +190,31 @@ namespace Gala
area.y + slot_height * y + slot_height / 2};
}
}
-
+
// Assign each window to the closest available slot
var tmplist = clones.copy ();
var window_count = tmplist.length ();
while (tmplist.length () > 0) {
var window = tmplist.nth_data (0) as WindowThumb;
var rect = window.window.get_outer_rect ();
-
+
var slot_candidate = -1;
var slot_candidate_distance = int.MAX;
var pos = rect_center (rect);
-
+
// all slots
for (int i = 0; i < columns * rows; i++) {
if (i > window_count - 1)
break;
-
+
var dist = squared_distance (pos, slot_centers[i]);
-
+
if (dist < slot_candidate_distance) {
// window is interested in this slot
WindowThumb occupier = taken_slots[i];
if (occupier == window)
continue;
-
+
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
slot_candidate = i;
@@ -222,35 +222,35 @@ namespace Gala
}
}
}
-
+
if (slot_candidate == -1)
continue;
-
+
if (taken_slots[slot_candidate] != null)
tmplist.prepend (taken_slots[slot_candidate]);
-
+
tmplist.remove_all (window);
taken_slots[slot_candidate] = window;
}
-
+
//see how many windows we have on the last row
int left_over = (int)clones.length () - columns * (rows - 1);
-
+
for (int slot = 0; slot < columns * rows; slot++) {
var window = taken_slots[slot];
// some slots might be empty
if (window == null)
continue;
-
+
var rect = window.window.get_outer_rect ();
-
+
// Work out where the slot is
Meta.Rectangle target = {area.x + (slot % columns) * slot_width,
area.y + (slot / columns) * slot_height,
- slot_width,
+ slot_width,
slot_height};
target = rect_adjusted (target, 10, 10, -10, -10);
-
+
float scale;
if (target.width / (double)rect.width < target.height / (double)rect.height) {
// Center vertically
@@ -263,46 +263,46 @@ namespace Gala
target.x += (target.width - (int)(rect.width * scale)) / 2;
target.width = (int)Math.floorf (rect.width * scale);
}
-
+
// Don't scale the windows too much
if (scale > 1.0) {
scale = 1.0f;
target = {rect_center (target).x - (int)Math.floorf (rect.width * 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)};
}
-
+
//put the last row in the center, if necessary
if (left_over != columns && slot >= columns * (rows - 1))
target.x += (columns - left_over) * slot_width / 2;
-
+
place_window (window, target);
}
}
-
+
void natural_placement (Meta.Rectangle area, List clones)
{
Meta.Rectangle bounds = {area.x, area.y, area.width, area.height};
-
+
var direction = 0;
int[] directions = new int[clones.length ()];
Meta.Rectangle[] rects = new Meta.Rectangle[clones.length ()];
-
+
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]
var rect = (clones.nth_data (i) as WindowThumb).window.get_outer_rect ();
rect = rect_adjusted(rect, -GAPS, -GAPS, GAPS, GAPS);
rects[i] = 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.
directions[i] = direction;
direction++;
if (direction == 4)
direction = 0;
}
-
+
var loop_counter = 0;
var overlap = false;
do {
@@ -311,25 +311,25 @@ namespace Gala
for (var j = 0; j < rects.length; j++) {
if (i == j)
continue;
-
+
var rect = rects[i];
var comp = rects[j];
-
+
if (!rect.overlap (comp))
continue;
-
+
loop_counter ++;
overlap = true;
-
+
// Determine pushing direction
Gdk.Point i_center = rect_center (rect);
Gdk.Point j_center = rect_center (comp);
Gdk.Point diff = {j_center.x - i_center.x, j_center.y - i_center.y};
-
+
// Prevent dividing by zero and non-movement
if (diff.x == 0 && diff.y == 0)
diff.x = 1;
-
+
// 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);
diff.x = (int)Math.floorf (diff.x * ACCURACY / length);
@@ -339,7 +339,7 @@ namespace Gala
rect.y += -diff.y;
comp.x += diff.x;
comp.y += diff.y;
-
+
// 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
// 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)
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));
-
+
i_center = rect_center (rect);
diff.x = 0;
diff.y = 0;
@@ -385,27 +385,27 @@ namespace Gala
rect.x += diff.x;
rect.y += diff.y;
}
-
+
// Update bounding rect
bounds = bounds.union(rect);
bounds = bounds.union(comp);
-
+
//we took copies from the rects from our list so we need to reassign them
rects[i] = rect;
rects[j] = comp;
}
}
} while (overlap && loop_counter < MAX_TRANSLATIONS);
-
+
// 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);
-
+
// Make bounding rect fill the screen size for later steps
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.width = (int)Math.floorf (area.width / scale);
bounds.height = (int)Math.floorf (area.height / scale);
-
+
// Move all windows back onto the screen and set their scale
var index = 0;
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.width * scale),
(int)Math.floorf (rect.height * scale)};
-
+
rects[index] = rect;
index++;
}
-
+
// fill gaps by enlarging windows
bool moved = false;
Meta.Rectangle border = area;
do {
moved = false;
-
+
index = 0;
foreach (var rect in rects) {
-
+
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);
int x_diff = width_diff / 2;
int y_diff = height_diff / 2;
-
+
//top right
Meta.Rectangle old = rect;
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;
else
moved = true;
-
+
//bottom right
old = rect;
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;
else
moved = true;
-
+
//bottom left
old = rect;
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;
else
moved = true;
-
+
//top left
old = rect;
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;
else
moved = true;
-
+
rects[index] = rect;
index++;
}
} while (moved);
-
+
index = 0;
foreach (var rect in rects) {
var window = clones.nth_data (index) as WindowThumb;
var window_rect = window.window.get_outer_rect ();
-
+
rect = rect_adjusted(rect, GAPS, GAPS, -GAPS, -GAPS);
scale = rect.width / (float)window_rect.width;
-
+
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;
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.height * scale)};
}
-
+
place_window (window, rect);
index++;
}
}
-
+
// animate a window to the given position
void place_window (WindowThumb clone, Meta.Rectangle rect)
{
var fscale = rect.width / clone.width;
-
+
//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.y = rect.y + Math.floorf (clone.height * fscale - 50.0f);
clone.icon.get_parent ().set_child_above_sibling (clone.icon, null);
-
+
float offset_x, offset_y, offset_width;
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;
@@ -516,46 +516,46 @@ namespace Gala
break;
}
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)
.completed.connect (() => ready = true );
clone.icon.opacity = 0;
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)
{
if (!ready)
return;
-
+
if (visible) {
close (true);
return;
}
-
+
var used_windows = new SList ();
-
+
workspaces = new List ();
-
+
if (all_windows) {
foreach (var workspace in screen.get_workspaces ())
workspaces.append (workspace);
} else {
workspaces.append (screen.get_active_workspace ());
}
-
+
foreach (var workspace in workspaces) {
foreach (var window in workspace.list_windows ()) {
- if (window.window_type != WindowType.NORMAL &&
- window.window_type != WindowType.DOCK &&
- window.window_type != WindowType.DIALOG ||
+ if (window.window_type != WindowType.NORMAL &&
+ window.window_type != WindowType.DOCK &&
+ window.window_type != WindowType.DIALOG ||
window.is_attached_dialog ()) {
(window.get_compositor_private () as Actor).hide ();
continue;
}
if (window.window_type == WindowType.DOCK)
continue;
-
+
// skip windows that are on all workspace except we're currently
// processing the workspace it actually belongs to
if (window.is_on_all_workspaces () && window.get_workspace () != workspace)
@@ -564,45 +564,45 @@ namespace Gala
used_windows.append (window);
}
}
-
+
var n_windows = used_windows.length ();
if (n_windows == 0)
return;
-
+
ready = false;
-
+
foreach (var workspace in workspaces) {
workspace.window_added.connect (add_window);
workspace.window_removed.connect (remove_window);
}
screen.window_left_monitor.connect (window_left_monitor);
-
+
// sort windows by stacking order
var windows = screen.get_display ().sort_windows_by_stacking (used_windows);
-
+
grab_key_focus ();
-
+
wm.begin_modal ();
-
+
visible = true;
-
+
foreach (var window in windows) {
var actor = window.get_compositor_private () as WindowActor;
if (actor == null)
return;
actor.hide ();
-
+
var clone = new WindowThumb (window);
clone.x = actor.x;
clone.y = actor.y;
-
+
clone.selected.connect (thumb_selected);
clone.closed.connect (thumb_closed);
-
+
add_child (clone);
}
-
+
calculate_places (get_children ());
}
@@ -616,39 +616,39 @@ namespace Gala
}
}
}
-
+
void add_window (Window window)
{
if (!visible || window.get_workspace () != screen.get_active_workspace ()
|| (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG))
return;
-
+
var actor = window.get_compositor_private () as WindowActor;
if (actor == null) {
//the window possibly hasn't reached the compositor yet
Idle.add (() => {
- if (window.get_compositor_private () != null &&
+ if (window.get_compositor_private () != null &&
window.get_workspace () == screen.get_active_workspace ())
add_window (window);
return false;
});
return;
}
-
+
actor.hide ();
-
+
var clone = new WindowThumb (window);
clone.x = actor.x;
clone.y = actor.y;
-
+
clone.selected.connect (thumb_selected);
clone.closed.connect (thumb_closed);
-
+
add_child (clone);
-
+
calculate_places (get_children ());
}
-
+
void remove_window (Window window)
{
WindowThumb thumb = null;
@@ -656,23 +656,23 @@ namespace Gala
if ((child as WindowThumb).window == window)
thumb = child as WindowThumb;
}
-
+
if (thumb != null) {
thumb_closed (thumb);
}
}
-
+
void thumb_closed (WindowThumb thumb)
{
thumb.destroy ();
-
+
var children = get_children ();
if (children.length () > 0)
calculate_places (children);
else
close (false);
}
-
+
void thumb_selected (Window window)
{
if (window.get_workspace () == screen.get_active_workspace ()) {
@@ -687,45 +687,45 @@ namespace Gala
});
}
}
-
+
void close (bool animate)
{
if (!visible || !ready)
return;
-
+
foreach (var workspace in workspaces) {
workspace.window_added.disconnect (add_window);
workspace.window_removed.disconnect (remove_window);
}
screen.window_left_monitor.disconnect (window_left_monitor);
-
+
ready = false;
-
+
wm.end_modal ();
wm.update_input_area ();
-
+
foreach (var child in get_children ()) {
var exposed = child as WindowThumb;
exposed.close (animate);
exposed.selected.disconnect (thumb_selected);
}
-
+
if (animate) {
Clutter.Threads.Timeout.add (300, () => {
visible = false;
ready = true;
-
+
foreach (var window in screen.get_active_workspace ().list_windows ()) {
if (window.showing_on_its_workspace ())
(window.get_compositor_private () as Actor).show ();
}
-
+
return false;
});
} else {
ready = true;
visible = false;
-
+
foreach (var window in screen.get_active_workspace ().list_windows ())
if (window.showing_on_its_workspace ())
(window.get_compositor_private () as Actor).show ();
diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala
index 4f2df337..f1e9726e 100644
--- a/src/Widgets/WindowSwitcher.vala
+++ b/src/Widgets/WindowSwitcher.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Clutter;
using Granite.Drawing;
@@ -23,11 +23,11 @@ namespace Gala
public class WindowSwitcher : Clutter.Actor
{
Gala.WindowManager wm;
-
+
Gee.ArrayList window_clones = new Gee.ArrayList ();
-
+
Meta.Window? current_window;
-
+
Meta.WindowActor? dock_window;
Actor dock;
CairoTexture dock_background;
@@ -38,68 +38,68 @@ namespace Gala
BindConstraint h_constraint;
bool closing = false;
-
+
//estimated value, if possible
float dock_width = 0.0f;
-
+
public WindowSwitcher (Gala.WindowManager _wm)
{
wm = _wm;
-
+
//pull drawing methods from libplank
dock_settings = new Plank.DockPreferences.with_filename (Environment.get_user_config_dir () + "/plank/dock1/settings");
dock_settings.notify["Theme"].connect (load_dock_theme);
-
+
dock = new Actor ();
dock.layout_manager = new BoxLayout ();
dock.anchor_gravity = Clutter.Gravity.CENTER;
-
+
dock_background = new CairoTexture (100, dock_settings.IconSize);
dock_background.anchor_gravity = Clutter.Gravity.CENTER;
dock_background.auto_resize = true;
dock_background.draw.connect (draw_dock_background);
-
+
y_constraint = new BindConstraint (dock, BindCoordinate.Y, 0);
h_constraint = new BindConstraint (dock, BindCoordinate.HEIGHT, 0);
-
+
dock_background.add_constraint (new BindConstraint (dock, BindCoordinate.X, 0));
dock_background.add_constraint (y_constraint);
dock_background.add_constraint (new BindConstraint (dock, BindCoordinate.WIDTH, 0));
dock_background.add_constraint (h_constraint);
-
+
add_child (dock_background);
add_child (dock);
-
+
load_dock_theme ();
-
+
visible = false;
}
-
+
void load_dock_theme ()
{
if (dock_theme != null)
dock_theme.notify.disconnect (update_dock);
-
+
dock_theme = new Plank.Drawing.DockTheme (dock_settings.Theme);
dock_theme.load ("dock");
dock_theme.notify.connect (update_dock);
-
+
update_dock ();
}
-
+
//set the values which don't get set every time and need to be updated when the theme changes
void update_dock ()
{
(dock.layout_manager as BoxLayout).spacing = (uint)(dock_theme.ItemPadding / 10.0 * dock_settings.IconSize);
dock.height = 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);
-
+
y_constraint.offset = -top_offset / 2 + bottom_offset / 2;
h_constraint.offset = top_offset + bottom_offset;
}
-
+
bool draw_dock_background (Cairo.Context cr)
{
if (dock_surface == null || dock_surface.Width != dock_background.width) {
@@ -107,23 +107,23 @@ namespace Gala
(int)dock_background.height, Gtk.PositionType.BOTTOM,
new Plank.Drawing.DockSurface.with_surface (1, 1, cr.get_target ()));
}
-
+
cr.set_source_surface (dock_surface.Internal, 0, 0);
cr.paint ();
-
+
return false;
}
-
+
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) {
close (event.time);
}
-
+
return true;
}
-
+
void close (uint time)
{
if (closing)
@@ -133,52 +133,52 @@ namespace Gala
var screen = wm.get_screen ();
var workspace = screen.get_active_workspace ();
-
+
if (dock_window != null)
dock_window.opacity = 0;
-
+
var dest_width = (dock_width > 0 ? dock_width : 600.0f);
dock_width = 0;
-
+
set_child_above_sibling (dock, null);
dock_background.animate (AnimationMode.EASE_OUT_CUBIC, 250, opacity : 0);
-
+
if (dock_window != null) {
dock_window.show ();
dock_window.animate (AnimationMode.LINEAR, 250, opacity : 255);
}
-
+
foreach (var clone in window_clones) {
//current window stays on top
if ((clone.source as Meta.WindowActor).get_meta_window () == current_window)
continue;
-
+
//reset order
clone.get_parent ().set_child_below_sibling (clone, null);
if (!(clone.source as Meta.WindowActor).get_meta_window ().minimized)
clone.animate (AnimationMode.EASE_OUT_CUBIC, 150, depth : 0.0f, opacity : 255);
}
-
+
if (current_window != null) {
current_window.activate (time);
current_window = null;
}
-
+
wm.end_modal ();
-
+
dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width:dest_width, opacity : 0).
completed.connect (() => {
dock.remove_all_children ();
-
+
if (dock_window != null)
dock_window = null;
-
+
visible = false;
-
+
foreach (var clone in window_clones)
remove_clone (clone);
window_clones.clear ();
-
+
//need to go through all the windows because of hidden dialogs
unowned List? window_actors = Meta.Compositor.get_window_actors (screen);
warn_if_fail (window_actors != null);
@@ -195,7 +195,7 @@ namespace Gala
screen.window_left_monitor.disconnect (window_left_monitor);
});
}
-
+
//used to figure out delays between switching when holding the tab key
uint last_time = -1;
bool released = false;
@@ -203,45 +203,45 @@ namespace Gala
{
var screen = wm.get_screen ();
var display = screen.get_display ();
-
+
if (event.get_type () == EventType.KEY_RELEASE) {
released = true;
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)))
return false;
-
+
released = false;
-
+
bool backward = (event.get_state () & X.KeyMask.ShiftMask) != 0;
var action = display.get_keybinding_action (event.get_key_code (), event.get_state ());
-
+
var prev_win = current_window;
if (action == Meta.KeyBindingAction.SWITCH_GROUP ||
- action == Meta.KeyBindingAction.SWITCH_WINDOWS ||
+ action == Meta.KeyBindingAction.SWITCH_WINDOWS ||
action == Meta.KeyBindingAction.SWITCH_APPLICATIONS ||
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);
last_time = display.get_current_time_roundtrip ();
-
+
} else if (action == Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD ||
action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD ||
action == Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD ||
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);
last_time = display.get_current_time_roundtrip ();
}
-
+
if (prev_win != current_window) {
dim_windows ();
}
-
+
return true;
}
@@ -251,10 +251,10 @@ namespace Gala
if (dock.get_child_at_index (index) == event.source)
break;
}
-
+
var prev_window = current_window;
current_window = (window_clones.get (index).source as Meta.WindowActor).get_meta_window ();
-
+
if (prev_window != current_window) {
dim_windows ();
// wait for the dimming to finish
@@ -268,7 +268,7 @@ namespace Gala
return true;
}
-
+
void dim_windows ()
{
var current_actor = current_window.get_compositor_private () as Actor;
@@ -277,13 +277,13 @@ namespace Gala
if (current_actor == clone.source) {
set_child_below_sibling (clone, dock_background);
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);
} else {
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);
}
-
+
i++;
}
}
@@ -296,14 +296,14 @@ namespace Gala
remove_window (window);
}
}
-
+
void add_window (Meta.Window window)
{
var screen = wm.get_screen ();
-
+
if (window.get_workspace () != screen.get_active_workspace ())
return;
-
+
var actor = window.get_compositor_private () as Meta.WindowActor;
if (actor == null) {
//the window possibly hasn't reached the compositor yet
@@ -315,19 +315,19 @@ namespace Gala
});
return;
}
-
+
if (actor.is_destroyed ())
return;
-
+
actor.hide ();
-
+
var clone = new Clone (actor);
clone.x = actor.x;
clone.y = actor.y;
-
+
add_child (clone);
window_clones.add (clone);
-
+
var icon = new GtkClutter.Texture ();
icon.reactive = true;
icon.button_release_event.connect (clicked_icon);
@@ -335,11 +335,11 @@ namespace Gala
var pix = Utils.get_icon_for_window (window, dock_settings.IconSize);
icon.set_from_pixbuf (pix);
} catch (Error e) { warning (e.message); }
-
+
icon.opacity = 100;
dock.add_child (icon);
(dock.layout_manager as BoxLayout).set_expand (icon, true);
-
+
//if the window has been added while being in alt-tab, redim
if (visible) {
float dest_width;
@@ -348,11 +348,11 @@ namespace Gala
dim_windows ();
}
}
-
+
void remove_clone (Clone clone)
{
var window = clone.source as Meta.WindowActor;
-
+
var meta_win = window.get_meta_window ();
if (meta_win != null &&
!window.is_destroyed () &&
@@ -360,14 +360,14 @@ namespace Gala
(meta_win.get_workspace () == wm.get_screen ().get_active_workspace ()) ||
meta_win.is_on_all_workspaces ())
window.show ();
-
+
clone.destroy ();
-
+
float 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);
}
-
+
void remove_window (Meta.Window window)
{
Clone found = null;
@@ -377,24 +377,24 @@ namespace Gala
break;
}
}
-
+
if (found == null) {
warning ("No clone found for removed window");
return;
}
-
+
var icon = dock.get_child_at_index (window_clones.index_of (found));
icon.button_release_event.disconnect (clicked_icon);
icon.destroy ();
window_clones.remove (found);
remove_clone (found);
}
-
+
public override void key_focus_out ()
{
close (wm.get_screen ().get_display ().get_current_time ());
}
-
+
public void handle_switch_windows (Meta.Display display, Meta.Screen screen, Meta.Window? window,
X.Event event, Meta.KeyBinding binding)
{
@@ -403,9 +403,9 @@ namespace Gala
close (screen.get_display ().get_current_time ());
return;
}
-
+
var workspace = screen.get_active_workspace ();
-
+
var metawindows = display.get_tab_list (Meta.TabList.NORMAL, screen, workspace);
if (metawindows.length () == 0)
return;
@@ -418,48 +418,48 @@ namespace Gala
return;
}
}
-
+
workspace.window_added.connect (add_window);
workspace.window_removed.connect (remove_window);
screen.window_left_monitor.connect (window_left_monitor);
-
+
//grab the windows to be switched
var layout = dock.layout_manager as BoxLayout;
window_clones.clear ();
foreach (var win in metawindows)
add_window (win);
-
+
visible = true;
-
+
//hide the others
Meta.Compositor.get_window_actors (screen).foreach ((w) => {
var type = w.get_meta_window ().window_type;
if (type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP && type != Meta.WindowType.NOTIFICATION)
w.hide ();
-
+
if (w.get_meta_window ().title in BehaviorSettings.get_default ().dock_names && type == Meta.WindowType.DOCK) {
dock_window = w;
dock_window.hide ();
}
});
-
+
closing = false;
wm.begin_modal ();
-
+
bool backward = (binding.get_name () == "switch-windows-backward");
-
+
current_window = Utils.get_next_window (screen.get_active_workspace (), backward);
if (current_window == null)
return;
-
+
if (binding.get_mask () == 0) {
current_window.activate (display.get_current_time ());
return;
}
-
+
//plank type switcher thing
var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ());
-
+
dock.width = (dock_window != null ? dock_window.width : 300.0f);
//FIXME do this better
//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);
while (children.next_file () != null)
count ++;
-
+
if (count > 0)
dock.width = count * (float)(dock_settings.IconSize + dock_theme.ItemPadding);
-
+
dock_width = dock.width;
-
+
} catch (Error e) { warning (e.message); }
}
-
-
+
+
var bottom_offset = (int)(dock_theme.BottomPadding / 10.0 * dock_settings.IconSize);
dock.opacity = 255;
dock.x = Math.ceilf (geometry.x + geometry.width / 2.0f);
dock.y = Math.ceilf (geometry.y + geometry.height - dock.height / 2.0f) - bottom_offset;
-
+
//add spacing on outer most items
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_last_child ().margin_right = horiz_padding;
-
+
float dest_width;
layout.get_preferred_width (dock, dock.height, null, out dest_width);
-
+
set_child_above_sibling (dock_background, null);
dock_background.opacity = 255;
dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width : dest_width);
set_child_above_sibling (dock, null);
-
+
dim_windows ();
grab_key_focus ();
diff --git a/src/Widgets/WindowThumb.vala b/src/Widgets/WindowThumb.vala
index a882d4b4..0c115462 100644
--- a/src/Widgets/WindowThumb.vala
+++ b/src/Widgets/WindowThumb.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Meta;
using Clutter;
@@ -28,28 +28,28 @@ namespace Gala
public GtkClutter.Texture close_button;
const int WAIT_FOR_CONFIRMATION_DIALOG = 100;
-
+
public signal void selected (Window window);
public signal void closed ();
-
+
public WindowThumb (Window _window)
{
window = _window;
-
+
reactive = true;
-
+
var actor = window.get_compositor_private () as WindowActor;
clone = new Clone (actor);
-
+
icon = new GtkClutter.Texture ();
icon.scale_x = 0.0f;
icon.scale_y = 0.0f;
icon.scale_gravity = Gravity.CENTER;
-
+
try {
icon.set_from_pixbuf (Utils.get_icon_for_window (window, 64));
} catch (Error e) { warning (e.message); }
-
+
close_button = new GtkClutter.Texture ();
close_button.reactive = true;
close_button.visible = false;
@@ -58,28 +58,28 @@ namespace Gala
close_button.scale_gravity = Gravity.CENTER;
close_button.button_release_event.connect (close_button_clicked);
close_button.leave_event.connect ((e) => leave_event (e));
-
+
try {
close_button.set_from_pixbuf (Granite.Widgets.Utils.get_close_pixbuf ());
} catch (Error e) { warning (e.message); }
-
+
add_child (clone);
-
+
var stage = Compositor.get_stage_for_screen (window.get_screen ());
stage.add_child (icon);
stage.add_child (close_button);
}
-
+
bool close_button_clicked (ButtonEvent event)
{
if (event.button != 1)
return false;
-
+
close_window ();
-
+
return true;
}
-
+
public void close_window ()
{
get_parent ().set_child_below_sibling (this, null);
@@ -102,44 +102,44 @@ namespace Gala
clone.destroy ();
close_button.destroy ();
icon.destroy ();
-
+
base.destroy ();
}
-
+
public override bool enter_event (CrossingEvent event)
{
//if we're still animating don't show the close button
if (get_animation () != null)
return false;
-
+
close_button.visible = true;
close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f);
-
+
return true;
}
-
+
public override bool motion_event (MotionEvent event)
{
if (get_animation () != null)
return false;
-
+
close_button.visible = true;
close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f);
-
+
return true;
}
-
+
public override bool leave_event (CrossingEvent event)
{
if (event.related == close_button)
return false;
-
+
close_button.animate (AnimationMode.EASE_IN_QUAD, 200, scale_x : 0.0f, scale_y : 0.0f)
.completed.connect (() => close_button.visible = false );
-
+
return true;
}
-
+
public override bool button_release_event (ButtonEvent event)
{
switch (event.button) {
@@ -151,32 +151,32 @@ namespace Gala
close_window ();
break;
}
-
+
return true;
}
-
+
public void close (bool do_animate = true)
{
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
float delta = window.maximized_horizontally || window.maximized_vertically ? 0 : 10;
-
+
float dest_x = rect.x - delta;
float dest_y = rect.y - delta;
-
+
//stop all running animations
detach_animation ();
icon.detach_animation ();
close_button.detach_animation ();
-
+
bool dont_show = window.minimized || window.get_workspace () != window.get_screen ().get_active_workspace ();
do_animate = do_animate && !dont_show;
-
+
if (do_animate) {
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);
-
+
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 ();
destroy ();
diff --git a/src/Widgets/WorkspaceThumb.vala b/src/Widgets/WorkspaceThumb.vala
index ee5eb8a4..83e529e1 100644
--- a/src/Widgets/WorkspaceThumb.vala
+++ b/src/Widgets/WorkspaceThumb.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Meta;
using Clutter;
@@ -26,66 +26,66 @@ namespace Gala
internal static const int APP_ICON_SIZE = 32;
static const float THUMBNAIL_HEIGHT = 80.0f;
static const uint CLOSE_BUTTON_DELAY = 500;
-
+
static const int PLUS_SIZE = 8;
static const int PLUS_WIDTH = 24;
static const int PLUS_OFFSET = 8;
-
+
public static const string DRAG_ID = "app-icon";
const string DROP_ACTION = "drop";
-
+
public signal void clicked ();
public signal void closed ();
public signal void window_on_last ();
-
+
public unowned Workspace? workspace { get; set; }
-
+
unowned Screen screen;
-
+
static Actor? plus = null;
static Plank.Drawing.DockSurface? buffer = null;
-
+
Gtk.StyleContext selector_style;
Gtk.EventBox selector_style_widget;
-
+
internal Actor wallpaper;
Actor wallpaper_manager;
Clutter.Actor windows;
internal Clutter.Actor icons;
Actor indicator;
GtkClutter.Texture close_button;
-
+
uint hover_timer = 0;
-
+
public WorkspaceThumb (Workspace _workspace, Meta.BackgroundGroup _wallpaper)
{
workspace = _workspace;
screen = workspace.get_screen ();
-
+
selector_style_widget = new Gtk.EventBox ();
selector_style_widget.show ();
selector_style = selector_style_widget.get_style_context ();
selector_style.add_class ("gala-workspace-selected");
selector_style.add_provider (Utils.get_default_style (), Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
-
+
screen.workspace_switched.connect (handle_workspace_switched);
screen.workspace_added.connect (workspace_added);
screen.monitors_changed.connect (resize);
-
+
workspace.window_added.connect (handle_window_added);
workspace.window_removed.connect (handle_window_removed);
screen.window_left_monitor.connect (window_left_monitor);
-
+
reactive = true;
-
+
indicator = new Actor ();
indicator.height = THUMBNAIL_HEIGHT + 2 * INDICATOR_BORDER;
indicator.opacity = 0;
indicator.content = new Canvas ();
(indicator.content as Canvas).draw.connect (draw_indicator);
-
+
handle_workspace_switched (-1, screen.get_active_workspace_index (), MotionDirection.LEFT);
-
+
wallpaper_manager = new BackgroundManager (screen);
//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.
@@ -94,7 +94,7 @@ namespace Gala
wallpaper.x = INDICATOR_BORDER;
wallpaper.y = INDICATOR_BORDER;
wallpaper.height = THUMBNAIL_HEIGHT;
-
+
close_button = new GtkClutter.Texture ();
try {
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_x = 0;
close_button.scale_y = 0;
-
+
icons = new Actor ();
icons.layout_manager = new BoxLayout ();
(icons.layout_manager as Clutter.BoxLayout).spacing = 6;
icons.height = APP_ICON_SIZE;
-
+
windows = new Actor ();
windows.x = INDICATOR_BORDER;
windows.y = INDICATOR_BORDER;
windows.height = THUMBNAIL_HEIGHT;
windows.clip_to_allocation = true;
-
+
add_child (indicator);
add_child (wallpaper);
add_child (windows);
@@ -125,18 +125,18 @@ namespace Gala
var click = new ClickAction ();
add_action (click);
click.clicked.connect (pressed);
-
+
//kill the workspace
var close_click = new ClickAction ();
close_button.add_action (close_click);
close_click.clicked.connect (close_workspace);
-
+
if (plus == null) {
plus = new Actor ();
var canvas = new Canvas ();
plus.content = canvas;
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
var buffer = new Granite.Drawing.BufferSurface (canvas.width, canvas.height);
@@ -168,18 +168,18 @@ namespace Gala
plus.height = PLUS_WIDTH + 2 * PLUS_OFFSET;
canvas.set_size ((int)plus.width, (int)plus.height);
}
-
+
var drop_action = new DragDropAction (DragDropActionType.DESTINATION, DRAG_ID);
add_action_with_name (DROP_ACTION, drop_action);
drop_action.crossed.connect (crossed);
-
+
check_last_workspace ();
-
+
visible = false;
-
+
var canvas = new Canvas ();
canvas.draw.connect (draw_background);
-
+
content = canvas;
resize (screen);
@@ -190,7 +190,7 @@ namespace Gala
{
int swidth, sheight;
screen.get_size (out swidth, out sheight);
-
+
// make sure we redraw the buffer
buffer = null;
@@ -236,7 +236,7 @@ namespace Gala
Cogl.set_source_color4f (1, 1, 1, 0.3f);
Cogl.Path.stroke ();
}
-
+
void crossed (bool over)
{
// when draggin, the leave event isn't emitted
@@ -249,7 +249,7 @@ namespace Gala
indicator.animate (AnimationMode.LINEAR, 100, opacity: over ? 200 : 0);
}
-
+
~WorkspaceThumb ()
{
screen.workspace_switched.disconnect (handle_workspace_switched);
@@ -257,7 +257,7 @@ namespace Gala
screen.monitors_changed.disconnect (resize);
screen.window_left_monitor.disconnect (window_left_monitor);
}
-
+
void close_workspace (Clutter.Actor actor)
{
if (workspace == null)
@@ -267,65 +267,65 @@ namespace Gala
if (window.window_type != WindowType.DOCK)
window.delete (screen.get_display ().get_current_time ());
}
-
+
Clutter.Threads.Timeout.add (250, () => {
//wait for confirmation dialogs to popup
if (Utils.get_n_windows (workspace) == 0) {
workspace.window_added.disconnect (handle_window_added);
workspace.window_removed.disconnect (handle_window_removed);
-
+
animate (Clutter.AnimationMode.LINEAR, 250, width : 0.0f, opacity : 0);
-
+
closed ();
} else
workspace.activate (workspace.get_screen ().get_display ().get_current_time ());
-
+
return false;
});
}
-
+
bool draw_indicator (Cairo.Context cr)
{
cr.set_operator (Cairo.Operator.CLEAR);
cr.paint ();
cr.set_operator (Cairo.Operator.OVER);
-
+
selector_style.render_background (cr, 0, 0, indicator.width, indicator.height);
selector_style.render_frame (cr, 0, 0, indicator.width, indicator.height);
-
+
return false;
}
-
+
bool draw_background (Cairo.Context cr)
{
if (buffer == null) {
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
- buffer.Context.rectangle (wallpaper.x, wallpaper.y,
+ buffer.Context.rectangle (wallpaper.x, wallpaper.y,
wallpaper.width - (width - wallpaper.width),
wallpaper.height - (height - wallpaper.height) - INDICATOR_BORDER);
-
+
buffer.Context.set_source_rgba (0, 0, 0, 1);
buffer.Context.fill ();
buffer.exponential_blur (5);
}
-
+
cr.set_operator (Cairo.Operator.CLEAR);
cr.paint ();
cr.set_operator (Cairo.Operator.OVER);
-
+
cr.set_source_surface (buffer.Internal, 0, 0);
cr.paint ();
-
+
return false;
}
-
+
void workspace_added (int index)
{
check_last_workspace ();
}
-
+
void window_left_monitor (int num, Meta.Window window)
{
if (window.located_on_workspace (workspace))
@@ -337,10 +337,10 @@ namespace Gala
windows.remove_all_children ();
if (workspace == null)
return;
-
+
int swidth, sheight;
screen.get_size (out swidth, out sheight);
-
+
// add window thumbnails
var aspect = windows.width / swidth;
@@ -348,7 +348,7 @@ namespace Gala
var list = new SList ();
foreach (var window in unordered) {
if (!window.minimized &&
- (window.window_type == WindowType.NORMAL ||
+ (window.window_type == WindowType.NORMAL ||
window.window_type == WindowType.DIALOG ||
window.window_type == WindowType.MODAL_DIALOG))
list.prepend (window);
@@ -365,55 +365,55 @@ namespace Gala
clone.height = aspect * clone.height;
clone.x = aspect * actor.x;
clone.y = aspect * actor.y;
-
+
windows.add_child (clone);
}
}
-
+
void update_icons ()
{
icons.remove_all_children ();
-
+
if (workspace == null)
return;
-
+
//show each icon only once, so log the ones added
var shown_applications = new List ();
-
+
workspace.list_windows ().foreach ((w) => {
if (w.window_type != Meta.WindowType.NORMAL || w.minimized)
return;
-
+
var app = Bamf.Matcher.get_default ().get_application_for_xid ((uint32)w.get_xwindow ());
if (shown_applications.index (app) != -1)
return;
-
+
if (app != null)
shown_applications.append (app);
-
+
var icon = new AppIcon (w, app);
-
+
icons.add_child (icon);
});
-
+
icons.x = Math.floorf (wallpaper.x + wallpaper.width / 2 - icons.width / 2);
icons.y = Math.floorf (wallpaper.y + wallpaper.height - 5);
}
-
+
void check_last_workspace ()
{
if (!Prefs.get_dynamic_workspaces ())
return;
-
+
//last workspace, show plus button and so on
//give the last one a different style
-
+
var index = screen.get_workspaces ().index (workspace);
if (index < 0) {
closed ();
return;
}
-
+
if (index == screen.n_workspaces - 1) {
wallpaper.opacity = 127;
if (plus.get_parent () != null)
@@ -425,21 +425,21 @@ namespace Gala
remove_child (plus);
}
}
-
+
void handle_workspace_switched (int index_old, int index_new, Meta.MotionDirection direction)
{
if (index_old == index_new)
return;
-
+
if (workspace == null)
return;
-
+
if (workspace.index () == index_old)
indicator.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity : 0);
else if (workspace.index () == index_new)
indicator.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity : 255);
}
-
+
void handle_window_added (Meta.Window window)
{
// wait till the window is ready
@@ -451,24 +451,24 @@ namespace Gala
});
return;
}
-
+
if (visible) {
update_windows ();
update_icons ();
}
-
+
if (!Prefs.get_dynamic_workspaces ())
return;
-
+
if (workspace != null && workspace.index () == screen.n_workspaces - 1 && Utils.get_n_windows (workspace) > 0)
window_on_last ();
}
-
+
void handle_window_removed (Meta.Window window)
{
if (visible)
update_windows ();
-
+
if (!Prefs.get_dynamic_workspaces ()
|| (window.window_type != WindowType.NORMAL
&& window.window_type != WindowType.DIALOG
@@ -477,106 +477,106 @@ namespace Gala
|| Utils.get_n_windows (workspace) > 0
|| workspace.index () == workspace.get_screen ().get_n_workspaces () - 1)
return;
-
+
// 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, () => {
// check again, maybe something opened
if (workspace == null || Utils.get_n_windows (workspace) > 0)
return false;
-
+
workspace.window_added.disconnect (handle_window_added);
workspace.window_removed.disconnect (handle_window_removed);
-
+
closed ();
return false;
});
}
-
+
public override void hide ()
{
base.hide ();
-
+
icons.remove_all_children ();
windows.remove_all_children ();
}
-
+
public override void show ()
{
check_last_workspace ();
-
+
update_icons ();
update_windows ();
-
+
base.show ();
}
-
+
public void pressed (Actor actor)
{
if (workspace == null)
return;
-
+
workspace.activate (screen.get_display ().get_current_time ());
-
+
// wait for the animation to be finished before closing, for aesthetic reasons
Clutter.Threads.Timeout.add (AnimationSettings.get_default ().workspace_switch_duration, () => {
clicked ();
return false;
});
}
-
+
public override bool enter_event (CrossingEvent event)
{
if (workspace == null)
return true;
-
+
if (!Prefs.get_dynamic_workspaces ())
return false;
-
+
if (workspace.index () == screen.n_workspaces - 1) {
wallpaper.animate (AnimationMode.EASE_OUT_QUAD, 300, opacity : 210);
return true;
}
-
+
//dont allow closing the tab if it's the last one used
if (workspace.index () == 0 && screen.n_workspaces == 2)
return false;
-
+
if (hover_timer > 0)
GLib.Source.remove (hover_timer);
-
+
hover_timer = Clutter.Threads.Timeout.add (CLOSE_BUTTON_DELAY, () => {
close_button.visible = true;
close_button.animate (AnimationMode.EASE_OUT_ELASTIC, 400, scale_x : 1.0f, scale_y : 1.0f);
return false;
});
-
+
return true;
}
-
+
internal void hide_close_button ()
{
close_button.animate (AnimationMode.EASE_IN_QUAD, 400, scale_x : 0.0f, scale_y : 0.0f)
.completed.connect (() => close_button.visible = false );
}
-
+
public override bool leave_event (CrossingEvent event)
{
if (contains (event.related))
return false;
-
+
if (hover_timer > 0) {
GLib.Source.remove (hover_timer);
hover_timer = 0;
}
-
+
if (workspace == null)
return false;
-
+
if (workspace.index () == screen.n_workspaces - 1)
wallpaper.animate (AnimationMode.EASE_OUT_QUAD, 400, opacity : 127);
else
hide_close_button ();
-
+
return false;
}
}
diff --git a/src/Widgets/WorkspaceView.vala b/src/Widgets/WorkspaceView.vala
index a7e5ddf2..d65a09ec 100644
--- a/src/Widgets/WorkspaceView.vala
+++ b/src/Widgets/WorkspaceView.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Meta;
@@ -23,72 +23,72 @@ namespace Gala
{
static const float VIEW_HEIGHT = 140.0f;
static const float SCROLL_SPEED = 30.0f;
-
+
Gala.WindowManager wm;
Screen screen;
-
+
Clutter.Actor thumbnails;
Clutter.Actor scroll;
-
+
bool animating; // delay closing the popup
-
+
bool wait_one_key_release; //called by shortcut, don't close it on first keyrelease
uint last_switch_time = 0;
-
+
Gtk.StyleContext background_style;
Gtk.EventBox background_style_widget;
-
+
public WorkspaceView (Gala.WindowManager _wm)
{
wm = _wm;
screen = wm.get_screen ();
-
+
height = VIEW_HEIGHT;
reactive = true;
clip_to_allocation = true;
-
+
background_style_widget = new Gtk.EventBox ();
background_style_widget.show ();
background_style = background_style_widget.get_style_context ();
background_style.add_class ("gala-workspaces-background");
background_style.add_provider (Utils.get_default_style (), Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
-
+
thumbnails = new Clutter.Actor ();
thumbnails.layout_manager = new Clutter.BoxLayout ();
(thumbnails.layout_manager as Clutter.BoxLayout).spacing = 12;
(thumbnails.layout_manager as Clutter.BoxLayout).homogeneous = true;
-
+
content = new Clutter.Canvas ();
(content as Clutter.Canvas).draw.connect (draw_background);
-
+
scroll = new Clutter.Actor ();
scroll.height = 12;
scroll.content = new Clutter.Canvas ();
(scroll.content as Clutter.Canvas).draw.connect (draw_scroll);
-
+
add_child (thumbnails);
add_child (scroll);
-
+
//place it somewhere low, so it won't slide down on first open
int swidth, sheight;
screen.get_size (out swidth, out sheight);
y = sheight;
-
+
screen.workspace_added.connect ((index) => {
create_workspace_thumb (screen.get_workspace_by_index (index));
});
-
+
Prefs.add_listener ((pref) => {
if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) {
// 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)
add_workspace ();
-
+
} else if ((pref == Preference.DYNAMIC_WORKSPACES ||
pref == Preference.NUM_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.
// For some reason workspace_removed is not emitted, when changing the workspace number
if (Prefs.get_num_workspaces () < thumbnails.get_n_children ()) {
@@ -98,10 +98,10 @@ namespace Gala
}
}
});
-
+
init_thumbnails ();
}
-
+
void init_thumbnails ()
{
foreach (var workspace in screen.get_workspaces ()) {
@@ -109,10 +109,10 @@ namespace Gala
thumb.clicked.connect (hide);
thumb.closed.connect (remove_workspace);
thumb.window_on_last.connect (add_workspace);
-
+
thumbnails.add_child (thumb);
}
-
+
//if there went something wrong, we need to get the system back rolling
if (Prefs.get_dynamic_workspaces ()
&& screen.n_workspaces == 1
@@ -125,13 +125,13 @@ namespace Gala
hide ();
return true;
}
-
+
bool draw_background (Cairo.Context cr)
{
cr.set_operator (Cairo.Operator.CLEAR);
cr.paint ();
cr.set_operator (Cairo.Operator.OVER);
-
+
background_style.render_background (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);
cr.set_source (pat);
cr.paint_with_alpha (0.6);
-
+
return false;
}
-
+
bool draw_scroll (Cairo.Context cr)
{
cr.set_operator (Cairo.Operator.CLEAR);
cr.paint ();
cr.set_operator (Cairo.Operator.OVER);
-
+
Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, 4, 4, scroll.width-32, 4, 2);
cr.set_source_rgba (1, 1, 1, 0.8);
cr.fill ();
-
+
return false;
}
-
+
void add_workspace ()
{
var wp = screen.append_new_workspace (false, screen.get_display ().get_current_time ());
if (wp == null)
return;
}
-
+
void create_workspace_thumb (Meta.Workspace workspace)
{
var thumb = new WorkspaceThumb (workspace, wm.background_group);
thumb.clicked.connect (hide);
thumb.closed.connect (remove_workspace);
thumb.window_on_last.connect (add_workspace);
-
+
thumbnails.insert_child_at_index (thumb, workspace.index ());
-
+
thumb.show ();
-
+
check_scrollbar ();
}
-
+
void remove_workspace (WorkspaceThumb thumb)
{
//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) {
return;
}
-
+
thumb.clicked.disconnect (hide);
thumb.closed.disconnect (remove_workspace);
thumb.window_on_last.disconnect (add_workspace);
-
+
var workspace = thumb.workspace;
-
+
//dont remove non existing workspaces
if (workspace != null && workspace.index () > -1) {
var screen = workspace.get_screen ();
screen.remove_workspace (workspace, screen.get_display ().get_current_time ());
}
-
+
thumb.workspace = null;
-
+
thumbnails.remove_child (thumb);
thumb.destroy ();
check_scrollbar ();
}
-
+
void check_scrollbar ()
{
scroll.visible = thumbnails.width > width;
-
+
if (scroll.visible) {
if (thumbnails.x + thumbnails.width < 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);
}
}
-
+
public override void key_focus_out ()
{
hide ();
}
-
+
public override bool key_press_event (Clutter.KeyEvent event)
{
var display = screen.get_display ();
var current_time = display.get_current_time_roundtrip ();
-
+
// 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))
return false;
-
+
int switch_index = -1;
-
+
switch (event.keyval) {
case Clutter.Key.Left:
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) != 0)
wm.move_window (display.get_focus_window (), MotionDirection.LEFT);
else
wm.switch_to_next_workspace (MotionDirection.LEFT);
-
+
last_switch_time = current_time;
-
+
return false;
case Clutter.Key.Right:
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) != 0)
wm.move_window (display.get_focus_window (), MotionDirection.RIGHT);
else
wm.switch_to_next_workspace (MotionDirection.RIGHT);
-
+
last_switch_time = current_time;
-
+
return false;
case Clutter.Key.@1:
switch_index = 1;
@@ -290,16 +290,16 @@ namespace Gala
default:
break;
}
-
+
if (switch_index > 0 && switch_index <= screen.n_workspaces) {
screen.get_workspace_by_index (switch_index - 1).activate (current_time);
-
+
last_switch_time = current_time;
}
-
+
return true;
}
-
+
public override bool key_release_event (Clutter.KeyEvent event)
{
switch (event.keyval) {
@@ -315,15 +315,15 @@ namespace Gala
wait_one_key_release = false;
return false;
}
-
+
hide ();
-
+
return true;
}
-
+
return false;
}
-
+
public override bool scroll_event (Clutter.ScrollEvent event)
{
switch (event.direction) {
@@ -340,12 +340,12 @@ namespace Gala
default:
return false;
}
-
+
scroll.x = Math.floorf (width / thumbnails.width * -thumbnails.x);
-
+
return false;
}
-
+
/*
* if shortcut, wait one key release before closing
*/
@@ -355,31 +355,31 @@ namespace Gala
hide ();
return;
}
-
+
wait_one_key_release = shortcut;
-
+
var screen = wm.get_screen ();
visible = true;
grab_key_focus ();
-
+
wm.begin_modal ();
-
+
wm.ui_group.button_release_event.connect (outside_clicked);
-
+
var area = screen.get_monitor_geometry (screen.get_primary_monitor ());
y = area.height + area.y;
x = area.x;
width = area.width;
(content as Clutter.Canvas).set_size ((int)width, (int)height);
-
+
thumbnails.get_children ().foreach ((thumb) => {
thumb.show ();
});
-
+
thumbnails.x = width / 2 - thumbnails.width / 2;
thumbnails.y = 15;
-
+
scroll.visible = thumbnails.width > width;
if (scroll.visible) {
scroll.y = height - 12;
@@ -387,37 +387,37 @@ namespace Gala
scroll.width = width / thumbnails.width * width;
thumbnails.x = 4.0f;
}
-
+
int swidth, sheight;
screen.get_size (out swidth, out sheight);
-
+
animating = true;
Clutter.Threads.Timeout.add (50, () => {
animating = false;
return false;
}); //catch hot corner hiding problem
-
+
var wins = Compositor.get_window_group_for_screen (screen);
wins.detach_animation ();
wins.x = 0.0f;
-
+
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);
}
-
+
public new void hide ()
{
if (!visible || animating)
return;
wm.ui_group.button_release_event.disconnect (outside_clicked);
-
+
float width, height;
wm.get_screen ().get_size (out width, out height);
-
+
wm.end_modal ();
wm.update_input_area ();
-
+
animating = true;
animate (Clutter.AnimationMode.EASE_OUT_EXPO, 500, y : height).completed.connect (() => {
thumbnails.get_children ().foreach ((thumb) => {
@@ -426,7 +426,7 @@ namespace Gala
animating = false;
visible = false;
});
-
+
var wins = Compositor.get_window_group_for_screen (screen);
wins.detach_animation ();
wins.x = 0.0f;
diff --git a/src/WindowManager.vala b/src/WindowManager.vala
index 3f0db9ed..7d907fc5 100644
--- a/src/WindowManager.vala
+++ b/src/WindowManager.vala
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
using Meta;
@@ -26,9 +26,9 @@ namespace Gala
public Clutter.Actor window_group { get; protected set; }
public Clutter.Actor top_window_group { get; protected set; }
public Meta.BackgroundGroup background_group { get; protected set; }
-
+
Meta.PluginInfo info;
-
+
WindowSwitcher? winswitcher = null;
WorkspaceView? workspace_view = null;
WindowOverview? window_overview = null;
@@ -36,11 +36,11 @@ namespace Gala
// used to detect which corner was used to trigger an action
Clutter.Actor? last_hotcorner;
ScreenSaver? screensaver;
-
+
Window? moving; //place for the window that is being moved over
-
+
int modal_count = 0; //count of modal modes overlaying each other
-
+
Gee.HashSet minimizing = new Gee.HashSet ();
Gee.HashSet maximizing = new Gee.HashSet ();
Gee.HashSet unmaximizing = new Gee.HashSet ();
@@ -51,7 +51,7 @@ namespace Gala
{
info = Meta.PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers",
license = "GPLv3", description = "A nice elementary window manager"};
-
+
Prefs.set_ignore_request_hide_titlebar (true);
Prefs.override_preference_schema ("dynamic-workspaces", Config.SCHEMA + ".behavior");
Prefs.override_preference_schema ("attach-modal-dialogs", Config.SCHEMA + ".appearance");
@@ -59,20 +59,20 @@ namespace Gala
Prefs.override_preference_schema ("edge-tiling", Config.SCHEMA + ".behavior");
Prefs.override_preference_schema ("enable-animations", Config.SCHEMA + ".animations");
}
-
+
public override void start ()
{
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
}
-
+
bool show_stage ()
{
var screen = get_screen ();
-
+
DBus.init (this);
EndSessionDialog.register (this);
BackgroundCache.init (screen);
-
+
// Due to a bug which enables access to the stage when using multiple monitors
// in the screensaver, we have to listen for changes and make sure the input area
// is set to NONE when we are in locked mode
@@ -84,15 +84,15 @@ namespace Gala
screensaver = null;
warning (e.message);
}
-
+
stage = Compositor.get_stage_for_screen (screen) as Clutter.Stage;
-
+
var color = BackgroundSettings.get_default ().primary_color;
stage.background_color = Clutter.Color.from_string (color);
-
+
if (Prefs.get_dynamic_workspaces ())
screen.override_workspace_layout (ScreenCorner.TOPLEFT, false, 1, -1);
-
+
/* our layer structure, copied from gnome-shell (from bottom to top):
* stage
* + system background
@@ -123,9 +123,9 @@ namespace Gala
top_window_group = Compositor.get_top_window_group_for_screen (screen);
stage.remove_child (top_window_group);
ui_group.add_child (top_window_group);
-
+
/*keybindings*/
-
+
screen.get_display ().add_keybinding ("switch-to-workspace-first", KeybindingSettings.get_default ().schema, 0, () => {
screen.get_workspace_by_index (0).activate (screen.get_display ().get_current_time ());
});
@@ -150,49 +150,49 @@ namespace Gala
screen.get_display ().add_keybinding ("cycle-workspaces-previous", KeybindingSettings.get_default ().schema, 0, () => {
cycle_workspaces (-1);
});
-
+
screen.get_display ().overlay_key.connect (() => {
try {
Process.spawn_command_line_async (
BehaviorSettings.get_default ().overlay_action);
} catch (Error e) { warning (e.message); }
});
-
+
KeyBinding.set_custom_handler ("panel-main-menu", () => {
try {
Process.spawn_command_line_async (
BehaviorSettings.get_default ().panel_main_menu_action);
} catch (Error e) { warning (e.message); }
});
-
+
KeyBinding.set_custom_handler ("toggle-recording", () => {
try {
Process.spawn_command_line_async (
BehaviorSettings.get_default ().toggle_recording_action);
} catch (Error e) { warning (e.message); }
});
-
+
KeyBinding.set_custom_handler ("switch-to-workspace-up", () => {});
KeyBinding.set_custom_handler ("switch-to-workspace-down", () => {});
KeyBinding.set_custom_handler ("switch-to-workspace-left", handle_switch_to_workspace);
KeyBinding.set_custom_handler ("switch-to-workspace-right", handle_switch_to_workspace);
-
+
KeyBinding.set_custom_handler ("move-to-workspace-up", () => {});
KeyBinding.set_custom_handler ("move-to-workspace-down", () => {});
KeyBinding.set_custom_handler ("move-to-workspace-left", (d, s, w) => move_window (w, MotionDirection.LEFT) );
KeyBinding.set_custom_handler ("move-to-workspace-right", (d, s, w) => move_window (w, MotionDirection.RIGHT) );
-
+
KeyBinding.set_custom_handler ("switch-group", () => {});
KeyBinding.set_custom_handler ("switch-group-backward", () => {});
-
+
/*shadows*/
InternalUtils.reload_shadow ();
ShadowSettings.get_default ().notify.connect (InternalUtils.reload_shadow);
-
+
/*hot corner, getting enum values from GraniteServicesSettings did not work, so we use GSettings directly*/
configure_hotcorners ();
screen.monitors_changed.connect (configure_hotcorners);
-
+
BehaviorSettings.get_default ().schema.changed.connect ((key) => update_input_area ());
// initialize plugins and add default components if no plugin overrides them
@@ -204,7 +204,7 @@ namespace Gala
workspace_view = new WorkspaceView (this);
workspace_view.visible = false;
ui_group.add_child (workspace_view);
-
+
KeyBinding.set_custom_handler ("show-desktop", () => {
workspace_view.show (true);
});
@@ -219,7 +219,7 @@ namespace Gala
KeyBinding.set_custom_handler ("switch-applications", winswitcher.handle_switch_windows);
KeyBinding.set_custom_handler ("switch-applications-backward", winswitcher.handle_switch_windows);
}
-
+
if (plugin_manager.window_overview_provider == null) {
window_overview = new WindowOverview (this);
ui_group.add_child (window_overview);
@@ -231,7 +231,7 @@ namespace Gala
window_overview.open (true, true);
});
}
-
+
update_input_area ();
stage.show ();
@@ -243,27 +243,27 @@ namespace Gala
plugin_manager.load_waiting_plugins ();
return false;
});
-
+
return false;
}
-
+
void configure_hotcorners ()
{
var geometry = get_screen ().get_monitor_geometry (get_screen ().get_primary_monitor ());
-
+
add_hotcorner (geometry.x, geometry.y, "hotcorner-topleft");
add_hotcorner (geometry.x + geometry.width - 1, geometry.y, "hotcorner-topright");
add_hotcorner (geometry.x, geometry.y + geometry.height - 1, "hotcorner-bottomleft");
add_hotcorner (geometry.x + geometry.width - 1, geometry.y + geometry.height - 1, "hotcorner-bottomright");
-
+
update_input_area ();
}
-
+
void add_hotcorner (float x, float y, string key)
{
Clutter.Actor hot_corner;
var stage = Compositor.get_stage_for_screen (get_screen ());
-
+
// if the hot corner already exists, just reposition it, create it otherwise
if ((hot_corner = stage.find_child_by_name (key)) == null) {
hot_corner = new Clutter.Actor ();
@@ -272,43 +272,43 @@ namespace Gala
hot_corner.opacity = 0;
hot_corner.reactive = true;
hot_corner.name = key;
-
+
stage.add_child (hot_corner);
-
+
hot_corner.enter_event.connect (() => {
last_hotcorner = hot_corner;
perform_action ((ActionType)BehaviorSettings.get_default ().schema.get_enum (key));
return false;
});
}
-
+
hot_corner.x = x;
hot_corner.y = y;
}
-
+
void handle_switch_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,
X.Event event, Meta.KeyBinding binding)
{
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
switch_to_next_workspace (direction);
}
-
+
public void switch_to_next_workspace (MotionDirection direction)
{
var screen = get_screen ();
var display = screen.get_display ();
var old_index = screen.get_active_workspace_index ();
var neighbor = screen.get_active_workspace ().get_neighbor (direction);
-
+
neighbor.activate (display.get_current_time ());
-
- // if we didnt switch, show a nudge-over animation. need to take the indices
+
+ // if we didnt switch, show a nudge-over animation. need to take the indices
// here since the changing only applies after the animation ends
if ((old_index == 0
&& direction == MotionDirection.LEFT)
|| (old_index == screen.n_workspaces - 1
&& direction == MotionDirection.RIGHT)) {
-
+
var dest = (direction == MotionDirection.LEFT ? 32.0f : -32.0f);
ui_group.animate (Clutter.AnimationMode.LINEAR, 100, x:dest);
Timeout.add (210, () => {
@@ -317,12 +317,12 @@ namespace Gala
});
}
}
-
+
public void update_input_area ()
{
var schema = BehaviorSettings.get_default ().schema;
var screen = get_screen ();
-
+
if (screensaver != null) {
try {
if (screensaver.get_active ()) {
@@ -331,7 +331,7 @@ namespace Gala
}
} catch (IOError e) { warning (e.message); }
}
-
+
if (modal_count > 0)
InternalUtils.set_input_area (screen, InputArea.FULLSCREEN);
else if (schema.get_enum ("hotcorner-topleft") != ActionType.NONE ||
@@ -346,15 +346,15 @@ namespace Gala
public uint32[] get_all_xids ()
{
var list = new Gee.ArrayList ();
-
+
foreach (var workspace in get_screen ().get_workspaces ()) {
foreach (var window in workspace.list_windows ())
list.add ((uint32)window.get_xwindow ());
}
-
+
return list.to_array ();
}
-
+
void cycle_workspaces (int direction)
{
var screen = get_screen ();
@@ -366,41 +366,41 @@ namespace Gala
screen.get_workspace_by_index (index).activate (screen.get_display ().get_current_time ());
}
-
+
public void move_window (Window? window, MotionDirection direction)
{
if (window == null)
return;
-
+
var screen = get_screen ();
var display = screen.get_display ();
-
+
var active = screen.get_active_workspace ();
var next = active.get_neighbor (direction);
-
+
//dont allow empty workspaces to be created by moving, if we have dynamic workspaces
if (Prefs.get_dynamic_workspaces () && active.n_windows == 1 && next.index () == screen.n_workspaces - 1) {
Utils.bell (screen);
return;
}
-
+
moving = window;
-
+
if (!window.is_on_all_workspaces ())
window.change_workspace (next);
-
+
next.activate_with_focus (window, display.get_current_time ());
}
-
+
public new void begin_modal ()
{
modal_count ++;
if (modal_count > 1)
return;
-
+
var screen = get_screen ();
var display = screen.get_display ();
-
+
update_input_area ();
#if HAS_MUTTER310
base.begin_modal (0, display.get_current_time ());
@@ -410,26 +410,26 @@ namespace Gala
Meta.Util.disable_unredirect_for_screen (screen);
}
-
+
public new void end_modal ()
{
modal_count --;
if (modal_count > 0)
return;
-
+
update_input_area ();
-
+
var screen = get_screen ();
base.end_modal (screen.get_display ().get_current_time ());
Meta.Util.enable_unredirect_for_screen (screen);
}
-
+
public void get_current_cursor_position (out int x, out int y)
{
- Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().get_position (null,
+ Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().get_position (null,
out x, out y);
}
-
+
public void dim_window (Window window, bool dim)
{
/*FIXME we need a super awesome blureffect here, the one from clutter is just... bah!
@@ -441,13 +441,13 @@ namespace Gala
} else
win.clear_effects ();*/
}
-
+
public void perform_action (ActionType type)
{
var screen = get_screen ();
var display = screen.get_display ();
var current = display.get_focus_window ();
-
+
switch (type) {
case ActionType.SHOW_WORKSPACE_VIEW:
workspace_view.show ();
@@ -455,7 +455,7 @@ namespace Gala
case ActionType.MAXIMIZE_CURRENT:
if (current == null || current.window_type != WindowType.NORMAL)
break;
-
+
if (current.get_maximized () == (MaximizeFlags.HORIZONTAL | MaximizeFlags.VERTICAL))
current.unmaximize (MaximizeFlags.HORIZONTAL | MaximizeFlags.VERTICAL);
else
@@ -511,37 +511,37 @@ namespace Gala
break;
}
}
-
+
/*
* effects
*/
-
+
public override void minimize (WindowActor actor)
{
- if (!AnimationSettings.get_default ().enable_animations ||
- AnimationSettings.get_default ().minimize_duration == 0 ||
+ if (!AnimationSettings.get_default ().enable_animations ||
+ AnimationSettings.get_default ().minimize_duration == 0 ||
actor.get_meta_window ().window_type != WindowType.NORMAL) {
minimize_completed (actor);
return;
}
-
+
kill_window_effects (actor);
minimizing.add (actor);
-
+
int width, height;
get_screen ().get_size (out width, out height);
-
+
Rectangle icon = {};
//FIXME don't use the icon geometry, since it seems broken right now
if (false && actor.get_meta_window ().get_icon_geometry (out icon)) {
-
+
float scale_x = (float)icon.width / actor.width;
float scale_y = (float)icon.height / actor.height;
float anchor_x = (float)(actor.x - icon.x) * actor.width / (icon.width - actor.width);
float anchor_y = (float)(actor.y - icon.y) * actor.height / (icon.height - actor.height);
-
+
actor.move_anchor_point (anchor_x, anchor_y);
- actor.animate (Clutter.AnimationMode.EASE_IN_EXPO, AnimationSettings.get_default ().minimize_duration,
+ actor.animate (Clutter.AnimationMode.EASE_IN_EXPO, AnimationSettings.get_default ().minimize_duration,
scale_x:scale_x, scale_y:scale_y,opacity:0)
.completed.connect (() => {
//FIXME once we enable this part and we still haven't found a fix for below issue, add the idle here too
@@ -552,11 +552,11 @@ namespace Gala
minimize_completed (actor);
minimizing.remove (actor);
});
-
+
} else {
actor.scale_center_x = width / 2.0f - actor.x;
actor.scale_center_y = height - actor.y;
- actor.animate (Clutter.AnimationMode.EASE_IN_EXPO, AnimationSettings.get_default ().minimize_duration,
+ actor.animate (Clutter.AnimationMode.EASE_IN_EXPO, AnimationSettings.get_default ().minimize_duration,
scale_x : 0.0f, scale_y : 0.0f, opacity : 0)
.completed.connect (() => {
//FIXME for unknown reasons clutter won't apply properties that are changed here,
@@ -573,49 +573,49 @@ namespace Gala
});
}
}
-
+
//stolen from original mutter plugin
public override void maximize (WindowActor actor, int ex, int ey, int ew, int eh)
{
float x, y, width, height;
actor.get_size (out width, out height);
actor.get_position (out x, out y);
-
- if (!AnimationSettings.get_default ().enable_animations ||
- AnimationSettings.get_default ().snap_duration == 0 ||
+
+ if (!AnimationSettings.get_default ().enable_animations ||
+ AnimationSettings.get_default ().snap_duration == 0 ||
(x == ex && y == ey && ew == width && eh == height)) {
maximize_completed (actor);
return;
}
-
+
if (actor.get_meta_window ().window_type == WindowType.NORMAL) {
maximizing.add (actor);
-
+
float scale_x = (float)ew / width;
float scale_y = (float)eh / height;
float anchor_x = (float)(x - ex) * width / (ew - width);
float anchor_y = (float)(y - ey) * height / (eh - height);
-
+
//reset the actor's anchors
actor.scale_gravity = actor.anchor_gravity = Clutter.Gravity.NORTH_WEST;
-
+
actor.move_anchor_point (anchor_x, anchor_y);
- actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, AnimationSettings.get_default ().snap_duration,
+ actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, AnimationSettings.get_default ().snap_duration,
scale_x:scale_x, scale_y:scale_y).get_timeline ().completed.connect ( () => {
-
+
actor.anchor_gravity = Clutter.Gravity.NORTH_WEST;
actor.set_scale (1.0, 1.0);
-
+
maximizing.remove (actor);
maximize_completed (actor);
});
-
+
return;
}
-
+
maximize_completed (actor);
}
-
+
public override void map (WindowActor actor)
{
if (!AnimationSettings.get_default ().enable_animations) {
@@ -623,29 +623,29 @@ namespace Gala
map_completed (actor);
return;
}
-
+
var window = actor.get_meta_window ();
-
+
actor.detach_animation ();
actor.show ();
-
+
switch (window.window_type) {
case WindowType.NORMAL:
if (AnimationSettings.get_default ().open_duration == 0) {
map_completed (actor);
return;
}
-
+
mapping.add (actor);
-
+
actor.scale_gravity = Clutter.Gravity.SOUTH;
actor.scale_x = 0.01f;
actor.scale_y = 0.1f;
actor.opacity = 0;
- actor.animate (Clutter.AnimationMode.EASE_OUT_EXPO, AnimationSettings.get_default ().open_duration,
+ actor.animate (Clutter.AnimationMode.EASE_OUT_EXPO, AnimationSettings.get_default ().open_duration,
scale_x:1.0f, scale_y:1.0f, opacity:255)
.completed.connect ( () => {
-
+
mapping.remove (actor);
map_completed (actor);
});
@@ -657,54 +657,54 @@ namespace Gala
map_completed (actor);
return;
}
-
+
mapping.add (actor);
-
+
actor.scale_gravity = Clutter.Gravity.CENTER;
actor.rotation_center_x = {0, 0, 10};
actor.scale_x = 0.9f;
actor.scale_y = 0.9f;
actor.opacity = 0;
- actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, AnimationSettings.get_default ().menu_duration,
+ actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, AnimationSettings.get_default ().menu_duration,
scale_x:1.0f, scale_y:1.0f, opacity:255)
.completed.connect ( () => {
-
+
mapping.remove (actor);
map_completed (actor);
});
break;
case WindowType.MODAL_DIALOG:
case WindowType.DIALOG:
-
+
mapping.add (actor);
-
+
actor.scale_gravity = Clutter.Gravity.NORTH;
actor.scale_y = 0.0f;
actor.opacity = 0;
-
- actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250,
+
+ actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250,
scale_y:1.0f, opacity:255).completed.connect ( () => {
-
+
mapping.remove (actor);
map_completed (actor);
});
-
+
if (AppearanceSettings.get_default ().dim_parents &&
- window.window_type == WindowType.MODAL_DIALOG &&
+ window.window_type == WindowType.MODAL_DIALOG &&
window.is_attached_dialog ())
dim_window (window.find_root_ancestor (), true);
-
+
break;
default:
map_completed (actor);
break;
}
}
-
+
public override void destroy (WindowActor actor)
{
var window = actor.get_meta_window ();
-
+
if (!AnimationSettings.get_default ().enable_animations) {
destroy_completed (actor);
@@ -714,24 +714,24 @@ namespace Gala
return;
}
-
+
actor.detach_animation ();
-
+
switch (window.window_type) {
case WindowType.NORMAL:
if (AnimationSettings.get_default ().close_duration == 0) {
destroy_completed (actor);
return;
}
-
+
destroying.add (actor);
-
+
actor.scale_gravity = Clutter.Gravity.CENTER;
actor.show ();
- actor.animate (Clutter.AnimationMode.LINEAR, AnimationSettings.get_default ().close_duration,
+ actor.animate (Clutter.AnimationMode.LINEAR, AnimationSettings.get_default ().close_duration,
scale_x:0.8f, scale_y:0.8f, opacity:0)
.completed.connect ( () => {
-
+
destroying.remove (actor);
destroy_completed (actor);
Utils.request_clean_icon_cache (get_all_xids ());
@@ -740,17 +740,17 @@ namespace Gala
case WindowType.MODAL_DIALOG:
case WindowType.DIALOG:
destroying.add (actor);
-
+
actor.scale_gravity = Clutter.Gravity.NORTH;
- actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200,
+ actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200,
scale_y:0.0f, opacity:0).completed.connect ( () => {
-
+
destroying.remove (actor);
destroy_completed (actor);
});
-
+
dim_window (window.find_root_ancestor (), false);
-
+
break;
case WindowType.MENU:
case WindowType.DROPDOWN_MENU:
@@ -759,13 +759,13 @@ namespace Gala
destroy_completed (actor);
return;
}
-
+
destroying.add (actor);
-
- actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, AnimationSettings.get_default ().menu_duration,
+
+ actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, AnimationSettings.get_default ().menu_duration,
scale_x:0.8f, scale_y:0.8f, opacity:0)
.completed.connect ( () => {
-
+
destroying.remove (actor);
destroy_completed (actor);
});
@@ -775,54 +775,54 @@ namespace Gala
break;
}
}
-
+
public override void unmaximize (Meta.WindowActor actor, int ex, int ey, int ew, int eh)
{
if (!AnimationSettings.get_default ().enable_animations || AnimationSettings.get_default ().snap_duration == 0) {
unmaximize_completed (actor);
return;
}
-
+
if (actor.get_meta_window ().window_type == WindowType.NORMAL) {
unmaximizing.add (actor);
-
+
float x, y, width, height;
actor.get_size (out width, out height);
actor.get_position (out x, out y);
-
+
float scale_x = (float)ew / width;
float scale_y = (float)eh / height;
float anchor_x = (float)(x - ex) * width / (ew - width);
float anchor_y = (float)(y - ey) * height / (eh - height);
-
+
actor.move_anchor_point (anchor_x, anchor_y);
- actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, AnimationSettings.get_default ().snap_duration,
+ actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, AnimationSettings.get_default ().snap_duration,
scale_x:scale_x, scale_y:scale_y).completed.connect ( () => {
actor.move_anchor_point_from_gravity (Clutter.Gravity.NORTH_WEST);
- actor.animate (Clutter.AnimationMode.LINEAR, 1, scale_x:1.0f,
+ actor.animate (Clutter.AnimationMode.LINEAR, 1, scale_x:1.0f,
scale_y:1.0f);//just scaling didnt want to work..
-
+
unmaximizing.remove (actor);
unmaximize_completed (actor);
});
-
+
return;
}
-
+
unmaximize_completed (actor);
}
-
+
// Cancel attached animation of an actor and reset it
bool end_animation (ref Gee.HashSet list, WindowActor actor)
{
if (!list.contains (actor))
return false;
-
+
if (actor.is_destroyed ()) {
list.remove (actor);
return false;
}
-
+
actor.detach_animation ();
actor.opacity = 255;
actor.scale_x = 1.0f;
@@ -830,11 +830,11 @@ namespace Gala
actor.rotation_angle_x = 0.0f;
actor.anchor_gravity = Clutter.Gravity.NORTH_WEST;
actor.scale_gravity = Clutter.Gravity.NORTH_WEST;
-
+
list.remove (actor);
return true;
}
-
+
public override void kill_window_effects (WindowActor actor)
{
if (end_animation (ref mapping, actor))
@@ -848,7 +848,7 @@ namespace Gala
if (end_animation (ref destroying, actor))
destroy_completed (actor);
}
-
+
/*workspace switcher*/
List? win;
List? par; //class space for kill func
@@ -856,7 +856,7 @@ namespace Gala
Clutter.Actor? in_group;
Clutter.Actor? out_group;
Clutter.Actor? moving_window_container;
-
+
void watch_window (Meta.Workspace workspace, Meta.Window window)
{
if (clones == null) {
@@ -865,7 +865,7 @@ namespace Gala
}
warning ("Dock window '%s' closed while switching workspaces", window.get_title ());
-
+
// finding the correct window here is not so easy
// and for those default 400ms we can live with
// some windows disappearing which in fact should never
@@ -875,23 +875,23 @@ namespace Gala
}
clones = null;
}
-
+
public override void switch_workspace (int from, int to, MotionDirection direction)
{
if (!AnimationSettings.get_default ().enable_animations || AnimationSettings.get_default ().workspace_switch_duration == 0) {
switch_workspace_completed ();
return;
}
-
+
var screen = get_screen ();
-
+
unowned Meta.Workspace wp_from = screen.get_workspace_by_index (from);
unowned Meta.Workspace wp_to = screen.get_workspace_by_index (to);
-
+
unowned List windows = Compositor.get_window_actors (screen);
float w, h;
screen.get_size (out w, out h);
-
+
var x2 = 0.0f; var y2 = 0.0f;
if (direction == MotionDirection.LEFT)
x2 = w;
@@ -899,49 +899,49 @@ namespace Gala
x2 = -w;
else
return;
-
+
var group = Compositor.get_window_group_for_screen (screen);
var wallpaper = background_group;
-
+
in_group = new Clutter.Actor ();
out_group = new Clutter.Actor ();
win = new List ();
par = new List ();
clones = new List ();
-
+
var wallpaper_clone = new Clutter.Clone (wallpaper);
wallpaper_clone.x = (x2 < 0 ? w : -w);
-
+
clones.append (wallpaper_clone);
-
+
group.add_child (wallpaper_clone);
group.add_child (in_group);
group.add_child (out_group);
-
+
WindowActor moving_actor = null;
if (moving != null) {
moving_actor = moving.get_compositor_private () as WindowActor;
-
+
win.append (moving_actor);
par.append (moving_actor.get_parent ());
-
+
// for some reason the actor alone won't stay where it should, only in a container
moving_window_container = new Clutter.Actor ();
clutter_actor_reparent (moving_actor, moving_window_container);
group.add_child (moving_window_container);
}
-
+
var to_has_fullscreened = false;
var from_has_fullscreened = false;
var docks = new List ();
-
+
foreach (var window in windows) {
var meta_window = window.get_meta_window ();
-
- if (!meta_window.showing_on_its_workspace () ||
+
+ if (!meta_window.showing_on_its_workspace () ||
moving != null && window == moving_actor)
continue;
-
+
if (meta_window.get_workspace () == wp_from) {
win.append (window);
par.append (window.get_parent ());
@@ -958,26 +958,26 @@ namespace Gala
docks.append (window);
}
}
-
+
// make sure we don't add docks when there are fullscreened
- // windows on one of the groups. Simply raising seems not to
+ // windows on one of the groups. Simply raising seems not to
// work, mutter probably reverts the order internally to match
// the display stack
foreach (var window in docks) {
win.append (window);
par.append (window.get_parent ());
-
+
var clone = new Clutter.Clone (window);
clone.x = window.x;
clone.y = window.y;
-
+
clones.append (clone);
if (!to_has_fullscreened)
in_group.add_child (clone);
if (!from_has_fullscreened)
clutter_actor_reparent (window, out_group);
}
-
+
// monitor the workspaces to see whether a window was removed
// in which case we need to stop the clones from drawing
// we monitor every workspace here because finding the ones a
@@ -985,19 +985,19 @@ namespace Gala
foreach (var workspace in screen.get_workspaces ()) {
workspace.window_removed.connect (watch_window);
}
-
+
in_group.set_position (-x2, -y2);
group.set_child_above_sibling (in_group, null);
if (moving_window_container != null)
group.set_child_above_sibling (moving_window_container, null);
-
+
in_group.clip_to_allocation = out_group.clip_to_allocation = true;
in_group.width = out_group.width = w;
in_group.height = out_group.height = h;
-
+
var animation_duration = AnimationSettings.get_default ().workspace_switch_duration;
var animation_mode = Clutter.AnimationMode.EASE_OUT_CUBIC;
-
+
out_group.animate (animation_mode, animation_duration, x : x2, y : y2);
in_group.animate (animation_mode, animation_duration, x : 0.0f, y : 0.0f).completed.connect (() => {
end_switch_workspace ();
@@ -1005,41 +1005,41 @@ namespace Gala
wallpaper.animate (animation_mode, animation_duration, x : (x2 < 0 ? -w : w));
wallpaper_clone.animate (animation_mode, animation_duration, x : 0.0f);
}
-
+
void end_switch_workspace ()
{
if (win == null || par == null)
return;
-
+
var screen = get_screen ();
var display = screen.get_display ();
-
+
for (var i=0;i 0;
}
-
+
public override unowned Meta.PluginInfo? plugin_info ()
{
return info;
}
-
+
static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent)
{
if (actor == new_parent)
return;
-
+
actor.ref ();
actor.get_parent ().remove_child (actor);
new_parent.add_child (actor);
actor.unref ();
}
}
-
+
[CCode (cname="clutter_x11_handle_event")]
public extern int x_handle_event (X.Event xevent);
[CCode (cname="clutter_x11_get_stage_window")]
diff --git a/vapi/config.vapi b/vapi/config.vapi
index ccaa87d5..967309a0 100644
--- a/vapi/config.vapi
+++ b/vapi/config.vapi
@@ -1,19 +1,19 @@
-//
+//
// Copyright (C) 2011 Robert Dyer, Rico Tzschichholz
-//
+//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//
+//
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config