[beryl-commits] r2238 - branches/beryl-plugins/tile

pichalsi at server.beryl-project.org pichalsi at server.beryl-project.org
Mon Jan 1 21:01:35 CET 2007


Author: pichalsi
Date: 2007-01-01 20:01:35 +0000 (Mon, 01 Jan 2007)
New Revision: 2238

Modified:
   branches/beryl-plugins/tile/tile.c
Log:
beryl-plugins/tile: one bugfix and some cleanup

Modified: branches/beryl-plugins/tile/tile.c
===================================================================
--- branches/beryl-plugins/tile/tile.c	2007-01-01 19:42:57 UTC (rev 2237)
+++ branches/beryl-plugins/tile/tile.c	2007-01-01 20:01:35 UTC (rev 2238)
@@ -14,10 +14,10 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
- *   - Requires a svn revision later than 1461 to compile.
+ * Requires a svn revision later than 1461 to compile.
  *
  **/
 
@@ -32,66 +32,67 @@
 
 #include <beryl.h>
 
-#define GET_TILE_DISPLAY(d)                            \
+#define GET_TILE_DISPLAY(d) \
 	((TileDisplay *) (d)->privates[displayPrivateIndex].ptr)
 
-#define TILE_DISPLAY(d)                                \
-    TileDisplay *td = GET_TILE_DISPLAY (d)
+#define TILE_DISPLAY(d) \
+	TileDisplay *td = GET_TILE_DISPLAY (d)
 
-#define GET_TILE_SCREEN(s, td)                         \
+#define GET_TILE_SCREEN(s, td) \
 	((TileScreen *) (s)->privates[(td)->screenPrivateIndex].ptr)
 
-#define TILE_SCREEN(s)                                 \
+#define TILE_SCREEN(s) \
 	TileScreen *ts = GET_TILE_SCREEN (s, GET_TILE_DISPLAY (s->display))
 	
 #define GET_TILE_WINDOW(w, ts) ((TileWindow *) (w)->privates[(ts)->windowPrivateIndex].ptr)
-#define TILE_WINDOW(w) TileWindow *tw = GET_TILE_WINDOW  (w, GET_TILE_SCREEN  (w->screen, GET_TILE_DISPLAY (w->screen->display)))
+#define TILE_WINDOW(w) TileWindow *tw = GET_TILE_WINDOW (w, GET_TILE_SCREEN (w->screen, GET_TILE_DISPLAY (w->screen->display)))
 
-#define TILE_DISPLAY_OPTION_VERTICALLY    	  	0
-#define TILE_DISPLAY_OPTION_HORIZONTALLY 	    1
-#define TILE_DISPLAY_OPTION_TILE		 	    2
-#define TILE_DISPLAY_OPTION_CASCADE             3
-#define TILE_DISPLAY_OPTION_RESTORE      	    4
-#define TILE_DISPLAY_OPTION_EXCLUDE_LIST    	5
-#define TILE_DISPLAY_OPTION_JOIN	   	 	    6
-#define TILE_DISPLAY_OPTION_DELTA				7
-#define TILE_DISPLAY_OPTION_ANIMATE				8
-#define TILE_DISPLAY_OPTION_ANIMATION_DURATION  9
-#define TILE_DISPLAY_OPTION_OUTLINE				10
-#define TILE_DISPLAY_OPTION_NUM             	11
+#define TILE_DISPLAY_OPTION_VERTICALLY					0
+#define TILE_DISPLAY_OPTION_HORIZONTALLY				1
+#define TILE_DISPLAY_OPTION_TILE						2
+#define TILE_DISPLAY_OPTION_CASCADE						3
+#define TILE_DISPLAY_OPTION_RESTORE						4
+#define TILE_DISPLAY_OPTION_EXCLUDE_LIST				5
+#define TILE_DISPLAY_OPTION_JOIN						6
+#define TILE_DISPLAY_OPTION_DELTA						7
+#define TILE_DISPLAY_OPTION_ANIMATE						8
+#define TILE_DISPLAY_OPTION_ANIMATION_DURATION			9
+#define TILE_DISPLAY_OPTION_OUTLINE						10
+#define TILE_DISPLAY_OPTION_NUM							11
 
