[fusion-commits] Scale addon plugin: Changes to 'master' (eee5c2c96bf4f7b47a8fac3d133eddfa90d5b037)

maniac at server.opencompositing.org maniac at server.opencompositing.org
Thu May 15 08:01:47 CEST 2008


New commits:
commit eee5c2c96bf4f7b47a8fac3d133eddfa90d5b037
Author: Danny Baumann <dannybaumann at web.de>
Date:   Thu May 15 08:00:43 2008 +0200

    Improved window pulling.
    Based on a patch by Douglas Young in bug #592.


 scaleaddon.c      |   81 ++++++++++++++++++++++++++++++++++++++++------------
 scaleaddon.xml.in |   13 ++++++++
 2 files changed, 75 insertions(+), 19 deletions(-)


Modified: fusion/plugins/scaleaddon/scaleaddon.c
===================================================================
--- fusion/plugins/scaleaddon/scaleaddon.c
+++ fusion/plugins/scaleaddon/scaleaddon.c
@@ -438,36 +438,79 @@ scaleaddonPullWindow  (CompDisplay     *d,
 
         if (w)
 	{
-	    int vx, vy;
+	    int x, y, vx, vy;
 
 	    defaultViewportForWindow (w, &vx, &vy);
 
-	    if (vx != s->x || vy != s->y)
+	    x = w->attrib.x + (s->x - vx) * s->width;
+	    y = w->attrib.y + (s->y - vy) * s->height;
+
+	    if (scaleaddonGetConstrainPullToScreen (s))
 	    {
-		int        opt, x, y;
-		CompAction *action;
-		CompOption o[1];
+	        XRectangle        workArea;
+		CompWindowExtents extents;
+
+		getWorkareaForOutput (s, outputDeviceForWindow (w), &workArea);
 
-		SCALE_DISPLAY (d);
+		extents.left   = x - w->input.left;
+		extents.right  = x + w->width + w->input.right;
+		extents.top    = y - w->input.top;
+		extents.bottom = y + w->height + w->input.bottom;
 
-		x = w->attrib.x + (s->x - vx) * s->width;
-		y = w->attrib.y + (s->y - vy) * s->height;
+		if (extents.left < workArea.x)
+		    x += workArea.x - extents.left;
+		else if (extents.right > workArea.x + workArea.width)
+		    x += workArea.x + workArea.width - extents.right;
+
+		if (extents.top < workArea.y)
+		    y += workArea.y - extents.top;
+		else if (extents.bottom > workArea.y + workArea.height)
+		    y += workArea.y + workArea.height - extents.bottom;
+	    }
+
+	    if (x != w->attrib.x || y != w->attrib.y)
+	    {
+		SCALE_WINDOW (w);
 
 		moveWindowToViewportPosition (w, x, y, TRUE);
 
-		/* Activate this window when ending scale */
-		sd->selectedWindow = w->id;
+		/* Select this window when ending scale */
+		(*ss->selectWindow) (w);
+
+		/* stop scaled window dissapearing */
+		sw->tx -= (s->x - vx) * s->width;
+		sw->ty -= (s->y - vy) * s->height;
 
-		opt = SCALE_DISPLAY_OPTION_INITIATE_KEY;
-		action = &sd->opt[opt].value.action;
+		if (scaleaddonGetExitAfterPull (s))
+		{
+		    int        opt;
+		    CompAction *action;
+		    CompOption o[1];
+
+		    SCALE_DISPLAY (d);
 
-		o[0].type    = CompOptionTypeInt;
-		o[0].name    = "root";
-		o[0].value.i = s->root;
+		    opt = SCALE_DISPLAY_OPTION_INITIATE_KEY;
+		    action = &sd->opt[opt].value.action;
 
-		if (action->terminate)
-		    (*action->terminate) (d, action, 0, o, 1);
+		    o[0].type    = CompOptionTypeInt;
+		    o[0].name    = "root";
+		    o[0].value.i = s->root;
 
+		    if (action->terminate)
+			(*action->terminate) (d, action, 0, o, 1);
+		}
+		else
+		{
+		    /* provide a simple animation */
+		    sw->tx -= (sw->slot->x2 - sw->slot->x1) / 20;
+		    sw->ty -= (sw->slot->y2 - sw->slot->y1) / 20;
+		    sw->scale *= 1.1f;
+		    sw->adjust = TRUE;
+
+		    ss->state = SCALE_STATE_OUT;
+		    damageScreen (s);
+		}
+		
 		return TRUE;
 	    }
 	}

Modified: fusion/plugins/scaleaddon/scaleaddon.xml.in
===================================================================
--- fusion/plugins/scaleaddon/scaleaddon.xml.in
+++ fusion/plugins/scaleaddon/scaleaddon.xml.in
@@ -157,6 +157,19 @@
 			<_name>Organic - EXPERIMENTAL</_name>
 		    </desc>
 		</option>
+		<subgroup>
+		    <_short>Window Pull</_short>
+		    <option name="constrain_pull_to_screen" type="bool">
+			<_short>Constrain Pull To Screen</_short>
+			<_long>Make sure windows are fully visible after pulling them to another viewport</_long>
+			<default>true</default>
+		    </option>
+		    <option name="exit_after_pull" type="bool">
+			<_short>Exit Scale On Pull</_short>
+			<_long>Exit scale mode after a window has been pulled.</_long>
+			<default>false</default>
+		    </option>
+		</subgroup>
 	    </group>
 	</screen>
     </plugin>


More information about the commits mailing list