diff --git a/src/Services/PopoverManager.vala b/src/Services/PopoverManager.vala index a690cf5a..f569c460 100644 --- a/src/Services/PopoverManager.vala +++ b/src/Services/PopoverManager.vala @@ -17,12 +17,19 @@ * Boston, MA 02110-1301 USA. */ +[DBus (name = "org.pantheon.gala")] +public interface WMDBus : GLib.Object { + public abstract async void offset_notifications (int32 offset) throws DBusError, Error; +} + public class Wingpanel.Services.PopoverManager : Object { private unowned Wingpanel.PanelWindow? owner; private bool grabbed = false; // whether the wingpanel grabbed focus private bool mousing = false; + private WMDBus? wm = null; + private Gee.HashMap registered_indicators; private Wingpanel.Widgets.IndicatorPopover popover; private Wingpanel.Widgets.IndicatorEntry? _current_indicator = null; @@ -59,10 +66,12 @@ public class Wingpanel.Services.PopoverManager : Object { owner.present (); popover.popup (); popover.show_all (); + offset_notifications (popover); _current_indicator.base_indicator.opened (); } else { update_has_tooltip (((Wingpanel.Widgets.IndicatorEntry)popover.get_relative_to ()).display_widget); popover.popdown (); + offset_notifications (); } } } @@ -72,6 +81,12 @@ public class Wingpanel.Services.PopoverManager : Object { this.owner = owner; + try { + this.wm = Bus.get_proxy_sync (BusType.SESSION, "org.pantheon.gala", "/org/pantheon/gala"); + } catch (Error e) { + warning ("Could not connect to dbus org.pantheon.gala"); + } + popover = new Wingpanel.Widgets.IndicatorPopover (); popover.leave_notify_event.connect ((e) => { @@ -238,4 +253,22 @@ public class Wingpanel.Services.PopoverManager : Object { } }); } + + private void offset_notifications (Wingpanel.Widgets.IndicatorPopover? popover = null) { + int offset = 0; + if (popover != null + && current_indicator.base_indicator.code_name != Indicator.APP_LAUNCHER + && current_indicator.base_indicator.code_name != Indicator.DATETIME) { + + popover.get_preferred_height (null, out offset); + } + + wm.offset_notifications.begin (offset, (obj, res) => { + try { + wm.offset_notifications.end (res); + } catch (Error e) { + warning ("Could not offset notifications: %s", e.message); + } + }); + } }