From b2c6aa3fc37af84fce77db74f547d83cdaaa5e25 Mon Sep 17 00:00:00 2001 From: "deasung.kim" Date: Thu, 1 Dec 2011 18:52:28 +0900 Subject: [PATCH] [Copy&paste popup] CQ:H0100137759 ctxpopup's position revised by screen size when entry has no viewport Change-Id: If94b2f483d20e9e45afb692782f04ab20154cc1d --- src/lib/elm_entry.c | 1 + src/lib/elm_module_priv.h | 2 +- src/modules/ctxpopup_copypasteUI/copypaste.c | 23 +++++++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index e338559..95a8aea 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -3093,6 +3093,7 @@ EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extensi ext_mod->cnpinit = _cnpinit; ext_mod->context_menu = wd->context_menu; ext_mod->cnp_mode = wd->cnp_mode; + ext_mod->viewport_rect = _viewport_region_get(obj); } EAPI void diff --git a/src/lib/elm_module_priv.h b/src/lib/elm_module_priv.h index 0af8b74..8693834 100644 --- a/src/lib/elm_module_priv.h +++ b/src/lib/elm_module_priv.h @@ -8,7 +8,7 @@ struct _Elm_Entry_Extension_data { Evas_Object *popup; Evas_Object *ent; - Evas_Object *viewport_obj; + Evas_Coord_Rectangle viewport_rect; Eina_List *items; cpfunc select; cpfunc copy; diff --git a/src/modules/ctxpopup_copypasteUI/copypaste.c b/src/modules/ctxpopup_copypasteUI/copypaste.c index 0831e37..9c587bb 100644 --- a/src/modules/ctxpopup_copypasteUI/copypaste.c +++ b/src/modules/ctxpopup_copypasteUI/copypaste.c @@ -44,12 +44,17 @@ _ctxpopup_position(Evas_Object *obj) } else { - if (ext_mod->viewport_obj) + if (ext_mod->viewport_rect.x != -1 || ext_mod->viewport_rect.y != -1 + || ext_mod->viewport_rect.w != -1 || ext_mod->viewport_rect.h != -1) { Evas_Coord vx, vy, vw, vh, x2, y2; x2 = x + w; y2 = y + h; - evas_object_geometry_get(ext_mod->viewport_obj, &vx, &vy, &vw, &vh); + vx = ext_mod->viewport_rect.x; + vy = ext_mod->viewport_rect.y; + vw = ext_mod->viewport_rect.w; + vh = ext_mod->viewport_rect.h; + if (x < vx) x = vx; if (y < vy) y = vy; if (x2 > vx + vw) x2 = vx + vw; @@ -57,6 +62,20 @@ _ctxpopup_position(Evas_Object *obj) w = x2 - x; h = y2 - y; } + else + { + Evas_Coord sw, sh, x2, y2; + x2 = x + w; + y2 = y + h; + ecore_x_window_size_get(ecore_x_window_root_first_get(), &sw, &sh); + + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x2 > sw) x2 = sw; + if (y2 > sh) y2 = sh; + w = x2 - x; + h = y2 - y; + } cx = x + (w / 2); cy = y + (h / 2); evas_object_move(ext_mod->popup, cx, cy); -- 2.7.4