Update to latest trunk

This commit is contained in:
Tom Beckmann 2012-08-28 10:21:59 +02:00
commit 0d5426e872
14 changed files with 1154 additions and 271 deletions

View File

@ -31,7 +31,7 @@ add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
find_package(PkgConfig)
pkg_check_modules(DEPS REQUIRED libmutter granite clutter-1.0 clutter-gtk-1.0 libbamf3 xfixes gee-1.0 libplank)
pkg_check_modules(MUTTER36 libmutter>=3.5.3)
pkg_check_modules(MUTTER36 QUIET libmutter>=3.5.3)
if (MUTTER36_FOUND)
set (GALAVALAFLAGS "--define=HAS_MUTTER36")
endif (MUTTER36_FOUND)
@ -55,19 +55,21 @@ vala_precompile(VALA_C
src/Utils.vala
src/Zooming.vala
src/Widgets/AppIcon.vala
src/Widgets/WindowOverview.vala
src/Widgets/WindowSwitcher.vala
src/Widgets/WindowThumb.vala
src/Widgets/WorkspaceThumb.vala
src/Widgets/WorkspaceView.vala
${CMAKE_BINARY_DIR}/src/Config.vala
PACKAGES
granite
libbamf3
libmutter
plank
clutter-gtk-1.0
gdk-x11-3.0
gdesktopenums-3.0
xfixes-4.0
bamf
OPTIONS
-g
--vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/

View File

@ -7,6 +7,11 @@
<value nick="minimize-current" value="3" />
<value nick="open-launcher" value="4" />
<value nick="custom-command" value="5" />
<value nick="window-overview" value="6" />
</enum>
<enum id="GalaWindowOverviewType">
<value nick='grid' value='0'/>
<value nick='natural' value='1'/>
</enum>
<schema path="/org/pantheon/desktop/gala/behavior/" id="org.pantheon.desktop.gala.behavior" gettext-domain="gala">
@ -15,6 +20,11 @@
<summary>Action for the top left corner</summary>
<description></description>
</key>
<key enum="GalaWindowOverviewType" name="window-overview-type">
<default>'grid'</default>
<summary>Algorithm for window overview layout</summary>
<description>Choose the algorithm used for exposing the windows</description>
</key>
<key enum="GalaActionType" name="hotcorner-topright">
<default>'none'</default>
<summary>Action for the top right corner</summary>
@ -73,6 +83,10 @@
<key type="as" name="zoom-out">
<default><![CDATA[['<Super>minus', '<Super>KP_Subtract']]]></default>
<summary>Zoom out</summary>
</key>
<key type="as" name="expose-windows">
<default><![CDATA[['<Super>e']]]></default>
<summary>Shortcut to move to last workspace</summary>
<description></description>
</key>
</schema>

View File

@ -26,7 +26,8 @@ namespace Gala
MAXIMIZE_CURRENT,
MINIMIZE_CURRENT,
OPEN_LAUNCHER,
CUSTOM_COMMAND
CUSTOM_COMMAND,
WINDOW_OVERVIEW
}
public enum InputArea {
@ -40,6 +41,7 @@ namespace Gala
WindowSwitcher winswitcher;
WorkspaceView workspace_view;
Zooming zooming;
WindowOverview window_overview;
Window? moving; //place for the window that is being moved over
@ -68,7 +70,9 @@ namespace Gala
DBus.init (this);
var stage = Compositor.get_stage_for_screen (screen) as Clutter.Stage;
stage.background_color = {0, 0, 0, 255};
string color = new Settings ("org.gnome.desktop.background").get_string ("primary-color");
stage.background_color = Clutter.Color.from_string (color);
stage.no_clear_hint = true;
screen.override_workspace_layout (ScreenCorner.TOPLEFT, false, 1, -1);
@ -79,12 +83,17 @@ namespace Gala
winswitcher = new WindowSwitcher (this);
zooming = new Zooming (this);
window_overview = new WindowOverview (this);
stage.add_child (workspace_view);
stage.add_child (winswitcher);
stage.add_child (window_overview);
/*keybindings*/
screen.get_display ().add_keybinding ("expose-windows", BehaviorSettings.get_default ().schema, 0, () => {
window_overview.open (true);
});
screen.get_display ().add_keybinding ("move-to-workspace-first", BehaviorSettings.get_default ().schema, 0, () => {
screen.get_workspace_by_index (0).activate (screen.get_display ().get_current_time ());
});
@ -263,15 +272,16 @@ namespace Gala
workspace_view.show ();
break;
case ActionType.MAXIMIZE_CURRENT:
if (current == null)
if (current == null || current.window_type != WindowType.NORMAL)
break;
if (current.get_maximized () == (MaximizeFlags.HORIZONTAL | MaximizeFlags.VERTICAL))
current.unmaximize (MaximizeFlags.HORIZONTAL | MaximizeFlags.VERTICAL);
else
current.maximize (MaximizeFlags.HORIZONTAL | MaximizeFlags.VERTICAL);
break;
case ActionType.MINIMIZE_CURRENT:
if (current != null)
if (current != null && current.window_type == WindowType.NORMAL)
current.minimize ();
break;
case ActionType.OPEN_LAUNCHER:
@ -288,6 +298,9 @@ namespace Gala
warning (e.message);
}
break;
case ActionType.WINDOW_OVERVIEW:
window_overview.open (true);
break;
default:
warning ("Trying to run unknown action");
break;
@ -304,11 +317,14 @@ namespace Gala
minimize_completed (actor);
return;
}
kill_window_effects (actor);
int width, height;
get_screen ().get_size (out width, out height);
Rectangle icon = {};
if (false && actor.get_meta_window ().get_icon_geometry (icon)) {
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;
@ -390,6 +406,7 @@ namespace Gala
var display = screen.get_display ();
var window = actor.get_meta_window ();
actor.detach_animation ();
actor.show ();
switch (window.window_type) {
@ -463,6 +480,7 @@ namespace Gala
var display = screen.get_display ();
var window = actor.get_meta_window ();
actor.detach_animation ();
destroying.add (actor);
switch (window.window_type) {
@ -577,8 +595,11 @@ namespace Gala
public override void kill_window_effects (WindowActor actor)
{
if (end_animation (ref mapping, actor))
if (end_animation (ref mapping, actor)) {
map_completed (actor);
//FIXME adding a print here seems to solve bug #1029609
print ("Killed map animation\n");
}
if (end_animation (ref minimizing, actor))
minimize_completed (actor);
if (end_animation (ref maximizing, actor))

View File

@ -25,6 +25,8 @@ namespace Gala
public string overlay_action { get; set; }
public string hotcorner_custom_command { 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; }

View File

@ -62,15 +62,12 @@ namespace Gala
} else {
WorkspaceThumb old = actor.get_parent ().get_parent () as WorkspaceThumb;
actor.get_parent ().remove_child (actor);
if (old != null)
old.icons.animate (AnimationMode.LINEAR, 100, x:Math.floorf (old.wallpaper.x + old.wallpaper.width / 2 - old.icons.width / 2));
actor.opacity = 255;
var icons = (WorkspaceThumb.destination as WorkspaceThumb).icons;
var wallpaper = (WorkspaceThumb.destination as WorkspaceThumb).wallpaper;
icons.add_child (actor);
icons.animate (AnimationMode.LINEAR, 100, x:Math.floorf (wallpaper.x + wallpaper.width / 2 - icons.width / 2));
var xids = app.get_xids ();
if (xids.length > 1) { //get all the windows that belong to this app
@ -86,6 +83,10 @@ namespace Gala
if (handle != null)
handle.destroy ();
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));
}
}

View File

@ -0,0 +1,597 @@
//
// 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 <http://www.gnu.org/licenses/>.
//
using Meta;
using Clutter;
namespace Gala
{
public enum WindowOverviewType
{
GRID = 0,
NATURAL
}
public class WindowOverview : Actor
{
Plugin plugin;
Screen screen;
bool ready;
static const int PADDING = 50;
public WindowOverview (Plugin _plugin)
{
plugin = _plugin;
screen = plugin.get_screen ();
screen.workspace_switched.connect (() => close (false));
visible = false;
ready = true;
}
public override bool key_press_event (Clutter.KeyEvent event)
{
//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.e || event.keyval == Clutter.Key.Escape) {
close (true);
return true;
}
return false;
}
public override void key_focus_out ()
{
close (false);
}
/**
* 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;
const int ACCURACY = 20;
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))
return true;
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<Actor> windows)
{
var clones = windows.copy ();
clones.sort ((a, b) => {
return (int)(a as WindowThumb).window.get_stable_sequence () -
(int)(b as WindowThumb).window.get_stable_sequence ();
});
//sort windows by monitor
List<Actor>[] monitors = {};
monitors.resize (screen.get_n_monitors ());
foreach (var clone in clones)
monitors[(clone as WindowThumb).window.get_monitor ()].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),
(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<Actor> 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);
for (int x = 0; x < columns; x++) {
for (int y = 0; y < rows; y++) {
slot_centers[x + y * columns] = {area.x + slot_width * x + slot_width / 2,
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;
slot_candidate_distance = dist;
}
}
}
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;
}
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_height};
target = rect_adjusted (target, 10, 10, -10, -10);
float scale;
if (target.width / (double)rect.width < target.height / (double)rect.height) {
// Center vertically
scale = target.width / (float)rect.width;
target.y += (target.height - (int)(rect.height * scale)) / 2;
target.height = (int)Math.floorf (rect.height * scale);
} else {
// Center horizontally
scale = target.height / (float)window.height;
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 > 2.0 || (scale > 1.0 && (rect.width > 300 || rect.height > 300))) {
scale = (rect.width > 300 || rect.height > 300) ? 1.0f : 2.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.height)};
}
place_window (window, target);
}
}
void natural_placement (Meta.Rectangle area, List<Actor> 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 {
overlap = false;
for (var i = 0; i < rects.length; i++) {
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);
diff.y = (int)Math.floorf (diff.y * ACCURACY / length);
// Move both windows apart
rect.x += -diff.x;
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
// window towards the outer corner. If it is in any of the other edge sections
// alternate between each corner on that edge. We don't want to determine it
// randomly as it will not produce consistant locations when using the filter.
// Only move one window so we don't cause large amounts of unnecessary zooming
// in some situations. We need to do this even when expanding later just in case
// all windows are the same size.
// (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;
if (x_section != 1 || y_section != 1) { // Remove this if you want the center to pull as well
if (x_section == 1)
x_section = (directions[i] / 2 == 1 ? 2 : 0);
if (y_section == 1)
y_section = (directions[i] % 2 == 1 ? 2 : 0);
}
if (x_section == 0 && y_section == 0) {
diff.x = bounds.x - i_center.x;
diff.y = bounds.y - i_center.y;
}
if (x_section == 2 && y_section == 0) {
diff.x = bounds.x + bounds.width - i_center.x;
diff.y = bounds.y - i_center.y;
}
if (x_section == 2 && y_section == 2) {
diff.x = bounds.x + bounds.width - i_center.x;
diff.y = bounds.y + bounds.height - i_center.y;
}
if (x_section == 0 && y_section == 2) {
diff.x = bounds.x - i_center.x;
diff.y = bounds.y + bounds.height - i_center.y;
}
if (diff.x != 0 || diff.y != 0) {
length = Math.sqrtf (diff.x * diff.x + diff.y * diff.y);
diff.x *= (int)Math.floorf (ACCURACY / length / 2.0f);
diff.y *= (int)Math.floorf (ACCURACY / length / 2.0f);
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) {
rect = {(int)Math.floorf ((rect.x - bounds.x) * scale + area.x),
(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) /
(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};
if (rect_is_overlapping_any (rect, rects, border))
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};
if (rect_is_overlapping_any (rect, rects, border))
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};
if (rect_is_overlapping_any (rect, rects, border))
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};
if (rect_is_overlapping_any (rect, rects, border))
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,
rect_center (rect).y - (int)Math.floorf (window_rect.height * scale) / 2,
(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);
clone.close_button.x = rect.x - 10;
clone.close_button.y = rect.y - 10;
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)
{
if (!ready)
return;
if (visible) {
close (true);
return;
}
ready = false;
var used_windows = new SList<Window> ();
foreach (var window in screen.get_active_workspace ().list_windows ()) {
if (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DOCK) {
(window.get_compositor_private () as Actor).hide ();
continue;
}
if (window.window_type == WindowType.DOCK)
continue;
used_windows.append (window);
}
var n_windows = used_windows.length ();
if (n_windows == 0)
return;
Compositor.get_background_actor_for_screen (screen).
animate (AnimationMode.EASE_OUT_QUAD, 1000, dim_factor : 0.4);
// sort windows by stacking order
var windows = screen.get_display ().sort_windows_by_stacking (used_windows);
grab_key_focus ();
plugin.begin_modal ();
Utils.set_input_area (screen, InputArea.FULLSCREEN);
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 (selected);
clone.reposition.connect (reposition);
add_child (clone);
}
calculate_places (get_children ());
}
//called when a window has been closed
void reposition (WindowThumb removed)
{
var children = get_children ().copy ();
children.remove (removed);
calculate_places (children);
}
void selected (Window window)
{
window.activate (screen.get_display ().get_current_time ());
close (true);
}
void close (bool animate)
{
if (!visible || !ready)
return;
ready = false;
plugin.end_modal ();
plugin.update_input_area ();
foreach (var child in get_children ()) {
var exposed = child as WindowThumb;
exposed.close (animate);
exposed.selected.disconnect (selected);
}
Compositor.get_background_actor_for_screen (screen).
animate (AnimationMode.EASE_OUT_QUAD, 500, dim_factor : 1.0);
if (animate) {
Timeout.add (300, () => {
visible = false;
ready = true;
foreach (var window in screen.get_active_workspace ().list_windows ())
(window.get_compositor_private () as Actor).show ();
return false;
});
} else {
ready = true;
visible = false;
foreach (var window in screen.get_active_workspace ().list_windows ())
(window.get_compositor_private () as Actor).show ();
}
}
}
}

View File

@ -116,36 +116,38 @@ namespace Gala
void close (uint time)
{
foreach (var clone in window_clones) {
remove_child (clone);
clone.destroy ();
}
var screen = plugin.get_screen ();
var display = screen.get_display ();
Meta.Compositor.get_window_actors (plugin.get_screen ()).foreach ((w) => {
var meta_win = w.get_meta_window ();
if (!meta_win.minimized &&
(meta_win.get_workspace () == plugin.get_screen ().get_active_workspace ()) ||
meta_win.is_on_all_workspaces ())
w.show ();
});
if (dock_window != null)
dock_window.opacity = 0;
window_clones.clear ();
plugin.end_modal ();
if (current_window != null) {
current_window.activate (time);
current_window = null;
}
var dest_width = (dock_window != null ? dock_window.width : 800.0f);
set_child_above_sibling (dock, null);
dock_background.animate (AnimationMode.EASE_OUT_CUBIC, 250, opacity : 0);
if (dock_window != null)
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);
clone.animate (AnimationMode.EASE_OUT_CUBIC, 150, depth : 0.0f, opacity : 255);
}
if (current_window != null) {
current_window.activate (time);
current_window = null;
}
plugin.end_modal ();
dock.animate (AnimationMode.EASE_OUT_CUBIC, 250, width:dest_width, opacity : 0).
completed.connect (() => {
@ -155,6 +157,18 @@ namespace Gala
dock_window = null;
visible = false;
foreach (var clone in window_clones)
clone.destroy ();
window_clones.clear ();
Meta.Compositor.get_window_actors (plugin.get_screen ()).foreach ((w) => {
var meta_win = w.get_meta_window ();
if (!meta_win.minimized &&
(meta_win.get_workspace () == plugin.get_screen ().get_active_workspace ()) ||
meta_win.is_on_all_workspaces ())
w.show ();
});
});
}

View File

@ -0,0 +1,167 @@
//
// 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 <http://www.gnu.org/licenses/>.
//
using Meta;
using Clutter;
namespace Gala
{
public class WindowThumb : Actor
{
public weak Window window;
Clone clone;
public GtkClutter.Texture icon;
public GtkClutter.Texture close_button;
public signal void selected (Window window);
public signal void reposition ();
public WindowThumb (Window _window)
{
window = _window;
reactive = true;
var actor = window.get_compositor_private () as WindowActor;
clone = new Clone (actor.get_texture ());
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;
close_button.scale_x = 0.0f;
close_button.scale_y = 0.0f;
close_button.scale_gravity = Gravity.CENTER;
close_button.button_press_event.connect (close_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_clicked (ButtonEvent event)
{
if (event.button != 1)
return false;
//make sure we dont see a window closing animation in the background
(window.get_compositor_private () as Actor).opacity = 0;
get_parent ().set_child_below_sibling (this, null);
animate (AnimationMode.EASE_IN_CUBIC, 200, depth : -50.0f, opacity : 0).completed.connect (() => {
destroy ();
window.delete (window.get_screen ().get_display ().get_current_time ());
});
close_button.destroy ();
icon.destroy ();
reposition ();
return true;
}
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_press_event (ButtonEvent event)
{
get_parent ().set_child_above_sibling (this, null);
selected (window);
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 ();
if (do_animate) {
icon.animate (AnimationMode.EASE_IN_CUBIC, 100, scale_x:0.0f, scale_y:0.0f).completed.connect ( () => {
icon.destroy ();
});
animate (AnimationMode.EASE_IN_OUT_CUBIC, 300, scale_x:1.0f, scale_y:1.0f, x:dest_x, y:dest_y).completed.connect (() => {
(window.get_compositor_private () as Actor).show ();
destroy ();
});
} else {
(window.get_compositor_private () as Actor).show ();
destroy ();
icon.destroy ();
}
close_button.destroy ();
}
}
}

View File

@ -46,7 +46,7 @@ namespace Gala
internal Clone wallpaper;
Clutter.Actor windows;
internal Clutter.Actor icons;
CairoTexture indicator;
Actor indicator;
GtkClutter.Texture close_button;
uint hover_timer = 0;
@ -75,10 +75,14 @@ namespace Gala
reactive = true;
indicator = new Clutter.CairoTexture ((uint)width + 2 * INDICATOR_BORDER, (uint)THUMBNAIL_HEIGHT + 2 * INDICATOR_BORDER);
indicator.draw.connect (draw_indicator);
indicator.auto_resize = true;
indicator = new Actor ();
indicator.width = width + 2 * INDICATOR_BORDER;
indicator.height = THUMBNAIL_HEIGHT + 2 * INDICATOR_BORDER;
indicator.opacity = 0;
indicator.content = new Canvas ();
(indicator.content as Canvas).draw.connect (draw_indicator);
(indicator.content as Canvas).set_size ((int)indicator.width, (int)indicator.height);
handle_workspace_switched (-1, screen.get_active_workspace_index (), MotionDirection.LEFT);
// FIXME find a nice way to draw a border around it, maybe combinable with the indicator using a ShaderEffect
@ -90,7 +94,7 @@ namespace Gala
close_button = new GtkClutter.Texture ();
try {
close_button.set_from_pixbuf (Granite.Widgets.get_close_pixbuf ());
close_button.set_from_pixbuf (Granite.Widgets.Utils.get_close_pixbuf ());
} catch (Error e) { warning (e.message); }
close_button.x = -12.0f;
close_button.y = -10.0f;
@ -208,7 +212,12 @@ namespace Gala
bool draw_indicator (Cairo.Context cr)
{
selector_style.render_activity (cr, 0, 0, indicator.width, indicator.height);
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;
}

View File

@ -27,8 +27,7 @@ namespace Gala
Screen screen;
Clutter.Actor thumbnails;
Clutter.CairoTexture background;
Clutter.CairoTexture scroll;
Clutter.Actor scroll;
Clutter.Actor click_catcher; //invisible plane that catches clicks outside the view
bool animating; // delay closing the popup
@ -58,16 +57,13 @@ namespace Gala
(thumbnails.layout_manager as Clutter.BoxLayout).spacing = 12;
(thumbnails.layout_manager as Clutter.BoxLayout).homogeneous = true;
background = new Clutter.CairoTexture (500, (uint)height);
background.auto_resize = true;
background.add_constraint (new Clutter.BindConstraint (this, Clutter.BindCoordinate.WIDTH, 0));
background.add_constraint (new Clutter.BindConstraint (this, Clutter.BindCoordinate.HEIGHT, 0));
background.draw.connect (draw_background);
content = new Clutter.Canvas ();
(content as Clutter.Canvas).draw.connect (draw_background);
scroll = new Clutter.CairoTexture (100, 12);
scroll = new Clutter.Actor ();
scroll.height = 12;
scroll.auto_resize = true;
scroll.draw.connect (draw_scroll);
scroll.content = new Clutter.Canvas ();
(scroll.content as Clutter.Canvas).draw.connect (draw_scroll);
click_catcher = new Clutter.Actor ();
click_catcher.reactive = true;
@ -77,7 +73,6 @@ namespace Gala
});
Compositor.get_stage_for_screen (screen).add_child (click_catcher);
add_child (background);
add_child (thumbnails);
add_child (scroll);
@ -125,6 +120,10 @@ namespace Gala
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);
@ -133,6 +132,10 @@ namespace Gala
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 ();
@ -192,6 +195,7 @@ namespace Gala
if (thumbnails.x + thumbnails.width < width)
thumbnails.x = width - thumbnails.width;
scroll.width = width / thumbnails.width * width;
(scroll.content as Clutter.Canvas).set_size ((int)scroll.width, 12);
} else {
thumbnails.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, x : width / 2 - thumbnails.width / 2);
}
@ -199,15 +203,20 @@ namespace Gala
void switch_to_next_workspace (MotionDirection direction)
{
var screen = plugin.get_screen ();
var display = screen.get_display ();
var neighbor = screen.get_active_workspace ().get_neighbor (direction);
if (neighbor == null)
return;
neighbor.activate (display.get_current_time ());
//if we didnt switch, show a nudge-over animation
if (screen.get_active_workspace () == neighbor) {
var dest = direction == MotionDirection.LEFT ? 32.0f : -32.0f;
Compositor.get_window_group_for_screen (screen).animate (Clutter.AnimationMode.LINEAR, 100, x:dest);
Clutter.Threads.Timeout.add (210, () => {
Compositor.get_window_group_for_screen (screen).animate (Clutter.AnimationMode.LINEAR, 150, x:0.0f);
return false;
});
}
}
public override bool leave_event (Clutter.CrossingEvent event) {
@ -217,20 +226,35 @@ namespace Gala
return false;
}
uint last_time = -1;
bool released = false;
public override bool key_press_event (Clutter.KeyEvent event)
{
var display = screen.get_display ();
if (!released && display.get_current_time_roundtrip () < (last_time + AnimationSettings.get_default ().workspace_switch_duration))
return false;
switch (event.keyval) {
case Clutter.Key.Left:
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) == 1)
plugin.move_window (screen.get_display ().get_focus_window (), MotionDirection.LEFT);
plugin.move_window (display.get_focus_window (), MotionDirection.LEFT);
else
switch_to_next_workspace (MotionDirection.LEFT);
released = false;
last_time = display.get_current_time_roundtrip ();
return false;
case Clutter.Key.Right:
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) == 1)
plugin.move_window (screen.get_display ().get_focus_window (), MotionDirection.RIGHT);
plugin.move_window (display.get_focus_window (), MotionDirection.RIGHT);
else
switch_to_next_workspace (MotionDirection.RIGHT);
released = false;
last_time = display.get_current_time_roundtrip ();
return false;
default:
break;
@ -241,6 +265,8 @@ namespace Gala
public override bool key_release_event (Clutter.KeyEvent event)
{
released = true;
if (event.keyval == Clutter.Key.Alt_L ||
event.keyval == Clutter.Key.Super_L ||
event.keyval == Clutter.Key.Control_L ||
@ -294,12 +320,12 @@ namespace Gala
var screen = plugin.get_screen ();
Utils.set_input_area (screen, InputArea.FULLSCREEN);
plugin.begin_modal ();
visible = true;
grab_key_focus ();
Utils.set_input_area (screen, InputArea.FULLSCREEN);
plugin.begin_modal ();
if (wait) {
timeout = Timeout.add (1000, () => {
show_elements ();
@ -316,6 +342,7 @@ namespace Gala
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 ();
@ -347,8 +374,12 @@ namespace Gala
return false;
}); //catch hot corner hiding problem and indicator placement
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);
Compositor.get_window_group_for_screen (plugin.get_screen ()).animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : -height + 1);
wins.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : -height + 1);
}
public new void hide ()
@ -371,7 +402,10 @@ namespace Gala
click_catcher.visible = false;
Compositor.get_window_group_for_screen (plugin.get_screen ()).animate (Clutter.AnimationMode.EASE_OUT_EXPO, 500, y : 0.0f);
var wins = Compositor.get_window_group_for_screen (screen);
wins.detach_animation ();
wins.x = 0.0f;
wins.animate (Clutter.AnimationMode.EASE_OUT_EXPO, 500, y : 0.0f);
}
public void handle_switch_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,

View File

@ -1,168 +0,0 @@
/* bamf.vapi generated by vapigen, do not modify. */
[CCode (cprefix = "Bamf", lower_case_cprefix = "bamf_")]
namespace Bamf {
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_APPLICATION")]
public class Application : Bamf.View {
[CCode (has_construct_function = false)]
protected Application ();
public unowned string? get_application_type ();
public unowned string? get_desktop_file ();
public bool get_show_menu_stubs ();
public GLib.List<weak Bamf.View>? get_windows ();
public GLib.Array<uint32>? get_xids ();
public virtual signal void window_added (Bamf.View p0);
public virtual signal void window_removed (Bamf.View p0);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_CONTROL")]
public class Control : GLib.Object {
[CCode (has_construct_function = false)]
protected Control ();
public static unowned Bamf.Control get_default ();
public void insert_desktop_file (string desktop_file);
public void register_application_for_pid (string application, int32 pid);
public void register_tab_provider (string path);
public void set_approver_behavior (int32 behavior);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_INDICATOR")]
public class Indicator : Bamf.View {
[CCode (has_construct_function = false)]
protected Indicator ();
public unowned string? get_dbus_menu_path ();
public unowned string? get_remote_address ();
public unowned string? get_remote_path ();
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_MATCHER")]
public class Matcher : GLib.Object {
[CCode (has_construct_function = false)]
protected Matcher ();
public bool application_is_running (string application);
public unowned Bamf.Application? get_active_application ();
public unowned Bamf.Window? get_active_window ();
public unowned Bamf.Application? get_application_for_desktop_file (string desktop_file_path, bool create_if_not_found);
public unowned Bamf.Application? get_application_for_window (Bamf.Window window);
public unowned Bamf.Application? get_application_for_xid (uint32 xid);
public GLib.List<weak Bamf.View>? get_applications ();
public static unowned Bamf.Matcher get_default ();
public GLib.List<weak Bamf.View>? get_running_applications ();
public GLib.List<weak Bamf.View>? get_tabs ();
public GLib.List<weak Bamf.View>? get_window_stack_for_monitor (int monitor);
public GLib.List<weak Bamf.View>? get_windows ();
public GLib.Array<uint32>? get_xids_for_application (string application);
public void register_favorites ([CCode (array_length = false)] string[] favorites);
public virtual signal void active_application_changed (Bamf.View? p0, Bamf.View? p1);
public virtual signal void active_window_changed (Bamf.View? p0, Bamf.View? p1);
public virtual signal void stacking_order_changed ();
public virtual signal void view_closed (Bamf.View p0);
public virtual signal void view_opened (Bamf.View p0);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_TAB_SOURCE")]
public class TabSource : GLib.Object {
[CCode (has_construct_function = false)]
protected TabSource ();
public unowned string get_tab_ids ();
public unowned GLib.Array get_tab_preview (string tab_id);
public unowned string get_tab_uri (string tab_id);
public uint32 get_tab_xid (string tab_id);
public virtual void show_tab (string tab_id, GLib.Error error);
[NoWrapper]
public virtual unowned string tab_ids ();
[NoWrapper]
public virtual unowned GLib.Array tab_preview (string tab_id);
[NoWrapper]
public virtual unowned string tab_uri (string tab_id);
[NoWrapper]
public virtual uint32 tab_xid (string tab_id);
[NoAccessorMethod]
public string id { owned get; set construct; }
public virtual signal void tab_closed (string p0);
public virtual signal void tab_opened (string p0);
public virtual signal void tab_uri_changed (string p0, string p1, string p2);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_VIEW")]
public class View : GLib.InitiallyUnowned {
[CCode (has_construct_function = false)]
protected View ();
[NoWrapper]
public virtual Bamf.ClickBehavior click_behavior ();
public virtual GLib.List<weak Bamf.View>? get_children ();
public Bamf.ClickBehavior get_click_suggestion ();
public virtual unowned string? get_icon ();
public virtual unowned string? get_name ();
public unowned string? get_view_type ();
public virtual bool is_active ();
public bool is_closed ();
public virtual bool is_running ();
public bool is_sticky ();
public virtual bool is_urgent ();
[CCode (cname = "bamf_view_user_visible")]
public bool is_user_visible ();
[NoWrapper]
public virtual void set_path (string path);
public void set_sticky (bool value);
[NoWrapper]
public virtual unowned string view_type ();
[NoAccessorMethod]
public bool active { get; }
[NoAccessorMethod]
public string path { owned get; }
[NoAccessorMethod]
public bool running { get; }
[NoAccessorMethod]
public bool urgent { get; }
[NoAccessorMethod]
public bool user_visible { get; }
public virtual signal void active_changed (bool active);
public virtual signal void child_added (Bamf.View? child);
public virtual signal void child_removed (Bamf.View? child);
public virtual signal void closed ();
public virtual signal void name_changed (string old_name, string new_name);
public virtual signal void running_changed (bool running);
public virtual signal void urgent_changed (bool urgent);
public virtual signal void user_visible_changed (bool user_visible);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_check_function = "BAMF_IS_WINDOW")]
public class Window : Bamf.View {
[CCode (has_construct_function = false)]
protected Window ();
public int get_monitor ();
public uint32 get_pid ();
public unowned Bamf.Window? get_transient ();
public unowned string? get_utf8_prop (string prop);
public Bamf.WindowType get_window_type ();
public uint32 get_xid ();
public ulong last_active ();
public Bamf.WindowMaximizationType maximized ();
public virtual signal void maximized_changed (int old_value, int new_value);
public virtual signal void monitor_changed (int old_value, int new_value);
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_CLICK_BEHAVIOR_", has_type_id = false)]
public enum ClickBehavior {
NONE,
OPEN,
FOCUS,
FOCUS_ALL,
MINIMIZE,
RESTORE,
RESTORE_ALL,
PICKER
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_WINDOW_", has_type_id = false)]
public enum WindowMaximizationType {
FLOATING,
HORIZONTAL_MAXIMIZED,
VERTICAL_MAXIMIZED,
MAXIMIZED
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_WINDOW_", has_type_id = false)]
public enum WindowType {
NORMAL,
DESKTOP,
DOCK,
DIALOG,
TOOLBAR,
MENU,
UTILITY,
SPLASHSCREEN
}
}

View File

@ -2,13 +2,13 @@
[CCode (cprefix = "GDesktop", gir_namespace = "GDesktopEnums", gir_version = "3.0", lower_case_cprefix = "g_desktop_")]
namespace GDesktop {
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_BACKGROUND_SHADING_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_BACKGROUND_SHADING_", has_type_id = false)]
public enum BackgroundShading {
SOLID,
VERTICAL,
HORIZONTAL
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_BACKGROUND_STYLE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_BACKGROUND_STYLE_", has_type_id = false)]
public enum BackgroundStyle {
NONE,
WALLPAPER,
@ -18,30 +18,30 @@ namespace GDesktop {
ZOOM,
SPANNED
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_CLOCK_FORMAT_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_CLOCK_FORMAT_", has_type_id = false)]
public enum ClockFormat {
@24H,
@12H
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_FOCUS_MODE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_FOCUS_MODE_", has_type_id = false)]
public enum FocusMode {
CLICK,
SLOPPY,
MOUSE
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_FOCUS_NEW_WINDOWS_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_FOCUS_NEW_WINDOWS_", has_type_id = false)]
public enum FocusNewWindows {
SMART,
STRICT
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MAGNIFIER_MOUSE_TRACKING_MODE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MAGNIFIER_MOUSE_TRACKING_MODE_", has_type_id = false)]
public enum MagnifierMouseTrackingMode {
NONE,
CENTERED,
PROPORTIONAL,
PUSH
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MAGNIFIER_SCREEN_POSITION_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MAGNIFIER_SCREEN_POSITION_", has_type_id = false)]
public enum MagnifierScreenPosition {
NONE,
FULL_SCREEN,
@ -50,31 +50,31 @@ namespace GDesktop {
LEFT_HALF,
RIGHT_HALF
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MOUSE_DWELL_DIRECTION_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MOUSE_DWELL_DIRECTION_", has_type_id = false)]
public enum MouseDwellDirection {
LEFT,
RIGHT,
UP,
DOWN
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MOUSE_DWELL_MODE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_MOUSE_DWELL_MODE_", has_type_id = false)]
public enum MouseDwellMode {
WINDOW,
GESTURE
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_PROXY_MODE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_PROXY_MODE_", has_type_id = false)]
public enum ProxyMode {
NONE,
MANUAL,
AUTO
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_SCREENSAVER_MODE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_SCREENSAVER_MODE_", has_type_id = false)]
public enum ScreensaverMode {
BLANK_ONLY,
RANDOM,
SINGLE
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_TITLEBAR_ACTION_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_TITLEBAR_ACTION_", has_type_id = false)]
public enum TitlebarAction {
TOGGLE_SHADE,
TOGGLE_MAXIMIZE,
@ -85,19 +85,19 @@ namespace GDesktop {
LOWER,
MENU
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_TOOLBAR_ICON_SIZE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_TOOLBAR_ICON_SIZE_", has_type_id = false)]
public enum ToolbarIconSize {
SMALL,
LARGE
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_TOOLBAR_STYLE_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_TOOLBAR_STYLE_", has_type_id = false)]
public enum ToolbarStyle {
BOTH,
BOTH_HORIZ,
ICONS,
TEXT
}
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_VISUAL_BELL_")]
[CCode (cheader_filename = "gsettings-desktop-schemas/gdesktop-enums.h", cprefix = "G_DESKTOP_VISUAL_BELL_", has_type_id = false)]
public enum VisualBellType {
FULLSCREEN_FLASH,
FRAME_FLASH

189
vapi/libbamf3.vapi Normal file
View File

@ -0,0 +1,189 @@
/* libbamf3.vapi generated by vapigen, do not modify. */
[CCode (cprefix = "Bamf", gir_namespace = "Bamf", gir_version = "0.2", lower_case_cprefix = "bamf_")]
namespace Bamf {
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_application_get_type ()")]
public class Application : Bamf.View {
[CCode (has_construct_function = false)]
protected Application ();
public unowned string get_application_type ();
public unowned string get_desktop_file ();
public bool get_show_menu_stubs ();
public GLib.List<weak Bamf.Window> get_windows ();
public GLib.Array<uint> get_xids ();
public signal void window_added (Bamf.View object);
public signal void window_removed (Bamf.View object);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_control_get_type ()")]
public class Control : GLib.Object {
[CCode (has_construct_function = false)]
protected Control ();
public void insert_desktop_file (string desktop_file);
public void register_application_for_pid (string application, int32 pid);
public void register_tab_provider (string path);
public void set_approver_behavior (int32 behavior);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_factory_get_type ()")]
public class Factory : GLib.Object {
[CCode (has_construct_function = false)]
protected Factory ();
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_indicator_get_type ()")]
public class Indicator : Bamf.View {
[CCode (has_construct_function = false)]
protected Indicator ();
public unowned string get_dbus_menu_path ();
public unowned string get_remote_address ();
public unowned string get_remote_path ();
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_matcher_get_type ()")]
public class Matcher : GLib.Object {
[CCode (has_construct_function = false)]
protected Matcher ();
public bool application_is_running (string application);
public unowned Bamf.Application get_active_application ();
public unowned Bamf.Window get_active_window ();
public unowned Bamf.Application get_application_for_desktop_file (string desktop_file_path, bool create_if_not_found);
public unowned Bamf.Application get_application_for_window (Bamf.Window window);
public unowned Bamf.Application get_application_for_xid (uint32 xid);
public GLib.List<weak Bamf.Application> get_applications ();
public static Bamf.Matcher get_default ();
public GLib.List<weak Bamf.Application> get_running_applications ();
public GLib.List<weak Bamf.View> get_tabs ();
public GLib.List<weak Bamf.View> get_window_stack_for_monitor (int monitor);
public GLib.List<weak Bamf.View> get_windows ();
public GLib.Array<uint32> get_xids_for_application (string application);
public void register_favorites ([CCode (array_length = false)] string[] favorites);
public signal void active_application_changed (Bamf.View p0, Bamf.View p1);
public signal void active_window_changed (Bamf.View p0, Bamf.View p1);
public signal void stacking_order_changed ();
public signal void view_closed (Bamf.View p0);
public signal void view_opened (Bamf.View p0);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_tab_get_type ()")]
public class Tab : Bamf.View {
[CCode (has_construct_function = false)]
public Tab (string id, string uri);
public string get_id ();
public string get_preview ();
public string get_uri ();
public void set_preview (string uri);
public void set_uri (string uri);
public virtual void show ();
[NoAccessorMethod]
public string id { owned get; set construct; }
public string preview { owned get; set; }
public string uri { owned get; set construct; }
public virtual signal void preview_updated ();
public virtual signal void uri_changed (string new_uri, string p0);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_tab_source_get_type ()")]
public class TabSource : GLib.Object {
[CCode (has_construct_function = false)]
protected TabSource ();
public string get_tab_uri (string tab_id);
public uint32 get_tab_xid (string tab_id);
[NoWrapper]
public virtual string tab_uri (string tab_id);
[NoWrapper]
public virtual uint32 tab_xid (string tab_id);
[NoAccessorMethod]
public string id { owned get; set construct; }
public signal void tab_closed (string object);
public signal void tab_opened (string object);
public signal void tab_uri_changed (string object, string p0, string p1);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_view_get_type ()")]
public class View : GLib.InitiallyUnowned {
[CCode (has_construct_function = false)]
protected View ();
[NoWrapper]
public virtual Bamf.ClickBehavior click_behavior ();
public virtual GLib.List<weak Bamf.View> get_children ();
public Bamf.ClickBehavior get_click_suggestion ();
public virtual string get_icon ();
public virtual string get_name ();
[CCode (vfunc_name = "view_type")]
public virtual unowned string get_view_type ();
public virtual bool is_active ();
public bool is_closed ();
public virtual bool is_running ();
public bool is_sticky ();
public virtual bool is_urgent ();
[CCode (cname = "bamf_view_user_visible")]
public bool is_user_visible ();
[NoWrapper]
public virtual void set_path (string path);
public void set_sticky (bool value);
[NoAccessorMethod]
public bool active { get; }
[NoAccessorMethod]
public string path { owned get; }
[NoAccessorMethod]
public bool running { get; }
[NoAccessorMethod]
public bool urgent { get; }
[NoAccessorMethod]
public bool user_visible { get; }
public virtual signal void active_changed (bool active);
public virtual signal void child_added (Bamf.View child);
public virtual signal void child_removed (Bamf.View child);
public virtual signal void closed ();
public virtual signal void name_changed (string old_name, string new_name);
public virtual signal void running_changed (bool running);
public virtual signal void urgent_changed (bool urgent);
public virtual signal void user_visible_changed (bool user_visible);
}
[CCode (cheader_filename = "libbamf/libbamf.h", type_id = "bamf_window_get_type ()")]
public class Window : Bamf.View {
[CCode (has_construct_function = false)]
protected Window ();
public int get_monitor ();
public uint32 get_pid ();
public unowned Bamf.Window get_transient ();
public string get_utf8_prop (string prop);
public Bamf.WindowType get_window_type ();
public uint32 get_xid ();
public long last_active ();
public Bamf.WindowMaximizationType maximized ();
public virtual signal void maximized_changed (int old_value, int new_value);
public virtual signal void monitor_changed (int old_value, int new_value);
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_CLICK_BEHAVIOR_")]
public enum ClickBehavior {
NONE,
OPEN,
FOCUS,
FOCUS_ALL,
MINIMIZE,
RESTORE,
RESTORE_ALL,
PICKER
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_FACTORY_")]
public enum FactoryViewType {
VIEW,
WINDOW,
APPLICATION,
INDICATOR,
NONE
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_WINDOW_")]
public enum WindowMaximizationType {
FLOATING,
HORIZONTAL_MAXIMIZED,
VERTICAL_MAXIMIZED,
MAXIMIZED
}
[CCode (cheader_filename = "libbamf/libbamf.h", cprefix = "BAMF_WINDOW_")]
public enum WindowType {
NORMAL,
DESKTOP,
DOCK,
DIALOG,
TOOLBAR,
MENU,
UTILITY,
SPLASHSCREEN
}
}

View File

@ -445,7 +445,7 @@ namespace Meta {
public unowned string get_gtk_menubar_object_path ();
public unowned string get_gtk_unique_bus_name ();
public unowned string get_gtk_window_object_path ();
public bool get_icon_geometry (Meta.Rectangle rect);
public bool get_icon_geometry (out Meta.Rectangle rect);
public Meta.Rectangle get_input_rect ();
public Meta.StackLayer get_layer ();
public Meta.MaximizeFlags get_maximized ();
@ -677,11 +677,11 @@ namespace Meta {
public Meta.Rectangle rect;
public Meta.Side side;
}
[CCode (cheader_filename = "meta/display.h", cprefix = "META_ATOM_")]
[CCode (cheader_filename = "meta/display.h", cprefix = "META_ATOM_", type_id = "meta_atom_get_type ()")]
public enum Atom {
FIRST
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_BUTTON_FUNCTION_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_BUTTON_FUNCTION_", type_id = "meta_button_function_get_type ()")]
public enum ButtonFunction {
MENU,
MINIMIZE,
@ -695,7 +695,7 @@ namespace Meta {
UNSTICK,
LAST
}
[CCode (cheader_filename = "meta/compositor.h", cprefix = "META_COMP_EFFECT_")]
[CCode (cheader_filename = "meta/compositor.h", cprefix = "META_COMP_EFFECT_", type_id = "meta_comp_effect_get_type ()")]
public enum CompEffect {
CREATE,
UNMINIMIZE,
@ -703,7 +703,7 @@ namespace Meta {
MINIMIZE,
NONE
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_CURSOR_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_CURSOR_", type_id = "meta_cursor_get_type ()")]
public enum Cursor {
DEFAULT,
NORTH_RESIZE,
@ -717,7 +717,7 @@ namespace Meta {
MOVE_OR_RESIZE_WINDOW,
BUSY
}
[CCode (cheader_filename = "meta/util.h", cprefix = "META_DEBUG_")]
[CCode (cheader_filename = "meta/util.h", cprefix = "META_DEBUG_", type_id = "meta_debug_topic_get_type ()")]
[Flags]
public enum DebugTopic {
VERBOSE,
@ -744,7 +744,7 @@ namespace Meta {
COMPOSITOR,
EDGE_RESISTANCE
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_DIRECTION_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_DIRECTION_", type_id = "meta_direction_get_type ()")]
[Flags]
public enum Direction {
LEFT,
@ -756,18 +756,18 @@ namespace Meta {
HORIZONTAL,
VERTICAL
}
[CCode (cheader_filename = "meta/boxes.h", cprefix = "META_EDGE_")]
[CCode (cheader_filename = "meta/boxes.h", cprefix = "META_EDGE_", type_id = "meta_edge_type_get_type ()")]
public enum EdgeType {
WINDOW,
MONITOR,
SCREEN
}
[CCode (cheader_filename = "meta/main.h", cprefix = "META_EXIT_")]
[CCode (cheader_filename = "meta/main.h", cprefix = "META_EXIT_", type_id = "meta_exit_code_get_type ()")]
public enum ExitCode {
SUCCESS,
ERROR
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_FRAME_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_FRAME_", type_id = "meta_frame_flags_get_type ()")]
[Flags]
public enum FrameFlags {
ALLOWS_DELETE,
@ -788,7 +788,7 @@ namespace Meta {
TILED_LEFT,
TILED_RIGHT
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_FRAME_TYPE_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_FRAME_TYPE_", type_id = "meta_frame_type_get_type ()")]
public enum FrameType {
NORMAL,
DIALOG,
@ -801,7 +801,7 @@ namespace Meta {
[CCode (cheader_filename = "meta/main.h")]
public static unowned string to_string (Meta.FrameType type);
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_GRAB_OP_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_GRAB_OP_", type_id = "meta_grab_op_get_type ()")]
public enum GrabOp {
NONE,
MOVING,
@ -843,14 +843,14 @@ namespace Meta {
CLICKING_UNSTICK,
COMPOSITOR
}
[CCode (cheader_filename = "meta/gradient.h", cprefix = "META_GRADIENT_")]
[CCode (cheader_filename = "meta/gradient.h", cprefix = "META_GRADIENT_", type_id = "meta_gradient_type_get_type ()")]
public enum GradientType {
VERTICAL,
HORIZONTAL,
DIAGONAL,
LAST
}
[CCode (cheader_filename = "meta/prefs.h", cprefix = "META_KEYBINDING_ACTION_")]
[CCode (cheader_filename = "meta/prefs.h", cprefix = "META_KEYBINDING_ACTION_", type_id = "meta_key_binding_action_get_type ()")]
public enum KeyBindingAction {
NONE,
WORKSPACE_1,
@ -932,9 +932,10 @@ namespace Meta {
MOVE_TO_SIDE_E,
MOVE_TO_SIDE_W,
MOVE_TO_CENTER,
OVERLAY_KEY,
LAST
}
[CCode (cheader_filename = "meta/prefs.h", cprefix = "META_KEY_BINDING_")]
[CCode (cheader_filename = "meta/prefs.h", cprefix = "META_KEY_BINDING_", type_id = "meta_key_binding_flags_get_type ()")]
[Flags]
public enum KeyBindingFlags {
NONE,
@ -943,19 +944,19 @@ namespace Meta {
REVERSES,
IS_REVERSED
}
[CCode (cheader_filename = "meta/util.h", cprefix = "META_LATER_")]
[CCode (cheader_filename = "meta/util.h", cprefix = "META_LATER_", type_id = "meta_later_type_get_type ()")]
public enum LaterType {
RESIZE,
BEFORE_REDRAW,
IDLE
}
[CCode (cheader_filename = "meta/window.h", cprefix = "META_MAXIMIZE_")]
[CCode (cheader_filename = "meta/window.h", cprefix = "META_MAXIMIZE_", type_id = "meta_maximize_flags_get_type ()")]
[Flags]
public enum MaximizeFlags {
HORIZONTAL,
VERTICAL
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_MENU_OP_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_MENU_OP_", type_id = "meta_menu_op_get_type ()")]
[Flags]
public enum MenuOp {
NONE,
@ -978,13 +979,13 @@ namespace Meta {
MOVE_DOWN,
RECOVER
}
[CCode (cheader_filename = "meta/meta-plugin.h", cprefix = "META_MODAL_")]
[CCode (cheader_filename = "meta/meta-plugin.h", cprefix = "META_MODAL_", type_id = "meta_modal_options_get_type ()")]
[Flags]
public enum ModalOptions {
POINTER_ALREADY_GRABBED,
KEYBOARD_ALREADY_GRABBED
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_MOTION_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_MOTION_", type_id = "meta_motion_direction_get_type ()")]
public enum MotionDirection {
UP,
DOWN,
@ -995,7 +996,7 @@ namespace Meta {
DOWN_LEFT,
DOWN_RIGHT
}
[CCode (cheader_filename = "meta/prefs.h", cprefix = "META_PREF_")]
[CCode (cheader_filename = "meta/prefs.h", cprefix = "META_PREF_", type_id = "meta_preference_get_type ()")]
public enum Preference {
MOUSE_BUTTON_MODS,
FOCUS_MODE,
@ -1032,21 +1033,21 @@ namespace Meta {
[CCode (cheader_filename = "meta/main.h")]
public static unowned string to_string (Meta.Preference pref);
}
[CCode (cheader_filename = "meta/screen.h", cprefix = "META_SCREEN_")]
[CCode (cheader_filename = "meta/screen.h", cprefix = "META_SCREEN_", type_id = "meta_screen_corner_get_type ()")]
public enum ScreenCorner {
TOPLEFT,
TOPRIGHT,
BOTTOMLEFT,
BOTTOMRIGHT
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_SIDE_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_SIDE_", type_id = "meta_side_get_type ()")]
public enum Side {
LEFT,
RIGHT,
TOP,
BOTTOM
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_LAYER_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_LAYER_", type_id = "meta_stack_layer_get_type ()")]
public enum StackLayer {
DESKTOP,
BOTTOM,
@ -1058,19 +1059,19 @@ namespace Meta {
OVERRIDE_REDIRECT,
LAST
}
[CCode (cheader_filename = "meta/display.h", cprefix = "META_TAB_LIST_")]
[CCode (cheader_filename = "meta/display.h", cprefix = "META_TAB_LIST_", type_id = "meta_tab_list_get_type ()")]
public enum TabList {
NORMAL,
DOCKS,
GROUP,
NORMAL_ALL
}
[CCode (cheader_filename = "meta/display.h", cprefix = "META_TAB_SHOW_")]
[CCode (cheader_filename = "meta/display.h", cprefix = "META_TAB_SHOW_", type_id = "meta_tab_show_type_get_type ()")]
public enum TabShowType {
ICON,
INSTANTLY
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_VIRTUAL_")]
[CCode (cheader_filename = "meta/common.h", cprefix = "META_VIRTUAL_", type_id = "meta_virtual_modifier_get_type ()")]
[Flags]
public enum VirtualModifier {
SHIFT_MASK,
@ -1084,7 +1085,7 @@ namespace Meta {
MOD4_MASK,
MOD5_MASK
}
[CCode (cheader_filename = "meta/window.h", cprefix = "META_WINDOW_")]
[CCode (cheader_filename = "meta/window.h", cprefix = "META_WINDOW_", type_id = "meta_window_type_get_type ()")]
public enum WindowType {
NORMAL,
DESKTOP,