free(wd);
}
+#ifdef HAVE_X
+static void _update_geometry_on_rotation(Evas_Object *obj, int angle,
+ int *x, int *y, int *w)
+{
+ Evas_Coord root_w, root_h;
+ struct Internal_Data *wd = evas_object_data_get(obj, data_key);
+
+ if (!wd)
+ return;
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w,
+ &root_h);
+
+ /* rotate window */
+ switch (angle) {
+ case 90:
+ *w = root_h;
+ if (wd->orient == NOTI_ORIENT_BOTTOM)
+ *x = root_w - wd->h;
+ break;
+ case 270:
+ *w = root_h;
+ if (!(wd->orient == NOTI_ORIENT_BOTTOM))
+ *x = root_w - wd->h;
+ break;
+ case 180:
+ *w = root_w;
+ if (!wd->orient == NOTI_ORIENT_BOTTOM)
+ *y = root_h - wd->h;
+ break;
+ case 0:
+ default:
+ *w = root_w;
+ if (wd->orient == NOTI_ORIENT_BOTTOM)
+ *y = root_h - wd->h;
+ break;
+ }
+}
+
+static void _win_rotated(Evas_Object *obj)
+{
+ int x = 0;
+ int y = 0;
+ int w = 0;
+ int angle = 0;
+ struct Internal_Data *wd = evas_object_data_get(obj, data_key);
+
+ if (!wd)
+ return;
+ angle = elm_win_rotation_get(obj);
+ if (angle % 90)
+ return;
+ angle %= 360;
+ if (angle < 0)
+ angle += 360;
+ wd->angle = angle;
+
+ _update_geometry_on_rotation(obj, wd->angle, &x, &y, &w);
+
+ evas_object_move(obj, x, y);
+ wd->w = w;
+ evas_object_resize(obj, wd->w, wd->h);
+}
+
+static Eina_Bool _prop_change(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_X_Event_Window_Property *ev;
+ struct Internal_Data *wd = evas_object_data_get(data, data_key);
+
+ if (!wd)
+ return ECORE_CALLBACK_PASS_ON;
+ ev = event;
+ if (ev->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
+ if (ev->win == elm_win_xwindow_get(data))
+ _win_rotated(data);
+ return ECORE_CALLBACK_PASS_ON;
+}
+#endif
+
HAPI Evas_Object *noti_win_add(Evas_Object *parent)
{
Evas_Object *win;
#ifdef HAVE_X
ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, NULL);
evas_object_resize(win, w, NOTI_HEIGHT);
+ wd->rotation_event_handler = ecore_event_handler_add(
+ ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, win);
#endif
wd->w = w;
wd->h = NOTI_HEIGHT;
static int quickpanel_ticker_fini(void *data);
static int quickpanel_ticker_enter_hib(void *data);
static int quickpanel_ticker_leave_hib(void *data);
-static void quickpanel_ticker_reflesh(void *data);
+void quickpanel_ticker_reflesh(void *data);
static void _quickpanel_ticker_destroy_tickernoti(Evas_Object *tickernoti);
+static int _quickpanel_ticker_get_angle(void *data);
QP_Module ticker = {
.name = "ticker",
.hib_enter = quickpanel_ticker_enter_hib,
.hib_leave = quickpanel_ticker_leave_hib,
.lang_changed = NULL,
- .refresh = NULL,
+ .refresh = quickpanel_ticker_reflesh
};
static int _is_lockscreen_launched(void) {
_quickpanel_ticker_hide(data);
}
-static void _quickpanel_ticker_win_rotated(Evas_Object *ticker_win) {
- int angle = 0;
- Evas_Coord root_w, root_h;
- int x = 0, y = 0, w = 0, h = 0;
-
- retif(ticker_win == NULL, , "invalid data");
-
- angle = elm_win_rotation_get(ticker_win);
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
- evas_object_size_hint_min_get(ticker_win, NULL, &g_noti_height);
-
- // rotate win
- switch(angle)
- {
- case 90:
- h = g_noti_height;
- w = root_h;
- break;
- case 270:
- h = g_noti_height;
- w = root_h;
- x = root_w - g_noti_height;
- break;
- case 180:
- w = root_w;
- h = g_noti_height;
- y = root_h - g_noti_height;
- break;
- case 0:
- default:
- w = root_w;
- h = g_noti_height;
- break;
- }
-
- if (ticker_win != NULL) {
- evas_object_move(ticker_win, x, y);
- evas_object_resize(ticker_win, w, h);
- }
-}
-
-static void _quickpanel_ticker_rotate_cb(void *data, Evas_Object *obj, void *event)
-{
- _quickpanel_ticker_win_rotated(obj);
-}
-
static Evas_Object *_quickpanel_ticker_create_tickernoti(void *data)
{
notification_h noti = (notification_h) data;
evas_object_size_hint_min_set(detail, 1, noti_height);
g_noti_height = noti_height;
- if (elm_win_wm_rotation_supported_get(tickernoti))
- {
- int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(tickernoti, rots, 4);
-
- evas_object_smart_callback_add(tickernoti, "wm,rotation,changed",
- _quickpanel_ticker_rotate_cb, data);
- }
-
noti_win_content_set(tickernoti, detail);
icon = _quickpanel_ticker_create_icon(detail, noti);
evas_object_del(tickernoti);
}
+static int _quickpanel_ticker_get_angle(void *data)
+{
+ struct appdata *ad = (struct appdata *)data;
+ Ecore_X_Window xwin, root;
+ int ret = 0, angle = 0, count = 0;
+ unsigned char *prop_data = NULL;
+
+ xwin = elm_win_xwindow_get(ad->win);
+ root = ecore_x_window_root_get(xwin);
+
+ ret = ecore_x_window_prop_property_get(root,
+ ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
+ ECORE_X_ATOM_CARDINAL, 32,
+ &prop_data, &count);
+
+ if (ret && prop_data) {
+ memcpy(&angle, prop_data, sizeof(int));
+
+ if (prop_data)
+ free(prop_data);
+
+ return angle;
+ } else {
+ ERR("Fail to get angle");
+ if (prop_data)
+ free(prop_data);
+
+ return -1;
+ }
+}
+
+static void _quickpanel_ticker_update_geometry_on_rotation(void *data, int *x, int *y, int *w, int *h) {
+ int angle = 0;
+
+ if (!data)
+ return;
+ angle = _quickpanel_ticker_get_angle(data);
+ Evas_Coord root_w, root_h;
+
+ /*
+ * manually calculate win_tickernoti_indi window position & size
+ * - win_indi is not full size window
+ */
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
+ evas_object_size_hint_min_get(g_ticker, NULL, &g_noti_height);
+
+ DBG("angle:%d", angle);
+
+ // rotate win
+ switch(angle)
+ {
+ case 90:
+ *h = g_noti_height;
+ *w = root_h;
+ break;
+ case 270:
+ *h = g_noti_height;
+ *w = root_h;
+ *x = root_w - g_noti_height;
+ break;
+ case 180:
+ *w = root_w;
+ *h = g_noti_height;
+ *y = root_h - g_noti_height;
+ break;
+ case 0:
+ default:
+ *w = root_w;
+ *h = g_noti_height;
+ break;
+ }
+ elm_win_rotation_set(g_ticker, angle);
+}
+
+static void _quickpanel_ticker_win_rotated(void *data) {
+ retif(data == NULL, ,"data is NULL");
+ struct appdata *ad = data;
+ int x = 0, y = 0, w = 0, h = 0;
+
+ _quickpanel_ticker_update_geometry_on_rotation(ad, &x, &y, &w, &h);
+
+ if (g_ticker != NULL) {
+ evas_object_move(g_ticker, x, y);
+ evas_object_resize(g_ticker, w, h);
+ }
+}
+
static void _quickpanel_noti_media_feedback_sound(notification_h noti) {
retif(noti == NULL, ,"op_list is NULL");
notification_free(noti);
return;
}
+
+ if (_quickpanel_ticker_get_angle(quickpanel_get_app_data()) == -1) {
+ ERR("[workaround] WM not ready");
+ notification_free(noti);
+ return;
+ }
+
/* Display ticker */
if (g_timer) {
ecore_timer_del(g_timer);
g_timer = ecore_timer_add(QP_TICKER_DURATION,
_quickpanel_ticker_timeout_cb, noti);
- _quickpanel_ticker_win_rotated(g_ticker);
+ _quickpanel_ticker_win_rotated(data);
evas_object_show(g_ticker);
evas_object_event_callback_add(g_ticker, EVAS_CALLBACK_SHOW,
{
return QP_OK;
}
+
+void quickpanel_ticker_reflesh(void *data)
+{
+ retif(data == NULL, , "Invalid parameter!");
+
+ if (g_ticker != NULL) {
+ _quickpanel_ticker_win_rotated(data);
+ }
+}