From d3804438a62fda5fba2e97a51bdfc8a3ecdb091e Mon Sep 17 00:00:00 2001 From: Shawn Lee Date: Thu, 27 Jun 2013 17:37:27 +0900 Subject: [PATCH] the repository of RSA merge with private repository. Change-Id: I6574d71d5cc7310d028e2b0a8d499853dd2f5882 --- configure.ac | 2 + src/bin/e_border.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++-- src/bin/e_log.c | 1 + src/bin/e_log.h | 18 +++++ src/bin/e_manager.c | 18 ++++- src/bin/e_manager.h | 11 ++- src/bin/e_start_main.c | 48 +++++++++++++ 7 files changed, 272 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 0e80c0e..35ca944 100644 --- a/configure.ac +++ b/configure.ac @@ -643,6 +643,8 @@ e_extra_features+="-D_F_DEICONIFY_APPROVE_ " e_extra_features+="-D_F_TRANSIENT_FOR_PATCH_ " # add border hook patch e_extra_features+="-D_F_BORDER_HOOK_PATCH_ " +# add multi-layer feature of the compositor +e_extra_features+="-D_F_COMP_LAYER_ " have_extra_features=no AC_ARG_ENABLE(extra_features, diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 78eb7cd..551b461 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -1386,11 +1386,18 @@ e_border_show(E_Border *bd) E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if (bd->visible) return; #ifdef _F_ZONE_WINDOW_ROTATION_ + // newly created window that has to be rotated will be show after rotation done. + // so, skip at this time. it will be called again after GETTING ROT_DONE. if ((bd->new_client) && (bd->client.e.state.rot.changes != -1)) { - // newly created window that has to be rotated will be show after rotation done. - // so, skip at this time. it will be called again after GETTING ROT_DONE. + // if this window is in withdrawn state, show this window right now. + // that's because the window in withdrawn state can't render its canvas. + // eventually, this window will not send the message of rotation done, + // even if e17 request to rotation this window. + if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL) + e_hints_window_visible_set(bd); + bd->client.e.state.rot.pending_show = 1; return; } @@ -8598,6 +8605,151 @@ _e_border_is_vkbd(E_Border *bd) return EINA_FALSE; } +static Eina_Bool +_e_border_rotation_change_floating_pos(E_Border *bd, int *x, int *y) +{ + int new_x, new_y; + int min_title_width=96; + + if (!bd) return EINA_FALSE; + if (!x || !y) return EINA_FALSE; + + new_x = bd->x; + new_y = bd->y; + + // Portrait -> Landscape, x= pre_x*2, y=pre_y/2 + // Landscape -> Portrait, x= pre_x/2, y=pre_y*2 + // guaranteeing the minimum size of titlebar shown, min_title_width + // so user can initiate drag&drop action after rotation changed. + if (bd->client.e.state.rot.curr == 0) + { + if (bd->client.e.state.rot.prev == 90) + { + new_x = (bd->zone->h - bd->h - bd->y) / 2; + new_y = 2 * bd->x; + } + else if (bd->client.e.state.rot.prev == 270) + { + new_x = bd->y / 2; + new_y = (bd->zone->w - bd->w - bd->x) * 2; + } + else if (bd->client.e.state.rot.prev == 180) + { + new_x = bd->zone->w - bd->x - bd->w; + new_y = bd->zone->h - bd->y - bd->h; + } + + if(new_x + bd->w < min_title_width) + { + new_x = min_title_width - bd->w; + } + else if(new_x > bd->zone->w - min_title_width) + { + new_x = bd->zone->w - min_title_width; + } + } + else if (bd->client.e.state.rot.curr == 90) + { + if (bd->client.e.state.rot.prev == 0) + { + new_x = bd->y / 2; + new_y = bd->zone->h - (2 * bd->x) - bd->w; + } + else if (bd->client.e.state.rot.prev == 270) + { + new_x = bd->zone->w - bd->x - bd->w; + new_y = bd->zone->h - bd->y - bd->h; + } + else if (bd->client.e.state.rot.prev == 180) + { + new_x = (bd->zone->h - bd->y - bd->h) / 2; + new_y = bd->zone->h - (2 * (bd->zone->w - bd->x - bd->w)) - bd->w; + } + + if(new_y > bd->zone->h - min_title_width) + { + new_y = bd->zone->h - min_title_width; + } + else if(new_y < min_title_width - bd->w) + { + new_y = min_title_width - bd->w; + } + } + else if (bd->client.e.state.rot.curr == 270) + { + if (bd->client.e.state.rot.prev == 0) + { + new_x = bd->zone->w - bd->h - (bd->y / 2); + new_y = bd->x * 2; + } + else if (bd->client.e.state.rot.prev == 90) + { + new_x = bd->zone->w - bd->x - bd->w; + new_y = bd->zone->h - bd->y - bd->h; + } + else if (bd->client.e.state.rot.prev == 180) + { + new_x = bd->zone->w - bd->x - bd->w; + new_y = bd->zone->h - bd->y - bd->h; + + new_x = bd->zone->w - bd->h - ((bd->zone->h - bd->y - bd->h) / 2); + new_y = (bd->zone->w - bd->x - bd->w) * 2; + } + + if(new_y > bd->zone->h - min_title_width) + { + new_y = bd->zone->h - min_title_width; + } + else if( new_y + bd->w < min_title_width) + { + new_y = min_title_width - bd->w ; + } + } + else if (bd->client.e.state.rot.curr == 180) + { + if (bd->client.e.state.rot.prev == 0) + { + new_x = bd->zone->w - bd->x - bd->w; + new_y = bd->zone->h - bd->y - bd->h; + } + else if (bd->client.e.state.rot.prev == 90) + { + new_x = bd->zone->w - ((bd->zone->h - bd->h - bd->y) / 2) - bd->h; + new_y = bd->zone->h - (2 * bd->x) - bd->w; + } + else if (bd->client.e.state.rot.prev == 270) + { + new_x = bd->zone->w - (bd->y / 2) - bd->h; + new_y = bd->zone->h - ((bd->zone->w - bd->w - bd->x) * 2) - bd->w; + } + + if(new_x + bd->w < min_title_width) + { + new_x = min_title_width - bd->w; + } + else if(new_x > bd->zone->w - min_title_width) + { + new_x = bd->zone->w - min_title_width; + } + } + + ELBF(ELBT_ROT, 0, bd->client.win, + "Floating Mode. ANGLE (%d->%d), POS (%d,%d) -> (%d,%d)", + bd->client.e.state.rot.prev, bd->client.e.state.rot.curr, + bd->x, bd->y, new_x, new_y); + + if ((new_x == *x) && + (new_y == *y)) + { + return EINA_FALSE; + } + + *x = new_x; + *y = new_y; + + return EINA_TRUE; +} + #define SIZE_EQUAL_TO_ZONE(a, z) \ ((((a)->w) == ((z)->w)) && \ (((a)->h) == ((z)->h))) @@ -8636,6 +8788,11 @@ _e_border_rotation_pre_resize(E_Border *bd, int rotation, int *x, int *y, int *w _x = bd->x; _y = bd->y; _w = bd->w; _h = bd->h; + if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) + move = _e_border_rotation_change_floating_pos(bd, &_x, &_y); + else + move = EINA_FALSE; + rot_dif = bd->client.e.state.rot.prev - rotation; if (rot_dif < 0) rot_dif = -rot_dif; if (rot_dif != 180) @@ -8653,6 +8810,9 @@ _e_border_rotation_pre_resize(E_Border *bd, int rotation, int *x, int *y, int *w } } + + if (!resize && move) + _e_border_move_internal(bd, _x, _y, EINA_TRUE); } if (resize) @@ -11937,6 +12097,8 @@ _e_border_zone_update(E_Border *bd) static int _e_border_resize_begin(E_Border *bd) { + int ret; + if (!bd->lock_user_stacking) { if (e_config->border_raise_on_mouse_action) @@ -11946,7 +12108,12 @@ _e_border_resize_begin(E_Border *bd) (bd->fullscreen) || (bd->lock_user_size)) return 0; - if (grabbed && !e_grabinput_get(bd->win, 0, bd->win)) + if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) + ret = e_grabinput_get(bd->win, 0, bd->win); + else + ret = e_grabinput_get(bd->win, 0, 0); + + if (grabbed && !ret) { grabbed = 0; return 0; @@ -12014,6 +12181,7 @@ _e_border_resize_update(E_Border *bd) static int _e_border_move_begin(E_Border *bd) { + int ret; if (!bd->lock_user_stacking) { if (e_config->border_raise_on_mouse_action) @@ -12022,7 +12190,12 @@ _e_border_move_begin(E_Border *bd) if ((bd->fullscreen) || (bd->lock_user_location)) return 0; - if (grabbed && !e_grabinput_get(bd->win, 0, bd->win)) + if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus) + ret = e_grabinput_get(bd->win, 0, bd->win); + else + ret = e_grabinput_get(bd->win, 0, 0); + + if (grabbed && !ret) { grabbed = 0; return 0; diff --git a/src/bin/e_log.c b/src/bin/e_log.c index 9ebfbe2..f3d2432 100644 --- a/src/bin/e_log.c +++ b/src/bin/e_log.c @@ -234,6 +234,7 @@ _type_name_get(unsigned int t) case ELBT_ILLUME: return "ILLUME"; break; case ELBT_COMP: return "COMP"; break; case ELBT_MOVE: return "MOVE"; break; + case ELBT_TRACE: return "TRACE"; break; case ELBT_ALL: return "ALL"; break; default: break; } diff --git a/src/bin/e_log.h b/src/bin/e_log.h index 3529525..99a1529 100644 --- a/src/bin/e_log.h +++ b/src/bin/e_log.h @@ -43,6 +43,7 @@ EINTERN int e_log_shutdown(void); #define ELBT_ILLUME 0x00000010 #define ELBT_COMP 0x00000020 #define ELBT_MOVE 0x00000040 +#define ELBT_TRACE 0x00000080 #define ELBT_ALL 0xFFFFFFFF extern EAPI unsigned int e_logbuf_type; @@ -54,9 +55,26 @@ EAPI void e_logbuf_fmt_add(unsigned int type, unsigned int blank, const char #define ELB(t, s, i) do { if ((e_logbuf_type) & (t)) { e_logbuf_add((t), __FUNCTION__, __LINE__, (s), (i)); } } while (0); #define ELBF(t, b, i, f, x...) do { if ((e_logbuf_type) & (t)) { e_logbuf_fmt_add((t), (b), __FUNCTION__, __LINE__, (i), f, ##x); } } while (0); +#define ELB_BACKTRACE() \ + do \ + { \ + void* frame_addrs[16]; \ + char** frame_strings; \ + size_t backtrace_size; \ + int i; \ + backtrace_size = backtrace(frame_addrs, 16); \ + frame_strings = backtrace_symbols(frame_addrs, backtrace_size); \ + for (i = 0; i < backtrace_size; ++i) \ + { \ + ELBF(ELBT_TRACE, 0, 0, "%d: [0x%x] %s", i, frame_addrs[i], frame_strings[i]); \ + } \ + free(frame_strings); \ + } \ + while (0); #else #define ELB(...) ; #define ELBF(...) ; +#define ELB_BACKTRACE() ; #endif #endif diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c index 1bd101e..1255a74 100644 --- a/src/bin/e_manager.c +++ b/src/bin/e_manager.c @@ -905,6 +905,21 @@ e_manager_comp_src_shadow_hide(E_Manager *man, E_Manager_Comp_Source *src) } #endif +#ifdef _F_COMP_LAYER_ +EAPI Evas_Object * +e_manager_comp_layer_get(E_Manager *man, E_Zone *zone, const char *name) +{ + E_OBJECT_CHECK_RETURN(man, NULL); + E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL); + E_OBJECT_CHECK_RETURN(zone, NULL); + E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL); + if (!name) return NULL; + if (!man->comp) return NULL; + if (!man->comp->func.layer_get) return NULL; + return man->comp->func.layer_get(man->comp->data, man, zone, name); +} +#endif + /* local subsystem functions */ static void _e_manager_free(E_Manager *man) @@ -961,7 +976,8 @@ _e_manager_cb_window_configure(void *data, int ev_type __UNUSED__, void *ev) man = data; e = ev; if (e->win != man->root) return ECORE_CALLBACK_PASS_ON; - e_manager_resize(man, e->w, e->h); + if ((man->w != e->w) || (man->h != e->h)) + e_manager_resize(man, e->w, e->h); return ECORE_CALLBACK_PASS_ON; } diff --git a/src/bin/e_manager.h b/src/bin/e_manager.h index d093de1..def027b 100644 --- a/src/bin/e_manager.h +++ b/src/bin/e_manager.h @@ -68,6 +68,9 @@ struct _E_Manager_Comp void (*src_shadow_show) (void *data, E_Manager *man, E_Manager_Comp_Source *src); void (*src_shadow_hide) (void *data, E_Manager *man, E_Manager_Comp_Source *src); #endif +#ifdef _F_COMP_LAYER_ + Evas_Object * (*layer_get) (void *data, E_Manager *man, E_Zone *zone, const char *name); +#endif } func; void *data; }; @@ -167,8 +170,8 @@ EAPI Eina_Bool e_manager_comp_input_region_id_set(E_Manager *man, int id, EAPI Eina_Bool e_manager_comp_input_region_id_del(E_Manager *man, int id); #endif #ifdef _F_COMP_MOVE_LOCK_ -EAPI Eina_Bool e_manager_comp_src_move_lock(E_Manager *man, E_Manager_Comp_Source *src); -EAPI Eina_Bool e_manager_comp_src_move_unlock(E_Manager *man, E_Manager_Comp_Source *src); +EAPI Eina_Bool e_manager_comp_src_move_lock(E_Manager *man, E_Manager_Comp_Source *src); /* deprecated */ +EAPI Eina_Bool e_manager_comp_src_move_unlock(E_Manager *man, E_Manager_Comp_Source *src); /* deprecated */ #endif #ifdef _F_COMP_COMPOSITE_MODE_ // set the composite rendering state of a zone. @@ -183,5 +186,9 @@ EAPI Eina_Bool e_manager_comp_composite_mode_get(E_Manager *man, E_Zone * EAPI void e_manager_comp_src_shadow_show(E_Manager *man, E_Manager_Comp_Source *src); EAPI void e_manager_comp_src_shadow_hide(E_Manager *man, E_Manager_Comp_Source *src); #endif +#ifdef _F_COMP_LAYER_ +// get compositor's layer by specific name +EAPI Evas_Object *e_manager_comp_layer_get(E_Manager *man, E_Zone *zone, const char *name); +#endif #endif #endif diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c index 27e10ad..7ecd14f 100755 --- a/src/bin/e_start_main.c +++ b/src/bin/e_start_main.c @@ -271,6 +271,12 @@ main(int argc, char **argv) int i, do_precache = 0, valgrind_mode = 0; int valgrind_tool = 0; int valgrind_gdbserver = 0; +#ifdef _F_SET_USER_GROUP_ + int res; + char *user; + int user_id; + int group_id; +#endif /* _F_SET_USER_GROUP_ */ char buf[16384], **args, *p; char valgrind_path[PATH_MAX] = ""; const char *valgrind_log = NULL; @@ -284,6 +290,18 @@ main(int argc, char **argv) for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-no-precache")) do_precache = 0; +#ifdef _F_SET_USER_GROUP_ + else if (!strncmp(argv[i], "-user", sizeof("-user") - 1)) + { + if (sscanf(argv[i+1], "%d", &user_id) <= 0) user_id = 0; + else i++; + } + else if (!strncmp(argv[i], "-group", sizeof("-group") - 1)) + { + if (sscanf(argv[i+1], "%d", &group_id) <= 0) group_id = 0; + else i++; + } +#endif /* _F_SET_USER_GROUP_ */ else if (!strcmp(argv[i], "-valgrind-gdb")) valgrind_gdbserver = 1; else if (!strncmp(argv[i], "-valgrind", sizeof("-valgrind") - 1)) { @@ -317,6 +335,10 @@ main(int argc, char **argv) printf ( "Options:\n" +#ifdef _F_SET_USER_GROUP_ + "\t-user [user id in integer value]\n" + "\t-group [group id in integer value]\n" +#endif /* _F_SET_USER_GROUP_ */ "\t-no-precache\n" "\t\tDisable pre-caching of files\n" "\t-valgrind[=MODE]\n" @@ -343,6 +365,32 @@ main(int argc, char **argv) really_know = EINA_TRUE; } +#ifdef _F_SET_USER_GROUP_ + if (group_id) + { + user = getenv("USER"); + + if (user) + { + res = initgroups(user, (gid_t)group_id); + + if (res) + { + printf("Failed to set groups !(errno=%d)\n", errno); + } + } + } + + if ((group_id) && setgid((gid_t)group_id) && setegid((gid_t)group_id)) + { + printf("Fail to set group to %d. errno=%d\n", group_id, errno); + } + if ((user_id) && setuid((uid_t)user_id) && seteuid((uid_t)user_id)) + { + printf("Fail to set user to %d. errno=%d\n", user_id, errno); + } +#endif /* _F_SET_USER_GROUP_ */ + if (really_know) { _env_path_append("PATH", eina_prefix_bin_get(pfx)); -- 2.7.4