Skip to content

Commit

Permalink
Use separate variable for stack offset
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-janssen committed Mar 29, 2023
1 parent 6caef64 commit d794bc6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/NotificationStack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ public class Gala.NotificationStack : Object {

// we need to keep a small offset to the top, because we clip the container to
// its allocations and the close button would be off for the first notification
private int TOP_OFFSET = 2;
private const int TOP_OFFSET = 2;
private const int ADDITIONAL_MARGIN = 12;
private const int MARGIN = 12;

private const int WIDTH = 300;

private int stack_y;
private int stack_y_offset;
private int stack_width;

public Meta.Display display { get; construct; }
Expand Down Expand Up @@ -105,7 +106,7 @@ public class Gala.NotificationStack : Object {

private void update_positions (bool animate, float add_y = 0.0f) {
var scale = Utils.get_ui_scaling_factor ();
var y = stack_y + TOP_OFFSET + add_y + ADDITIONAL_MARGIN * scale;
var y = stack_y + TOP_OFFSET + stack_y_offset + add_y + ADDITIONAL_MARGIN * scale;
var i = notifications.size;
var delay_step = i > 0 ? 150 / i : 0;
var iterator = 0;
Expand Down Expand Up @@ -147,7 +148,7 @@ public class Gala.NotificationStack : Object {
}

public void offset_notifications (int32 offset) {
TOP_OFFSET = 2 + offset;
stack_y_offset = offset;
update_positions (true);
}

Expand Down

0 comments on commit d794bc6

Please sign in to comment.