-#define TILE_HORIZONTALLY_DISPLAY_OPTION_INITIATE_KEY        "q"
-#define TILE_HORIZONTALLY_DISPLAY_OPTION_INITIATE_MOD        CompSuperMask|ShiftMask
+#define TILE_HORIZONTALLY_DISPLAY_OPTION_INITIATE_KEY						"q"
+#define TILE_HORIZONTALLY_DISPLAY_OPTION_INITIATE_MOD						CompSuperMask|ShiftMask
 
-#define TILE_VERTICALLY_DISPLAY_OPTION_INITIATE_KEY        "w"
-#define TILE_VERTICALLY_DISPLAY_OPTION_INITIATE_MOD        CompSuperMask|ShiftMask
+#define TILE_VERTICALLY_DISPLAY_OPTION_INITIATE_KEY							"w"
+#define TILE_VERTICALLY_DISPLAY_OPTION_INITIATE_MOD							CompSuperMask|ShiftMask
 
-#define TILE_TILE_DISPLAY_OPTION_INITIATE_KEY        "a"
-#define TILE_TILE_DISPLAY_OPTION_INITIATE_MOD        CompSuperMask|ShiftMask
+#define TILE_TILE_DISPLAY_OPTION_INITIATE_KEY								"a"
+#define TILE_TILE_DISPLAY_OPTION_INITIATE_MOD								CompSuperMask|ShiftMask
 
-#define TILE_CASCADE_DISPLAY_OPTION_INITIATE_KEY        "s"
-#define TILE_CASCADE_DISPLAY_OPTION_INITIATE_MOD        CompSuperMask|ShiftMask
+#define TILE_CASCADE_DISPLAY_OPTION_INITIATE_KEY							"s"
+#define TILE_CASCADE_DISPLAY_OPTION_INITIATE_MOD							CompSuperMask|ShiftMask
 
-#define TILE_RESTORE_DISPLAY_OPTION_INITIATE_KEY        "z"
-#define TILE_RESTORE_DISPLAY_OPTION_INITIATE_MOD        CompSuperMask|ShiftMask
+#define TILE_RESTORE_DISPLAY_OPTION_INITIATE_KEY							"z"
+#define TILE_RESTORE_DISPLAY_OPTION_INITIATE_MOD							CompSuperMask|ShiftMask
 
-#define TILE_DEFAULT_JOIN 					FALSE
-#define TILE_DEFAULT_ANIMATE				FALSE
-#define TILE_DEFAULT_OUTLINE				FALSE
+#define TILE_DEFAULT_JOIN 								FALSE
+#define TILE_DEFAULT_ANIMATE							FALSE
+#define TILE_DEFAULT_OUTLINE							FALSE
 
-#define TILE_DELTA_DEFAULT					35
-#define TILE_DELTA_MIN						0
-#define TILE_DELTA_MAX						250
+#define TILE_DELTA_DEFAULT								35
+#define TILE_DELTA_MIN									0
+#define TILE_DELTA_MAX									250
 
 #define TILE_ANIMATION_DURATION_DEFAULT					1000
 #define TILE_ANIMATION_DURATION_MIN 					0
 #define TILE_ANIMATION_DURATION_MAX						5000
 
-#define TILE_TYPE_NONE						0
-#define TILE_TYPE_VERTICALLY				1
-#define TILE_TYPE_HORIZONTALLY				2
-#define TILE_TYPE_BOTH						3
-#define TILE_TYPE_CASCADE					4
+// tiling types
+#define TILE_TYPE_NONE									0
+#define TILE_TYPE_VERTICALLY							1
+#define TILE_TYPE_HORIZONTALLY							2
+#define TILE_TYPE_BOTH									3
+#define TILE_TYPE_CASCADE								4
 
 // Minimal width and height under which the window cant be resized
 #define MINIMUM_WIDTH 						150
@@ -118,12 +119,15 @@
 	int futureY;
 	int futureWidth;
 	int futureHeight;
-	Bool isResizing;
 	
+	Bool isResizing; // tells if the window is being resized
+	
 	int originalX; // x coord before resizing
 	int originalY; // y coord before resizing
 	int originalWidth; // width before resizing
 	int originalHeight; // height before resizing
