[gnome-shell] dnd: fix a case where ungrabEvents wasn't being called
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] dnd: fix a case where ungrabEvents wasn't being called
- Date: Fri, 19 Nov 2010 20:10:57 +0000 (UTC)
commit b7c1400eb374d3f0cd3adff7f98996af8ccf2a0d
Author: Dan Winship <danw gnome org>
Date: Fri Nov 19 11:09:48 2010 -0500
dnd: fix a case where ungrabEvents wasn't being called
If the drag actor is destroyed as part of a drag target accepting it,
we were not calling ungrabEvents, meaning the mouse/keyboard remained
grabbed until you clicked somewhere to cancel it.
This fixes that without trying to improve the extremely confusing
control flow...
https://bugzilla.gnome.org/show_bug.cgi?id=635278
js/ui/dnd.js | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index c4ba7fd..66f4680 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -100,6 +100,8 @@ _Draggable.prototype = {
this._buttonDown = false; // The mouse button has been pressed and has not yet been released.
this._dragInProgress = false; // The drag has been started, and has not been dropped or cancelled yet.
this._animationInProgress = false; // The drag is over and the item is in the process of animating to its original position (snapping back or reverting).
+
+ this._eventsGrabbed = false;
},
_onButtonPress : function (actor, event) {
@@ -147,13 +149,19 @@ _Draggable.prototype = {
},
_grabEvents: function() {
- Clutter.grab_pointer(_getEventHandlerActor());
- Clutter.grab_keyboard(_getEventHandlerActor());
+ if (!this._eventsGrabbed) {
+ Clutter.grab_pointer(_getEventHandlerActor());
+ Clutter.grab_keyboard(_getEventHandlerActor());
+ this._eventsGrabbed = true;
+ }
},
_ungrabEvents: function() {
- Clutter.ungrab_pointer();
- Clutter.ungrab_keyboard();
+ if (this._eventsGrabbed) {
+ Clutter.ungrab_pointer();
+ Clutter.ungrab_keyboard();
+ this._eventsGrabbed = false;
+ }
},
_onEvent: function(actor, event) {
@@ -476,6 +484,8 @@ _Draggable.prototype = {
if (this._actorDestroyed) {
global.unset_cursor();
+ if (!this._buttonDown)
+ this._ungrabEvents();
this.emit('drag-end', eventTime, false);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]