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

maniac at server.opencompositing.org maniac at server.opencompositing.org
Mon May 12 18:21:59 CEST 2008


New commits:
commit 7411db7999937154525c73026a707375bbfa9ceb
Author: Danny Baumann <dannybaumann at web.de>
Date:   Mon May 12 16:03:56 2008 +0200

    More description fixup.

commit 626ad92cbb8d6ed1ce6153916cd02097ea24a29e
Author: Danny Baumann <dannybaumann at web.de>
Date:   Mon May 12 16:03:09 2008 +0200

    Improve descriptions.

commit 5c3dccfb7f5eb379a17647238e5cdcadff1c36b1
Author: Danny Baumann <dannybaumann at web.de>
Date:   Mon May 12 16:02:06 2008 +0200

    Fixup indention.

commit 506abfb3fa496f98cf447f52132be2dd398e1245
Author: Danny Baumann <dannybaumann at web.de>
Date:   Mon May 12 15:56:11 2008 +0200

    Added bindings for pulling windows to the current viewport.


 scaleaddon.c      |   76 +++++++++++++
 scaleaddon.xml.in |  309 ++++++++++++++++++++++++++++-------------------------
 2 files changed, 237 insertions(+), 148 deletions(-)


Modified: fusion/plugins/scaleaddon/scaleaddon.c
===================================================================
--- fusion/plugins/scaleaddon/scaleaddon.c
+++ fusion/plugins/scaleaddon/scaleaddon.c
@@ -407,6 +407,76 @@ scaleaddonCloseWindow (CompDisplay     *d,
 }
 
 static Bool
