[fusion-commits] Compiz mirror: Changes to 'master' (de14011dd90e40c6562e891c8debb81ad9cbf11f)

compiz at server.opencompositing.org compiz at server.opencompositing.org
Wed May 14 07:35:10 CEST 2008


New commits:
commit de14011dd90e40c6562e891c8debb81ad9cbf11f
Author: Danny Baumann <dannybaumann at web.de>
Date:   Wed May 14 07:31:37 2008 +0200

    Try to follow multi output option as close as possible when placing centered on screen.

commit 82326b3e010b3b3322fc8da104cdc2ecf442dd47
Author: Danny Baumann <dannybaumann at web.de>
Date:   Wed May 14 07:29:45 2008 +0200

    Added option to place on output the focussed window is on.

commit 216b1e07a5723beb646baf2de31838e0c56122d0
Author: Danny Baumann <dannybaumann at web.de>
Date:   Wed May 14 07:18:30 2008 +0200

    Added optional placement to fullscreen output, which makes sense especially for smart window placement.
    Reference: http://bugs.opencompositing.org/show_bug.cgi?id=643


 metadata/place.xml.in |   10 +++++++-
 plugins/place.c       |   64 +++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 58 insertions(+), 16 deletions(-)


Modified: compiz/metadata/place.xml.in
===================================================================
--- compiz/metadata/place.xml.in
+++ compiz/metadata/place.xml.in
@@ -39,7 +39,7 @@
 		<_short>Multi Output Mode</_short>
 		<_long>Selects how window placement should behave if multiple outputs are selected</_long>
 		<min>0</min>
-		<max>1</max>
+		<max>3</max>
 		<default>0</default>
 		<desc>
 		    <value>0</value>
@@ -49,6 +49,14 @@
 		    <value>1</value>
 		    <_name>Use output device with pointer</_name>
 		</desc>
+		<desc>
+		    <value>2</value>
+		    <_name>Use output device of focussed window</_name>
+		</desc>
+		<desc>
+		    <value>3</value>
+		    <_name>Place across all outputs</_name>
+		</desc>
 	    </option>
 	    <option name="force_placement_match" type="match">
 		<_short>Force Placement Windows</_short>

Modified: compiz/plugins/place.c
===================================================================
--- compiz/plugins/place.c
+++ compiz/plugins/place.c
@@ -41,9 +41,11 @@ typedef struct _PlaceDisplay {
 #define PLACE_MODE_RANDOM   4
 #define PLACE_MODE_LAST     PLACE_MODE_RANDOM
 
-#define PLACE_MOMODE_CURRENT 0
-#define PLACE_MOMODE_POINTER 1
-#define PLACE_MOMODE_LAST    PLACE_MOMODE_POINTER
+#define PLACE_MOMODE_CURRENT    0
+#define PLACE_MOMODE_POINTER    1
+#define PLACE_MOMODE_ACTIVEWIN  2
+#define PLACE_MOMODE_FULLSCREEN 3
+#define PLACE_MOMODE_LAST       PLACE_MOMODE_FULLSCREEN
 
 #define PLACE_SCREEN_OPTION_WORKAROUND        0
 #define PLACE_SCREEN_OPTION_MODE              1
@@ -993,20 +995,24 @@ placeGetPlacementOutput (CompWindow        *w,
 
     PLACE_SCREEN (s);
 
-    if (strategy == PlaceOverParent)
-    {
-	CompWindow *parent;
+    switch (strategy) {
+    case PlaceOverParent:
+	{
+	    CompWindow *parent;
 
-	parent = findWindowAtScreen (s, w->transientFor);
-	if (parent)
-	    output = outputDeviceForWindow (parent);
-    }
-    else if (strategy == ConstrainOnly)
-    {
+	    parent = findWindowAtScreen (s, w->transientFor);
+	    if (parent)
+		output = outputDeviceForWindow (parent);
+	}
+	break;
+    case ConstrainOnly:
 	output = outputDeviceForGeometry (s, x, y,
 					  w->serverWidth,
 					  w->serverHeight,
 					  w->serverBorderWidth);
+	break;
+    default:
+	break;
     }
 
     if (output >= 0)
@@ -1033,13 +1039,25 @@ placeGetPlacementOutput (CompWindow        *w,
 	    }
 	}
 	break;
+    case PLACE_MOMODE_ACTIVEWIN:
+	{
+	    CompWindow *active;
+
+	    active = findWindowAtScreen (s, s->display->activeWindow);
+	    if (active)
+		output = outputDeviceForWindow (active);
+	}
+	break;
+    case PLACE_MOMODE_FULLSCREEN:
+	/* only place on fullscreen output if not placing centered, as the
+	   constraining will move the window away from the center otherwise */
+	if (strategy != PlaceCenteredOnScreen)
+	    return &s->fullscreenOutput;
+	break;
     }
 
     if (output < 0)
-    {
-	/* should never happen */
 	output = s->currentOutputDev;
-    }
 
     return &s->outputDev[output];
 }
@@ -1171,6 +1189,22 @@ placeDoWindowPlacement (CompWindow *w,
 	    break;
 	}
 
+	/* When placing to the fullscreen output, constrain to one
+	   output nevertheless */
+	if (output->id == ~0)
+	{
+	    int id;
+
+	    id = outputDeviceForGeometry (s, x, y,
+					  w->serverWidth,
+					  w->serverHeight,
+					  w->serverBorderWidth);
+	    getWorkareaForOutput (s, id, &workArea);
+
+	    workArea.x += (targetVpX - s->x) * s->width;
+	    workArea.y += (targetVpY - s->y) * s->height;
+	}
+
 	/* Maximize windows if they are too big for their work area (bit of
 	 * a hack here). Assume undecorated windows probably don't intend to
 	 * be maximized.


More information about the commits mailing list