Move workspace_switcher method to WorkspaceSwitcher

This commit is contained in:
Rico Tzschichholz 2012-06-01 14:33:03 +02:00
parent d3db71a6c9
commit 8f9d154973
2 changed files with 19 additions and 16 deletions

View File

@ -79,8 +79,8 @@ namespace Gala
KeyBinding.set_custom_handler ("switch-to-workspace-left", () => {});
KeyBinding.set_custom_handler ("switch-to-workspace-right", () => {});
KeyBinding.set_custom_handler ("switch-to-workspace-up", (d, s) => workspace_switcher (s, true));
KeyBinding.set_custom_handler ("switch-to-workspace-down", (d, s) => workspace_switcher (s, false));
KeyBinding.set_custom_handler ("switch-to-workspace-up", wswitcher.handle_switch_to_workspace);
KeyBinding.set_custom_handler ("switch-to-workspace-down", wswitcher.handle_switch_to_workspace);
KeyBinding.set_custom_handler ("move-to-workspace-left", () => {});
KeyBinding.set_custom_handler ("move-to-workspace-right", () => {});
@ -164,20 +164,6 @@ namespace Gala
base.end_modal (get_screen ().get_display ().get_current_time ());
}
void workspace_switcher (Screen screen, bool up)
{
int width, height;
screen.get_size (out width, out height);
wswitcher.x = width / 2 - wswitcher.width / 2;
wswitcher.y = height / 2 - wswitcher.height / 2;
wswitcher.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, opacity:255);
wswitcher.workspace = move_workspaces (up);;
begin_modal ();
wswitcher.grab_key_focus ();
}
public int move_workspaces (bool up)
{
var i = screen.get_active_workspace_index ();

View File

@ -146,5 +146,22 @@ namespace Gala
return true;
}
public void handle_switch_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,
X.Event event, Meta.KeyBinding binding)
{
int width, height;
screen.get_size (out width, out height);
x = width / 2 - this.width / 2;
y = height / 2 - this.height / 2;
animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, opacity:255);
bool up = (binding.get_name () == "switch-to-workspace-up");
workspace = plugin.move_workspaces (up);;
plugin.begin_modal ();
grab_key_focus ();
}
}
}