From 9d42b9b5c46cd25aa7db9e27058a19231d1f304c Mon Sep 17 00:00:00 2001 From: "sunil85.kim" Date: Fri, 22 Mar 2013 19:38:22 +0900 Subject: [PATCH] Fix the keypad layout in EAP connect screen --- .gitignore | 59 +++++++++ debian/changelog | 24 ++++ packaging/wifi-efl-ug.spec | 2 +- sources/libraries/Common/common_eap_connect.c | 9 +- sources/libraries/Common/common_utils.c | 33 +++++ sources/wifi-syspopup/wifi-syspopup.c | 179 ++++++++++++++++++++++---- 6 files changed, 279 insertions(+), 27 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c826a48 --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +build_log +*.log +*.pyc +usr +opt +*.o +*.os +*.exe +packages +binaries +*.ipk +*~ +.project +.cproject +CMakeCache.txt +CMakeFiles +Makefile +build-stamp +cmake_install.cmake +install_manifest.txt +configure-stamp +debian/files +debian/net.wifi-qs-dbg.substvars +debian/net.wifi-qs-dbg +debian/net.wifi-qs.install +debian/net.wifi-qs.substvars +debian/net.wifi-qs +debian/wifi-efl-ug-dbg.substvars +debian/wifi-efl-ug-dbg +debian/wifi-efl-ug.install +debian/wifi-efl-ug.postinst.debhelper +debian/wifi-efl-ug.postrm.debhelper +debian/wifi-efl-ug.substvars +debian/wifi-efl-ug +sources/ui-gadget/CMakeCache.txt +sources/ui-gadget/CMakeFiles +sources/ui-gadget/Makefile +sources/ui-gadget/cmake_install.cmake +sources/ui-gadget/install_manifest.txt +sources/ui-gadget/edcs/*.edj +sources/ui-gadget/libug-wifi-efl-UG.so +sources/ui-gadget/libug-wifi-efl-UG.so.0.1.0 +sources/ui-gadget/po/CMakeCache.txt +sources/ui-gadget/po/CMakeFiles +sources/ui-gadget/po/Makefile +sources/ui-gadget/po/cmake_install.cmake +sources/ui-gadget/po/install_manifest.txt +sources/ui-gadget/po/*.mo +sources/wifi-syspopup/CMakeCache.txt +sources/wifi-syspopup/CMakeFiles +sources/wifi-syspopup/Makefile +sources/wifi-syspopup/cmake_install.cmake +sources/wifi-syspopup/install_manifest.txt +sources/wifi-syspopup/net.wifi-qs.desktop +sources/wifi-syspopup/edcs/*.edj +sources/wifi-syspopup/po/CMakeFiles +sources/wifi-syspopup/po/Makefile +sources/wifi-syspopup/po/*.mo +sources/wifi-syspopup/wifi-qs diff --git a/debian/changelog b/debian/changelog index 91cbe59..8b33e90 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +wifi-efl-ug (0.5.2-4) precise; urgency=low + + * Fix the keypad layout in EAP connect screen + * Git: magnolia/apps/home/ug-wifi-efl + * Tag: wifi-efl-ug_0.5.2-4 + + -- sunil85.kim Fri, 22 Mar 2013 11:09:35 +0900 + +wifi-efl-ug (0.5.2-3) precise; urgency=low + + * Destroy Wi-Fi popup when lockscreen shown + * Git: magnolia/apps/home/ug-wifi-efl + * Tag: wifi-efl-ug_0.5.2-3 + + -- sunil85.kim Thu, 21 Mar 2013 17:30:54 +0900 + +wifi-efl-ug (0.5.2-2) precise; urgency=low + + * Modify rotation function + * Git: magnolia/apps/home/ug-wifi-efl + * Tag: wifi-efl-ug_0.5.2-2 + + -- sunil85.kim Thu, 21 Mar 2013 15:51:52 +0900 + wifi-efl-ug (0.5.2-1) precise; urgency=low * Update for SR diff --git a/packaging/wifi-efl-ug.spec b/packaging/wifi-efl-ug.spec index ba4a66b..ef1ad68 100644 --- a/packaging/wifi-efl-ug.spec +++ b/packaging/wifi-efl-ug.spec @@ -1,6 +1,6 @@ Name: wifi-efl-ug Summary: Wi-Fi UI Gadget -Version: 0.5.2_1 +Version: 0.5.2_4 Release: 1 Group: App/Network License: Flora License diff --git a/sources/libraries/Common/common_eap_connect.c b/sources/libraries/Common/common_eap_connect.c index 5d82ae4..c52cfc5 100644 --- a/sources/libraries/Common/common_eap_connect.c +++ b/sources/libraries/Common/common_eap_connect.c @@ -121,6 +121,8 @@ struct common_eap_connect_data { Evas_Object* navi_frame; int key_status; + int visible_area_width; + int visible_area_height; }; static void _gl_eap_provision_sel(void *data, Evas_Object *obj, void *event_info); @@ -459,7 +461,7 @@ static Evas_Object *_gl_eap_entry_item_content_get(void *data, Evas_Object *obj, char *guide_txt = NULL; char *accepted = NULL; Eina_Bool hide_entry_txt = EINA_FALSE; - Elm_Input_Panel_Layout panel_type = ELM_INPUT_PANEL_LAYOUT_URL; + Elm_Input_Panel_Layout panel_type = ELM_INPUT_PANEL_LAYOUT_PASSWORD; Elm_Entry_Filter_Limit_Size limit_filter_data; @@ -712,8 +714,11 @@ static void __common_eap_connect_im_ctxt_evnt_resize_cb(void *data, Ecore_IMF_Co eap_connect_data_t *eap_data = (eap_connect_data_t *)data; eap_data->key_status = value; + Evas_Object *box = elm_object_content_get(eap_data->popup); - eap_view_rotate_popup(eap_data, rotate_angle); + __common_popup_size_get(ctx, &eap_data->visible_area_width, &eap_data->visible_area_height); + evas_object_size_hint_min_set(box, eap_data->visible_area_width * elm_config_scale_get(), + eap_data->visible_area_height * elm_config_scale_get()); __COMMON_FUNC_EXIT__; return; diff --git a/sources/libraries/Common/common_utils.c b/sources/libraries/Common/common_utils.c index 23c8eec..844d943 100644 --- a/sources/libraries/Common/common_utils.c +++ b/sources/libraries/Common/common_utils.c @@ -25,6 +25,9 @@ #include "common_utils.h" #include "i18nmanager.h" +#define POPUP_HEAD_AREA 134 +#define POPUP_BUTTON_AREA 80 + typedef struct { char *title_str; char *info_str; @@ -168,6 +171,36 @@ char *common_utils_entry_layout_get_text(Evas_Object *layout) return elm_entry_markup_to_utf8(elm_entry_entry_get(entry)); } +void __common_popup_size_get(Ecore_IMF_Context *target_imf, int *width, int *height) +{ + __COMMON_FUNC_ENTER__; + + int window_width, window_height; + int start_x, start_y, imf_width, imf_height; + int rotate_angle; + float resize_scale = 0.7f; + + rotate_angle = common_utils_get_rotate_angle(APPCORE_RM_UNKNOWN); + ecore_x_window_size_get(ecore_x_window_root_first_get(), &window_width, &window_height); + + *width = window_width; + + if (rotate_angle == 0 || rotate_angle == 180) + { + *height = window_height * resize_scale; + }else + *height = window_width; + + if (target_imf != NULL) { + ecore_imf_context_input_panel_geometry_get(target_imf, &start_x, &start_y, &imf_width, &imf_height); + *height = start_y * resize_scale; + } + + *height = *height-POPUP_HEAD_AREA-POPUP_BUTTON_AREA; + + __COMMON_FUNC_EXIT__; +} + void common_utils_entry_password_set(Evas_Object *layout, Eina_Bool pswd_set) { Evas_Object *entry = elm_object_part_content_get(layout, "elm.swallow.content"); diff --git a/sources/wifi-syspopup/wifi-syspopup.c b/sources/wifi-syspopup/wifi-syspopup.c index 9bd03a8..8e5c198 100644 --- a/sources/wifi-syspopup/wifi-syspopup.c +++ b/sources/wifi-syspopup/wifi-syspopup.c @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include "common.h" #include "view-main.h" @@ -33,33 +36,150 @@ #include "appcoreWrapper.h" #include "wifi-syspopup-engine-callback.h" +#define POPUP_HEAD_AREA 134 +#define POPUP_BUTTON_AREA 200 +#define MAX_INITIAL_QS_POPUP_LIST_SIZE 8 + wifi_object* syspopup_app_state = NULL; -static int wifi_syspopup_rotate_cb(enum appcore_rm rotate_mode, void *data) +static int __get_window_property(Display *dpy, Window win, Atom atom, + Atom type, unsigned int *val, + unsigned int len) +{ + __COMMON_FUNC_ENTER__; + unsigned char *prop_ret = NULL; + Atom type_ret = -1; + unsigned long bytes_after = 0; + unsigned long num_ret = -1; + int format_ret = -1; + unsigned int i = 0; + int num = 0; + + prop_ret = NULL; + if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False, + type, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) != Success) { + return -1; + } + + if (type_ret != type || format_ret != 32) { + num = -1; + } else if (num_ret == 0 || !prop_ret) { + num = 0; + } else { + if (num_ret < len) { + len = num_ret; + } + for (i = 0; i < len; i++) { + val[i] = ((unsigned long *)prop_ret)[i]; + } + num = len; + } + + if (prop_ret) { + XFree(prop_ret); + } + + __COMMON_FUNC_EXIT__; + return num; +} + +static int __x_rotation_get(Display *dpy, Window win) { + __COMMON_FUNC_ENTER__; + Window active_win = 0; + Window root_win = 0; + int rotation = -1; + int ret = -1; + + Atom atom_active_win; + Atom atom_win_rotate_angle; + + root_win = XDefaultRootWindow(dpy); + + atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); + ret = __get_window_property(dpy, root_win, atom_active_win, + XA_WINDOW, + (unsigned int *)&active_win, 1); + + if (ret != 1) + return 0; + + atom_win_rotate_angle = + XInternAtom(dpy, "_E_ILLUME_ROTATE_WINDOW_ANGLE", False); + ret = __get_window_property(dpy, active_win , + atom_win_rotate_angle, XA_CARDINAL, + (unsigned int *)&rotation, 1); + + __COMMON_FUNC_EXIT__; + + if (ret == 1) + return rotation; + else + return 0; +} + +static Eina_Bool __rotate(void *data, int type, void *event) +{ + __COMMON_FUNC_ENTER__; + struct wifi_object *ad = data; + Ecore_X_Event_Client_Message *ev = event; + int visible_area_width, visible_area_height; int rotate_angle; + Evas_Object *box = NULL; - rotate_angle = common_utils_get_rotate_angle(rotate_mode); - box = elm_object_content_get(syspopup_app_state->syspopup); + if (!event) + return ECORE_CALLBACK_RENEW; - elm_win_rotation_with_resize_set(syspopup_app_state->win_main, rotate_angle); + if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE) { + box = elm_object_content_get(syspopup_app_state->syspopup); - if (0 == rotate_angle || 180 == rotate_angle) - evas_object_size_hint_min_set(box, -1, - DEVICE_PICKER_POPUP_H * elm_config_scale_get()); - else - evas_object_size_hint_min_set(box, -1, - DEVICE_PICKER_POPUP_LN_H * elm_config_scale_get()); + if (box) { + rotate_angle = __x_rotation_get(ecore_x_display_get(), elm_win_xwindow_get(syspopup_app_state->win_main)); + if (rotate_angle < 0) + rotate_angle = 0; + __common_popup_size_set(NULL ,&visible_area_width, &visible_area_height, rotate_angle); + elm_win_rotation_with_resize_set(syspopup_app_state->win_main, rotate_angle); + evas_object_size_hint_min_set(box, visible_area_width * elm_config_scale_get(), visible_area_height * elm_config_scale_get()); + } - if (syspopup_app_state->eap_popup) - eap_view_rotate_popup(syspopup_app_state->eap_popup, rotate_angle); + if (syspopup_app_state->eap_popup) + eap_view_rotate_popup(syspopup_app_state->eap_popup, rotate_angle); + } - INFO_LOG(SP_NAME_NORMAL, "rotate_angle: %d", rotate_angle); + __COMMON_FUNC_EXIT__; return 0; } +void __common_popup_size_set(Ecore_IMF_Context *target_imf, int *width, int *height, int rotate_angle) +{ + __COMMON_FUNC_ENTER__; + + int window_width, window_height; + int start_x, start_y, imf_width, imf_height; + float resize_scale = 0.7f; + + ecore_x_window_size_get(ecore_x_window_root_first_get(), &window_width, &window_height); + + *width = -1; + + if (rotate_angle == 0 || rotate_angle == 180) + *height = window_height * resize_scale; + else + *height = window_width; + + if (target_imf != NULL) { + ecore_imf_context_input_panel_geometry_get(target_imf, &start_x, &start_y, &imf_width, &imf_height); + *height = start_y * resize_scale; + }else + *height = *height-POPUP_HEAD_AREA-POPUP_BUTTON_AREA; + + + __COMMON_FUNC_EXIT__; +} + static void wifi_syspopup_exit(void) { __COMMON_FUNC_ENTER__; @@ -96,6 +216,7 @@ static void _exit_cb(void *data, Evas_Object *obj, void *event_info) int wifi_syspopup_destroy(void) { + __COMMON_FUNC_ENTER__; if (syspopup_app_state->passpopup) { passwd_popup_free(syspopup_app_state->passpopup); syspopup_app_state->passpopup = NULL; @@ -124,6 +245,7 @@ int wifi_syspopup_destroy(void) connman_request_scan_mode_set(WIFI_BGSCAN_MODE_EXPONENTIAL); wifi_syspopup_exit(); + __COMMON_FUNC_EXIT__; return 1; } @@ -132,6 +254,8 @@ int wifi_syspopup_create(void) { __COMMON_FUNC_ENTER__; int rotate_angle; + int visible_area_height; + int visible_area_width; if (NULL == syspopup_app_state->syspopup) { syspopup_app_state->syspopup = elm_popup_add(syspopup_app_state->layout_main); @@ -155,14 +279,18 @@ int wifi_syspopup_create(void) elm_box_pack_end(box, main_list); evas_object_show(main_list); - rotate_angle = common_utils_get_rotate_angle(APPCORE_RM_UNKNOWN); + rotate_angle = __x_rotation_get(ecore_x_display_get(), elm_win_xwindow_get(syspopup_app_state->win_main)); + + if (rotate_angle < 0) + rotate_angle = 0; + + ecore_x_icccm_hints_set(elm_win_xwindow_get(syspopup_app_state->win_main), 1, 0, 0, 0, 0, 0, 0); + elm_win_rotation_with_resize_set(syspopup_app_state->win_main, rotate_angle); - if (0 == rotate_angle || 180 == rotate_angle) - evas_object_size_hint_min_set(box, -1, - DEVICE_PICKER_POPUP_H * elm_config_scale_get()); - else - evas_object_size_hint_min_set(box, -1, - DEVICE_PICKER_POPUP_LN_H * elm_config_scale_get()); + + __common_popup_size_set(NULL ,&visible_area_width, &visible_area_height, rotate_angle); + + evas_object_size_hint_min_set(box, visible_area_width * elm_config_scale_get(), visible_area_height * elm_config_scale_get()); elm_object_content_set(syspopup_app_state->syspopup, box); evas_object_show(syspopup_app_state->syspopup); @@ -336,7 +464,7 @@ static void __pw_lock_state_change_cb(keynode_t *node, void *user_data) pw_lock_state != VCONFKEY_PWLOCK_BOOTING_LOCK) { vconf_ignore_key_changed(VCONFKEY_PWLOCK_STATE, __pw_lock_state_change_cb); wifi_syspopup_create(); - appcore_set_rotation_cb(wifi_syspopup_rotate_cb, NULL); + ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __rotate, (void *)syspopup_app_state); g_idle_add(load_initial_ap_list, NULL); } @@ -354,6 +482,7 @@ static int app_reset(bundle *b, void *data) Evas *evas = NULL; int ret = 0; int pw_lock_state = 0; + int w, h = 0; assertm_if(NULL == data, "data param is NULL!!"); assertm_if(NULL == b, "bundle is NULL!!"); @@ -363,7 +492,6 @@ static int app_reset(bundle *b, void *data) if (syspopup_has_popup(b)) { INFO_LOG(SP_NAME_NORMAL, "Wi-Fi device picker is already launched"); - syspopup_reset(b); } else { win_main = appcore_create_win(PACKAGE); @@ -418,7 +546,6 @@ static int app_reset(bundle *b, void *data) return 0; } else { syspopup_app_state->syspopup_type = WIFI_SYSPOPUP_WITH_AP_LIST; - int wlan_ret = wifi_syspopup_init(); if (WLAN_MANAGER_ERR_NONE != wlan_ret || _power_on_check() == FALSE) { @@ -457,8 +584,10 @@ static int app_reset(bundle *b, void *data) */ vconf_notify_key_changed(VCONFKEY_PWLOCK_STATE, __pw_lock_state_change_cb, NULL); } else { + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + wifi_syspopup_create(); - appcore_set_rotation_cb(wifi_syspopup_rotate_cb, NULL); + ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __rotate, (void *)syspopup_app_state); g_idle_add(load_initial_ap_list, NULL); } @@ -496,6 +625,8 @@ static int app_pause(void *data) connman_request_scan_mode_set(WIFI_BGSCAN_MODE_EXPONENTIAL); + wifi_syspopup_destroy(); + __COMMON_FUNC_EXIT__; return 0; } -- 2.7.4