DTRACE("set focus mode = %d\n", enable);
}
-int get_rotation_degree()
-{
- int angle;
- enum appcore_rm mode;
- int rotate_lock;
-
- if (!vconf_get_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &rotate_lock))
- {
- if (SETTING_ON_OFF_BTN_ON == rotate_lock)
- return 0;
- }
-
- appcore_get_rotation_state(&mode);
- if (mode == -1)
- return 0;
-
- switch (mode)
- {
- case APPCORE_RM_LANDSCAPE_NORMAL:
- angle = -90;
- break;
-
- case APPCORE_RM_LANDSCAPE_REVERSE:
- angle = 90;
- break;
-
- case APPCORE_RM_PORTRAIT_REVERSE:
- angle = 180;
- break;
-
- case APPCORE_RM_UNKNOWN:
- case APPCORE_RM_PORTRAIT_NORMAL:
- default:
- angle = 0;
- break;
- }
-
- return angle;
-}
-
-static int _rotation_cb(enum appcore_rm mode, void *data)
-{
- struct appdata *ad = (struct appdata *)data;
- int angle;
-
- switch (mode)
- {
- case APPCORE_RM_LANDSCAPE_NORMAL:
- angle = -90;
- break;
-
- case APPCORE_RM_LANDSCAPE_REVERSE:
- angle = 90;
- break;
-
- case APPCORE_RM_PORTRAIT_REVERSE:
- angle = 180;
- break;
-
- case APPCORE_RM_UNKNOWN:
- case APPCORE_RM_PORTRAIT_NORMAL:
- default:
- angle = 0;
- break;
- }
-
- elm_win_rotation_set(ad->win_main, angle);
-
- // This is need for customized rotation process.
- set_rotation_to_clipdrawer(ad, angle);
-
- return 0;
-}
-
static Evas_Object* create_win(void *data, const char *name)
{
struct appdata *ad = (struct appdata *) data;
static int app_pause(void *data)
{
- appcore_unset_rotation_cb();
return 0;
}
static int app_resume(void *data)
{
- struct appdata *ad = data;
-
- appcore_set_rotation_cb(_rotation_cb, ad);
-
return 0;
}
ops.data = &ad;
appcore_set_i18n(PACKAGE, LOCALEDIR);
- appcore_set_rotation_cb(_rotation_cb, &ad);
return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
}
int anim_count;
Eina_Bool windowshow;
Eina_Bool pastetextonly;
+
+ Ecore_X_Window active_win;
+ int o_degree;
};
void* g_get_main_appdata();
}
}
-void set_rotation_to_clipdrawer(void *data, int angle)
+void set_rotation_to_clipdrawer(void *data)
{
struct appdata *ad = data;
double wh, wy;
int wposx, wwidth;
+ int angle = ad->o_degree;
if (angle == 180) // reverse
{
wwidth = ad->root_h;
wposx = CLIPDRAWER_WIDTH-CLIPDRAWER_HEIGHT_LANDSCAPE;
}
- else if (angle == -90) // left rotate
+ else if (angle == 270) // left rotate
{
wh = (1.0*CLIPDRAWER_HEIGHT_LANDSCAPE/SCREEN_WIDTH)*ad->root_w;
wy = (1.0*CLIPDRAWER_POS_X/SCREEN_WIDTH)*ad->root_w;
// for elm_check
elm_theme_extension_add(NULL, APP_EDJ_FILE);
- set_rotation_to_clipdrawer(ad, get_rotation_degree());
-
edje_object_signal_callback_add(elm_layout_edje_get(ad->ly_main),
"mouse,up,1", "*", clipdrawer_ly_clicked, ad);
return EINA_FALSE;
struct appdata *ad = data;
- int angle = get_rotation_degree();
+ int angle = ad->o_degree;
int anim_start, anim_end, delta;
if (angle == 180) // reverse
anim_end = (int)(((double)CLIPDRAWER_HEIGHT_LANDSCAPE/SCREEN_WIDTH)*ad->root_w);
anim_end = anim_start-anim_end;
}
- else if (angle == -90) // left rotate
+ else if (angle == 270) // left rotate
{
anim_start = (int)(((double)CLIPDRAWER_HEIGHT_LANDSCAPE/SCREEN_WIDTH)*ad->root_w);
anim_start = ad->root_w-anim_start;
return EINA_FALSE;
struct appdata *ad = data;
- int angle = get_rotation_degree();
+ int angle = ad->o_degree;
int delta;
double posprop;
posprop = 1.0*ac/ANIM_DURATION;
delta = (int)((ep-sp)*posprop);
evas_object_move(ad->win_main, sp+delta, 0);
}
- else if (angle == -90) // left rotate
+ else if (angle == 270) // left rotate
{
delta = (int)((ep-sp)*posprop);
evas_object_move(ad->win_main, sp+delta, 0);
if (ad->win_main)
{
set_transient_for(ad);
+ ad->o_degree = get_active_window_degree(ad->active_win);
+ elm_win_rotation_set(ad->win_main, ad->o_degree);
+ set_rotation_to_clipdrawer(data);
evas_object_show(ad->win_main);
elm_win_activate(ad->win_main);
if (clipdrawer_anim_effect(ad, SHOW_ANIM))
//void clipdrawer_hide_view(void *data);
void clipdrawer_lower_view(void *data);
-void set_rotation_to_clipdrawer(void *data, int angle);
+void set_rotation_to_clipdrawer(void *data);
const char* clipdrawer_get_plain_string_from_escaped(char *escstr);
static Ecore_Event_Handler *xsel_notify_handler = NULL;
static Ecore_Event_Handler *xclient_msg_handler = NULL;
static Ecore_Event_Handler *xfocus_out_handler = NULL;
+static Ecore_Event_Handler *xproperty_notify_handler = NULL;
char *g_lastest_content = NULL;
int g_history_pos = 0;
xsel_notify_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, _xsel_notify_cb, ad);
xclient_msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _xclient_msg_cb, ad);
xfocus_out_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _xfocus_out_cb, ad);
+ xproperty_notify_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _xproperty_notify_cb, ad);
if(!xsel_clear_handler)
DTRACE("Failed to add ECORE_X_EVENT_SELECTION_CLEAR handler\n");
DTRACE("Failed to add ECORE_X_EVENT_CLIENT_MESSAGE handler\n");
if(!xfocus_out_handler)
DTRACE("Failed to add ECORE_X_EVENT_WINDOW_FOCUS_OUT handler\n");
+ if(!xproperty_notify_handler)
+ DTRACE("Failed to add ECORE_X_EVENT_WINDOW_PROPERTY handler\n");
return TRUE;
}
ecore_event_handler_del(xsel_notify_handler);
ecore_event_handler_del(xclient_msg_handler);
ecore_event_handler_del(xfocus_out_handler);
+ ecore_event_handler_del(xproperty_notify_handler);
xsel_clear_handler = NULL;
xsel_request_handler = NULL;
xsel_notify_handler = NULL;
xclient_msg_handler = NULL;
xfocus_out_handler = NULL;
+ xproperty_notify_handler = NULL;
_cbhm_fini();
atomTargets = XInternAtom(g_disp, "TARGETS", False);
atomUTF8String = XInternAtom(g_disp, "UTF8_STRING", False);
atomHtmltext = XInternAtom(g_disp, "text/html;charset=utf-8", False);
+ atomWindowRotate = ecore_x_atom_get("_E_ILLUME_ROTATE_WINDOW_ANGLE");
+
return TRUE;
}
return pos;
}
+int get_active_window_degree(Ecore_X_Window active)
+{
+ //ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE
+
+ int rotation = 0;
+ unsigned char *prop_data = NULL;
+ int count;
+ int ret = ecore_x_window_prop_property_get(
+ active, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+ ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
+ if (ret && prop_data) memcpy(&rotation, prop_data, sizeof(int));
+ if (prop_data) free(prop_data);
+ return rotation;
+}
+
int get_current_history_position()
{
int pos = g_history_pos-1;
return TRUE;
}
+static Eina_Bool _xproperty_notify_cb(void *data, int ev_type, void *event)
+{
+ Ecore_X_Event_Window_Property *pevent = (Ecore_X_Event_Window_Property *)event;
+ struct appdata *ad = data;
+
+ if (ad->active_win != pevent->win)
+ return EINA_TRUE;
+
+ if (atomWindowRotate == pevent->atom)
+ {
+ int angle = get_active_window_degree(ad->active_win);
+ if (angle != ad->o_degree)
+ {
+ ad->o_degree = angle;
+ elm_win_rotation_set(ad->win_main, angle);
+ set_rotation_to_clipdrawer(data);
+ }
+ }
+
+ return EINA_TRUE;
+}
+
static int _xsel_request_cb(void *data, int ev_type, void *event)
{
Ecore_X_Event_Selection_Request *ev = (Ecore_X_Event_Selection_Request *)event;
// Atom atomActive = XInternAtom(g_disp, "_NET_ACTIVE_WINDOW", False);
Atom atomActive = XInternAtom(g_disp, "_ISF_ACTIVE_WINDOW", False);
- if (ecore_x_window_prop_window_get(DefaultRootWindow(g_disp),
- atomActive, &xwin_active, 1) != -1)
+ if (ecore_x_window_prop_window_get(DefaultRootWindow(g_disp),
+ atomActive, &xwin_active, 1) != -1)
{
ecore_x_icccm_transient_for_set (elm_win_xwindow_get(ad->win_main), xwin_active);
DTRACE("Success to set transient_for active window = 0x%X\n", xwin_active);
+ ecore_x_event_mask_set(xwin_active, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
+
+ ad->active_win = xwin_active;
}
else
{
{
struct appdata *ad = data;
+ ecore_x_event_mask_unset(ad->active_win, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
ecore_x_icccm_transient_for_unset(elm_win_xwindow_get(ad->win_main));
}
int set_selection_owner();
int get_selection_content(void *data);
int processing_selection_request(Ecore_X_Event_Selection_Request *ev);
+int get_active_window_degree(Ecore_X_Window active);
void set_transient_for(void *data);
void unset_transient_for(void *data);
static int _xsel_notify_cb(void *data, int ev_type, void *event);
static int _xclient_msg_cb(void *data, int ev_type, void *event);
static int _xfocus_out_cb(void *data, int ev_type, void *event);
+static Eina_Bool _xproperty_notify_cb(void *data, int ev_type, void *event);
static Ecore_X_Window get_selection_secondary_target_win();
int set_selection_secondary_data(char *sdata);
-
+
#define ATOM_CLIPBOARD_NAME "CLIPBOARD"
#define ATOM_CLIPBOARD_MANAGER_NAME "CLIPBOARD_MANAGER"
#define ATOM_CBHM_OUTBUF "CBHM_BUF"
static Atom atomTargets;
static Atom atomUTF8String;
static Atom atomHtmltext;
+static Atom atomWindowRotate;
#endif //_xcnphandler_h_