Use explicit Clutter and Meta namespaces

This commit is contained in:
lenemter 2023-02-12 20:14:05 +09:00 committed by Corentin Noël
parent 695346006f
commit 9d3adf507e
12 changed files with 182 additions and 212 deletions

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
public class Gala.Plugins.PIP.ShadowEffect : Clutter.Effect {
public class Gala.Plugins.PIP.ShadowEffect : Clutter.Effect {
private class Shadow {
public int users;
public Cogl.Texture texture;

View File

@ -15,8 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Meta;
namespace Gala {
public enum InputArea {
NONE,
@ -26,8 +24,8 @@ namespace Gala {
public class InternalUtils {
public static bool workspaces_only_on_primary () {
return Prefs.get_dynamic_workspaces ()
&& Prefs.get_workspaces_only_on_primary ();
return Meta.Prefs.get_dynamic_workspaces ()
&& Meta.Prefs.get_workspaces_only_on_primary ();
}
private static GLib.Settings? shadow_settings = null;
@ -38,7 +36,7 @@ namespace Gala {
if (shadow_settings == null) {
shadow_settings = new GLib.Settings (Config.SCHEMA + ".shadows");
}
var factory = ShadowFactory.get_default ();
var factory = Meta.ShadowFactory.get_default ();
Meta.ShadowParams shadow;
//normal focused
@ -91,7 +89,7 @@ namespace Gala {
/**
* set the area where clutter can receive events
**/
public static void set_input_area (Display display, InputArea area) {
public static void set_input_area (Meta.Display display, InputArea area) {
if (Meta.Util.is_wayland_compositor ()) {
return;
}
@ -147,13 +145,13 @@ namespace Gala {
* @param index The index at which to insert the workspace
* @param new_window A window that should be moved to the new workspace
*/
public static void insert_workspace_with_window (int index, Window new_window) {
public static void insert_workspace_with_window (int index, Meta.Window new_window) {
unowned WorkspaceManager workspace_manager = WorkspaceManager.get_default ();
workspace_manager.freeze_remove ();
new_window.change_workspace_by_index (index, false);
unowned List<WindowActor> actors = new_window.get_display ().get_window_actors ();
unowned List<Meta.WindowActor> actors = new_window.get_display ().get_window_actors ();
foreach (unowned Meta.WindowActor actor in actors) {
if (actor.is_destroyed ())
continue;

View File

@ -4,16 +4,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
using Clutter;
using Meta;
namespace Gala {
/**
* Container for WindowIconActors which takes care of the scaling and positioning.
* It also decides whether to draw the container shape, a plus sign or an ellipsis.
* Lastly it also includes the drawing code for the active highlight.
*/
public class IconGroup : Actor {
public class IconGroup : Clutter.Actor {
public const int SIZE = 64;
const int PLUS_SIZE = 8;
@ -59,7 +56,7 @@ namespace Gala {
_active = value;
var transition = new PropertyTransition ("backdrop-opacity") {
var transition = new Clutter.PropertyTransition ("backdrop-opacity") {
duration = 300,
remove_on_complete = true
};
@ -72,20 +69,20 @@ namespace Gala {
DragDropAction drag_action;
public Workspace workspace { get; construct; }
public Meta.Workspace workspace { get; construct; }
Actor? prev_parent = null;
Actor close_button;
Actor icon_container;
Clutter.Actor? prev_parent = null;
Clutter.Actor close_button;
Clutter.Actor icon_container;
public IconGroup (Workspace workspace) {
public IconGroup (Meta.Workspace workspace) {
Object (workspace: workspace);
}
construct {
reactive = true;
var canvas = new Canvas ();
var canvas = new Clutter.Canvas ();
canvas.draw.connect (draw);
content = canvas;
@ -97,7 +94,7 @@ namespace Gala {
drag_action.notify["dragging"].connect (redraw);
add_action (drag_action);
icon_container = new Actor ();
icon_container = new Clutter.Actor ();
icon_container.width = width;
icon_container.height = height;
@ -118,7 +115,7 @@ namespace Gala {
add_child (close_button);
var close_click = new ClickAction ();
var close_click = new Clutter.ClickAction ();
close_click.clicked.connect (close);
close_button.add_action (close_click);
@ -129,13 +126,13 @@ namespace Gala {
icon_container.actor_removed.disconnect (redraw);
}
public override bool enter_event (CrossingEvent event) {
public override bool enter_event (Clutter.CrossingEvent event) {
toggle_close_button (true);
return Gdk.EVENT_PROPAGATE;
}
public override bool leave_event (CrossingEvent event) {
public override bool leave_event (Clutter.CrossingEvent event) {
if (!contains (event.related)) {
toggle_close_button (false);
}
@ -156,7 +153,7 @@ namespace Gala {
// or when there are no windows on us. For one, our method for closing
// wouldn't work anyway without windows and it's also the last workspace
// which we don't want to have closed if everything went correct
if (!Prefs.get_dynamic_workspaces () || icon_container.get_n_children () < 1 || drag_action.dragging) {
if (!Meta.Prefs.get_dynamic_workspaces () || icon_container.get_n_children () < 1 || drag_action.dragging) {
return;
}
@ -189,7 +186,7 @@ namespace Gala {
width = size;
height = size;
return ((Canvas) content).set_size (size, size);
return ((Clutter.Canvas) content).set_size (size, size);
}
void place_close_button () {
@ -243,7 +240,7 @@ namespace Gala {
* @param temporary Mark the WindowIconActor as temporary. Used for windows dragged over
* the group.
*/
public void add_window (Window window, bool no_redraw = false, bool temporary = false) {
public void add_window (Meta.Window window, bool no_redraw = false, bool temporary = false) {
var new_window = new WindowIconActor (window);
new_window.save_easing_state ();
@ -263,12 +260,12 @@ namespace Gala {
*
* @param animate Whether to fade the icon out before removing it
*/
public void remove_window (Window window, bool animate = true) {
public void remove_window (Meta.Window window, bool animate = true) {
foreach (var child in icon_container.get_children ()) {
unowned WindowIconActor w = (WindowIconActor) child;
if (w.window == window) {
if (animate) {
w.set_easing_mode (AnimationMode.LINEAR);
w.set_easing_mode (Clutter.AnimationMode.LINEAR);
w.set_easing_duration (200);
w.opacity = 0;
@ -293,7 +290,7 @@ namespace Gala {
/**
* Sets a hovered actor for the drag action.
*/
public void set_hovered_actor (Actor actor) {
public void set_hovered_actor (Clutter.Actor actor) {
drag_action.hovered = actor;
}
@ -315,8 +312,8 @@ namespace Gala {
var time = workspace.get_display ().get_current_time ();
foreach (var window in workspace.list_windows ()) {
var type = window.window_type;
if (!window.is_on_all_workspaces () && (type == WindowType.NORMAL
|| type == WindowType.DIALOG || type == WindowType.MODAL_DIALOG))
if (!window.is_on_all_workspaces () && (type == Meta.WindowType.NORMAL
|| type == Meta.WindowType.DIALOG || type == Meta.WindowType.MODAL_DIALOG))
window.@delete (time);
}
}
@ -394,7 +391,7 @@ namespace Gala {
}
if (n_windows < 1) {
if (!Prefs.get_dynamic_workspaces ()
if (!Meta.Prefs.get_dynamic_workspaces ()
|| workspace_index != manager.get_n_workspaces () - 1)
return false;
@ -489,12 +486,12 @@ namespace Gala {
return false;
}
Actor? drag_begin (float click_x, float click_y) {
Clutter.Actor? drag_begin (float click_x, float click_y) {
toggle_close_button (false);
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
if (icon_container.get_n_children () < 1 &&
Prefs.get_dynamic_workspaces () &&
Meta.Prefs.get_dynamic_workspaces () &&
workspace.index () == manager.get_n_workspaces () - 1) {
return null;
}
@ -524,7 +521,7 @@ namespace Gala {
return this;
}
void drag_end (Actor destination) {
void drag_end (Clutter.Actor destination) {
if (destination is WorkspaceInsertThumb) {
get_parent ().remove_child (this);

View File

@ -15,16 +15,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Clutter;
using Meta;
namespace Gala {
/**
* This class contains the icon groups at the bottom and will take
* care of displaying actors for inserting windows between the groups
* once implemented
*/
public class IconGroupContainer : Actor {
public class IconGroupContainer : Clutter.Actor {
public const int SPACING = 48;
public const int GROUP_WIDTH = 64;
@ -35,7 +32,7 @@ namespace Gala {
public IconGroupContainer (Meta.Display display) {
Object (display: display);
layout_manager = new BoxLayout ();
layout_manager = new Clutter.BoxLayout ();
}
public void add_group (IconGroup group) {

View File

@ -15,9 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Clutter;
using Meta;
namespace Gala {
/**
* More or less utility class to contain a WindowCloneContainer for each
@ -26,8 +23,8 @@ namespace Gala {
* as the WindowGroup is hidden while the view is active. Only used when
* workspaces-only-on-primary is set to true.
*/
public class MonitorClone : Actor {
public signal void window_selected (Window window);
public class MonitorClone : Clutter.Actor {
public signal void window_selected (Meta.Window window);
public Meta.Display display { get; construct; }
public int monitor { get; construct; }
@ -106,15 +103,15 @@ namespace Gala {
background.opacity = 255;
}
void window_left (int window_monitor, Window window) {
void window_left (int window_monitor, Meta.Window window) {
if (window_monitor != monitor)
return;
window_container.remove_window (window);
}
void window_entered (int window_monitor, Window window) {
if (window_monitor != monitor || window.window_type != WindowType.NORMAL)
void window_entered (int window_monitor, Meta.Window window) {
if (window_monitor != monitor || window.window_type != Meta.WindowType.NORMAL)
return;
window_container.add_window (window);

View File

@ -15,16 +15,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Clutter;
using Meta;
namespace Gala {
/**
* The central class for the MultitaskingView which takes care of
* preparing the wm, opening the components and holds containers for
* the icon groups, the WorkspaceClones and the MonitorClones.
*/
public class MultitaskingView : Actor, ActivatableComponent {
public class MultitaskingView : Clutter.Actor, ActivatableComponent {
public const int ANIMATION_DURATION = 250;
private const string OPEN_MULTITASKING_VIEW = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1";
@ -43,8 +40,8 @@ namespace Gala {
List<MonitorClone> window_containers_monitors;
IconGroupContainer icon_groups;
Actor workspaces;
Actor dock_clones;
Clutter.Actor workspaces;
Clutter.Actor dock_clones;
private GLib.Settings gala_behavior_settings;
@ -71,12 +68,12 @@ namespace Gala {
workspace_gesture_tracker.enable_scroll (this, Clutter.Orientation.HORIZONTAL);
workspace_gesture_tracker.on_gesture_detected.connect (on_workspace_gesture_detected);
workspaces = new Actor ();
workspaces.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
workspaces = new Clutter.Actor ();
workspaces.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
icon_groups = new IconGroupContainer (display);
dock_clones = new Actor ();
dock_clones = new Clutter.Actor ();
add_child (icon_groups);
add_child (workspaces);
@ -98,18 +95,18 @@ namespace Gala {
update_monitors ();
Meta.MonitorManager.@get ().monitors_changed.connect (update_monitors);
Prefs.add_listener ((pref) => {
if (pref == Preference.WORKSPACES_ONLY_ON_PRIMARY) {
Meta.Prefs.add_listener ((pref) => {
if (pref == Meta.Preference.WORKSPACES_ONLY_ON_PRIMARY) {
update_monitors ();
return;
}
if (Prefs.get_dynamic_workspaces () ||
(pref != Preference.DYNAMIC_WORKSPACES && pref != Preference.NUM_WORKSPACES))
if (Meta.Prefs.get_dynamic_workspaces () ||
(pref != Meta.Preference.DYNAMIC_WORKSPACES && pref != Meta.Preference.NUM_WORKSPACES))
return;
Idle.add (() => {
unowned List<Workspace> existing_workspaces = null;
unowned List<Meta.Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
existing_workspaces.append (manager.get_workspace_by_index (i));
}
@ -173,27 +170,27 @@ namespace Gala {
* Scroll through workspaces with the mouse wheel. Smooth scrolling is handled by
* GestureTracker.
*/
public override bool scroll_event (ScrollEvent scroll_event) {
public override bool scroll_event (Clutter.ScrollEvent scroll_event) {
if (!opened) {
return true;
}
if (scroll_event.direction == ScrollDirection.SMOOTH ||
scroll_event.scroll_source == ScrollSource.FINGER ||
if (scroll_event.direction == Clutter.ScrollDirection.SMOOTH ||
scroll_event.scroll_source == Clutter.ScrollSource.FINGER ||
scroll_event.get_source_device ().get_device_type () == Clutter.InputDeviceType.TOUCHPAD_DEVICE) {
return false;
}
Meta.MotionDirection direction;
switch (scroll_event.direction) {
case ScrollDirection.UP:
case ScrollDirection.LEFT:
direction = MotionDirection.LEFT;
case Clutter.ScrollDirection.UP:
case Clutter.ScrollDirection.LEFT:
direction = Meta.MotionDirection.LEFT;
break;
case ScrollDirection.DOWN:
case ScrollDirection.RIGHT:
case Clutter.ScrollDirection.DOWN:
case Clutter.ScrollDirection.RIGHT:
default:
direction = MotionDirection.RIGHT;
direction = Meta.MotionDirection.RIGHT;
break;
}
@ -387,7 +384,7 @@ namespace Gala {
if (animate) {
icon_groups.save_easing_state ();
icon_groups.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
icon_groups.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
icon_groups.set_easing_duration (200);
}
@ -424,7 +421,7 @@ namespace Gala {
// FIXME is there a better way to get the removed workspace?
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
List<Workspace> existing_workspaces = null;
List<Meta.Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
existing_workspaces.append (manager.get_workspace_by_index (i));
}
@ -483,16 +480,16 @@ namespace Gala {
toggle ();
break;
case Clutter.Key.Down:
select_window (MotionDirection.DOWN);
select_window (Meta.MotionDirection.DOWN);
break;
case Clutter.Key.Up:
select_window (MotionDirection.UP);
select_window (Meta.MotionDirection.UP);
break;
case Clutter.Key.Left:
select_window (MotionDirection.LEFT);
select_window (Meta.MotionDirection.LEFT);
break;
case Clutter.Key.Right:
select_window (MotionDirection.RIGHT);
select_window (Meta.MotionDirection.RIGHT);
break;
case Clutter.Key.Return:
case Clutter.Key.KP_Enter:
@ -512,7 +509,7 @@ namespace Gala {
*
* @param direction The direction in which to move the focus to
*/
void select_window (MotionDirection direction) {
void select_window (Meta.MotionDirection direction) {
get_active_workspace_clone ().window_container.select_next_window (direction);
}
@ -697,7 +694,7 @@ namespace Gala {
unowned Meta.Window window = actor.get_meta_window ();
var monitor = window.get_monitor ();
if (window.window_type != WindowType.DOCK)
if (window.window_type != Meta.WindowType.DOCK)
continue;
if (display.get_monitor_in_fullscreen (monitor))
@ -723,7 +720,7 @@ namespace Gala {
GestureTracker.OnBegin on_animation_begin = () => {
clone.set_position (initial_x, initial_y);
clone.set_easing_mode (AnimationMode.LINEAR);
clone.set_easing_mode (Clutter.AnimationMode.LINEAR);
};
GestureTracker.OnUpdate on_animation_update = (percentage) => {
@ -732,7 +729,7 @@ namespace Gala {
};
GestureTracker.OnEnd on_animation_end = (percentage, cancel_action) => {
clone.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
clone.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
if (cancel_action) {
return;
@ -753,7 +750,7 @@ namespace Gala {
void hide_docks (bool with_gesture, bool is_cancel_animation) {
foreach (var child in dock_clones.get_children ()) {
var dock = (Clone) child;
var dock = (Clutter.Clone) child;
var initial_y = dock.y;
var target_y = dock.source.y;
@ -768,7 +765,7 @@ namespace Gala {
}
dock.set_easing_duration (ANIMATION_DURATION);
dock.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
dock.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
dock.y = target_y;
};
@ -780,32 +777,32 @@ namespace Gala {
}
}
private bool keybinding_filter (KeyBinding binding) {
var action = Prefs.get_keybinding_action (binding.get_name ());
private bool keybinding_filter (Meta.KeyBinding binding) {
var action = Meta.Prefs.get_keybinding_action (binding.get_name ());
// allow super key only when it toggles multitasking view
if (action == KeyBindingAction.OVERLAY_KEY &&
if (action == Meta.KeyBindingAction.OVERLAY_KEY &&
gala_behavior_settings.get_string ("overlay-action") == OPEN_MULTITASKING_VIEW) {
return false;
}
switch (action) {
case KeyBindingAction.WORKSPACE_1:
case KeyBindingAction.WORKSPACE_2:
case KeyBindingAction.WORKSPACE_3:
case KeyBindingAction.WORKSPACE_4:
case KeyBindingAction.WORKSPACE_5:
case KeyBindingAction.WORKSPACE_6:
case KeyBindingAction.WORKSPACE_7:
case KeyBindingAction.WORKSPACE_8:
case KeyBindingAction.WORKSPACE_9:
case KeyBindingAction.WORKSPACE_10:
case KeyBindingAction.WORKSPACE_11:
case KeyBindingAction.WORKSPACE_12:
case KeyBindingAction.WORKSPACE_LEFT:
case KeyBindingAction.WORKSPACE_RIGHT:
case KeyBindingAction.SHOW_DESKTOP:
case KeyBindingAction.NONE:
case Meta.KeyBindingAction.WORKSPACE_1:
case Meta.KeyBindingAction.WORKSPACE_2:
case Meta.KeyBindingAction.WORKSPACE_3:
case Meta.KeyBindingAction.WORKSPACE_4:
case Meta.KeyBindingAction.WORKSPACE_5:
case Meta.KeyBindingAction.WORKSPACE_6:
case Meta.KeyBindingAction.WORKSPACE_7:
case Meta.KeyBindingAction.WORKSPACE_8:
case Meta.KeyBindingAction.WORKSPACE_9:
case Meta.KeyBindingAction.WORKSPACE_10:
case Meta.KeyBindingAction.WORKSPACE_11:
case Meta.KeyBindingAction.WORKSPACE_12:
case Meta.KeyBindingAction.WORKSPACE_LEFT:
case Meta.KeyBindingAction.WORKSPACE_RIGHT:
case Meta.KeyBindingAction.SHOW_DESKTOP:
case Meta.KeyBindingAction.NONE:
return false;
default:
break;

View File

@ -15,8 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Meta;
namespace Gala {
/**
* A clone for a MetaWindowActor that will guard against the
@ -24,7 +22,7 @@ namespace Gala {
* as soon as it gets unavailable.
*/
public class SafeWindowClone : Clutter.Clone {
public Window window { get; construct; }
public Meta.Window window { get; construct; }
/**
* If set to true, the SafeWindowClone will destroy itself when the connected
@ -38,8 +36,8 @@ namespace Gala {
* @param window The window to clone from
* @param destroy_on_unmanaged see destroy_on_unmanaged property
*/
public SafeWindowClone (Window window, bool destroy_on_unmanaged = false) {
var actor = (WindowActor) window.get_compositor_private ();
public SafeWindowClone (Meta.Window window, bool destroy_on_unmanaged = false) {
var actor = (Meta.WindowActor) window.get_compositor_private ();
Object (window: window,
source: actor,

View File

@ -15,15 +15,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Clutter;
using Meta;
namespace Gala {
/**
* Container which controls the layout of a set of WindowClones.
*/
public class WindowCloneContainer : Actor {
public signal void window_selected (Window window);
public class WindowCloneContainer : Clutter.Actor {
public signal void window_selected (Meta.Window window);
public int padding_top { get; set; default = 12; }
public int padding_left { get; set; default = 12; }
@ -55,12 +52,12 @@ namespace Gala {
*
* @param window The window for which to create the WindowClone for
*/
public void add_window (Window window) {
public void add_window (Meta.Window window) {
unowned Meta.Display display = window.get_display ();
var children = get_children ();
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
foreach (unowned Actor child in children) {
foreach (unowned Clutter.Actor child in children) {
unowned WindowClone tw = (WindowClone) child;
windows.prepend (tw.window);
}
@ -85,7 +82,7 @@ namespace Gala {
break;
}
foreach (unowned Actor child in children) {
foreach (unowned Clutter.Actor child in children) {
unowned WindowClone tw = (WindowClone) child;
if (target == tw.window) {
insert_child_above (new_window, tw);
@ -104,7 +101,7 @@ namespace Gala {
/**
* Find and remove the WindowClone for a MetaWindow
*/
public void remove_window (Window window) {
public void remove_window (Meta.Window window) {
foreach (var child in get_children ()) {
if (((WindowClone) child).window == window) {
remove_child (child);
@ -118,7 +115,7 @@ namespace Gala {
window_selected (tiled.window);
}
void window_destroyed (Actor actor) {
void window_destroyed (Clutter.Actor actor) {
var window = actor as WindowClone;
if (window == null)
return;
@ -140,7 +137,7 @@ namespace Gala {
var children = get_children ();
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
foreach (unowned Actor child in children) {
foreach (unowned Clutter.Actor child in children) {
unowned WindowClone tw = (WindowClone) child;
windows.prepend (tw.window);
}
@ -150,7 +147,7 @@ namespace Gala {
foreach (unowned Meta.Window window in windows_ordered) {
var i = 0;
foreach (unowned Actor child in children) {
foreach (unowned Clutter.Actor child in children) {
if (((WindowClone) child).window == window) {
set_child_at_index (child, i);
children.remove (child);
@ -209,7 +206,7 @@ namespace Gala {
*
* @param direction The MetaMotionDirection in which to search for windows for.
*/
public void select_next_window (MotionDirection direction) {
public void select_next_window (Meta.MotionDirection direction) {
if (get_n_children () < 1)
return;
@ -228,7 +225,7 @@ namespace Gala {
var window_rect = ((WindowClone) window).slot;
switch (direction) {
case MotionDirection.LEFT:
case Meta.MotionDirection.LEFT:
if (window_rect.x > current_rect.x)
continue;
@ -241,7 +238,7 @@ namespace Gala {
closest = (WindowClone) window;
}
break;
case MotionDirection.RIGHT:
case Meta.MotionDirection.RIGHT:
if (window_rect.x < current_rect.x)
continue;
@ -254,7 +251,7 @@ namespace Gala {
closest = (WindowClone) window;
}
break;
case MotionDirection.UP:
case Meta.MotionDirection.UP:
if (window_rect.y > current_rect.y)
continue;
@ -267,7 +264,7 @@ namespace Gala {
closest = (WindowClone) window;
}
break;
case MotionDirection.DOWN:
case Meta.MotionDirection.DOWN:
if (window_rect.y < current_rect.y)
continue;
@ -308,7 +305,7 @@ namespace Gala {
/**
* When opened the WindowClones are animated to a tiled layout
*/
public void open (Window? selected_window = null, bool with_gesture = false, bool is_cancel_animation = false) {
public void open (Meta.Window? selected_window = null, bool with_gesture = false, bool is_cancel_animation = false) {
if (opened) {
return;
}

View File

@ -15,17 +15,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Clutter;
using Meta;
namespace Gala {
/**
* Private class which is basically just a container for the actual
* icon and takes care of blending the same icon in different sizes
* over each other and various animations related to the icons
*/
public class WindowIconActor : Actor {
public Window window { get; construct; }
public class WindowIconActor : Clutter.Actor {
public Meta.Window window { get; construct; }
int icon_scale;
@ -68,24 +65,24 @@ namespace Gala {
if (_temporary && !value) {
remove_transition ("pulse");
} else if (!_temporary && value) {
var transition = new TransitionGroup () {
var transition = new Clutter.TransitionGroup () {
duration = 800,
auto_reverse = true,
repeat_count = -1,
progress_mode = AnimationMode.LINEAR
progress_mode = Clutter.AnimationMode.LINEAR
};
var opacity_transition = new PropertyTransition ("opacity");
var opacity_transition = new Clutter.PropertyTransition ("opacity");
opacity_transition.set_from_value (100);
opacity_transition.set_to_value (255);
opacity_transition.auto_reverse = true;
var scale_x_transition = new PropertyTransition ("scale-x");
var scale_x_transition = new Clutter.PropertyTransition ("scale-x");
scale_x_transition.set_from_value (0.8);
scale_x_transition.set_to_value (1.1);
scale_x_transition.auto_reverse = true;
var scale_y_transition = new PropertyTransition ("scale-y");
var scale_y_transition = new Clutter.PropertyTransition ("scale-y");
scale_y_transition.set_from_value (0.8);
scale_y_transition.set_to_value (1.1);
scale_y_transition.auto_reverse = true;
@ -106,13 +103,13 @@ namespace Gala {
WindowIcon? icon = null;
WindowIcon? old_icon = null;
public WindowIconActor (Window window) {
public WindowIconActor (Meta.Window window) {
Object (window: window);
}
construct {
set_pivot_point (0.5f, 0.5f);
set_easing_mode (AnimationMode.EASE_OUT_ELASTIC);
set_easing_mode (Clutter.AnimationMode.EASE_OUT_ELASTIC);
set_easing_duration (800);
window.notify["on-all-workspaces"].connect (on_all_workspaces_changed);
@ -157,12 +154,12 @@ namespace Gala {
void fade_new_icon () {
var scale = InternalUtils.get_ui_scaling_factor ();
var new_icon = new WindowIcon (window, icon_size, scale);
new_icon.add_constraint (new BindConstraint (this, BindCoordinate.SIZE, 0));
new_icon.add_constraint (new Clutter.BindConstraint (this, Clutter.BindCoordinate.SIZE, 0));
new_icon.opacity = 0;
add_child (new_icon);
new_icon.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
new_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
new_icon.set_easing_duration (500);
if (icon == null) {

View File

@ -15,9 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Meta;
using Clutter;
namespace Gala {
public enum WindowOverviewType {
@ -25,9 +22,9 @@ namespace Gala {
NATURAL
}
public delegate void WindowPlacer (Actor window, Meta.Rectangle rect);
public delegate void WindowPlacer (Clutter.Actor window, Meta.Rectangle rect);
public class WindowOverview : Actor, ActivatableComponent {
public class WindowOverview : Clutter.Actor, ActivatableComponent {
const int BORDER = 10;
const int TOP_GAP = 30;
const int BOTTOM_GAP = 100;
@ -39,7 +36,7 @@ namespace Gala {
bool ready;
// the workspaces which we expose right now
List<Workspace> workspaces;
List<Meta.Workspace> workspaces;
public WindowOverview (WindowManager wm) {
Object (wm : wm);
@ -103,9 +100,9 @@ namespace Gala {
var all_windows = hints != null && "all-windows" in hints;
var used_windows = new SList<Window> ();
var used_windows = new SList<Meta.Window> ();
workspaces = new List<Workspace> ();
workspaces = new List<Meta.Workspace> ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
if (all_windows) {
@ -118,16 +115,16 @@ namespace Gala {
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 != Meta.WindowType.NORMAL &&
window.window_type != Meta.WindowType.DOCK &&
window.window_type != Meta.WindowType.DIALOG ||
window.is_attached_dialog ()) {
var actor = window.get_compositor_private () as WindowActor;
var actor = window.get_compositor_private () as Meta.WindowActor;
if (actor != null)
actor.hide ();
continue;
}
if (window.window_type == WindowType.DOCK)
if (window.window_type == Meta.WindowType.DOCK)
continue;
// skip windows that are on all workspace except we're currently
@ -179,7 +176,7 @@ namespace Gala {
}
foreach (var window in windows) {
unowned WindowActor actor = window.get_compositor_private () as WindowActor;
unowned Meta.WindowActor actor = window.get_compositor_private () as Meta.WindowActor;
if (actor != null)
actor.hide ();
@ -196,17 +193,17 @@ namespace Gala {
ready = true;
}
bool keybinding_filter (KeyBinding binding) {
bool keybinding_filter (Meta.KeyBinding binding) {
var name = binding.get_name ();
return (name != "expose-windows" && name != "expose-all-windows");
}
void restack_windows (Display display) {
void restack_windows (Meta.Display display) {
foreach (var child in get_children ())
((WindowCloneContainer) child).restack_windows (display);
}
void window_left_monitor (int num, Window window) {
void window_left_monitor (int num, Meta.Window window) {
unowned WindowCloneContainer container = get_child_at_index (num) as WindowCloneContainer;
if (container == null)
return;
@ -219,9 +216,9 @@ namespace Gala {
}
}
void add_window (Window window) {
void add_window (Meta.Window window) {
if (!visible
|| (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG))
|| (window.window_type != Meta.WindowType.NORMAL && window.window_type != Meta.WindowType.DIALOG))
return;
unowned WindowCloneContainer container = get_child_at_index (window.get_monitor ()) as WindowCloneContainer;
@ -236,7 +233,7 @@ namespace Gala {
}
}
void remove_window (Window window) {
void remove_window (Meta.Window window) {
unowned WindowCloneContainer container = get_child_at_index (window.get_monitor ()) as WindowCloneContainer;
if (container == null)
return;
@ -244,7 +241,7 @@ namespace Gala {
container.remove_window (window);
}
void thumb_selected (Window window) {
void thumb_selected (Meta.Window window) {
if (window.get_workspace () == display.get_workspace_manager ().get_active_workspace ()) {
window.activate (display.get_current_time ());
close ();
@ -292,7 +289,7 @@ namespace Gala {
foreach (var window in display.get_workspace_manager ().get_active_workspace ().list_windows ())
if (window.showing_on_its_workspace ())
((Actor) window.get_compositor_private ()).show ();
((Clutter.Actor) window.get_compositor_private ()).show ();
destroy_all_children ();
}

View File

@ -15,9 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Clutter;
using Meta;
namespace Gala {
/**
* Utility class which adds a border and a shadow to a Background
@ -30,7 +27,7 @@ namespace Gala {
private int last_width;
private int last_height;
public FramedBackground (Display display) {
public FramedBackground (Meta.Display display) {
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
}
@ -117,7 +114,7 @@ namespace Gala {
* The latter is not added to the WorkspaceClone itself though but to a container
* of the MultitaskingView.
*/
public class WorkspaceClone : Actor {
public class WorkspaceClone : Clutter.Actor {
/**
* The offset of the scaled background to the bottom of the monitor bounds
*/
@ -144,7 +141,7 @@ namespace Gala {
* A window has been selected, the MultitaskingView should consider activating
* and closing the view.
*/
public signal void window_selected (Window window);
public signal void window_selected (Meta.Window window);
/**
* The background has been selected. Switch to that workspace.
@ -154,7 +151,7 @@ namespace Gala {
*/
public signal void selected (bool close_view);
public Workspace workspace { get; construct; }
public Meta.Workspace workspace { get; construct; }
public GestureTracker gesture_tracker { get; construct; }
public IconGroup icon_group { get; private set; }
public WindowCloneContainer window_container { get; private set; }
@ -179,14 +176,14 @@ namespace Gala {
uint hover_activate_timeout = 0;
public WorkspaceClone (Workspace workspace, GestureTracker gesture_tracker) {
public WorkspaceClone (Meta.Workspace workspace, GestureTracker gesture_tracker) {
Object (workspace: workspace, gesture_tracker: gesture_tracker);
}
construct {
opened = false;
unowned Display display = workspace.get_display ();
unowned Meta.Display display = workspace.get_display ();
var monitor_geometry = display.get_monitor_geometry (display.get_primary_monitor ());
background = new FramedBackground (display);
@ -236,7 +233,7 @@ namespace Gala {
// add existing windows
var windows = workspace.list_windows ();
foreach (var window in windows) {
if (window.window_type == WindowType.NORMAL
if (window.window_type == Meta.WindowType.NORMAL
&& !window.on_all_workspaces
&& window.get_monitor () == display.get_primary_monitor ()) {
window_container.add_window (window);
@ -268,8 +265,8 @@ namespace Gala {
* Add a window to the WindowCloneContainer and the IconGroup if it really
* belongs to this workspace and this monitor.
*/
void add_window (Window window) {
if (window.window_type != WindowType.NORMAL
void add_window (Meta.Window window) {
if (window.window_type != Meta.WindowType.NORMAL
|| window.get_workspace () != workspace
|| window.on_all_workspaces
|| window.get_monitor () != window.get_display ().get_primary_monitor ())
@ -286,16 +283,16 @@ namespace Gala {
/**
* Remove a window from the WindowCloneContainer and the IconGroup
*/
void remove_window (Window window) {
void remove_window (Meta.Window window) {
window_container.remove_window (window);
icon_group.remove_window (window, opened);
}
void window_entered_monitor (Display display, int monitor, Window window) {
void window_entered_monitor (Meta.Display display, int monitor, Meta.Window window) {
add_window (window);
}
void window_left_monitor (Display display, int monitor, Window window) {
void window_left_monitor (Meta.Display display, int monitor, Meta.Window window) {
if (monitor == display.get_primary_monitor ())
remove_window (window);
}
@ -389,13 +386,13 @@ namespace Gala {
save_easing_state ();
set_easing_duration (MultitaskingView.ANIMATION_DURATION);
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
set_x (target_x);
restore_easing_state ();
background.save_easing_state ();
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
background.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
background.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
background.set_scale (scale, scale);
background.restore_easing_state ();
};
@ -422,7 +419,7 @@ namespace Gala {
icon_group.redraw ();
Window? selected_window = display.get_workspace_manager ().get_active_workspace () == workspace ? display.get_focus_window () : null;
Meta.Window? selected_window = display.get_workspace_manager ().get_active_workspace () == workspace ? display.get_focus_window () : null;
window_container.open (selected_window, with_gesture, is_cancel_animation);
}
@ -459,13 +456,13 @@ namespace Gala {
save_easing_state ();
set_easing_duration (MultitaskingView.ANIMATION_DURATION);
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
set_x (target_x);
restore_easing_state ();
background.save_easing_state ();
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
background.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
background.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
background.set_scale (1, 1);
background.restore_easing_state ();
};

View File

@ -15,8 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
using Meta;
namespace Gala {
public class WorkspaceManager : Object {
public static void init (WindowManager wm) requires (instance == null) {
@ -31,7 +29,7 @@ namespace Gala {
public WindowManager wm { get; construct; }
Gee.LinkedList<Workspace> workspaces_marked_removed;
Gee.LinkedList<Meta.Workspace> workspaces_marked_removed;
int remove_freeze_count = 0;
WorkspaceManager (WindowManager wm) {
@ -39,20 +37,20 @@ namespace Gala {
}
construct {
workspaces_marked_removed = new Gee.LinkedList<Workspace> ();
workspaces_marked_removed = new Gee.LinkedList<Meta.Workspace> ();
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
// There are some empty workspace at startup
cleanup ();
if (Prefs.get_dynamic_workspaces ())
manager.override_workspace_layout (DisplayCorner.TOPLEFT, false, 1, -1);
if (Meta.Prefs.get_dynamic_workspaces ())
manager.override_workspace_layout (Meta.DisplayCorner.TOPLEFT, false, 1, -1);
for (var i = 0; i < manager.get_n_workspaces (); i++)
workspace_added (manager, i);
Prefs.add_listener (prefs_listener);
Meta.Prefs.add_listener (prefs_listener);
manager.workspace_switched.connect_after (workspace_switched);
manager.workspace_added.connect (workspace_added);
@ -61,13 +59,13 @@ namespace Gala {
display.window_left_monitor.connect (window_left_monitor);
// make sure the last workspace has no windows on it
if (Prefs.get_dynamic_workspaces ()
if (Meta.Prefs.get_dynamic_workspaces ()
&& Utils.get_n_windows (manager.get_workspace_by_index (manager.get_n_workspaces () - 1)) > 0)
append_workspace ();
}
~WorkspaceManager () {
Prefs.remove_listener (prefs_listener);
Meta.Prefs.remove_listener (prefs_listener);
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
@ -88,7 +86,7 @@ namespace Gala {
}
void workspace_removed (Meta.WorkspaceManager manager, int index) {
List<Workspace> existing_workspaces = null;
List<Meta.Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
existing_workspaces.append (manager.get_workspace_by_index (i));
}
@ -102,8 +100,8 @@ namespace Gala {
}
}
void workspace_switched (Meta.WorkspaceManager manager, int from, int to, MotionDirection direction) {
if (!Prefs.get_dynamic_workspaces ())
void workspace_switched (Meta.WorkspaceManager manager, int from, int to, Meta.MotionDirection direction) {
if (!Meta.Prefs.get_dynamic_workspaces ())
return;
// remove empty workspaces after we switched away from them unless it's the last one
@ -119,23 +117,23 @@ namespace Gala {
}
}
void window_added (Workspace? workspace, Window window) {
if (workspace == null || !Prefs.get_dynamic_workspaces ()
void window_added (Meta.Workspace? workspace, Meta.Window window) {
if (workspace == null || !Meta.Prefs.get_dynamic_workspaces ()
|| window.on_all_workspaces)
return;
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
int last_workspace = manager.get_n_workspaces () - 1;
if ((window.window_type == WindowType.NORMAL
|| window.window_type == WindowType.DIALOG
|| window.window_type == WindowType.MODAL_DIALOG)
if ((window.window_type == Meta.WindowType.NORMAL
|| window.window_type == Meta.WindowType.DIALOG
|| window.window_type == Meta.WindowType.MODAL_DIALOG)
&& workspace.index () == last_workspace)
append_workspace ();
}
void window_removed (Workspace? workspace, Window window) {
if (workspace == null || !Prefs.get_dynamic_workspaces () || window.on_all_workspaces)
void window_removed (Meta.Workspace? workspace, Meta.Window window) {
if (workspace == null || !Meta.Prefs.get_dynamic_workspaces () || window.on_all_workspaces)
return;
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
@ -143,9 +141,9 @@ namespace Gala {
bool is_active_workspace = workspace == manager.get_active_workspace ();
int last_workspace = manager.get_n_workspaces () - 1;
if (window.window_type != WindowType.NORMAL
&& window.window_type != WindowType.DIALOG
&& window.window_type != WindowType.MODAL_DIALOG)
if (window.window_type != Meta.WindowType.NORMAL
&& window.window_type != Meta.WindowType.DIALOG
&& window.window_type != Meta.WindowType.MODAL_DIALOG)
return;
// has already been removed
@ -162,13 +160,13 @@ namespace Gala {
}
}
void window_entered_monitor (Meta.Display display, int monitor, Window window) {
void window_entered_monitor (Meta.Display display, int monitor, Meta.Window window) {
if (InternalUtils.workspaces_only_on_primary ()
&& monitor == display.get_primary_monitor ())
window_added (window.get_workspace (), window);
}
void window_left_monitor (Meta.Display display, int monitor, Window window) {
void window_left_monitor (Meta.Display display, int monitor, Meta.Window window) {
if (InternalUtils.workspaces_only_on_primary ()
&& monitor == display.get_primary_monitor ())
window_removed (window.get_workspace (), window);
@ -177,7 +175,7 @@ namespace Gala {
void prefs_listener (Meta.Preference pref) {
unowned Meta.WorkspaceManager manager = wm.get_display ().get_workspace_manager ();
if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) {
if (pref == Meta.Preference.DYNAMIC_WORKSPACES && Meta.Prefs.get_dynamic_workspaces ()) {
// if the last workspace has a window, we need to append a new workspace
if (Utils.get_n_windows (manager.get_workspace_by_index (manager.get_n_workspaces () - 1)) > 0)
append_workspace ();
@ -196,19 +194,19 @@ namespace Gala {
*
* @param workspace The workspace to remove
*/
void remove_workspace (Workspace workspace) {
void remove_workspace (Meta.Workspace workspace) {
unowned Meta.Display display = workspace.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var time = display.get_current_time ();
unowned Meta.Workspace active_workspace = manager.get_active_workspace ();
if (workspace == active_workspace) {
Workspace? next = null;
Meta.Workspace? next = null;
next = workspace.get_neighbor (MotionDirection.LEFT);
next = workspace.get_neighbor (Meta.MotionDirection.LEFT);
// if it's the first one we may have another one to the right
if (next == workspace || next == null)
next = workspace.get_neighbor (MotionDirection.RIGHT);
next = workspace.get_neighbor (Meta.MotionDirection.RIGHT);
if (next != null)
next.activate (time);
@ -249,7 +247,7 @@ namespace Gala {
* cleanup after an operation that required stable workspace/window indices
*/
public void cleanup () {
if (!Prefs.get_dynamic_workspaces ())
if (!Meta.Prefs.get_dynamic_workspaces ())
return;
unowned Meta.Display display = wm.get_display ();