summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-11-07 12:52:32 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-11-18 11:44:44 -0500
commit9b17e1079d155c155feca964177d66ca017a1e59 (patch)
tree0114f608987db3f22cc55dcc0b5a6207bcc85fdb
parent5972d0369ab2722bcbc3d1aeee39eea9d8b7f00a (diff)
break out repeated code from _e_place_desk_region_smart_area_calc() into separate function
no functional changes
-rw-r--r--src/bin/e_place.c104
1 files changed, 31 insertions, 73 deletions
diff --git a/src/bin/e_place.c b/src/bin/e_place.c
index 112f3f9b4..347603552 100644
--- a/src/bin/e_place.c
+++ b/src/bin/e_place.c
@@ -210,92 +210,50 @@ _e_place_desk_region_smart_obstacle_add(char *u_x, char *u_y, int **a_x, int **a
210} 210}
211 211
212static int 212static int
213_e_place_desk_region_smart_area_calc(int x, int y, int xx, int yy, int zx, int zy, int zw, int zh, int w, int h, Eina_List *skiplist, E_Desk *desk, int area, int *rx, int *ry) 213_e_place_desk_region_smart_area_check(Eina_List *skiplist, int x, int y, int w, int h, E_Desk *desk, int area, int *rx, int *ry)
214{ 214{
215 if ((x <= MAX(zx, zx + (zw - w))) && 215 int ar = 0;
216 (y <= MAX(zy, zy + (zh - h))))
217 {
218 int ar = 0;
219 216
220 ar = _e_place_coverage_client_add(skiplist, ar, 217 ar = _e_place_coverage_client_add(skiplist, ar, x, y, w, h);
221 x, y,
222 w, h);
223 218
224 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART) 219 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
225 ar = _e_place_coverage_zone_obstacles_add(desk, ar, 220 ar = _e_place_coverage_zone_obstacles_add(desk, ar, x, y, w, h);
226 x, y,
227 w, h);
228 221
229 if (ar < area) 222 if (ar < area)
230 { 223 {
231 area = ar; 224 *rx = x;
232 *rx = x; 225 *ry = y;
233 *ry = y; 226 if (ar == 0) return ar;
234 if (ar == 0) return ar; 227 }
235 } 228 return ar;
229}
230
231static int
232_e_place_desk_region_smart_area_calc(int x, int y, int xx, int yy, int zx, int zy, int zw, int zh, int w, int h, Eina_List *skiplist, E_Desk *desk, int area, int *rx, int *ry)
233{
234 if ((x <= MAX(zx, zx + (zw - w))) && (y <= MAX(zy, zy + (zh - h))))
235 {
236 int ar = _e_place_desk_region_smart_area_check(skiplist, x, y, w, h, desk, area, rx, ry);
237 if (!ar) return ar;
238 if (ar < area) area = ar;
236 } 239 }
237 if ((MAX(zx, xx - w) > zx) && (y <= MAX(zy, zy + (zh - h)))) 240 if ((MAX(zx, xx - w) > zx) && (y <= MAX(zy, zy + (zh - h))))
238 { 241 {
239 int ar = 0; 242 int ar = _e_place_desk_region_smart_area_check(skiplist, xx - w, y, w, h, desk, area, rx, ry);
240 243 if (!ar) return ar;
241 ar = _e_place_coverage_client_add(skiplist, ar, 244 if (ar < area) area = ar;
242 xx - w, y,
243 w, h);
244
245 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
246 ar = _e_place_coverage_zone_obstacles_add(desk, ar,
247 xx - w, y,
248 w, h);
249
250 if (ar < area)
251 {
252 area = ar;
253 *rx = xx - w;
254 *ry = y;
255 if (ar == 0) return ar;
256 }
257 } 245 }
258 if ((MAX(zx, xx - w) > zx) && (MAX(zy, yy - h) > zy)) 246 if ((MAX(zx, xx - w) > zx) && (MAX(zy, yy - h) > zy))
259 { 247 {
260 int ar = 0; 248 int ar = _e_place_desk_region_smart_area_check(skiplist, xx - w, yy - h, w, h, desk, area, rx, ry);
261 249 if (!ar) return ar;
262 ar = _e_place_coverage_client_add(skiplist, ar, 250 if (ar < area) area = ar;
263 xx - w, yy - h,
264 w, h);
265
266 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
267 ar = _e_place_coverage_zone_obstacles_add(desk, ar,
268 xx - w, yy - h,
269 w, h);
270
271 if (ar < area)
272 {
273 area = ar;
274 *rx = xx - w;
275 *ry = yy - h;
276 if (ar == 0) return ar;
277 }
278 } 251 }
279 if ((x <= MAX(zx, zx + (zw - w))) && (MAX(zy, yy - h) > zy)) 252 if ((x <= MAX(zx, zx + (zw - w))) && (MAX(zy, yy - h) > zy))
280 { 253 {
281 int ar = 0; 254 int ar = _e_place_desk_region_smart_area_check(skiplist, x, yy - h, w, h, desk, area, rx, ry);
282 255 if (!ar) return ar;
283 ar = _e_place_coverage_client_add(skiplist, ar, 256 if (ar < area) area = ar;
284 x, yy - h,
285 w, h);
286
287 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_SMART)
288 ar = _e_place_coverage_zone_obstacles_add(desk, ar,
289 x, yy - h,
290 w, h);
291
292 if (ar < area)
293 {
294 area = ar;
295 *rx = x;
296 *ry = yy - h;
297 if (ar == 0) return ar;
298 }
299 } 257 }
300 return area; 258 return area;
301} 259}