+scaleaddonPullWindow  (CompDisplay     *d,
+	               CompAction      *action,
+		       CompActionState state,
+		       CompOption      *option,
+		       int             nOption)
+{
+    CompScreen *s;
+    Window     xid;
+
+    xid = getIntOptionNamed (option, nOption, "root", 0);
+
+    s = findScreenAtDisplay (d, xid);
+    if (s)
+    {
+	CompWindow *w;
+
+	SCALE_SCREEN (s);
+
+	if (!ss->grabIndex)
+	    return FALSE;
+
+	if (state & CompActionStateInitKey)
+	{
+	    SCALE_DISPLAY (d);
+	    w = findWindowAtDisplay (d, sd->hoveredWindow);
+	}
+	else
+	    w = scaleaddonCheckForWindowAt (s, pointerX, pointerY);
+
+        if (w)
+	{
+	    int vx, vy;
+
+	    defaultViewportForWindow (w, &vx, &vy);
+
+	    if (vx != s->x || vy != s->y)
+	    {
+		int        opt, x, y;
+		CompAction *action;
+		CompOption o[1];
+
+		SCALE_DISPLAY (d);
+
+		x = w->attrib.x + (s->x - vx) * s->width;
+		y = w->attrib.y + (s->y - vy) * s->height;
+
+		moveWindowToViewportPosition (w, x, y, TRUE);
+
+		/* Activate this window when ending scale */
+		sd->selectedWindow = w->id;
+
+		opt = SCALE_DISPLAY_OPTION_INITIATE_KEY;
+		action = &sd->opt[opt].value.action;
+
+		o[0].type    = CompOptionTypeInt;
+		o[0].name    = "root";
+		o[0].value.i = s->root;
+
+		if (action->terminate)
+		    (*action->terminate) (d, action, 0, o, 1);
+
+		return TRUE;
+	    }
+	}
+    }
+
+    return FALSE;
+}
+
+static Bool
 scaleaddonZoomWindow (CompDisplay     *d,
 		      CompAction      *action,
 		      CompActionState state,
@@ -671,8 +741,10 @@ scaleaddonHandleCompizEvent (CompDisplay *d,
 	    {
 		addScreenAction (s, scaleaddonGetCloseKey (d));
 		addScreenAction (s, scaleaddonGetZoomKey (d));
+		addScreenAction (s, scaleaddonGetPullKey (d));
 		addScreenAction (s, scaleaddonGetCloseButton (d));
 		addScreenAction (s, scaleaddonGetZoomButton (d));
+		addScreenAction (s, scaleaddonGetPullButton (d));
 
 		/* TODO: or better
 		   ad->highlightedWindow     = sd->selectedWindow;
@@ -695,8 +767,10 @@ scaleaddonHandleCompizEvent (CompDisplay *d,
 
 		removeScreenAction (s, scaleaddonGetCloseKey (d));
 		removeScreenAction (s, scaleaddonGetZoomKey (d));
+		removeScreenAction (s, scaleaddonGetPullKey (d));
 		removeScreenAction (s, scaleaddonGetCloseButton (d));
 		removeScreenAction (s, scaleaddonGetZoomButton (d));
+		removeScreenAction (s, scaleaddonGetPullButton (d));
 	    }
 	}
     }
@@ -1193,8 +1267,10 @@ scaleaddonInitDisplay (CompPlugin  *p,
 
     scaleaddonSetCloseKeyInitiate (d, scaleaddonCloseWindow);
     scaleaddonSetZoomKeyInitiate (d, scaleaddonZoomWindow);
+    scaleaddonSetPullKeyInitiate (d, scaleaddonPullWindow);
     scaleaddonSetCloseButtonInitiate (d, scaleaddonCloseWindow);
     scaleaddonSetZoomButtonInitiate (d, scaleaddonZoomWindow);
+    scaleaddonSetPullButtonInitiate (d, scaleaddonPullWindow);
 
     return TRUE;
 }

Modified: fusion/plugins/scaleaddon/scaleaddon.xml.in
===================================================================
--- fusion/plugins/scaleaddon/scaleaddon.xml.in
+++ fusion/plugins/scaleaddon/scaleaddon.xml.in
@@ -1,150 +1,163 @@
 <compiz>
-	<plugin name="scaleaddon" useBcop="true">
-		<_short>Scale Addons</_short>
-		<_long>Some useful additions to the scale plugin</_long>
-		<category>Utility</category>
-		<deps>
-			<relation type="after">
-				<plugin>scale</plugin>
-				<plugin>text</plugin>
-			</relation>
-			<requirement>
-				<plugin>scale</plugin>
-			</requirement>
-		</deps>
-		<display>
-			<group>
-			    <_short>Bindings</_short>
-			    <option name="close_key" type="key">
-					<_short>Close Windows In Scale</_short>
-					<_long>Close windows while in scale mode</_long>
-					<passive_grab>false</passive_grab>
-					<internal/>
-			    </option>
-			    <option name="close_button" type="button">
-					<_short>Close Windows In Scale</_short>
-					<_long>Close windows while in scale mode</_long>
-					<passive_grab>false</passive_grab>
-					<default>Button2</default>
-					<internal/>
-			    </option>
-			    <option name="zoom_key" type="key">
-					<_short>Zoom Windows In Scale</_short>
-					<_long>Zoom windows while in scale mode</_long>
-					<passive_grab>false</passive_grab>
-					<internal/>
-			    </option>
-			    <option name="zoom_button" type="button">
-					<_short>Zoom Windows In Scale</_short>
-					<_long>Zoom windows while in scale mode</_long>
-					<passive_grab>false</passive_grab>
-					<default>Button3</default>
-					<internal/>
-			    </option>
-			</group>
-		</display>
-		<screen>
-			<group>
-				<_short>Appearance</_short>
-				<subgroup>
-					<_short>Window Title</_short>
-					<option name="window_title" type="int">
-						<_short>Window Title Display</_short>
-						<_long>Window title display in scale mode</_long>
-						<min>0</min>
-						<max>2</max>
-						<default>1</default>
-						<desc>
-							<value>0</value>
-							<_name>No display</_name>
-						</desc>
-						<desc>
-							<value>1</value>
-							<_name>Highlighted window only</_name>
-						</desc>
-						<desc>
-							<value>2</value>
-							<_name>All windows</_name>
-						</desc>
-					</option>
-					<option name="title_bold" type="bool">
-						<_short>Bold Font</_short>
-						<_long>Use bold font for window title display</_long>
-						<default>false</default>
-					</option>
-					<option name="title_size" type="int">
-						<_short>Font Size</_short>
-						<_long>Font size for window title display</_long>
-						<min>6</min>
-						<max>48</max>
-						<default>10</default>
-					</option>
-					<option name="border_size" type="int">
-						<_short>Title Border Size</_short>
-						<_long>Size of the border around the window title</_long>
-						<min>1</min>
-						<max>20</max>
-						<default>3</default>
-					</option>
-					<option name="font_color" type="color">
-						<_short>Font Color</_short>
-						<_long>Font color of the window title</_long>
-						<default>
-							<red>0xffff</red>
-							<green>0xffff</green>
-							<blue>0xffff</blue>
-							<alpha>0xffff</alpha>
-						</default>
-					</option>
-					<option name="back_color" type="color">
-						<_short>Background Color</_short>
-						<_long>Background color of the window title</_long>
-						<default>
-							<red>0x0000</red>
-							<green>0x0000</green>
-							<blue>0x0000</blue>
-							<alpha>0x9999</alpha>
-						</default>
-					</option>
-				</subgroup>
-				<subgroup>
-					<_short>Window Highlight</_short>
-					<option name="window_highlight" type="bool">
-						<_short>Draw Window Highlight</_short>
-						<_long>Highlights the hovered window with the given color</_long>
-						<default>false</default>
-					</option>
-					<option name="highlight_color" type="color">
-						<_short>Highlight Color</_short>
-						<_long>Color used for highlighting the hovered window</_long>
-						<default>
-							<red>0xffff</red>
-							<green>0xffff</green>
-							<blue>0xffff</blue>
-							<alpha>0x9696</alpha>
-						</default>
-					</option>
-				</subgroup>
-			</group>
-			<group>
-				<_short>Behaviour</_short>
-				<option name="layout_mode" type="int">
-					<_short>Window Layout Mode</_short>
-					<_long>Selects the mode to layout the windows in scale mode</_long>
-					<min>0</min>
-					<!-- note: don't offer the organic mode for now as it's utterly broken -->
-					<max>0</max>
-					<default>0</default>
-					<desc>
-						<value>0</value>
-						<_name>Normal</_name>
-					</desc>
-					<desc>
-						<value>1</value>
-						<_name>Organic - EXPERIMENTAL</_name>
-					</desc>
-				</option>
-			</group>
-		</screen>
-	</plugin>
+    <plugin name="scaleaddon" useBcop="true">
+	<_short>Scale Addons</_short>
+	<_long>Some useful additions to the scale plugin</_long>
+	<category>Utility</category>
+	<deps>
+	    <relation type="after">
+		<plugin>scale</plugin>
+		<plugin>text</plugin>
+	    </relation>
+	    <requirement>
+		<plugin>scale</plugin>
+	    </requirement>
+	</deps>
+	<display>
+	    <group>
+		<_short>Bindings</_short>
+		<option name="close_key" type="key">
+		    <_short>Close Window</_short>
+		    <_long>Close windows while in scale mode</_long>
+		    <passive_grab>false</passive_grab>
+		    <internal/>
+		</option>
+		<option name="close_button" type="button">
+		    <_short>Close Window</_short>
+		    <_long>Close window while in scale mode</_long>
+		    <passive_grab>false</passive_grab>
+		    <default>Button2</default>
+		    <internal/>
+		</option>
+		<option name="pull_key" type="key">
+		    <_short>Pull Window</_short>
+		    <_long>Pull window to current viewport while in scale mode</_long>
+		    <passive_grab>false</passive_grab>
+		    <internal/>
+		</option>
+		<option name="pull_button" type="button">
+		    <_short>Pull Window</_short>
+		    <_long>Pull window to current viewport while in scale mode</_long>
+		    <passive_grab>false</passive_grab>
+		    <default></default>
+		    <internal/>
+		</option>
+		<option name="zoom_key" type="key">
+		    <_short>Zoom Window</_short>
+		    <_long>Zoom window while in scale mode</_long>
+		    <passive_grab>false</passive_grab>
+		    <internal/>
+		</option>
+		<option name="zoom_button" type="button">
+		    <_short>Zoom Window</_short>
+		    <_long>Zoom window while in scale mode</_long>
+		    <passive_grab>false</passive_grab>
+		    <default>Button3</default>
+		    <internal/>
+		</option>
+	    </group>
+	</display>
+	<screen>
+	    <group>
+		<_short>Appearance</_short>
+		<subgroup>
+		    <_short>Window Title</_short>
+		    <option name="window_title" type="int">
+			<_short>Window Title Display</_short>
+			<_long>Window title display in scale mode</_long>
+			<min>0</min>
+			<max>2</max>
+			<default>1</default>
+			<desc>
+			    <value>0</value>
+			    <_name>No display</_name>
+			</desc>
+			<desc>
+			    <value>1</value>
+			    <_name>Highlighted window only</_name>
+			</desc>
+			<desc>
+			    <value>2</value>
+			    <_name>All windows</_name>
+			</desc>
+		    </option>
+		    <option name="title_bold" type="bool">
+			<_short>Bold Font</_short>
+			<_long>Use bold font for window title display</_long>
+			<default>false</default>
+		    </option>
+		    <option name="title_size" type="int">
+			<_short>Font Size</_short>
+			<_long>Font size for window title display</_long>
+			<min>6</min>
+			<max>48</max>
+			<default>10</default>
+		    </option>
+		    <option name="border_size" type="int">
+			<_short>Title Border Size</_short>
+			<_long>Size of the border around the window title</_long>
+			<min>1</min>
+			<max>20</max>
+			<default>3</default>
+		    </option>
+		    <option name="font_color" type="color">
+			<_short>Font Color</_short>
+			<_long>Font color of the window title</_long>
+			<default>
+			    <red>0xffff</red>
+			    <green>0xffff</green>
+			    <blue>0xffff</blue>
+			    <alpha>0xffff</alpha>
+			</default>
+		    </option>
+		    <option name="back_color" type="color">
+			<_short>Background Color</_short>
+			<_long>Background color of the window title</_long>
+			<default>
+			    <red>0x0000</red>
+			    <green>0x0000</green>
+			    <blue>0x0000</blue>
+			    <alpha>0x9999</alpha>
+			</default>
+		    </option>
+		</subgroup>
+		<subgroup>
+		    <_short>Window Highlight</_short>
+		    <option name="window_highlight" type="bool">
+			<_short>Draw Window Highlight</_short>
+			<_long>Highlights the hovered window with the given color</_long>
+			<default>false</default>
+		    </option>
+		    <option name="highlight_color" type="color">
+			<_short>Highlight Color</_short>
+			<_long>Color used for highlighting the hovered window</_long>
+			<default>
+			    <red>0xffff</red>
+			    <green>0xffff</green>
+			    <blue>0xffff</blue>
+			    <alpha>0x9696</alpha>
+			</default>
+		    </option>
+		</subgroup>
+	    </group>
+	    <group>
+		<_short>Behaviour</_short>
+		<option name="layout_mode" type="int">
+		    <_short>Window Layout Mode</_short>
+		    <_long>Selects the mode to layout the windows in scale mode</_long>
+		    <min>0</min>
+		    <!-- note: don't offer the organic mode for now as it's utterly broken -->
+		    <max>0</max>
+		    <default>0</default>
+		    <desc>
+			<value>0</value>
+			<_name>Normal</_name>
+		    </desc>
+		    <desc>
+			<value>1</value>
+			<_name>Organic - EXPERIMENTAL</_name>
+		    </desc>
+		</option>
+	    </group>
+	</screen>
+    </plugin>
 </compiz>


More information about the commits mailing list