diff options
-rwxr-xr-x | packaging/syspopup.spec | 5 | ||||
-rwxr-xr-x | syspopup/syspopup.c | 42 | ||||
-rwxr-xr-x | syspopup/syspopup_efl.c | 24 |
3 files changed, 44 insertions, 27 deletions
diff --git a/packaging/syspopup.spec b/packaging/syspopup.spec index 51444cf..9faf185 100755 --- a/packaging/syspopup.spec +++ b/packaging/syspopup.spec @@ -3,7 +3,7 @@ Name: syspopup Summary: Syspopup package -Version: 0.0.98 +Version: 0.0.99 Release: 0 Group: System/Libraries License: Apache-2.0 @@ -124,6 +124,9 @@ touch %{buildroot}%{_datadir}/popup_noti_term %{_libdir}/pkgconfig/syspopup-caller.pc %changelog +* Tue Aug 13 2013 - Hyungdeuk Kim <hd3.kim@samsung.com> +- Add key handler for esc of keyboard + * Fri Jun 21 2013 - Hyungdeuk Kim <hd3.kim@samsung.com> - Change end key term info of wifi-qs diff --git a/syspopup/syspopup.c b/syspopup/syspopup.c index e91b812..4e16c57 100755 --- a/syspopup/syspopup.c +++ b/syspopup/syspopup.c @@ -31,6 +31,8 @@ #include <X11/Xutil.h> #endif +#define WIN_PROP_NAME "SYSTEM_POPUP" + #ifndef WAYLAND static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom, Atom type, unsigned int *val, @@ -242,18 +244,22 @@ int X_syspopup_rotation_get(Display *dpy, Window win) } #endif -int X_syspopup_process_keydown(int id, const char *keyname) +int X_syspopup_process_keypress(int id, const char *keyname) { #ifndef WAYLAND Display *d; Window win; syspopup *sp = NULL; - if (strcmp(keyname, KEY_END) == 0) { + _D("key press - %s", keyname); + + if ((strcmp(keyname, KEY_END) == 0) || + (strcmp(keyname, "Escape") == 0)) + { d = XOpenDisplay(NULL); sp = _syspopup_find_by_id(id); if (sp != NULL) { - _D("find key down - %s", sp->name); + _D("find - %s / endkey_act - %d", sp->name, sp->endkey_act); if (sp->endkey_act == SYSPOPUP_KEYEND_TERM) { if (sp->def_term_fn != NULL) sp->def_term_fn(sp->dupped_bundle, @@ -268,7 +274,6 @@ int X_syspopup_process_keydown(int id, const char *keyname) win = (Window) sp->internal_data; XUnmapWindow(d, win); } - } else { _E("no find key down"); } @@ -302,6 +307,17 @@ int X_syspopup_process_rotate(int id) return 0; } +#else +static void __efl_rotation_set(Evas_Object* win, Ecore_X_Window xwin) +{ + ecore_x_icccm_name_class_set(xwin, WIN_PROP_NAME, WIN_PROP_NAME); + if (elm_win_wm_rotation_supported_get(win)) { + int rots[4] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(win, &rots, 4); + } else { + _E("win rotation no supported"); + } +} #endif #ifndef WAYLAND @@ -340,7 +356,7 @@ int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win, _syspopup_info_free(info); return -1; } - + sp->name = strdup(info->name); sp->def_term_fn = handler->def_term_fn; sp->def_timeout_fn = handler->def_timeout_fn; @@ -366,7 +382,11 @@ int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win, __X_syspopup_disable_focus (dpy, xwin); } +#ifdef ROTATE_USING_X_CLIENT rotate_func(dpy, xwin, sp); +#else + __efl_rotation_set((Evas_Object* )win,(Ecore_X_Window)xwin); +#endif if (is_unviewable == 1) { XMapWindow(dpy, xwin); @@ -382,8 +402,8 @@ int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win, * @brief This API reset created the system popup's properties * * This API reset created the system popup's properties based on - * system popup information DB after extracting popup name from - * given bundle system popup properties to be reset : timeout, + * system popup information DB after extracting popup name from + * given bundle system popup properties to be reset : timeout, * default action type, .... * * @param[in] b bundle received by app_reset handler @@ -398,7 +418,6 @@ int X_syspopup_reset(bundle *b) const char *popup_name; syspopup_info_t *info; syspopup *sp = NULL; - int (*rotate_func) (Display *, Window, syspopup *); popup_name = _syspopup_get_name_from_bundle(b); if (popup_name == NULL) @@ -427,9 +446,14 @@ int X_syspopup_reset(bundle *b) if (info->focus == 1) { __X_syspopup_disable_focus (d, win); } + +#ifdef ROTATE_USING_X_CLIENT + int (*rotate_func) (Display *, Window, syspopup *); rotate_func = sp->rotate_cb; rotate_func(d, win, sp); - +#else + __efl_rotation_set((Evas_Object *)sp->win, (Ecore_X_Window)win); +#endif XMapWindow(d, win); /*XMapRaised(d,win);*/ XCloseDisplay(d); diff --git a/syspopup/syspopup_efl.c b/syspopup/syspopup_efl.c index 2b46281..dbb3555 100755 --- a/syspopup/syspopup_efl.c +++ b/syspopup/syspopup_efl.c @@ -33,9 +33,7 @@ #include <Ecore_X.h> #endif -#define WIN_PROP_NAME "SYSTEM_POPUP" - -static Eina_Bool __x_keydown_cb(void *data, int type, void *event) +static Eina_Bool __x_keypress_cb(void *data, int type, void *event) { int id = (int)data; Ecore_Event_Key *ev = event; @@ -43,9 +41,9 @@ static Eina_Bool __x_keydown_cb(void *data, int type, void *event) if (ev == NULL) return 0; - X_syspopup_process_keydown(id, ev->keyname); + X_syspopup_process_keypress(id, ev->keyname); - return ECORE_CALLBACK_DONE; + return ECORE_CALLBACK_RENEW; } #ifdef ROTATE_USING_X_CLIENT @@ -128,22 +126,14 @@ API int syspopup_create(bundle *b, syspopup_handler *handler, return -1; } - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __x_keydown_cb, - (void *)id); - /* X_syspopup_core should process 2 events */ /* First, rotate event */ - /* Second, keydown event */ + /* Second, keypress event */ + utilx_grab_key(dpy, xwin, KEY_BACK, TOP_POSITION_GRAB); + ecore_event_handler_add(ECORE_EVENT_KEY_UP, __x_keypress_cb, (void *)id); + #ifdef ROTATE_USING_X_CLIENT ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,__x_rotate_cb, (void *)id); -#else - ecore_x_icccm_name_class_set(xwin, WIN_PROP_NAME, WIN_PROP_NAME); - if (elm_win_wm_rotation_supported_get(parent)) { - int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(parent, &rots, 4); - } else { - _E("win rotation no supported"); - } #endif } #endif |