dnd: Hide drag actor from pick

Instead of hiding the drag actor temporarily to determine the actor
beneath it, make it invisible to picks while dragging using the new
shell_util_set_hidden_from_pick().

https://bugzilla.gnome.org/show_bug.cgi?id=634560
This commit is contained in:
Florian Müllner 2010-11-17 11:00:35 +01:00
parent 1c8955b34a
commit be6e189b49

View File

@ -267,6 +267,7 @@ _Draggable.prototype = {
this._dragActor.reparent(this.actor.get_stage()); this._dragActor.reparent(this.actor.get_stage());
this._dragActor.raise_top(); this._dragActor.raise_top();
Shell.util_set_hidden_from_pick(this._dragActor, true);
this._dragOrigOpacity = this._dragActor.opacity; this._dragOrigOpacity = this._dragActor.opacity;
if (this._dragActorOpacity != undefined) if (this._dragActorOpacity != undefined)
@ -332,12 +333,8 @@ _Draggable.prototype = {
this._dragActor.set_position(stageX + this._dragOffsetX, this._dragActor.set_position(stageX + this._dragOffsetX,
stageY + this._dragOffsetY); stageY + this._dragOffsetY);
// Because we want to find out what other actor is located at the current position of this._dragActor,
// we have to temporarily hide this._dragActor.
this._dragActor.hide();
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL, let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
stageX, stageY); stageX, stageY);
this._dragActor.show();
// We call observers only once per motion with the innermost // We call observers only once per motion with the innermost
// target actor. If necessary, the observer can walk the // target actor. If necessary, the observer can walk the
@ -384,13 +381,9 @@ _Draggable.prototype = {
}, },
_dragActorDropped: function(event) { _dragActorDropped: function(event) {
// Find a drop target. Because we want to find out what other actor is located at
// the current position of this._dragActor, we have to temporarily hide this._dragActor.
this._dragActor.hide();
let [dropX, dropY] = event.get_coords(); let [dropX, dropY] = event.get_coords();
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL, let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
dropX, dropY); dropX, dropY);
this._dragActor.show();
// We call observers only once per motion with the innermost // We call observers only once per motion with the innermost
// target actor. If necessary, the observer can walk the // target actor. If necessary, the observer can walk the
@ -522,6 +515,8 @@ _Draggable.prototype = {
}, },
_dragComplete: function() { _dragComplete: function() {
Shell.util_set_hidden_from_pick(this._dragActor, false);
this._dragActor = undefined; this._dragActor = undefined;
currentDraggable = null; currentDraggable = null;
this._ungrabEvents(); this._ungrabEvents();