mirror of
https://github.com/elementary/gala.git
synced 2024-12-25 18:24:05 +03:00
fix workspace switch animation for secondary monitor on the left
This commit is contained in:
parent
570f236c1b
commit
5c382a76d0
@ -1241,6 +1241,8 @@ namespace Gala
|
||||
var primary = screen.get_primary_monitor ();
|
||||
var move_primary_only = InternalUtils.workspaces_only_on_primary ();
|
||||
var monitor_geom = screen.get_monitor_geometry (primary);
|
||||
var clone_offset_x = move_primary_only ? monitor_geom.x : 0;
|
||||
var clone_offset_y = move_primary_only ? monitor_geom.y : 0;
|
||||
|
||||
screen.get_size (out screen_width, out screen_height);
|
||||
|
||||
@ -1255,10 +1257,10 @@ namespace Gala
|
||||
parents = new List<Clutter.Actor> ();
|
||||
tmp_actors = new List<Clutter.Clone> ();
|
||||
|
||||
tmp_actors.append (main_container);
|
||||
tmp_actors.append (in_group);
|
||||
tmp_actors.append (out_group);
|
||||
tmp_actors.append (static_windows);
|
||||
tmp_actors.prepend (main_container);
|
||||
tmp_actors.prepend (in_group);
|
||||
tmp_actors.prepend (out_group);
|
||||
tmp_actors.prepend (static_windows);
|
||||
|
||||
window_group.add_child (main_container);
|
||||
|
||||
@ -1270,24 +1272,27 @@ namespace Gala
|
||||
} else
|
||||
wallpaper = background_group;
|
||||
|
||||
windows.append (wallpaper);
|
||||
parents.append (wallpaper.get_parent ());
|
||||
windows.prepend (wallpaper);
|
||||
parents.prepend (wallpaper.get_parent ());
|
||||
|
||||
var wallpaper_clone = new Clutter.Clone (wallpaper);
|
||||
tmp_actors.append (wallpaper_clone);
|
||||
tmp_actors.prepend (wallpaper_clone);
|
||||
|
||||
// pack all containers
|
||||
clutter_actor_reparent (wallpaper, main_container);
|
||||
main_container.add_child (wallpaper_clone);
|
||||
main_container.add_child (out_group);
|
||||
main_container.add_child (in_group);
|
||||
main_container.add_child (static_windows);
|
||||
|
||||
// if we have a move action, pack that window to the static ones
|
||||
if (moving != null) {
|
||||
var moving_actor = (WindowActor) moving.get_compositor_private ();
|
||||
|
||||
windows.append (moving_actor);
|
||||
parents.append (moving_actor.get_parent ());
|
||||
windows.prepend (moving_actor);
|
||||
parents.prepend (moving_actor.get_parent ());
|
||||
|
||||
moving_actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (moving_actor, static_windows);
|
||||
}
|
||||
|
||||
@ -1295,6 +1300,7 @@ namespace Gala
|
||||
var from_has_fullscreened = false;
|
||||
var docks = new List<WindowActor> ();
|
||||
|
||||
// collect all windows and put them in the appropriate containers
|
||||
foreach (var actor in Compositor.get_window_actors (screen)) {
|
||||
if (actor.is_destroyed ())
|
||||
continue;
|
||||
@ -1310,13 +1316,14 @@ namespace Gala
|
||||
// only collect docks here that need to be displayed on both workspaces
|
||||
// all other windows will be collected below
|
||||
if (window.window_type == WindowType.DOCK) {
|
||||
docks.append (actor);
|
||||
docks.prepend (actor);
|
||||
} else {
|
||||
// windows that are on all workspaces will be faded out and back in
|
||||
windows.append (actor);
|
||||
parents.append (actor.get_parent ());
|
||||
windows.prepend (actor);
|
||||
parents.prepend (actor.get_parent ());
|
||||
clutter_actor_reparent (actor, static_windows);
|
||||
|
||||
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
actor.save_easing_state ();
|
||||
actor.set_easing_duration (300);
|
||||
actor.opacity = 0;
|
||||
@ -1329,6 +1336,7 @@ namespace Gala
|
||||
if (window.get_workspace () == workspace_from) {
|
||||
windows.append (actor);
|
||||
parents.append (actor.get_parent ());
|
||||
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (actor, out_group);
|
||||
|
||||
if (window.fullscreen)
|
||||
@ -1337,6 +1345,7 @@ namespace Gala
|
||||
} else if (window.get_workspace () == workspace_to) {
|
||||
windows.append (actor);
|
||||
parents.append (actor.get_parent ());
|
||||
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (actor, in_group);
|
||||
|
||||
if (window.fullscreen)
|
||||
@ -1352,16 +1361,17 @@ namespace Gala
|
||||
foreach (var window in docks) {
|
||||
if (!to_has_fullscreened) {
|
||||
var clone = new SafeWindowClone (window.get_meta_window ());
|
||||
clone.x = window.x;
|
||||
clone.y = window.y;
|
||||
clone.x = window.x - clone_offset_x;
|
||||
clone.y = window.y - clone_offset_y;
|
||||
|
||||
in_group.add_child (clone);
|
||||
tmp_actors.append (clone);
|
||||
tmp_actors.prepend (clone);
|
||||
}
|
||||
|
||||
if (!from_has_fullscreened) {
|
||||
windows.append (window);
|
||||
parents.append (window.get_parent ());
|
||||
windows.prepend (window);
|
||||
parents.prepend (window.get_parent ());
|
||||
window.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
|
||||
clutter_actor_reparent (window, out_group);
|
||||
}
|
||||
@ -1369,7 +1379,7 @@ namespace Gala
|
||||
|
||||
main_container.clip_to_allocation = true;
|
||||
main_container.x = move_primary_only ? monitor_geom.x : 0;
|
||||
main_container.y = move_primary_only ? monitor_geom.x : 0;
|
||||
main_container.y = move_primary_only ? monitor_geom.y : 0;
|
||||
main_container.width = move_primary_only ? monitor_geom.width : screen_width;
|
||||
main_container.height = move_primary_only ? monitor_geom.height : screen_height;
|
||||
|
||||
@ -1400,10 +1410,10 @@ namespace Gala
|
||||
wallpaper.set_easing_duration (animation_duration);
|
||||
|
||||
out_group.x = x2;
|
||||
in_group.x = move_primary_only ? monitor_geom.x : 0;
|
||||
in_group.x = 0;
|
||||
|
||||
wallpaper.x = x2;
|
||||
wallpaper_clone.x = move_primary_only ? monitor_geom.x : 0;
|
||||
wallpaper_clone.x = 0;
|
||||
wallpaper.restore_easing_state ();
|
||||
|
||||
var transition = in_group.get_transition ("x");
|
||||
@ -1423,6 +1433,7 @@ namespace Gala
|
||||
|
||||
for (var i = 0; i < windows.length (); i++) {
|
||||
var actor = windows.nth_data (i);
|
||||
actor.set_translation (0, 0, 0);
|
||||
|
||||
// to maintain the correct order of monitor, we need to insert the Background
|
||||
// back manually
|
||||
|
Loading…
Reference in New Issue
Block a user