mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 15:15:39 +03:00
ShellClients: Keep PanelClone around and move HideTracker reference to PanelWindow
Preparation for using the PanelClone for smoother MultitaskingView animations on wayland
This commit is contained in:
parent
fe650bfa80
commit
6782287391
@ -11,20 +11,10 @@ public class Gala.PanelClone : Object {
|
|||||||
public WindowManager wm { get; construct; }
|
public WindowManager wm { get; construct; }
|
||||||
public PanelWindow panel { get; construct; }
|
public PanelWindow panel { get; construct; }
|
||||||
|
|
||||||
public Pantheon.Desktop.HideMode hide_mode {
|
|
||||||
get {
|
|
||||||
return hide_tracker.hide_mode;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
hide_tracker.hide_mode = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool panel_hidden { get; private set; default = false; }
|
public bool panel_hidden { get; private set; default = false; }
|
||||||
|
|
||||||
private SafeWindowClone clone;
|
private SafeWindowClone clone;
|
||||||
private Meta.WindowActor actor;
|
private Meta.WindowActor actor;
|
||||||
private HideTracker hide_tracker;
|
|
||||||
|
|
||||||
public PanelClone (WindowManager wm, PanelWindow panel) {
|
public PanelClone (WindowManager wm, PanelWindow panel) {
|
||||||
Object (wm: wm, panel: panel);
|
Object (wm: wm, panel: panel);
|
||||||
@ -45,16 +35,7 @@ public class Gala.PanelClone : Object {
|
|||||||
// but we want to keep it in sync with us
|
// but we want to keep it in sync with us
|
||||||
actor.notify["visible"].connect (update_visible);
|
actor.notify["visible"].connect (update_visible);
|
||||||
|
|
||||||
notify["panel-hidden"].connect (() => {
|
notify["panel-hidden"].connect (update_visible);
|
||||||
update_visible ();
|
|
||||||
// When hidden changes schedule an update to make sure it's actually
|
|
||||||
// correct since things might have changed during the animation
|
|
||||||
hide_tracker.schedule_update ();
|
|
||||||
});
|
|
||||||
|
|
||||||
hide_tracker = new HideTracker (wm.get_display (), panel);
|
|
||||||
hide_tracker.hide.connect (hide);
|
|
||||||
hide_tracker.show.connect (show);
|
|
||||||
|
|
||||||
update_visible ();
|
update_visible ();
|
||||||
update_clone_position ();
|
update_clone_position ();
|
||||||
@ -89,7 +70,7 @@ public class Gala.PanelClone : Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hide () {
|
public void hide () {
|
||||||
if (panel_hidden) {
|
if (panel_hidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,9 @@ public class Gala.PanelWindow : Object {
|
|||||||
public Meta.Side anchor;
|
public Meta.Side anchor;
|
||||||
|
|
||||||
private Barrier? barrier;
|
private Barrier? barrier;
|
||||||
|
private HideTracker? hide_tracker;
|
||||||
|
|
||||||
private PanelClone? clone = null;
|
private PanelClone clone;
|
||||||
|
|
||||||
private int width = -1;
|
private int width = -1;
|
||||||
private int height = -1;
|
private int height = -1;
|
||||||
@ -44,6 +45,15 @@ public class Gala.PanelWindow : Object {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.stick ();
|
window.stick ();
|
||||||
|
|
||||||
|
clone = new PanelClone (wm, this);
|
||||||
|
clone.notify["panel-hidden"].connect (() => {
|
||||||
|
// When hidden changes schedule an update to make sure it's actually
|
||||||
|
// correct since things might have changed during the animation
|
||||||
|
if (hide_tracker != null) {
|
||||||
|
hide_tracker.schedule_update ();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER46
|
#if HAS_MUTTER46
|
||||||
@ -69,14 +79,14 @@ public class Gala.PanelWindow : Object {
|
|||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
position_window ();
|
position_window ();
|
||||||
set_hide_mode (clone == null ? Pantheon.Desktop.HideMode.NEVER : clone.hide_mode); // Resetup barriers etc.
|
set_hide_mode (hide_tracker == null ? Pantheon.Desktop.HideMode.NEVER : hide_tracker.hide_mode); // Resetup barriers etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update_anchor (Meta.Side anchor) {
|
public void update_anchor (Meta.Side anchor) {
|
||||||
this.anchor = anchor;
|
this.anchor = anchor;
|
||||||
|
|
||||||
position_window ();
|
position_window ();
|
||||||
set_hide_mode (clone == null ? Pantheon.Desktop.HideMode.NEVER : clone.hide_mode); // Resetup barriers etc.
|
set_hide_mode (hide_tracker == null ? Pantheon.Desktop.HideMode.NEVER : hide_tracker.hide_mode); // Resetup barriers etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void position_window () {
|
private void position_window () {
|
||||||
@ -131,15 +141,17 @@ public class Gala.PanelWindow : Object {
|
|||||||
destroy_barrier ();
|
destroy_barrier ();
|
||||||
|
|
||||||
if (hide_mode == NEVER) {
|
if (hide_mode == NEVER) {
|
||||||
clone = null;
|
hide_tracker = null;
|
||||||
make_exclusive ();
|
make_exclusive ();
|
||||||
} else {
|
} else {
|
||||||
unmake_exclusive ();
|
unmake_exclusive ();
|
||||||
|
|
||||||
if (clone == null) {
|
if (hide_tracker == null) {
|
||||||
clone = new PanelClone (wm, this);
|
hide_tracker = new HideTracker (wm.get_display (), this);
|
||||||
|
hide_tracker.show.connect (clone.show);
|
||||||
|
hide_tracker.hide.connect (clone.hide);
|
||||||
}
|
}
|
||||||
clone.hide_mode = hide_mode;
|
hide_tracker.hide_mode = hide_mode;
|
||||||
|
|
||||||
setup_barrier ();
|
setup_barrier ();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user