if(status == UNLOCK_STATUS)
{
- _rotate_func(ad);
-
/* set type once when volume app shows */
ad->type = _get_volume_type();
ad->step = _get_step(ad->type);
return 0;
}
+/* rotation event callback func. */
+static void _rotate_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ struct appdata *ad = data;
+ retvm_if(ad == NULL, NULL, "Invalid argument: appdata is NULL\n");
+
+ static int current_angle = 0;
+ //int changed_angle = elm_win_rotation_get(obj);
+ ad->angle = elm_win_rotation_get(obj);
+
+ _D("window rotated [%d] => [%d]", current_angle, ad->angle);
+ /* If S View Lock is not running, execute rotations function */
+ if(current_angle != ad->angle) {
+ current_angle = ad->angle;
+ switch(current_angle){
+ case 90 :
+ case 270 :
+ _D("show,landscape");
+ elm_object_signal_emit(ad->block_events, "show,landscape", "bg");
+ break;
+ default :
+ _D("show,portrait");
+ elm_object_signal_emit(ad->block_events, "show,portrait", "bg");
+ break;
+ }
+ }
+}
+
int _app_create(struct appdata *ad)
{
_D("%s\n", __func__);
return -1;
}
+ /* Set available rotations */
+ if (elm_win_wm_rotation_supported_get(ad->win)) {
+ const int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(ad->win, &rots, 4);
+ _D("set available rotations");
+ }
+
+ /* rotation event callback */
+ evas_object_smart_callback_add(ad->win, "wm,rotation,changed", _rotate_changed_cb, ad);
+
_init_svi(ad);
/* vconf changed callback */
return ret;
}
-int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom,
- Atom type, unsigned int *val,
- unsigned int len)
-{
- 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);
-
- return num;
-}
-
-int _x_rotation_get(Display *dpy, void *data)
-{
- Window active_win = 0;
- Window root_win = 0;
- int rotation = -1;
- int ret = -1;
-
- Atom atom_active_win;
- Atom atom_win_rotate_angle;
-
- retvm_if(dpy == NULL, -1, "dpy is NULL\n");
- root_win = XDefaultRootWindow(dpy);
-
- atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
- ret = __utilx_ss_get_window_property(dpy, root_win, atom_active_win,
- XA_WINDOW,
- (unsigned int *)&active_win, 1);
-
- if(ret < 0)
- return ret;
-
- atom_win_rotate_angle = XInternAtom(dpy, "_E_ILLUME_ROTATE_ROOT_ANGLE", False);
- ret = __utilx_ss_get_window_property(dpy, root_win,
- atom_win_rotate_angle, XA_CARDINAL,
- (unsigned int *)&rotation, 1);
-
- if(ret != -1)
- return rotation;
-
- return -1;
-}
-
-int _volume_popup_resize(void *data, int angle)
-{
- int rotation = 0;
- struct appdata *ad = (struct appdata *)data;
- retvm_if(ad->win == NULL, -1, "Invalid argument: window is NULL\n");
- retvm_if(ad->block_events == NULL, -1, "Invalid argument: notify is NULL\n");
-
- if(angle == -1)
- rotation = ad->angle;
- else
- rotation = angle;
-
- switch(rotation){
- case 90 :
- case 270 :
- _D("show,landscape");
- elm_object_signal_emit(ad->block_events, "show,landscape", "bg");
- break;
- case 0 :
- case 180 :
- default :
- _D("show,portrait");
- elm_object_signal_emit(ad->block_events, "show,portrait", "bg");
- break;
- }
- return 1;
-}
-
-int _efl_rotate(Display *dpy, void *data)
-{
- int rotation = -1;
- struct appdata *ad = (struct appdata *)data;
- retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
-
- rotation = _x_rotation_get(dpy, ad);
- _D("Window rotations : %d", rotation);
-
- if(rotation == -1) {
- rotation = 0;
- }
-
- if(rotation >= 0){
- elm_win_rotation_set(ad->win, rotation);
- ad->angle = rotation;
- return _volume_popup_resize(data, rotation);
- }
-
- return 0;
-}
-
-int _rotate_func(void *data)
-{
- _D("%s", __func__);
- struct appdata *ad = (struct appdata *)data;
- Display *d = NULL;
- int ret = 0;
-
- retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
-
- d = XOpenDisplay(NULL);
- ret = _efl_rotate(d, ad);
-
- if(d != NULL){
- XCloseDisplay(d);
- }
-
- return ret;
-}
-
int myterm(bundle *b, void *data)
{
_D("%s\n", __func__);