In my native Tizen 2.3 mobile app I'd like to show a popup menu when the user presses the menu button, and adjust the placement of the popup menu in case the user rotates the device while the menu is open. However, by registering a callback for APP_EVENT_DEVICE_ORIENTATION_CHANGED, it looks to me as if the callback procedure is only called _before_ the orientation change on the UI takes place. And it makes it impossible for me to measure the current window dimensions and move the menu to the right place on the device screen. I've tried to use debugging to see if it works the way I assume, and it seems it does. So when the callback procedure is fired, the device is already physically rotated, but the UI is not yet rotated. I would like to have a callback procedure called _after_ the UI is adjusted for the new orientation state, but I'm not sure if it's possible with Tizen?
My code looks like this:
int main(int argc, char *argv[])
{
...
ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
...
}
static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
{
appdata_s *ad = user_data;
if (ad->popup) move_menu_popup(ad->win, ad->popup);
}
static void move_menu_popup(Evas_Object *parent, Evas_Object *obj)
{
Evas_Coord w, h;
int pos = -1;
elm_win_screen_size_get(parent, NULL, NULL, &w, &h);
pos = elm_win_rotation_get(parent);
switch (pos) {
case 0:
case 180:
evas_object_move(obj, 0, h);
break;
case 90:
evas_object_move(obj, 0, w);
break;
case 270:
evas_object_move(obj, h, w);
break;
}
}
Thank you.
Regards,
Tamas