+	
+	int isOtherAnimationAtom; // atom to check whether animation plugin is animating the window
 } TileWindow;
 
 typedef struct _TileScreen {
@@ -144,6 +148,7 @@
 
 static Bool placeWindow(CompWindow *w, int x, int y, int width, int height);
 static Bool setWindowFutureSize(CompWindow *w);
+static Bool isTileWindow(CompWindow *w);
 
 // window painting function, draws animation
 static Bool tilePaintWindow(CompWindow * w, const WindowPaintAttrib * attrib, Region region, unsigned int mask)
@@ -164,12 +169,13 @@
 	status = (*s->paintWindow) (w, attrib, region, mask);
 	WRAP(ts, s, paintWindow, tilePaintWindow);
 
-	// Draw modified window texture
+	// Window attributes in time
 	int x = ((float)tw->futureX - (float)w->attrib.x)/td->animationDuration * ts->msResizing;
 	int y = ((float)tw->futureY - (float)w->attrib.y)/td->animationDuration * ts->msResizing;
 	int width = ((float)tw->futureWidth - (float)w->attrib.width)/td->animationDuration * ts->msResizing + w->attrib.width;
 	int height = ((float)tw->futureHeight - (float)w->attrib.height)/td->animationDuration * ts->msResizing + w->attrib.height;
 
+	// Scale window texture according to position in time
 	WindowPaintAttrib sAttrib = *attrib;
 	sAttrib.xScale = (float)width/w->attrib.width;
 	sAttrib.yScale = (float)height/w->attrib.height;
@@ -193,20 +199,20 @@
 	TILE_SCREEN(s);
 	TILE_DISPLAY(s->display);
 	
-	// couldnt find a better place cause i dont know why but it wont work in setDisplayOption
+	// this probably shouldnt be here...
 	td->animationDuration = td->opt[TILE_DISPLAY_OPTION_ANIMATION_DURATION].value.i;
 	
 	// add spent time
 	if(ts->isResizing)
 		ts->msResizing += msSinceLastPaint;
 	
+	// Check if the animation hasnt finished yet
 	if(ts->isResizing && ts->msResizing > td->animationDuration)
 	{
 		CompWindow *w = ts->firstTiled;
 		while(w)
 		{
 			TILE_WINDOW(w);
-
 			if(tw->isResizing)
 			{
 				tw->isResizing = FALSE;
@@ -218,7 +224,7 @@
 		ts->isResizing = FALSE;
 		ts->msResizing = 0;
 	}
-	
+
 	UNWRAP(ts, s, preparePaintScreen);
 	(*s->preparePaintScreen) (s, msSinceLastPaint);
 	WRAP(ts, s, preparePaintScreen, tilePreparePaintScreen);
@@ -227,7 +233,6 @@
 static void tileDonePaintScreen(CompScreen * s)
 {
 	TILE_SCREEN(s);
-	// TILE_DISPLAY(s->display);
 
 	// hope this is ok
 	if(ts->isResizing)
@@ -255,7 +260,7 @@
 	// Check if animation is enabled, there is resizing on screen and only outline should be drawn
 	if(!td->opt[TILE_DISPLAY_OPTION_ANIMATE].value.b || !ts->isResizing || !td->opt[TILE_DISPLAY_OPTION_OUTLINE].value.b)
 		return status;
-	
+
 	glPushMatrix();
 	glLoadIdentity();
 
@@ -267,7 +272,7 @@
 	glBegin(GL_LINES);
 
 	CompWindow *w = ts->firstTiled;
-	while(w)
+	while(w && isTileWindow(w))
 	{
 		TILE_WINDOW(w);
 
@@ -275,7 +280,7 @@
 		{
 			// Coordinate = start +            speed          * elapsedTime
 			// Coordinate = start + (target - start)/interval * elapsedTime
-			// OUTLINE
+			// Draw outline
 			
 			int x = ((float)tw->futureX - (float)w->attrib.x)/td->animationDuration * ts->msResizing + w->attrib.x;
 			x -= w->input.left; // decoration
@@ -298,9 +303,9 @@
 		
 		w = tw->next;
 	}
-	
+
 	glEnd();
-	
+
 	glPopMatrix();
 	glColor3f(1,1,1);
 	glLineWidth(1.0);
@@ -314,15 +319,15 @@
 	TILE_SCREEN(w->screen);
 	TILE_WINDOW(w);
 	TILE_DISPLAY(w->screen->display);
-	
+
 	UNWRAP(ts, w->screen, windowResizeNotify);
 	(*w->screen->windowResizeNotify) (w);
 	WRAP(ts, w->screen, windowResizeNotify, tileResizeNotify);
-	
+
 	// Dont do anything if joining is disabled or windows are being resized
 	if(!td->opt[TILE_DISPLAY_OPTION_JOIN].value.b || ts->isResizing)
 		return;
-	
+
 	if(ts->tileType == TILE_TYPE_VERTICALLY)
 	{
 		if(tw->prev)
@@ -354,14 +359,14 @@
 	TILE_DISPLAY(s->display);
 
 	TileScreen *ts = (TileScreen *) calloc(1, sizeof(TileScreen));
-	
+
 	ts->windowPrivateIndex = allocateWindowPrivateIndex(s);
 	if (ts->windowPrivateIndex < 0)
 	{
 		free(ts);
 		return FALSE;
 	}
-	
+
 	s->privates[td->screenPrivateIndex].ptr = ts;
 	
 	ts->firstTiled = 0;
@@ -371,7 +376,7 @@
 	ts->tileType = TILE_TYPE_NONE;
 	ts->isResizing = FALSE;
 	ts->msResizing = 0;
-	
+
 	// Wrap plugin functions
 	WRAP(ts, s, paintScreen, tilePaintScreen);
 	WRAP(ts, s, preparePaintScreen, tilePreparePaintScreen);
@@ -459,11 +464,11 @@
 	// minimum size and window existence check
 	if(width < MINIMUM_WIDTH || height < MINIMUM_HEIGHT || !w)
 		return FALSE;
-	
+
 	// check if the window isnt already where its going to be
 	if(x == w->attrib.x && y == w->attrib.y && width == w->attrib.width && height == w->attrib.height)
 		return TRUE;
-	
+
 	TILE_WINDOW(w);
 	TILE_SCREEN(w->screen);
 	TILE_DISPLAY(w->screen->display);
@@ -472,7 +477,7 @@
 	tw->futureY = y;
 	tw->futureWidth = width;
 	tw->futureHeight = height;
-	
+
 	if(td->opt[TILE_DISPLAY_OPTION_ANIMATE].value.b)
 	{
 		ts->isResizing = TRUE;
@@ -483,7 +488,7 @@
 	{
 		setWindowFutureSize(w);
 	}
-	
+
 	return TRUE;
 }
 
@@ -493,20 +498,20 @@
 	// Window existence check
 	if(!w)
 		return FALSE;
-	
+
 	TILE_WINDOW(w);
-	
+
 	int x = tw->futureX;
 	int y = tw->futureY;
 	int width = tw->futureWidth;
 	int height = tw->futureHeight;
-	
+
 	XWindowChanges xwc;
 	xwc.x = x;
 	xwc.y = y;
 	xwc.width = width;
 	xwc.height = height;
-	
+
 	if(width+w->input.left+w->input.right == w->screen->workArea.width && height+w->input.top+w->input.bottom == w->screen->workArea.height && x == w->screen->workArea.x + w->input.left && y == w->screen->workArea.y + w->input.top)
 	{
 		w->state |= MAXIMIZE_STATE;
@@ -519,7 +524,7 @@
 	}
 
 	configureXWindow (w, CWHeight | CWWidth | CWY | CWX, &xwc);
-	
+
 	return TRUE;
 }
 
@@ -527,7 +532,7 @@
 static Bool isTileWindow(CompWindow * w)
 {
 	TILE_DISPLAY(w->screen->display);
-	
+
 	// Exclude windows from exclusion list
 	CompOption *o = &td->opt[TILE_DISPLAY_OPTION_EXCLUDE_LIST];
 	int i;
@@ -536,10 +541,10 @@
 		if (w->resClass && (strcmp(o->value.list.value[i].s, w->resClass) == 0))
 			return FALSE;
 	}
-	
+
 	if (w->attrib.override_redirect)
 		return FALSE;
-	
+
 	if (!(*w->screen->focusWindow) (w))
 		return FALSE;
 
@@ -555,7 +560,7 @@
 	// Normal windows
 	if ((w->type & CompWindowTypeNormalMask)==CompWindowTypeNormalMask && !w->minimized && !w->invisible && w->placed)
 		return TRUE;
-	
+
 	// Shaded windows, maybe an option for not scaling shaded windows or scaling them only
 	if((w->type & CompWindowTypeNormalMask)==CompWindowTypeNormalMask && !w->minimized && w->shaded)
 		return TRUE;
@@ -569,7 +574,7 @@
 	int count = 0;
 	int decoHeight = 0, decoWidth = 0;
 	CompWindow *first = 0, *previous = 0;
-	
+
 	CompWindow *w;
 	for (w = s->windows; w; w = w->next)
 	{
@@ -593,13 +598,13 @@
 			decoWidth = w->input.left + w->input.right;
 		}
 	}
-		
+
 	TILE_SCREEN(s);
 	ts->firstTiled = first;
 	ts->tiledCount = count;
 	ts->decoHeight = decoHeight;
 	ts->decoWidth = decoWidth;
-	
+
 	return TRUE;
 }
 
@@ -612,7 +617,7 @@
 	tw->originalY = w->attrib.y;
 	tw->originalWidth = w->attrib.width;
 	tw->originalHeight = w->attrib.height;
-	
+
 	return TRUE;
 }
 
@@ -622,7 +627,7 @@
 	loadTiledWindows(s);
 	TILE_SCREEN(s);
 	ts->tileType = TILE_TYPE_NONE;
-	
+
 	if(ts->tiledCount>0)
 	{
 		int numWidth = ceil(sqrt(ts->tiledCount));
@@ -630,10 +635,10 @@
 		
 		int height = (s->workArea.height - ts->decoHeight*numHeight)/numHeight;
 		int width = (s->workArea.width - ts->decoWidth*numWidth)/numWidth;
-	
+
 		int i = 0;
 		CompWindow *w = ts->firstTiled;
-		
+
 		int currentX = w->input.left + s->workArea.x;
 		int currentY = w->input.top + s->workArea.y;
 
@@ -674,7 +679,7 @@
 	if(ts->tiledCount>0)
 	{
 		int height=(s->workArea.height - ts->decoHeight*ts->tiledCount)/ts->tiledCount;
-	
+
 		int i = 0;	
 		CompWindow *w = ts->firstTiled;
 
@@ -694,7 +699,7 @@
 		}
 	}
 	ts->tileType = TILE_TYPE_HORIZONTALLY;
-	
+
 	return TRUE;
 }
 
@@ -704,11 +709,11 @@
 	TILE_SCREEN(s);
 	ts->tileType = TILE_TYPE_NONE;
 	loadTiledWindows(s);
-	
+
 	if(ts->tiledCount>0)
 	{
 		int width = (s->workArea.width - ts->decoWidth*ts->tiledCount)/ts->tiledCount;
-	
+
 		int i = 0;	
 		CompWindow *w = ts->firstTiled;
 
@@ -728,7 +733,7 @@
 		}
 	}
 	ts->tileType = TILE_TYPE_VERTICALLY;
