Unverified Commit 2765a7cc authored by Erik Reider's avatar Erik Reider Committed by GitHub

Improve large notification groups performance (#669)

* Moved ExpanableGroup into its own file * Noti Group: Cull non-visible notifications + don't calc transforms every frame Makes sure that only visible notifications are allocated and rendered. Also moves the transforms on size-allocate instead of every frame. Should improve performance. :) * Fixed expandable group not re-allocating on scroll * Fixed floating notifications warning on first map
parent f26aeae2
...@@ -15,6 +15,37 @@ private struct WidgetHeights { ...@@ -15,6 +15,37 @@ private struct WidgetHeights {
private struct WidgetAlloc { private struct WidgetAlloc {
float y; float y;
int height; int height;
public WidgetAlloc () {
y = 0;
height = 0;
}
}
private class AnimationValueTarget : Object {
private double _progress = 0;
public double progress {
get {
return _progress;
}
set {
_progress = value;
cb (_progress);
}
}
public delegate void callback (double value);
private unowned callback ?cb;
public AnimationValueTarget (float init_value, callback cb) {
this._progress = init_value;
this.cb = cb;
}
public Adw.PropertyAnimationTarget get_animation_target () {
return new Adw.PropertyAnimationTarget (this, "progress");
}
} }
public class AnimatedList : Gtk.Widget, Gtk.Scrollable { public class AnimatedList : Gtk.Widget, Gtk.Scrollable {
......
...@@ -182,7 +182,7 @@ namespace SwayNotificationCenter.Widgets { ...@@ -182,7 +182,7 @@ namespace SwayNotificationCenter.Widgets {
noti_groups_name.lookup_extended (param.name_id, null, out group); noti_groups_name.lookup_extended (param.name_id, null, out group);
} }
if (group == null || ConfigModel.instance.notification_grouping == false) { if (group == null || ConfigModel.instance.notification_grouping == false) {
group = new NotificationGroup (param.name_id, param.display_name); group = new NotificationGroup (param.name_id, param.display_name, viewport);
// Collapse other groups on expand // Collapse other groups on expand
group.on_expand_change.connect ((expanded) => { group.on_expand_change.connect ((expanded) => {
if (!expanded) { if (!expanded) {
......
...@@ -68,6 +68,7 @@ app_sources = [ ...@@ -68,6 +68,7 @@ app_sources = [
'dismissableWidget/dismissableWidget.vala', 'dismissableWidget/dismissableWidget.vala',
'notification/notification.vala', 'notification/notification.vala',
'notificationGroup/notificationGroup.vala', 'notificationGroup/notificationGroup.vala',
'notificationGroup/expandableGroup.vala',
'controlCenter/controlCenter.vala', 'controlCenter/controlCenter.vala',
widget_sources, widget_sources,
'blankWindow/blankWindow.vala', 'blankWindow/blankWindow.vala',
......
...@@ -172,7 +172,7 @@ namespace SwayNotificationCenter { ...@@ -172,7 +172,7 @@ namespace SwayNotificationCenter {
} }
private void set_input_region () { private void set_input_region () {
unowned Gdk.Surface ?surface = window.get_surface (); unowned Gdk.Surface ?surface = get_surface ();
if (surface == null) { if (surface == null) {
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment