#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#define WIN_PROP_NAME "SYSTEM_POPUP"
+
static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom,
Atom type, unsigned int *val,
unsigned int len)
return -1;
}
-int X_syspopup_process_keydown(int id, const char *keyname)
+int X_syspopup_process_keypress(int id, const char *keyname)
{
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,
win = (Window) sp->internal_data;
XUnmapWindow(d, win);
}
-
} else {
_E("no find key down");
}
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
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;
__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);
* @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
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)
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);
#include <Ecore_Input.h>
#include <Ecore_X.h>
-#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;
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
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
}