-	
+
 	return TRUE;
 }
 
@@ -768,7 +773,7 @@
 		}
 	}
 	ts->tileType = TILE_TYPE_CASCADE;
-	
+
 	return TRUE;
 }
 
@@ -776,30 +781,55 @@
 static Bool restoreWindows(CompScreen *s)
 {
 	TILE_SCREEN(s);
-	
+
 	ts->tileType = TILE_TYPE_NONE;
 	CompWindow *w = ts->firstTiled;
 	while(w)
 	{
 		TILE_WINDOW(w);
+
+		// This fixes problem with window closing animation running while restoring window, causing beryl crash
+		if(IPCS_GetBool(IPCS_OBJECT(w), tw->isOtherAnimationAtom))
+		{
+			CompWindow *prev = tw->prev;
+			CompWindow *next = tw->next;
+	
+			if(prev && next)
+			{
+				TileWindow *twprev = GET_TILE_WINDOW(prev, GET_TILE_SCREEN (prev->screen, GET_TILE_DISPLAY (prev->screen->display)));
+				twprev->next = next;
+			}
+			else if(prev && !next)
+			{
+				TileWindow *twprev = GET_TILE_WINDOW(prev, GET_TILE_SCREEN (prev->screen, GET_TILE_DISPLAY (prev->screen->display)));
+				twprev->next = 0;
+			}
+			else if(!prev && next)
+			{
+				ts->firstTiled = next;
+			}
+			else if(!prev && !next)
+			{
+				ts->firstTiled = 0;
+			}
+		}
+		else
+			placeWindow(w, tw->originalX, tw->originalY, tw->originalWidth, tw->originalHeight);
 		
-		placeWindow(w, tw->originalX, tw->originalY, tw->originalWidth, tw->originalHeight);
-		
 		tw->originalX = 0;
 		tw->originalY = 0;
 		tw->originalWidth = 0;
 		tw->originalHeight = 0;
-		
+
 		w = tw->next;
 	}
-	 
+
 	return TRUE;
 }
 
 static Bool tileRestore(CompDisplay * d, CompAction * ac, CompActionState state, CompOption * option, int nOption)
 {
 	CompScreen *s;
-	// TILE_DISPLAY(d);
 
 	s = findScreenAtDisplay(d, getIntOptionNamed(option, nOption, "root", 0));
 
@@ -809,7 +839,6 @@
 		{
 			restoreWindows(s);
 		}
-		// damageScreen(s);
 	}
 	return FALSE;
 }
