Skip to content

Commit

Permalink
Merge with revealer branch
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Aug 9, 2023
2 parents ad0c314 + c9561cd commit 5933470
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/PanelWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public class Wingpanel.PanelWindow : Gtk.Window {

private Widgets.Panel panel;
private Gtk.EventControllerKey key_controller; // For keeping in memory
private Gtk.Revealer revealer;
private int monitor_number;
private int monitor_width;
private int monitor_height;
private int monitor_x;
private int monitor_y;
private int panel_height;
private bool expanded = false;
private int panel_displacement;

public PanelWindow (Gtk.Application application) {
Object (
Expand Down Expand Up @@ -77,32 +77,28 @@ public class Wingpanel.PanelWindow : Gtk.Window {
application.set_accels_for_action ("app.cycle", {"<Control>Tab"});
application.set_accels_for_action ("app.cycle-back", {"<Control><Shift>Tab"});

add (panel);
revealer = new Gtk.Revealer () {
child = panel,
reveal_child = true,
transition_type = NONE
};

child = revealer;

key_controller = new Gtk.EventControllerKey (this);
key_controller.key_pressed.connect (on_key_pressed);

panel.size_allocate.connect (update_panel_dimensions);
}

private bool animation_step () {
if (panel_displacement <= panel_height * (-1)) {
return false;
}

panel_displacement--;

update_panel_dimensions ();

return true;
}

private void on_realize () {
// realize isn't called when reveal_child is false, so we set true, then
// false, then true again to animate
revealer.reveal_child = false;
update_panel_dimensions ();

Services.BackgroundManager.initialize (this.monitor_number, panel_height);

Timeout.add (300 / panel_height, animation_step);
revealer.transition_type = SLIDE_DOWN;
revealer.reveal_child = true;
}

private void update_panel_dimensions () {
Expand All @@ -126,7 +122,7 @@ public class Wingpanel.PanelWindow : Gtk.Window {
monitor_x = monitor_dimensions.x;
monitor_y = monitor_dimensions.y;

this.move (monitor_x, monitor_y);
move (monitor_x, monitor_y);

update_struts ();
}
Expand Down

0 comments on commit 5933470

Please sign in to comment.