[gnome-shell] [workspaces] Don't use a clone for the window drag actor
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] [workspaces] Don't use a clone for the window drag actor
- Date: Tue, 23 Mar 2010 15:32:58 +0000 (UTC)
commit 2a740448e19ff3571cf0f9c316c545bb3ca22dab
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Fri Mar 19 16:46:08 2010 -0400
[workspaces] Don't use a clone for the window drag actor
Using a clone for the drag actor causes the animation into
the final position not to work as expected; instead use
the newly added DND parameters to change the original
drag actors size and opacity. (This reverts the change in
011db9f).
Since we are using the original actor, we have to be careful
not to change it during the drag, so don't actually position
dragged window actors in Workspace.positionWindows().
https://bugzilla.gnome.org/show_bug.cgi?id=613367
js/ui/workspace.js | 62 +++++++++++++--------------------------------------
1 files changed, 16 insertions(+), 46 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 8b570a4..9894935 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -128,53 +128,20 @@ WindowClone.prototype = {
Lang.bind(this, this._onLeave));
this._havePointer = false;
- this._draggable = DND.makeDraggable(this.actor);
+ this._draggable = DND.makeDraggable(this.actor,
+ { dragActorMaxSize: WINDOW_DND_SIZE,
+ dragActorOpacity: DRAGGING_WINDOW_OPACITY });
this._draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin));
this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd));
- this._inDrag = false;
+ this.inDrag = false;
this._zooming = false;
this._selected = false;
},
- getDragActorSource: function() {
- return this.actor;
- },
-
- getDragActor: function(x, y) {
- // We want to shrink the window down to at most THUMBNAIL_SIZE in one direction,
- // but animate that transition. The way we do this is to compute our final
- // width/height, and set that on the Clone. The clone itself will then scale
- // the source. But to animate, we need to compute a scale which will get us
- // back to the original size, and then animate down to a scale of 1.
- let scale = Math.min(WINDOW_DND_SIZE / this.realWindow.width, WINDOW_DND_SIZE / this.realWindow.height);
- let [transformedX, transformedY] = this.actor.get_transformed_position();
- let [transformedWidth, transformedHeight] = this.actor.get_transformed_size();
- let xOffset = (x - transformedX) * scale;
- let yOffset = (y - transformedY) * scale;
- let targetWidth = this.realWindow.width * scale;
- let targetHeight = this.realWindow.height * scale;
- let inverseScale;
- if (targetWidth < transformedWidth)
- inverseScale = transformedWidth / targetWidth;
- else
- inverseScale = 1;
- let actor = new Clutter.Clone({ source: this.realWindow,
- width: targetWidth,
- height: targetHeight,
- opacity: DRAGGING_WINDOW_OPACITY });
- actor.set_scale_full(inverseScale, inverseScale, xOffset, yOffset);
- Tweener.addTween(actor, { time: Overview.ANIMATION_TIME,
- transition: "easeOutQuad",
- scale_x: 1,
- scale_y: 1 });
- actor._delegate = this;
- return actor;
- },
-
setStackAbove: function (actor) {
this._stackAbove = actor;
- if (this._inDrag || this._zooming)
+ if (this.inDrag || this._zooming)
// We'll fix up the stack after the drag/zooming
return;
this.actor.raise(this._stackAbove);
@@ -204,9 +171,9 @@ WindowClone.prototype = {
if (this._zoomLightbox)
this._zoomLightbox.destroy();
- if (this._inDrag) {
+ if (this.inDrag) {
this.emit('drag-end');
- this._inDrag = false;
+ this.inDrag = false;
}
this.disconnectAll();
@@ -215,7 +182,7 @@ WindowClone.prototype = {
_onEnter: function (actor, event) {
// If the user drags faster than we can follow, he'll end up
// leaving the window temporarily and then re-entering it
- if (this._inDrag)
+ if (this.inDrag)
return;
this._havePointer = true;
@@ -224,7 +191,7 @@ WindowClone.prototype = {
_onLeave: function (actor, event) {
// If the user drags faster than we can follow, he'll end up
// leaving the window temporarily and then re-entering it
- if (this._inDrag)
+ if (this.inDrag)
return;
this._havePointer = false;
@@ -324,14 +291,12 @@ WindowClone.prototype = {
},
_onDragBegin : function (draggable, time) {
- this.actor.hide();
- this._inDrag = true;
+ this.inDrag = true;
this.emit('drag-begin');
},
_onDragEnd : function (draggable, time, snapback) {
- this._inDrag = false;
- this.actor.show();
+ this.inDrag = false;
// Most likely, the clone is going to move away from the
// pointer now. But that won't cause a leave-event, so
@@ -1135,6 +1100,11 @@ Workspace.prototype = {
let mainIndex = this._lookupIndex(metaWindow);
let overlay = this._windowOverlays[mainIndex];
+ // Positioning a window currently being dragged must be avoided;
+ // we'll just leave a blank spot in the layout for it.
+ if (clone.inDrag)
+ continue;
+
let [x, y, scale] = this._computeWindowRelativeLayout(metaWindow, slot);
if (overlay)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]