@@ -817,13 +846,11 @@
 static Bool tileCascade(CompDisplay * d, CompAction * ac, CompActionState state, CompOption * option, int nOption)
 {
 	CompScreen *s;
-	// TILE_DISPLAY(d);
 
 	s = findScreenAtDisplay(d, getIntOptionNamed(option, nOption, "root", 0));
 
 	if (s) {
 			tileWindowsCascade(s);
-		// damageScreen(s);
 	}
 	return FALSE;
 }
@@ -831,14 +858,11 @@
 static Bool tileTile(CompDisplay * d, CompAction * ac, CompActionState state, CompOption * option, int nOption)
 {
 	CompScreen *s;
-	// TILE_DISPLAY(d);
 
 	s = findScreenAtDisplay(d, getIntOptionNamed(option, nOption, "root", 0));
 
 	if (s) {
-		// TILE_SCREEN(s);
 		tileWindowsTile(s);
-		// damageScreen(s);
 	}
 	return FALSE;
 }
@@ -846,14 +870,11 @@
 static Bool tileHorizontally(CompDisplay * d, CompAction * ac, CompActionState state, CompOption * option, int nOption)
 {
 	CompScreen *s;
-	// TILE_DISPLAY(d);
 
 	s = findScreenAtDisplay(d, getIntOptionNamed(option, nOption, "root", 0));
 
 	if (s) {
-		// TILE_SCREEN(s);
 		tileWindowsHorizontally(s);
-		// damageScreen(s);
 	}
 	return FALSE;
 }
