mirror of
https://github.com/elementary/gala.git
synced 2024-11-23 20:07:21 +03:00
pip: Hide the preview when the target window is focused (#166)
This commit is contained in:
parent
f90fc625e3
commit
c0eb426f81
@ -91,16 +91,32 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin
|
||||
var clip = rect.init (point_x, point_y, width, height);
|
||||
|
||||
var popup_window = new PopupWindow (wm, active, clip);
|
||||
popup_window.show.connect (on_popup_window_show);
|
||||
popup_window.hide.connect (on_popup_window_hide);
|
||||
add_window (popup_window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void on_popup_window_show (Clutter.Actor popup_window)
|
||||
{
|
||||
track_actor (popup_window);
|
||||
update_region ();
|
||||
}
|
||||
|
||||
private void on_popup_window_hide (Clutter.Actor popup_window)
|
||||
{
|
||||
untrack_actor (popup_window);
|
||||
update_region ();
|
||||
}
|
||||
|
||||
private void select_window_at (int x, int y)
|
||||
{
|
||||
var selected = get_window_actor_at (x, y);
|
||||
if (selected != null) {
|
||||
var popup_window = new PopupWindow (wm, selected, null);
|
||||
popup_window.show.connect (on_popup_window_show);
|
||||
popup_window.hide.connect (on_popup_window_hide);
|
||||
add_window (popup_window);
|
||||
}
|
||||
}
|
||||
@ -167,7 +183,6 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin
|
||||
{
|
||||
popup_window.closed.connect (() => remove_window (popup_window));
|
||||
windows.add (popup_window);
|
||||
track_actor (popup_window);
|
||||
wm.ui_group.add_child (popup_window);
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor
|
||||
|
||||
var window = window_actor.get_meta_window ();
|
||||
window.unmanaged.connect (on_close_click_clicked);
|
||||
window.notify["appears-focused"].connect (on_appears_focused_changed);
|
||||
|
||||
clone = new Clutter.Clone (window_actor.get_texture ());
|
||||
|
||||
@ -153,6 +154,22 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor
|
||||
set_easing_duration (0);
|
||||
}
|
||||
|
||||
public override void hide ()
|
||||
{
|
||||
opacity = 255;
|
||||
|
||||
set_easing_duration (200);
|
||||
opacity = 0;
|
||||
|
||||
set_easing_duration (0);
|
||||
|
||||
ulong completed_id = 0UL;
|
||||
completed_id = transitions_completed.connect (() => {
|
||||
disconnect (completed_id);
|
||||
base.hide ();
|
||||
});
|
||||
}
|
||||
|
||||
public override bool enter_event (Clutter.CrossingEvent event)
|
||||
{
|
||||
close_button.opacity = 255;
|
||||
@ -265,6 +282,16 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor
|
||||
});
|
||||
}
|
||||
|
||||
private void on_appears_focused_changed ()
|
||||
{
|
||||
var window = window_actor.get_meta_window ();
|
||||
if (window.appears_focused) {
|
||||
hide ();
|
||||
} else {
|
||||
show ();
|
||||
}
|
||||
}
|
||||
|
||||
private void update_size ()
|
||||
{
|
||||
if (container_clip != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user