[gnome-shell/wip/carlosg/tablet-dnd-on-chrome: 2/3] dnd: Avoid breaking drag state on cancellation
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/tablet-dnd-on-chrome: 2/3] dnd: Avoid breaking drag state on cancellation
- Date: Wed, 12 Sep 2018 11:55:25 +0000 (UTC)
commit 53e4aec045859e94b2c475b769ad63d63310d467
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Sep 10 14:24:57 2018 +0200
dnd: Avoid breaking drag state on cancellation
In the case where the draggable has an actor of its own, state could be
left broken when dragging on a place that would not accept the DnD op.
After button release, drag state is set to "cancelled" and the animation
begins. After the animation is finished, the drag actor would be destroyed
before disconnecting from its destroy handler.
Within the destroy handler, the grab would be undone but drag state would
be left on "cancelled" state for subsequent operations. This results in
DnD oddities and stuck grabs.
In order to fix this, undo the grab first after the animation finishes, so
destroying the actor doesn't trigger paths meant to catch cases where
destruction happens while DnD is ongoing.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/540
js/ui/dnd.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 532da6486..5bdff14c9 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -656,6 +656,9 @@ var _Draggable = new Lang.Class({
},
_onAnimationComplete(dragActor, eventTime) {
+ this.emit('drag-end', eventTime, false);
+ this._finishAnimation();
+
if (this._dragOrigParent) {
Main.uiGroup.remove_child(this._dragActor);
this._dragOrigParent.add_actor(this._dragActor);
@@ -664,9 +667,6 @@ var _Draggable = new Lang.Class({
} else {
dragActor.destroy();
}
-
- this.emit('drag-end', eventTime, false);
- this._finishAnimation();
},
_dragComplete() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]