@@ -861,14 +882,11 @@
 static Bool tileVertically(CompDisplay * d, CompAction * ac, CompActionState state,CompOption * option, int nOption)
 {
 	CompScreen *s;
-	// TILE_DISPLAY(d);
 
 	s = findScreenAtDisplay(d, getIntOptionNamed(option, nOption, "root", 0));
 
 	if (s) {
-		// TILE_SCREEN(s);
 		tileWindowsVertically(s);
-		// damageScreen(s);
 	}
 	return FALSE;
 }
@@ -894,7 +912,7 @@
 	o->value.action.key.modifiers = TILE_VERTICALLY_DISPLAY_OPTION_INITIATE_MOD;
 	o->value.action.key.keysym =
 			XStringToKeysym(TILE_VERTICALLY_DISPLAY_OPTION_INITIATE_KEY);
-		
+
 	o = &td->opt[TILE_DISPLAY_OPTION_HORIZONTALLY];
 	o->name = "horizontally";
 	o->group = N_("Key Bindings");
@@ -912,7 +930,7 @@
 	o->value.action.key.modifiers = TILE_HORIZONTALLY_DISPLAY_OPTION_INITIATE_MOD;
 	o->value.action.key.keysym =
 			XStringToKeysym(TILE_HORIZONTALLY_DISPLAY_OPTION_INITIATE_KEY);
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_TILE];
 	o->name = "tiletile";
 	o->group = N_("Key Bindings");
@@ -930,7 +948,7 @@
 	o->value.action.key.modifiers = TILE_TILE_DISPLAY_OPTION_INITIATE_MOD;
 	o->value.action.key.keysym =
 			XStringToKeysym(TILE_TILE_DISPLAY_OPTION_INITIATE_KEY);
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_CASCADE];
 	o->name = "tilecascade";
 	o->group = N_("Key Bindings");
@@ -948,7 +966,7 @@
 	o->value.action.key.modifiers = TILE_CASCADE_DISPLAY_OPTION_INITIATE_MOD;
 	o->value.action.key.keysym =
 			XStringToKeysym(TILE_CASCADE_DISPLAY_OPTION_INITIATE_KEY);
-		
+
 	o = &td->opt[TILE_DISPLAY_OPTION_RESTORE];
 	o->name = "tilerestore";
 	o->group = N_("Key Bindings");
