mirror of
https://github.com/elementary/gala.git
synced 2024-12-30 04:34:17 +03:00
clean up a bit
This commit is contained in:
parent
13f5494bcf
commit
deaaeb0d6b
@ -240,11 +240,11 @@ namespace Gala
|
||||
if (window.get_workspace () != screen.get_active_workspace ())
|
||||
return;
|
||||
|
||||
var actor = window.get_compositor_private () as Meta.WindowActor;
|
||||
var actor = window.get_compositor_private () as Meta.WindowActor;
|
||||
if (actor == null) {
|
||||
//the window possibly hasn't reached the compositor yet
|
||||
Idle.add (() => {
|
||||
if (window.get_compositor_private () != null &&
|
||||
if (window.get_compositor_private () != null &&
|
||||
window.get_workspace () == screen.get_active_workspace ())
|
||||
add_window (window);
|
||||
return false;
|
||||
@ -252,6 +252,9 @@ namespace Gala
|
||||
return;
|
||||
}
|
||||
|
||||
if (actor.is_destroyed ())
|
||||
return;
|
||||
|
||||
actor.hide ();
|
||||
|
||||
var clone = new Clone (actor);
|
||||
@ -286,8 +289,8 @@ namespace Gala
|
||||
var meta_win = window.get_meta_window ();
|
||||
if (meta_win != null &&
|
||||
!window.is_destroyed () &&
|
||||
!meta_win.minimized &&
|
||||
(meta_win.get_workspace () == plugin.get_screen ().get_active_workspace ()) ||
|
||||
!meta_win.minimized &&
|
||||
(meta_win.get_workspace () == plugin.get_screen ().get_active_workspace ()) ||
|
||||
meta_win.is_on_all_workspaces ())
|
||||
window.show ();
|
||||
|
||||
@ -309,11 +312,13 @@ namespace Gala
|
||||
}
|
||||
|
||||
if (found != null) {
|
||||
dock.get_child_at_index (window_clones.index_of (found)).destroy ();
|
||||
window_clones.remove (found);
|
||||
remove_clone (found);
|
||||
} else
|
||||
warning ("No clone found for removed window");
|
||||
return;
|
||||
}
|
||||
|
||||
dock.get_child_at_index (window_clones.index_of (found)).destroy ();
|
||||
window_clones.remove (found);
|
||||
remove_clone (found);
|
||||
}
|
||||
|
||||
public void handle_switch_windows (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
||||
|
@ -54,7 +54,7 @@ namespace Gala
|
||||
close_button.scale_x = 0.0f;
|
||||
close_button.scale_y = 0.0f;
|
||||
close_button.scale_gravity = Gravity.CENTER;
|
||||
close_button.button_press_event.connect (close_clicked);
|
||||
close_button.button_press_event.connect (close_button_clicked);
|
||||
close_button.leave_event.connect ((e) => leave_event (e));
|
||||
|
||||
try {
|
||||
@ -68,7 +68,7 @@ namespace Gala
|
||||
stage.add_child (close_button);
|
||||
}
|
||||
|
||||
bool close_clicked (ButtonEvent event)
|
||||
bool close_button_clicked (ButtonEvent event)
|
||||
{
|
||||
if (event.button != 1)
|
||||
return false;
|
||||
@ -81,7 +81,7 @@ namespace Gala
|
||||
public void close_window ()
|
||||
{
|
||||
//make sure we dont see a window closing animation in the background
|
||||
(window.get_compositor_private () as Actor).opacity = 0;
|
||||
clone.source.opacity = 0;
|
||||
get_parent ().set_child_below_sibling (this, null);
|
||||
animate (AnimationMode.EASE_IN_CUBIC, 200, depth : -50.0f, opacity : 0).completed.connect (() => {
|
||||
destroy ();
|
||||
@ -149,7 +149,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
public void close (bool do_animate=true)
|
||||
public void close (bool do_animate = true)
|
||||
{
|
||||
unowned Meta.Rectangle rect = window.get_outer_rect ();
|
||||
|
||||
@ -162,24 +162,19 @@ namespace Gala
|
||||
//stop all running animations
|
||||
detach_animation ();
|
||||
icon.detach_animation ();
|
||||
close_button.detach_animation ();
|
||||
|
||||
if (do_animate) {
|
||||
icon.animate (AnimationMode.EASE_IN_CUBIC, 100, scale_x:0.0f, scale_y:0.0f).completed.connect ( () => {
|
||||
icon.destroy ();
|
||||
});
|
||||
icon.animate (AnimationMode.EASE_IN_CUBIC, 100, scale_x:0.0f, scale_y:0.0f);
|
||||
|
||||
animate (AnimationMode.EASE_IN_OUT_CUBIC, 300, scale_x:1.0f, scale_y:1.0f, x:dest_x, y:dest_y).completed.connect (() => {
|
||||
(window.get_compositor_private () as Actor).show ();
|
||||
clone.source.show ();
|
||||
destroy ();
|
||||
});
|
||||
} else {
|
||||
(window.get_compositor_private () as Actor).show ();
|
||||
|
||||
clone.source.show ();
|
||||
destroy ();
|
||||
icon.destroy ();
|
||||
}
|
||||
|
||||
close_button.destroy ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user