notify: Make it build with Mutter >= 3.30 (#708)

The previous modification didn't took the API changes from 3.30, this commit resolves this issue.
This commit is contained in:
Corentin Noël 2020-01-15 19:44:25 +01:00 committed by Daniel Foré
parent 7b4246d583
commit 2aa417cdb1
3 changed files with 30 additions and 1 deletions

View File

@ -47,8 +47,13 @@ namespace Gala.Plugins.Notify {
freeze_track = running;
});
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed_internal.connect (update_position);
display.workareas_changed.connect (update_position);
#else
screen.monitors_changed.connect (update_position);
screen.workareas_changed.connect (update_position);
#endif
server = new NotifyServer (stack);

View File

@ -29,19 +29,34 @@ public class Gala.NotificationStack : Object {
private int stack_y;
private int stack_width;
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Meta.Screen screen { get; construct; }
#endif
private Gee.ArrayList<unowned Meta.WindowActor> notifications;
#if HAS_MUTTER330
public NotificationStack (Meta.Display display) {
Object (display: display);
}
#else
public NotificationStack (Meta.Screen screen) {
Object (screen: screen);
}
#endif
construct {
notifications = new Gee.ArrayList<Meta.WindowActor> ();
notifications = new Gee.ArrayList<unowned Meta.WindowActor> ();
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed_internal.connect (update_stack_allocation);
display.workareas_changed.connect (update_stack_allocation);
#else
screen.monitors_changed.connect (update_stack_allocation);
screen.workareas_changed.connect (update_stack_allocation);
#endif
update_stack_allocation ();
}
@ -83,8 +98,13 @@ public class Gala.NotificationStack : Object {
}
private void update_stack_allocation () {
#if HAS_MUTTER330
var primary = display.get_primary_monitor ();
var area = display.get_workspace_manager ().get_active_workspace ().get_work_area_for_monitor (primary);
#else
var primary = screen.get_primary_monitor ();
var area = screen.get_active_workspace ().get_work_area_for_monitor (primary);
#endif
var scale = Utils.get_ui_scaling_factor ();
stack_width = (WIDTH + MARGIN) * scale;

View File

@ -161,7 +161,11 @@ namespace Gala {
#endif
KeyboardManager.init (display);
#if HAS_MUTTER330
notification_stack = new NotificationStack (display);
#else
notification_stack = new NotificationStack (screen);
#endif
// Due to a bug which enables access to the stage when using multiple monitors
// in the screensaver, we have to listen for changes and make sure the input area