Add key handler for esc of keyboard / merge latest code using private 18/17818/2
authorHyungdeuk Kim <hd3.kim@samsung.com>
Tue, 13 Aug 2013 04:28:48 +0000 (13:28 +0900)
committerSemun Lee <sm79.lee@samsung.com>
Thu, 13 Mar 2014 01:00:50 +0000 (18:00 -0700)
Change-Id: Ida24ade6a65257a965c9954ac086abc89820dfc9

packaging/syspopup.spec
syspopup/syspopup.c
syspopup/syspopup_efl.c

index 51444cfafc6604253b1b30f806db6b6e035b0fc8..9faf185360ff683cfe7264f50c195477093495a4 100755 (executable)
@@ -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
 
index e91b81229a8f3953c3256d7a67e7d992da1c0506..4e16c57aeaccbb3798c92dd85855c9104abcc653 100755 (executable)
@@ -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);
index 2b46281272c1ab35051a1fc981bf809e785d0f26..dbb3555651f4cf59a7c557694c704bce9d8116e3 100755 (executable)
@@ -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