appDisplay: Ignore dragging over leeways

The leeways are parts of the icon that ignore incoming drag
events. This is how IconGrid and IconGridLayout treat it, and
this is how the icons should treat themselves too.

Make AppIcon ignore dragging over the left and right leeways.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
This commit is contained in:
Georges Basile Stavracas Neto 2020-05-25 16:00:23 -03:00 committed by Florian Müllner
parent 427b9ac75f
commit 8e24ac6b26

View File

@ -2212,24 +2212,37 @@ var AppIcon = GObject.registerClass({
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
} }
handleDragOver(source) { _withinLeeways(x) {
return x < IconGrid.LEFT_DIVIDER_LEEWAY ||
x > this.width - IconGrid.RIGHT_DIVIDER_LEEWAY;
}
handleDragOver(source, _actor, x) {
if (source == this) if (source == this)
return DND.DragMotionResult.NO_DROP; return DND.DragMotionResult.NO_DROP;
if (!this._canAccept(source)) if (!this._canAccept(source))
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
if (this._withinLeeways(x)) {
this._setHoveringByDnd(false);
return DND.DragMotionResult.CONTINUE;
}
this._setHoveringByDnd(true); this._setHoveringByDnd(true);
return DND.DragMotionResult.MOVE_DROP; return DND.DragMotionResult.MOVE_DROP;
} }
acceptDrop(source) { acceptDrop(source, _actor, x) {
this._setHoveringByDnd(false); this._setHoveringByDnd(false);
if (!this._canAccept(source)) if (!this._canAccept(source))
return false; return false;
if (this._withinLeeways(x))
return false;
let view = _getViewFromIcon(this); let view = _getViewFromIcon(this);
let apps = [this.id, source.id]; let apps = [this.id, source.id];