mirror of
https://github.com/elementary/gala.git
synced 2024-12-25 10:13:04 +03:00
Move workspace_switcher method to WorkspaceSwitcher
This commit is contained in:
parent
d3db71a6c9
commit
8f9d154973
@ -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 ();
|
||||
|
@ -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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user