Re: [compiz] [PATCH] Fix placement mode option

2007-06-27 Thread Danny Baumann
Hi,

>> In current git, placement mode option isn't working.
>>
>> This patch fix this issue.
>>
>> Cedric
>
> Hmm, i just miss to remove the old placeMode struct :(

I've just applied your patch - thank you.

Regards,

Danny

___
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz


Re: [compiz] [PATCH] Fix placement mode option

2007-06-24 Thread Bellegarde Cedric
Le dimanche 24 juin 2007, Bellegarde Cedric a écrit :
> In current git, placement mode option isn't working.
>
> This patch fix this issue.
>
> Cedric

Hmm, i just miss to remove the old placeMode struct :(

Just "Open your eyes and wake up" before sending a patch...

Cedric
diff --git a/plugins/place.c b/plugins/place.c
index deb5376..f7d9cca 100644
--- a/plugins/place.c
+++ b/plugins/place.c
@@ -30,14 +30,12 @@
 
 static CompMetadata placeMetadata;
 
-typedef enum {
-PlaceModeCascade  = 0,
-PlaceModeCentered = 1,
-PlaceModeSmart= 2,
-PlaceModeMaximize = 3,
-PlaceModeRandom   = 4,
-PlaceModeNum
-} PlaceMode;
+#define PLACE_MODE_CASCADE  0
+#define PLACE_MODE_CENTERED 1
+#define PLACE_MODE_SMART2
+#define PLACE_MODE_MAXIMIZE 3
+#define PLACE_MODE_RANDOM   4
+#define PLACE_MODE_LAST PLACE_MODE_RANDOM
 
 /* overlap types */
 #define NONE0
@@ -65,7 +63,6 @@ typedef struct _PlaceScreen {
 
 PlaceWindowProc placeWindow;
 
-PlaceMode placeMode;
 } PlaceScreen;
 
 #define GET_PLACE_DISPLAY(d)  \
@@ -171,10 +168,7 @@ placeSetScreenOption (CompPlugin  *plugin,
 switch (index) {
 case PLACE_SCREEN_OPTION_MODE:
 	if (compSetIntOption (o, value))
-	{
-	ps->placeMode = value->i;
 	return TRUE;
-	}
 	break;
 case PLACE_SCREEN_OPTION_POSITION_MATCHES:
 case PLACE_SCREEN_OPTION_VIEWPORT_MATCHES:
@@ -1236,8 +1230,8 @@ placeWin (CompWindow *window,
 
 if (!placeMatchPosition (window, &x, &y))
 {
-	switch (ps->placeMode) {
-	case PlaceModeCascade:
+	switch (ps->opt[PLACE_SCREEN_OPTION_MODE].value.i) {
+	case PLACE_MODE_CASCADE:
 	if (find_first_fit (window, windows, x, y, &x, &y))
 		goto done_check_denied_focus;
 
@@ -1246,16 +1240,16 @@ placeWin (CompWindow *window,
 	 */
 	find_next_cascade (window, windows, x, y, &x, &y);
 	break;
-	case PlaceModeCentered:
+	case PLACE_MODE_CENTERED:
 	placeCentered (window, &work_area, &x, &y);
 	break;
-	case PlaceModeRandom:
+	case PLACE_MODE_RANDOM:
 	placeRandom (window, &work_area, &x, &y);
 	break;
-	case PlaceModeSmart:
+	case PLACE_MODE_SMART:
 	placeSmart (window, &work_area, &x, &y);
 	break;
-	case PlaceModeMaximize:
+	case PLACE_MODE_MAXIMIZE:
 	maximizeWindow (window, MAXIMIZE_STATE);
 	break;
 	default:
@@ -1422,7 +1416,7 @@ placeFiniDisplay (CompPlugin  *p,
 
 static const CompMetadataOptionInfo placeScreenOptionInfo[] = {
 { "workarounds", "bool", 0, 0, 0 },
-{ "mode", "int", RESTOSTRING (0, PlaceModeNum - 1), 0, 0 },
+{ "mode", "int", RESTOSTRING (0, PLACE_MODE_LAST), 0, 0 },
 { "position_matches", "list", "match", 0, 0 },
 { "position_x_values", "list", "int", 0, 0 },
 { "position_y_values", "list", "int", 0, 0 },
@@ -1457,8 +1451,6 @@ placeInitScreen (CompPlugin *p,
 
 WRAP (ps, s, placeWindow, placePlaceWindow);
 
-ps->placeMode = 0;
-
 return TRUE;
 }
 
___
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz


[compiz] [PATCH] Fix placement mode option

2007-06-24 Thread Bellegarde Cedric
In current git, placement mode option isn't working.

This patch fix this issue.

Cedric
diff --git a/plugins/place.c b/plugins/place.c
index deb5376..0708eed 100644
--- a/plugins/place.c
+++ b/plugins/place.c
@@ -30,6 +30,13 @@
 
 static CompMetadata placeMetadata;
 
+#define PLACE_MODE_CASCADE  0
+#define PLACE_MODE_CENTERED 1
+#define PLACE_MODE_SMART2
+#define PLACE_MODE_MAXIMIZE 3
+#define PLACE_MODE_RANDOM   4
+#define PLACE_MODE_LAST PLACE_MODE_RANDOM
+
 typedef enum {
 PlaceModeCascade  = 0,
 PlaceModeCentered = 1,
@@ -65,7 +72,6 @@ typedef struct _PlaceScreen {
 
 PlaceWindowProc placeWindow;
 
-PlaceMode placeMode;
 } PlaceScreen;
 
 #define GET_PLACE_DISPLAY(d)  \
@@ -171,10 +177,7 @@ placeSetScreenOption (CompPlugin  *plugin,
 switch (index) {
 case PLACE_SCREEN_OPTION_MODE:
 	if (compSetIntOption (o, value))
-	{
-	ps->placeMode = value->i;
 	return TRUE;
-	}
 	break;
 case PLACE_SCREEN_OPTION_POSITION_MATCHES:
 case PLACE_SCREEN_OPTION_VIEWPORT_MATCHES:
@@ -1236,7 +1239,7 @@ placeWin (CompWindow *window,
 
 if (!placeMatchPosition (window, &x, &y))
 {
-	switch (ps->placeMode) {
+	switch (ps->opt[PLACE_SCREEN_OPTION_MODE].value.i) {
 	case PlaceModeCascade:
 	if (find_first_fit (window, windows, x, y, &x, &y))
 		goto done_check_denied_focus;
@@ -1422,7 +1425,7 @@ placeFiniDisplay (CompPlugin  *p,
 
 static const CompMetadataOptionInfo placeScreenOptionInfo[] = {
 { "workarounds", "bool", 0, 0, 0 },
-{ "mode", "int", RESTOSTRING (0, PlaceModeNum - 1), 0, 0 },
+{ "mode", "int", RESTOSTRING (0, PLACE_MODE_LAST), 0, 0 },
 { "position_matches", "list", "match", 0, 0 },
 { "position_x_values", "list", "int", 0, 0 },
 { "position_y_values", "list", "int", 0, 0 },
@@ -1457,8 +1460,6 @@ placeInitScreen (CompPlugin *p,
 
 WRAP (ps, s, placeWindow, placePlaceWindow);
 
-ps->placeMode = 0;
-
 return TRUE;
 }
 
___
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz