cleanup: Port non-GObject classes to JS6 classes

ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
This commit is contained in:
Florian Müllner
2017-10-31 02:19:44 +01:00
committed by Georges Basile Stavracas Neto
parent 99ce3deeb0
commit bacfdbbb03
102 changed files with 3454 additions and 4183 deletions

View File

@ -1,17 +1,14 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
const Lang = imports.lang;
const Main = imports.ui.main;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
const DND = imports.ui.dnd;
var XdndHandler = new Lang.Class({
Name: 'XdndHandler',
_init() {
var XdndHandler = class {
constructor() {
// Used to display a clone of the cursor window when the
// window group is hidden (like it happens in the overview)
this._cursorWindowClone = null;
@ -30,7 +27,7 @@ var XdndHandler = new Lang.Class({
dnd.connect('dnd-leave', this._onLeave.bind(this));
this._windowGroupVisibilityHandlerId = 0;
},
}
// Called when the user cancels the drag (i.e release the button)
_onLeave() {
@ -44,7 +41,7 @@ var XdndHandler = new Lang.Class({
}
this.emit('drag-end');
},
}
_onEnter() {
this._windowGroupVisibilityHandlerId =
@ -52,7 +49,7 @@ var XdndHandler = new Lang.Class({
this._onWindowGroupVisibilityChanged.bind(this));
this.emit('drag-begin', global.get_current_time());
},
}
_onWindowGroupVisibilityChanged() {
if (!global.window_group.visible) {
@ -80,7 +77,7 @@ var XdndHandler = new Lang.Class({
this._cursorWindowClone = null;
}
}
},
}
_onPositionChanged(obj, x, y) {
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
@ -120,6 +117,5 @@ var XdndHandler = new Lang.Class({
pickedActor = pickedActor.get_parent();
}
}
});
};
Signals.addSignalMethods(XdndHandler.prototype);