@@ -966,7 +984,7 @@
 	o->value.action.key.modifiers = TILE_RESTORE_DISPLAY_OPTION_INITIATE_MOD;
 	o->value.action.key.keysym =
 			XStringToKeysym(TILE_RESTORE_DISPLAY_OPTION_INITIATE_KEY);
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_JOIN];
 	o->advanced = False;
 	o->name = "tilejoin";
@@ -977,7 +995,7 @@
 	o->longDesc = N_("Tries to join the windows together when horizontal or vertical (not both) tiling is enabled so that when you resize a window surrounding windows resize accordingly. Dont forget to use restore when using this, or weird things may happen if you maximize window.");
 	o->type = CompOptionTypeBool;
 	o->value.b = TILE_DEFAULT_JOIN;
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_ANIMATE];
 	o->advanced = False;
 	o->name = "tileanimate";
@@ -988,7 +1006,7 @@
 	o->longDesc = N_("Adds animation to tiling proccess.");
 	o->type = CompOptionTypeBool;
 	o->value.b = TILE_DEFAULT_ANIMATE;
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_OUTLINE];
 	o->advanced = False;
 	o->name = "tileoutline";
@@ -999,7 +1017,7 @@
 	o->longDesc = N_("Show only outline instead of window texture when animating.");
 	o->type = CompOptionTypeBool;
 	o->value.b = TILE_DEFAULT_OUTLINE;
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_ANIMATION_DURATION];
 	o->advanced = False;
 	o->name = "tileanimationduration";
@@ -1012,7 +1030,7 @@
 	o->value.i = TILE_ANIMATION_DURATION_DEFAULT;
 	o->rest.i.min = TILE_ANIMATION_DURATION_MIN;
 	o->rest.i.max = TILE_ANIMATION_DURATION_MAX;
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_DELTA];
 	o->advanced = False;
 	o->name = "tiledelta";
@@ -1025,7 +1043,7 @@
 	o->value.i = TILE_DELTA_DEFAULT;
 	o->rest.i.min = TILE_DELTA_MIN;
 	o->rest.i.max = TILE_DELTA_MAX;
-	
+
 	o = &td->opt[TILE_DISPLAY_OPTION_EXCLUDE_LIST];
 	o->advanced = False;
 	o->name = "exclude_list";
@@ -1102,17 +1120,18 @@
 
 	tw->next = 0;
 	tw->prev = 0;
-	
+
 	tw->originalX = 0;
 	tw->originalY = 0;
 	tw->originalWidth = 0;
 	tw->originalHeight = 0;
-	
+
 	tw->futureX = 0;
 	tw->futureY = 0;
 	tw->futureWidth = 0;
 	tw->futureHeight = 0;
 	tw->isResizing = FALSE;
+	tw->isOtherAnimationAtom = IPCS_GetAtom(IPCS_OBJECT(w), IPCS_BOOL, "is_animated", True); // animation plugin sets is_animated to true while it animates the window
 
 	w->privates[ts->windowPrivateIndex].ptr = tw;
 
@@ -1123,36 +1142,24 @@
 {
 	TILE_WINDOW(w);
 	TILE_SCREEN(w->screen);
-	
-	// Temporar fix to bug when window is destroyed while animating...
-	ts->isResizing = FALSE;
 
 	if(tw->originalWidth > 0 && tw->originalHeight > 0)
 	{
-		// when one window is destroyed, join the linked list, so many bugs here... ><
+		// when one window is destroyed, join the linked list
 		CompWindow *prev = tw->prev;
 		CompWindow *next = tw->next;
-	
-		if(prev && next)
+
+		if(prev)
 		{
-			TileWindow *twprev = GET_TILE_WINDOW(prev, GET_TILE_SCREEN  (prev->screen, GET_TILE_DISPLAY (prev->screen->display)));
+			TileWindow *twprev = GET_TILE_WINDOW(prev, GET_TILE_SCREEN (prev->screen, GET_TILE_DISPLAY (prev->screen->display)));
 			twprev->next = next;
 		}
-		else if(prev && !next)
+		else
 		{
-			TileWindow *twprev = GET_TILE_WINDOW(prev, GET_TILE_SCREEN  (prev->screen, GET_TILE_DISPLAY (prev->screen->display)));
-			twprev->next = 0;
-		}
-		else if(!prev && next)
-		{
 			ts->firstTiled = next;
 		}
-		else if(!prev && !next)
-		{
-			ts->firstTiled = 0;
-		}
 	}
-	
+
 	free(tw);
 }
 




More information about the commits mailing list