diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala index 3e7936e9..6f9d1b93 100644 --- a/src/Widgets/WindowSwitcher.vala +++ b/src/Widgets/WindowSwitcher.vala @@ -26,6 +26,8 @@ public class WindowSwitcher : Clutter.Group { this.height = ICON_SIZE+spacing*2; this.opacity = 0; + this.scale_x = 0; + this.scale_gravity = Clutter.Gravity.CENTER; this.bg = new Clutter.CairoTexture (100, 100); this.bg.auto_resize = true; @@ -72,7 +74,8 @@ public class WindowSwitcher : Clutter.Group { plugin.end_modal (); current_window.activate (e.time); - this.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity:0); + this.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity:0). + completed.connect ( () => { this.scale_x = 0.0f; }); } return true; }); diff --git a/src/Widgets/WorkspaceSwitcher.vala b/src/Widgets/WorkspaceSwitcher.vala index b97c263f..735d6363 100644 --- a/src/Widgets/WorkspaceSwitcher.vala +++ b/src/Widgets/WorkspaceSwitcher.vala @@ -16,17 +16,19 @@ public class WorkspaceSwitcher : Clutter.Group { get {return _workspace;} set { _workspace = value; - cur.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, y:_workspace*len+1+spacing) - .completed.connect ( () => { - this.animate (Clutter.AnimationMode.EASE_IN_QUAD, 800, opacity:0); - }); + cur.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, y:_workspace*len+1+spacing); } } int spacing = 10; float WIDTH = 200; - public WorkspaceSwitcher (int w, int h) { + Gala.Plugin plugin; + + public WorkspaceSwitcher (Gala.Plugin plugin, int w, int h) { + + this.plugin = plugin; + this.height = 100+spacing*2; this.width = WIDTH+spacing*2; this.opacity = 0; @@ -78,5 +80,29 @@ public class WorkspaceSwitcher : Clutter.Group { this.add_child (cur); bg.add_constraint (new Clutter.BindConstraint (this, Clutter.BindCoordinate.WIDTH, 0)); bg.add_constraint (new Clutter.BindConstraint (this, Clutter.BindCoordinate.HEIGHT, 0)); + + this.key_release_event.connect ( (e) => { + if (((e.modifier_state & Clutter.ModifierType.MOD1_MASK) == 0) || + e.keyval == Clutter.Key.Alt_L) { + + plugin.end_modal (); + this.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200, opacity:0); + + return true; + } + return false; + }); + this.key_press_event.connect ( (e) => { + switch (e.keyval) { + case Clutter.Key.Up: + this.workspace = plugin.move_workspaces (true); + return false; + case Clutter.Key.Down: + this.workspace = plugin.move_workspaces (false); + return false; + default: + return true; + } + }); } } diff --git a/src/gala-plugin.vala b/src/gala-plugin.vala index 064e1c94..8eda6dfb 100644 --- a/src/gala-plugin.vala +++ b/src/gala-plugin.vala @@ -23,7 +23,7 @@ namespace Gala { int w, h; this.get_screen ().get_size (out w, out h); - this.wswitcher = new WorkspaceSwitcher (w, h); + this.wswitcher = new WorkspaceSwitcher (this, w, h); this.wswitcher.workspaces = 4; this.elements.add_child (this.wswitcher); @@ -63,18 +63,29 @@ namespace Gala { int w, h; this.get_screen ().get_size (out w, out h); - /*TODO -> bindig.get_modifiers - if ((e.xkey.state & X.KeyMask.ShiftMask) == 1) - backward = !backward;*/ this.winswitcher.list_windows (display, screen, binding, backward); this.winswitcher.x = w/2-winswitcher.width/2; this.winswitcher.y = h/2-winswitcher.height/2; this.winswitcher.grab_key_focus (); - this.winswitcher.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, opacity:255); + this.winswitcher.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, opacity:255, + scale_x:1.0F); } public void workspace_switcher (Meta.Screen screen, bool up) { + int w, h; + this.get_screen ().get_size (out w, out h); + + wswitcher.x = w/2-wswitcher.width/2; + wswitcher.y = h/2-wswitcher.height/2; + wswitcher.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, opacity:255); + wswitcher.workspace = move_workspaces (up);; + + this.begin_modal (); + wswitcher.grab_key_focus (); + } + + public int move_workspaces (bool up) { var i = screen.get_active_workspace_index (); if (up && i-1 >= 0) //move up i --; @@ -83,15 +94,8 @@ namespace Gala { if (i != screen.get_active_workspace_index ()) { screen.get_workspace_by_index (i). activate (screen.get_display ().get_current_time ()); - - int w, h; - this.get_screen ().get_size (out w, out h); - - wswitcher.x = w/2-wswitcher.width/2; - wswitcher.y = h/2-wswitcher.height/2; - wswitcher.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, opacity:255); - wswitcher.workspace = i; } + return i; } public override void minimize (Meta.WindowActor actor) { @@ -173,7 +177,8 @@ namespace Gala { private Clutter.Group out_group; public override void switch_workspace (int from, int to, Meta.MotionDirection direction) { - unowned List windows = Meta.Compositor.get_window_actors (this.get_screen ()); + unowned List windows = + Meta.Compositor.get_window_actors (this.get_screen ()); //FIXME js/ui/windowManager.js line 430 int w, h; this.get_screen ().get_size (out w, out h);