diff -Nur compiz-0.9.11.3+14.04.20150313.orig/plugins/place/src/smart/src/smart.cpp compiz-0.9.11.3+14.04.20150313/plugins/place/src/smart/src/smart.cpp --- compiz-0.9.11.3+14.04.20150313.orig/plugins/place/src/smart/src/smart.cpp 2015-03-13 12:25:10.000000000 -0500 +++ compiz-0.9.11.3+14.04.20150313/plugins/place/src/smart/src/smart.cpp 2016-01-31 12:16:53.526434193 -0600 @@ -53,6 +53,10 @@ int cw = placeable->geometry ().width () - 1; int ch = placeable->geometry ().height () - 1; +//(DA) 20160131 + int revupdown = 1; + if(revupdown) yTmp = placeable->workArea ().bottom () - ch - (yTmp - placeable->workArea ().top ()); + int xOptimal = xTmp; int yOptimal = yTmp; @@ -60,7 +64,21 @@ do { /* test if enough room in x and y directions */ - if (yTmp + ch > placeable->workArea ().bottom () && ch < placeable->workArea ().height ()) +// if (yTmp + ch > placeable->workArea ().bottom () && ch < placeable->workArea ().height ()) +// overlap = H_WRONG; /* this throws the algorithm to an exit */ + int ybad = 0; + if(ch < placeable->workArea ().height ()) + { + if(!revupdown) + { + if (yTmp + ch > placeable->workArea ().bottom ()) ybad = 1; + } + else + { + if (yTmp < placeable->workArea ().top ()) ybad = 1; + } + } + if(ybad) overlap = H_WRONG; /* this throws the algorithm to an exit */ else if (xTmp + cw > placeable->workArea ().right ()) overlap = W_WRONG; @@ -160,10 +178,19 @@ else if (overlap == W_WRONG) { xTmp = placeable->workArea ().x (); - int possible = placeable->workArea ().bottom (); + int possible; + if(!revupdown) + { + possible = placeable->workArea ().bottom (); + if (possible - ch > yTmp) + possible -= ch; + } else + { + possible = placeable->workArea ().top () - ch; + if (possible + ch < yTmp) + possible += ch; + } - if (possible - ch > yTmp) - possible -= ch; /* test the position of each window on the desk */ foreach (Placeable *p, placeables) @@ -177,23 +204,30 @@ /* if not enough room to the left or right of the current * client determine the first non-overlapped y position */ - if (yb > yTmp && possible > yb) - possible = yb; - basket = yt - ch; - if (basket > yTmp && possible > basket) - possible = basket; + if(!revupdown) + { + if (yTmp < yb && yb < possible ) possible = yb; + basket = yt - ch;if (yTmp < basket && basket < possible) possible = basket; + } else + { + basket = yt - ch;if (possible < basket && basket < yTmp) possible = basket; + if (possible < yb && yb < yTmp) possible = yb; + } } yTmp = possible; } } - while (overlap != NONE && overlap != H_WRONG && yTmp < placeable->workArea ().bottom ()); + while (overlap != NONE && overlap != H_WRONG && ( + (!revupdown && yTmp < placeable->workArea ().bottom ()) || + (revupdown && yTmp > placeable->workArea ().top () - ch) + )); if (ch >= placeable->workArea ().height ()) yOptimal = placeable->workArea ().y (); pos.setX (xOptimal + placeable->extents ().left); - pos.setY (yOptimal + placeable->extents ().top); + pos.setY (yOptimal + (!revupdown ? placeable->extents ().top : -placeable->extents ().bottom)); } } }