summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-01-22 22:35:28 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-01-22 22:37:00 -0500
commiteb2dfda7bb3e058acc118e5fbc4f1b01ce36905f (patch)
treeb77bbb2c9aa9d6ade8bdb9b80b70b5ddfda892a5
parente2525fbb8fe7cdf18a3c7b884cca5e38cd670acb (diff)
win centering: unbork!
not centering on an axis does not mean that it needs to be moved to the screen origin. also clamp to screen x,y, not 0,0
-rw-r--r--src/lib/elm_win.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 233e17b93..53bbe8a74 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3797,15 +3797,13 @@ _elm_win_center(Eo *obj, Elm_Win_Data *sd, Eina_Bool h, Eina_Bool v)
3797 ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &screen_w, &screen_h); 3797 ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &screen_w, &screen_h);
3798 if ((!screen_w) || (!screen_h)) return; 3798 if ((!screen_w) || (!screen_h)) return;
3799 3799
3800 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h); 3800 evas_object_geometry_get(obj, &nx, &ny, &win_w, &win_h);
3801 if ((!win_w) || (!win_h)) return; 3801 if ((!win_w) || (!win_h)) return;
3802 3802
3803 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2); 3803 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
3804 else nx = sd->screen.x;
3805 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2); 3804 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
3806 else ny = sd->screen.y; 3805 if (nx < sd->screen.x) nx = sd->screen.x;
3807 if (nx < 0) nx = 0; 3806 if (ny < sd->screen.y) ny = sd->screen.y;
3808 if (ny < 0) ny = 0;
3809 3807
3810 evas_object_move(obj, nx, ny); 3808 evas_object_move(obj, nx, ny);
3811} 3809}