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:
Leonhard Kargl 2024-05-26 20:16:57 +02:00
parent fe650bfa80
commit 6782287391
2 changed files with 21 additions and 28 deletions

View File

@ -11,20 +11,10 @@ public class Gala.PanelClone : Object {
public WindowManager wm { 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; }
private SafeWindowClone clone;
private Meta.WindowActor actor;
private HideTracker hide_tracker;
public PanelClone (WindowManager wm, PanelWindow 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
actor.notify["visible"].connect (update_visible);
notify["panel-hidden"].connect (() => {
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);
notify["panel-hidden"].connect (update_visible);
update_visible ();
update_clone_position ();
@ -89,7 +70,7 @@ public class Gala.PanelClone : Object {
}
}
private void hide () {
public void hide () {
if (panel_hidden) {
return;
}

View File

@ -18,8 +18,9 @@ public class Gala.PanelWindow : Object {
public Meta.Side anchor;
private Barrier? barrier;
private HideTracker? hide_tracker;
private PanelClone? clone = null;
private PanelClone clone;
private int width = -1;
private int height = -1;
@ -44,6 +45,15 @@ public class Gala.PanelWindow : Object {
});
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
@ -69,14 +79,14 @@ public class Gala.PanelWindow : Object {
this.height = height;
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) {
this.anchor = anchor;
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 () {
@ -131,15 +141,17 @@ public class Gala.PanelWindow : Object {
destroy_barrier ();
if (hide_mode == NEVER) {
clone = null;
hide_tracker = null;
make_exclusive ();
} else {
unmake_exclusive ();
if (clone == null) {
clone = new PanelClone (wm, this);
if (hide_tracker == null) {
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 ();
}