environment: Add Meta.Rectangle compatibility

Meta.Rectangle was replaced by Mtk.Rectangle. Mutter defines a
typedef for compatibility, but it turns out that gjs fails to
pick it up.

Work around that by adding a small compatibility function
that prints a deprecation warning and returns the expected
Mtk.Rectangle.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2930>
This commit is contained in:
Florian Müllner 2023-08-31 19:40:43 +02:00 committed by Marge Bot
parent d9bc474dea
commit f1317f07db

View File

@ -10,6 +10,7 @@ import Gio from 'gi://Gio';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Meta from 'gi://Meta'; import Meta from 'gi://Meta';
import Mtk from 'gi://Mtk';
import Polkit from 'gi://Polkit'; import Polkit from 'gi://Polkit';
import Shell from 'gi://Shell'; import Shell from 'gi://Shell';
import St from 'gi://St'; import St from 'gi://St';
@ -322,6 +323,11 @@ Object.defineProperty(Clutter.Actor.prototype, 'actor', {
}, },
}); });
Meta.Rectangle = function (params = {}) {
console.warn('Meta.Rectangle is deprecated, use Mtk.Rectangle instead');
return new Mtk.Rectangle(params);
};
Gio.File.prototype.touch_async = function (callback) { Gio.File.prototype.touch_async = function (callback) {
Shell.util_touch_file_async(this, callback); Shell.util_touch_file_async(this, callback);
}; };