diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index 494ae093e..3e9db1114 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -87,6 +87,7 @@ ACT_FN_GO(window_move) if (!((E_Border *)obj)->lock_user_location) e_border_act_move_begin((E_Border *)obj, NULL); } + ACT_FN_GO_MOUSE(window_move) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -95,6 +96,7 @@ ACT_FN_GO_MOUSE(window_move) if (!((E_Border *)obj)->lock_user_location) e_border_act_move_begin((E_Border *)obj, ev); } + ACT_FN_GO_SIGNAL(window_move) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -103,9 +105,7 @@ ACT_FN_GO_SIGNAL(window_move) if (!((E_Border *)obj)->lock_user_location) { if ((params) && (!strcmp(params, "end"))) - { - e_border_signal_move_end((E_Border *)obj, sig, src); - } + e_border_signal_move_end((E_Border *)obj, sig, src); else { if (((E_Border *)obj)->moving) @@ -115,6 +115,7 @@ ACT_FN_GO_SIGNAL(window_move) } } } + ACT_FN_END(window_move) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -122,6 +123,7 @@ ACT_FN_END(window_move) if (obj->type != E_BORDER_TYPE) return; e_border_act_move_end((E_Border *)obj, NULL); } + ACT_FN_END_MOUSE(window_move) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -152,6 +154,7 @@ ACT_FN_GO(window_resize) if (!((E_Border *)obj)->lock_user_size) e_border_act_resize_begin((E_Border *)obj, NULL); } + ACT_FN_GO_MOUSE(window_resize) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -160,6 +163,7 @@ ACT_FN_GO_MOUSE(window_resize) if (!((E_Border *)obj)->lock_user_size) e_border_act_resize_begin((E_Border *)obj, ev); } + ACT_FN_GO_SIGNAL(window_resize) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -179,6 +183,7 @@ ACT_FN_GO_SIGNAL(window_resize) } } } + ACT_FN_END(window_resize) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -186,6 +191,7 @@ ACT_FN_END(window_resize) if (obj->type != E_BORDER_TYPE) return; e_border_act_resize_end((E_Border *)obj, NULL); } + ACT_FN_END_MOUSE(window_resize) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -219,6 +225,7 @@ ACT_FN_GO(window_menu) } e_border_act_menu_begin((E_Border *)obj, NULL, 0); } + ACT_FN_GO_MOUSE(window_menu) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -230,6 +237,7 @@ ACT_FN_GO_MOUSE(window_menu) } e_border_act_menu_begin((E_Border *)obj, ev, 0); } + ACT_FN_GO_KEY(window_menu) { if (!obj) obj = E_OBJECT(e_border_focused_get()); @@ -332,7 +340,7 @@ ACT_FN_GO(window_kill) } bd = (E_Border *)obj; if ((bd->lock_close) || (bd->internal)) return; - + if (kill_dialog) e_object_del(E_OBJECT(kill_dialog)); if (e_config->cnfmdlg_disabled) @@ -379,7 +387,7 @@ ACT_FN_GO(window_sticky_toggle) if (!((E_Border *)obj)->lock_user_sticky) { E_Border *bd; - + bd = (E_Border *)obj; if (bd->sticky) e_border_unstick(bd); else e_border_stick(bd); @@ -399,7 +407,7 @@ ACT_FN_GO(window_sticky) if (!((E_Border *)obj)->lock_user_sticky) { E_Border *bd; - + bd = (E_Border *)obj; if (params) { @@ -424,7 +432,7 @@ ACT_FN_GO(window_iconic_toggle) if (!((E_Border *)obj)->lock_user_iconify) { E_Border *bd; - + bd = (E_Border *)obj; if (bd->iconic) e_border_uniconify(bd); else e_border_iconify(bd); @@ -444,7 +452,7 @@ ACT_FN_GO(window_iconic) if (!((E_Border *)obj)->lock_user_iconify) { E_Border *bd; - + bd = (E_Border *)obj; if (params) { @@ -469,6 +477,7 @@ ACT_FN_GO(window_fullscreen_toggle) if (!((E_Border *)obj)->lock_user_fullscreen) { E_Border *bd; + bd = (E_Border *)obj; if (bd->fullscreen) e_border_unfullscreen(bd); @@ -494,11 +503,13 @@ ACT_FN_GO(window_fullscreen) if (!((E_Border *)obj)->lock_user_fullscreen) { E_Border *bd; + bd = (E_Border *)obj; if (params) { int v; char buf[32]; + buf[0] = 0; if (sscanf(params, "%i %20s", &v, buf) == 2) { @@ -531,7 +542,7 @@ ACT_FN_GO(window_maximized_toggle) if (!((E_Border *)obj)->lock_user_maximize) { E_Border *bd; - + bd = (E_Border *)obj; if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE) { @@ -581,14 +592,14 @@ ACT_FN_GO(window_maximized) if (!((E_Border *)obj)->lock_user_maximize) { E_Border *bd; - + bd = (E_Border *)obj; if (params) { E_Maximize max; int v, ret; char s1[32], s2[32]; - + max = (e_config->maximize_policy & E_MAXIMIZE_DIRECTION); ret = sscanf(params, "%i %20s %20s", &v, s1, s2); if (ret == 3) @@ -604,11 +615,16 @@ ACT_FN_GO(window_maximized) { if (v == 1) { - if (!strcmp(s1, "fullscreen")) e_border_maximize(bd, E_MAXIMIZE_FULLSCREEN | max); - else if (!strcmp(s1, "smart")) e_border_maximize(bd, E_MAXIMIZE_SMART | max); - else if (!strcmp(s1, "expand")) e_border_maximize(bd, E_MAXIMIZE_EXPAND | max); - else if (!strcmp(s1, "fill")) e_border_maximize(bd, E_MAXIMIZE_FILL | max); - else e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | max); + if (!strcmp(s1, "fullscreen")) + e_border_maximize(bd, E_MAXIMIZE_FULLSCREEN | max); + else if (!strcmp(s1, "smart")) + e_border_maximize(bd, E_MAXIMIZE_SMART | max); + else if (!strcmp(s1, "expand")) + e_border_maximize(bd, E_MAXIMIZE_EXPAND | max); + else if (!strcmp(s1, "fill")) + e_border_maximize(bd, E_MAXIMIZE_FILL | max); + else + e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | max); } else if (v == 0) e_border_unmaximize(bd, max); @@ -630,7 +646,7 @@ ACT_FN_GO(window_shaded_toggle) if (!((E_Border *)obj)->lock_user_shade) { E_Border *bd; - + bd = (E_Border *)obj; if (bd->shaded) { @@ -638,11 +654,16 @@ ACT_FN_GO(window_shaded_toggle) e_border_unshade(bd, E_DIRECTION_UP); else { - if (!strcmp(params, "up")) e_border_unshade(bd, E_DIRECTION_UP); - else if (!strcmp(params, "down")) e_border_unshade(bd, E_DIRECTION_DOWN); - else if (!strcmp(params, "left")) e_border_unshade(bd, E_DIRECTION_LEFT); - else if (!strcmp(params, "right")) e_border_unshade(bd, E_DIRECTION_RIGHT); - else e_border_unshade(bd, E_DIRECTION_UP); + if (!strcmp(params, "up")) + e_border_unshade(bd, E_DIRECTION_UP); + else if (!strcmp(params, "down")) + e_border_unshade(bd, E_DIRECTION_DOWN); + else if (!strcmp(params, "left")) + e_border_unshade(bd, E_DIRECTION_LEFT); + else if (!strcmp(params, "right")) + e_border_unshade(bd, E_DIRECTION_RIGHT); + else + e_border_unshade(bd, E_DIRECTION_UP); } } else @@ -651,11 +672,16 @@ ACT_FN_GO(window_shaded_toggle) e_border_shade(bd, E_DIRECTION_UP); else { - if (!strcmp(params, "up")) e_border_shade(bd, E_DIRECTION_UP); - else if (!strcmp(params, "down")) e_border_shade(bd, E_DIRECTION_DOWN); - else if (!strcmp(params, "left")) e_border_shade(bd, E_DIRECTION_LEFT); - else if (!strcmp(params, "right")) e_border_shade(bd, E_DIRECTION_RIGHT); - else e_border_shade(bd, E_DIRECTION_UP); + if (!strcmp(params, "up")) + e_border_shade(bd, E_DIRECTION_UP); + else if (!strcmp(params, "down")) + e_border_shade(bd, E_DIRECTION_DOWN); + else if (!strcmp(params, "left")) + e_border_shade(bd, E_DIRECTION_LEFT); + else if (!strcmp(params, "right")) + e_border_shade(bd, E_DIRECTION_RIGHT); + else + e_border_shade(bd, E_DIRECTION_UP); } } } @@ -674,13 +700,13 @@ ACT_FN_GO(window_shaded) if (!((E_Border *)obj)->lock_user_shade) { E_Border *bd; - + bd = (E_Border *)obj; if (params) { int v; char buf[32]; - + if (sscanf(params, "%i %20s", &v, buf) == 2) { if (v == 1) @@ -740,11 +766,10 @@ ACT_FN_GO(window_pinned_toggle) if (!((E_Border *)obj)->lock_border) { E_Border *bd; - - bd = (E_Border *)obj; + bd = (E_Border *)obj; if ((bd->client.netwm.state.stacking == E_STACKING_BELOW) && - (bd->user_skip_winlist) && (bd->borderless)) + (bd->user_skip_winlist) && (bd->borderless)) e_border_pinned_set(bd, 0); else e_border_pinned_set(bd, 1); @@ -764,15 +789,14 @@ ACT_FN_GO(window_move_by) if (params) { int dx, dy; - + if (sscanf(params, "%i %i", &dx, &dy) == 2) { E_Border *bd; - + bd = (E_Border *)obj; - e_border_move(bd, bd->x + dx, bd->y + dy); - + if (e_config->focus_policy != E_FOCUS_CLICK) ecore_x_pointer_warp(bd->zone->container->win, bd->x + (bd->w / 2), @@ -798,7 +822,6 @@ ACT_FN_GO(window_move_to) char cx, cy; bd = (E_Border *)obj; - if (sscanf(params, "%c%i %c%i", &cx, &x, &cy, &y) == 4) { /* Nothing, both x and y is updated. */ @@ -832,6 +855,9 @@ ACT_FN_GO(window_move_to) /***************************************************************************/ ACT_FN_GO(window_move_to_center) { + E_Border *bd; + int x, y; + if (!obj) obj = E_OBJECT(e_border_focused_get()); if (!obj) return; if (obj->type != E_BORDER_TYPE) @@ -840,19 +866,17 @@ ACT_FN_GO(window_move_to_center) if (!obj) return; } - E_Border *bd; - int x, y; bd = (E_Border *)obj; e_border_center_pos_get(bd, &x, &y); if ((x != bd->x) || (y != bd->y)) { - e_border_move(bd, x, y); + e_border_move(bd, x, y); - if (e_config->focus_policy != E_FOCUS_CLICK) - ecore_x_pointer_warp(bd->zone->container->win, - x + (bd->w / 2), - y + (bd->h / 2)); + if (e_config->focus_policy != E_FOCUS_CLICK) + ecore_x_pointer_warp(bd->zone->container->win, + x + (bd->w / 2), + y + (bd->h / 2)); } } @@ -870,17 +894,18 @@ ACT_FN_GO(window_resize_by) if (params) { int dw, dh; - + if (sscanf(params, "%i %i", &dw, &dh) == 2) { E_Border *bd; + bd = (E_Border *)obj; - + dw += bd->w; dh += bd->h; e_border_resize_limit(bd, &dw, &dh); e_border_resize(bd, dw, dh); - + if (e_config->focus_policy != E_FOCUS_CLICK) ecore_x_pointer_warp(bd->zone->container->win, bd->x + (dw / 2), bd->y + (dh / 2)); @@ -898,7 +923,7 @@ ACT_FN_GO(window_push) obj = E_OBJECT(e_border_focused_get()); if (!obj) return; } - + if (params) { E_Border *bd, *cur; @@ -959,11 +984,10 @@ ACT_FN_GO(window_push) cur = e_container_border_list_next(bd_list); } e_container_border_list_free(bd_list); - + if ((x != bd->x) || (y != bd->y)) { e_border_move(bd, x, y); - if (e_config->focus_policy != E_FOCUS_CLICK) ecore_x_pointer_warp(bd->zone->container->win, bd->x + (bd->w / 2), bd->y + (bd->h / 2)); @@ -983,7 +1007,7 @@ ACT_FN_GO(window_drag_icon) } { E_Border *bd; - + bd = (E_Border *)obj; bd->drag.start = 1; bd->drag.x = -1; @@ -1015,7 +1039,7 @@ ACT_FN_GO(window_desk_move_by) int to_x = 0, to_y = 0; e_desk_xy_get(bd->desk, &dx, &dy); - + to_x = dx + x; to_y = dy + y; while ((desk = e_desk_at_xy_get(bd->zone, to_x, to_y )) == NULL) @@ -1031,7 +1055,7 @@ ACT_FN_GO(window_desk_move_by) to_x += bd->zone->desk_x_count; to_y--; } - + while (to_y >= bd->zone->desk_y_count) to_y -= bd->zone->desk_y_count; while (to_y < 0) @@ -1072,8 +1096,7 @@ ACT_FN_GO(window_desk_move_to) E_Desk *desk; desk = e_desk_at_xy_get(bd->zone, x, y); - if (desk) - e_border_desk_set(bd, desk); + if (desk) e_border_desk_set(bd, desk); } } @@ -1105,7 +1128,7 @@ ACT_FN_GO(desk_flip_by) if (params) { int dx = 0, dy = 0; - + if (sscanf(params, "%i %i", &dx, &dy) == 2) e_zone_desk_flip_by(zone, dx, dy); } @@ -1123,7 +1146,7 @@ ACT_FN_GO(desk_flip_to) if (params) { int dx = 0, dy = 0; - + if (sscanf(params, "%i %i", &dx, &dy) == 2) e_zone_desk_flip_to(zone, dx, dy); } @@ -1131,14 +1154,14 @@ ACT_FN_GO(desk_flip_to) } /***************************************************************************/ -#define ACT_FLIP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || ((zone)->desk_x_current > 0)) +#define ACT_FLIP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || ((zone)->desk_x_current > 0)) #define ACT_FLIP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || (((zone)->desk_x_current + 1) < (zone)->desk_x_count)) -#define ACT_FLIP_UP(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0)) -#define ACT_FLIP_DOWN(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count)) -#define ACT_FLIP_UP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && ((zone)->desk_y_current > 0))) -#define ACT_FLIP_UP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && ((zone)->desk_y_current > 0))) -#define ACT_FLIP_DOWN_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count))) -#define ACT_FLIP_DOWN_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count))) +#define ACT_FLIP_UP(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0)) +#define ACT_FLIP_DOWN(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count)) +#define ACT_FLIP_UP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && ((zone)->desk_y_current > 0))) +#define ACT_FLIP_UP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && ((zone)->desk_y_current > 0))) +#define ACT_FLIP_DOWN_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count))) +#define ACT_FLIP_DOWN_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count))) ACT_FN_GO_EDGE(desk_flip_in_direction) { @@ -1255,7 +1278,7 @@ ACT_FN_GO(desk_linear_flip_by) if (params) { int dx = 0; - + if (sscanf(params, "%i", &dx) == 1) e_zone_desk_linear_flip_by(zone, dx); } @@ -1273,7 +1296,7 @@ ACT_FN_GO(desk_linear_flip_to) if (params) { int dx = 0; - + if (sscanf(params, "%i", &dx) == 1) e_zone_desk_linear_flip_to(zone, dx); } @@ -1281,7 +1304,6 @@ ACT_FN_GO(desk_linear_flip_to) } - #define DESK_ACTION_ALL(zone, act) \ E_Zone *zone; \ Eina_List *lm, *lc, *lz; \ @@ -1300,61 +1322,59 @@ ACT_FN_GO(desk_linear_flip_to) /***************************************************************************/ ACT_FN_GO(desk_flip_by_all) { - if (params) - { - int dx = 0, dy = 0; + if (params) + { + int dx = 0, dy = 0; - if (sscanf(params, "%i %i", &dx, &dy) == 2) - { - DESK_ACTION_ALL(zone, e_zone_desk_flip_by(zone, dx, dy)); - } - } + if (sscanf(params, "%i %i", &dx, &dy) == 2) + { + DESK_ACTION_ALL(zone, e_zone_desk_flip_by(zone, dx, dy)); + } + } } /***************************************************************************/ ACT_FN_GO(desk_flip_to_all) { - if (params) - { - int dx = 0, dy = 0; + if (params) + { + int dx = 0, dy = 0; - if (sscanf(params, "%i %i", &dx, &dy) == 2) - { - DESK_ACTION_ALL(zone, e_zone_desk_flip_to(zone, dx, dy)); - } - } + if (sscanf(params, "%i %i", &dx, &dy) == 2) + { + DESK_ACTION_ALL(zone, e_zone_desk_flip_to(zone, dx, dy)); + } + } } /***************************************************************************/ ACT_FN_GO(desk_linear_flip_by_all) { - if (params) - { - int dx = 0; + if (params) + { + int dx = 0; - if (sscanf(params, "%i", &dx) == 1) - { - DESK_ACTION_ALL(zone, e_zone_desk_linear_flip_by(zone, dx)); - } - } + if (sscanf(params, "%i", &dx) == 1) + { + DESK_ACTION_ALL(zone, e_zone_desk_linear_flip_by(zone, dx)); + } + } } /***************************************************************************/ ACT_FN_GO(desk_linear_flip_to_all) { - if (params) - { - int dx = 0; + if (params) + { + int dx = 0; - if (sscanf(params, "%i", &dx) == 1) - { - DESK_ACTION_ALL(zone, e_zone_desk_linear_flip_to(zone, dx)); - } - } + if (sscanf(params, "%i", &dx) == 1) + { + DESK_ACTION_ALL(zone, e_zone_desk_linear_flip_to(zone, dx)); + } + } } - - /***************************************************************************/ ACT_FN_GO(screen_send_to) { @@ -1367,11 +1387,11 @@ ACT_FN_GO(screen_send_to) if (params) { int scr = 0; - + if (sscanf(params, "%i", &scr) == 1) { E_Zone *zone2 = NULL; - + if (eina_list_count(e_manager_list()) > 1) { scr = scr % eina_list_count(e_manager_list()); @@ -1404,11 +1424,11 @@ ACT_FN_GO(screen_send_by) if (params) { int scr = 0; - + if (sscanf(params, "%i", &scr) == 1) { E_Zone *zone2 = NULL; - + if (eina_list_count(e_manager_list()) > 1) { scr += zone->container->num; @@ -1433,33 +1453,33 @@ ACT_FN_GO(screen_send_by) } #define ZONE_DESK_ACTION(con_num, zone_num, zone, act) \ -E_Zone *zone; \ -if ((con_num < 0) || (zone_num < 0)) { \ - Eina_List *l, *ll, *lll; \ - E_Container *con; \ - E_Manager *man; \ - if ((con_num >= 0) && (zone_num < 0)) /* con=1 zone=all */ { \ - con = e_util_container_number_get(con_num); \ - EINA_LIST_FOREACH(con->zones, l, zone) { \ - act; \ - } } \ - else if ((con_num < 0) && (zone_num >= 0)) /* con=all zone=1 */ { \ - EINA_LIST_FOREACH(e_manager_list(), l, man) { \ - EINA_LIST_FOREACH(man->containers, ll, con) { \ - zone = e_container_zone_number_get(con, zone_num); \ - if (zone) \ - act; \ - } } } \ - else if ((con_num < 0) && (zone_num < 0)) /* con=all zone=all */ { \ - EINA_LIST_FOREACH(e_manager_list(), l, man) { \ - EINA_LIST_FOREACH(man->containers, ll, con) { \ - EINA_LIST_FOREACH(con->zones, lll, zone) { \ - act; \ - } } } } } \ -else { \ - zone = e_util_container_zone_number_get(con_num, zone_num); \ - if (zone) act; \ -} + E_Zone *zone; \ + if ((con_num < 0) || (zone_num < 0)) { \ + Eina_List *l, *ll, *lll; \ + E_Container *con; \ + E_Manager *man; \ + if ((con_num >= 0) && (zone_num < 0)) /* con=1 zone=all */ { \ + con = e_util_container_number_get(con_num); \ + EINA_LIST_FOREACH(con->zones, l, zone) { \ + act; \ + } } \ + else if ((con_num < 0) && (zone_num >= 0)) /* con=all zone=1 */ { \ + EINA_LIST_FOREACH(e_manager_list(), l, man) { \ + EINA_LIST_FOREACH(man->containers, ll, con) { \ + zone = e_container_zone_number_get(con, zone_num); \ + if (zone) \ + act; \ + } } } \ + else if ((con_num < 0) && (zone_num < 0)) /* con=all zone=all */ { \ + EINA_LIST_FOREACH(e_manager_list(), l, man) { \ + EINA_LIST_FOREACH(man->containers, ll, con) { \ + EINA_LIST_FOREACH(con->zones, lll, zone) { \ + act; \ + } } } } } \ + else { \ + zone = e_util_container_zone_number_get(con_num, zone_num); \ + if (zone) act; \ + } /***************************************************************************/ #if 0 @@ -1469,12 +1489,10 @@ ACT_FN_GO(zone_desk_flip_by) { int con_num = 0, zone_num = 0; int dx = 0, dy = 0; - + if (sscanf(params, "%i %i %i %i", &con_num, &zone_num, &dx, &dy) == 4) - { - ZONE_DESK_ACTION(con_num, zone_num, zone, - e_zone_desk_flip_by(zone, dx, dy)); - } + ZONE_DESK_ACTION(con_num, zone_num, zone, + e_zone_desk_flip_by(zone, dx, dy)); } } #endif @@ -1487,12 +1505,10 @@ ACT_FN_GO(zone_desk_flip_to) { int con_num = 0, zone_num = 0; int dx = 0, dy = 0; - + if (sscanf(params, "%i %i %i %i", &con_num, &zone_num, &dx, &dy) == 4) - { - ZONE_DESK_ACTION(con_num, zone_num, zone, - e_zone_desk_flip_to(zone, dx, dy)); - } + ZONE_DESK_ACTION(con_num, zone_num, zone, + e_zone_desk_flip_to(zone, dx, dy)); } } #endif @@ -1505,12 +1521,10 @@ ACT_FN_GO(zone_desk_linear_flip_by) { int con_num = 0, zone_num = 0; int dx = 0; - + if (sscanf(params, "%i %i %i", &con_num, &zone_num, &dx) == 3) - { - ZONE_DESK_ACTION(con_num, zone_num, zone, - e_zone_desk_linear_flip_by(zone, dx)); - } + ZONE_DESK_ACTION(con_num, zone_num, zone, + e_zone_desk_linear_flip_by(zone, dx)); } } #endif @@ -1523,12 +1537,10 @@ ACT_FN_GO(zone_desk_linear_flip_to) { int con_num = 0, zone_num = 0; int dx = 0; - + if (sscanf(params, "%i %i %i", &con_num, &zone_num, &dx) == 3) - { - ZONE_DESK_ACTION(con_num, zone_num, zone, - e_zone_desk_linear_flip_to(zone, dx)); - } + ZONE_DESK_ACTION(con_num, zone_num, zone, + e_zone_desk_linear_flip_to(zone, dx)); } } #endif @@ -1539,17 +1551,25 @@ _e_actions_cb_menu_end(void *data, E_Menu *m) { e_object_del(E_OBJECT(m)); } + static E_Menu * _e_actions_menu_find(const char *name) { - if (!strcmp(name, "main")) return e_int_menus_main_new(); - else if (!strcmp(name, "favorites")) return e_int_menus_favorite_apps_new(); - else if (!strcmp(name, "all")) return e_int_menus_all_apps_new(); - else if (!strcmp(name, "clients")) return e_int_menus_clients_new(); - else if (!strcmp(name, "lost_clients")) return e_int_menus_lost_clients_new(); - else if (!strcmp(name, "configuration")) return e_int_menus_config_new(); + if (!strcmp(name, "main")) + return e_int_menus_main_new(); + else if (!strcmp(name, "favorites")) + return e_int_menus_favorite_apps_new(); + else if (!strcmp(name, "all")) + return e_int_menus_all_apps_new(); + else if (!strcmp(name, "clients")) + return e_int_menus_clients_new(); + else if (!strcmp(name, "lost_clients")) + return e_int_menus_lost_clients_new(); + else if (!strcmp(name, "configuration")) + return e_int_menus_config_new(); return NULL; } + ACT_FN_GO(menu_show) { E_Zone *zone; @@ -1562,12 +1582,12 @@ ACT_FN_GO(menu_show) if (params) { E_Menu *m = NULL; - + m = _e_actions_menu_find(params); if (m) { int x, y; - + /* FIXME: this is a bit of a hack... setting m->con - bad hack */ m->zone = zone; ecore_x_pointer_xy_get(zone->container->win, &x, &y); @@ -1579,6 +1599,7 @@ ACT_FN_GO(menu_show) } } } + ACT_FN_GO_MOUSE(menu_show) { E_Zone *zone; @@ -1591,12 +1612,12 @@ ACT_FN_GO_MOUSE(menu_show) if (params) { E_Menu *m = NULL; - + m = _e_actions_menu_find(params); if (m) { int x, y; - + /* FIXME: this is a bit of a hack... setting m->con - bad hack */ m->zone = zone; x = ev->root.x; @@ -1610,6 +1631,7 @@ ACT_FN_GO_MOUSE(menu_show) } } } + ACT_FN_GO_KEY(menu_show) { E_Zone *zone; @@ -1622,12 +1644,12 @@ ACT_FN_GO_KEY(menu_show) if (params) { E_Menu *m = NULL; - + m = _e_actions_menu_find(params); if (m) { int x, y; - + /* FIXME: this is a bit of a hack... setting m->con - bad hack */ m->zone = zone; ecore_x_pointer_xy_get(zone->container->win, &x, &y); @@ -1643,14 +1665,12 @@ ACT_FN_GO_KEY(menu_show) ACT_FN_GO(exec) { E_Zone *zone; - + zone = _e_actions_zone_get(obj); if (zone) { if (params) - { - e_exec(zone, NULL, params, NULL, "action/exec"); - } + e_exec(zone, NULL, params, NULL, "action/exec"); } } @@ -1658,7 +1678,7 @@ ACT_FN_GO(exec) ACT_FN_GO(app) { E_Zone *zone; - + zone = _e_actions_zone_get(obj); if (zone) { @@ -1666,7 +1686,7 @@ ACT_FN_GO(app) { Efreet_Desktop *desktop = NULL; char *p, *p2; - + p2 = alloca(strlen(params) + 1); strcpy(p2, params); p = strchr(p2, ' '); @@ -1695,10 +1715,7 @@ ACT_FN_GO(desk_deskshow_toggle) zone = _e_actions_zone_get(obj); if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); - if (zone) - { - e_desk_deskshow(zone); - } + if (zone) e_desk_deskshow(zone); } ACT_FN_GO(cleanup_windows) @@ -1707,8 +1724,7 @@ ACT_FN_GO(cleanup_windows) zone = _e_actions_zone_get(obj); if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); - if (zone) - e_place_zone_region_smart_cleanup(zone); + if (zone) e_place_zone_region_smart_cleanup(zone); } /***************************************************************************/ @@ -1763,8 +1779,7 @@ ACT_FN_GO(exit) e_dialog_text_set(exit_dialog, _("You requested to exit Enlightenment.
" "
" - "Are you sure you want to exit?" - )); + "Are you sure you want to exit?")); e_dialog_icon_set(exit_dialog, "application-exit", 64); e_dialog_button_add(exit_dialog, _("Yes"), NULL, _e_actions_cb_exit_dialog_ok, NULL); @@ -1847,7 +1862,7 @@ ACT_FN_GO(logout) return; } if (logout_dialog) e_object_del(E_OBJECT(logout_dialog)); - + if (e_config->cnfmdlg_disabled) { _e_actions_cb_logout_dialog_ok(NULL, NULL); @@ -1861,8 +1876,7 @@ ACT_FN_GO(logout) e_dialog_text_set(logout_dialog, _("You are about to log out.
" "
" - "Are you sure you want to do this?" - )); + "Are you sure you want to do this?")); e_dialog_icon_set(logout_dialog, "system-log-out", 64); e_dialog_button_add(logout_dialog, _("Yes"), NULL, _e_actions_cb_logout_dialog_ok, NULL); @@ -1925,8 +1939,7 @@ ACT_FN_GO(halt) e_dialog_text_set(halt_dialog, _("You requested to turn off your Computer.
" "
" - "Are you sure you want to shut down?" - )); + "Are you sure you want to shut down?")); e_dialog_icon_set(halt_dialog, "system-shutdown", 64); e_dialog_button_add(halt_dialog, _("Yes"), NULL, _e_actions_cb_halt_dialog_ok, NULL); @@ -1989,8 +2002,7 @@ ACT_FN_GO(reboot) e_dialog_text_set(reboot_dialog, _("You requested to reboot your Computer.
" "
" - "Are you sure you want to restart it?" - )); + "Are you sure you want to restart it?")); e_dialog_icon_set(reboot_dialog, "system-restart", 64); e_dialog_button_add(reboot_dialog, _("Yes"), NULL, _e_actions_cb_reboot_dialog_ok, NULL); @@ -2053,8 +2065,7 @@ ACT_FN_GO(suspend) e_dialog_text_set(suspend_dialog, _("You requested to suspend your Computer.
" "
" - "Are you sure you want to suspend?" - )); + "Are you sure you want to suspend?")); e_dialog_icon_set(suspend_dialog, "system-suspend", 64); e_dialog_button_add(suspend_dialog, _("Yes"), NULL, _e_actions_cb_suspend_dialog_ok, NULL); @@ -2117,8 +2128,7 @@ ACT_FN_GO(hibernate) e_dialog_text_set(hibernate_dialog, _("You requested to hibernate your Computer.
" "
" - "Are you sure you want to suspend to disk?" - )); + "Are you sure you want to suspend to disk?")); e_dialog_icon_set(hibernate_dialog, "system-suspend-hibernate", 64); e_dialog_button_add(hibernate_dialog, _("Yes"), NULL, _e_actions_cb_hibernate_dialog_ok, NULL); @@ -2138,6 +2148,7 @@ ACT_FN_GO(pointer_resize_push) if (obj->type == E_BORDER_TYPE) { E_Border *bd; + bd = (E_Border *)obj; if ((bd->lock_user_size) || (bd->shaded) || (bd->shading) || (bd->fullscreen) || @@ -2159,6 +2170,7 @@ ACT_FN_GO(pointer_resize_pop) if (obj->type == E_BORDER_TYPE) { E_Border *bd; + bd = (E_Border *)obj; if ((bd->lock_user_size) || (bd->shaded) || (bd->shading) || (bd->fullscreen) || @@ -2211,6 +2223,7 @@ if ((!params) || (params && (fnmatch(params, es->name, 0) == 0))) \ e_shelf_toggle(es, 1); \ e_shelf_toggle(es, 0); \ } + ACT_FN_GO_EDGE(shelf_show) { Eina_List *l; @@ -2263,21 +2276,20 @@ ACT_FN_GO_EDGE(shelf_show) } } #undef ACT_SHELF_SHOW -/***************************************************************************/ -typedef struct _Delayed_Action Delayed_Action; +/***************************************************************************/ +typedef struct _Delayed_Action Delayed_Action; struct _Delayed_Action { - int mouse; - int button; - const char *keyname; - E_Object *obj; + int mouse, button; + const char *keyname; + E_Object *obj; Ecore_Timer *timer; - struct { - const char *action; - const char *params; - } def, delayed; + struct + { + const char *action, *params; + } def, delayed; }; static Eina_List *_delayed_actions = NULL; @@ -2300,7 +2312,7 @@ _delayed_action_cb_timer(void *data) { Delayed_Action *da; E_Action *act; - + da = data; da->timer = NULL; act = e_action_find(da->delayed.action); @@ -2317,7 +2329,7 @@ static void _delayed_action_do(Delayed_Action *da) { E_Action *act; - + act = e_action_find(da->def.action); if (act) { @@ -2331,7 +2343,7 @@ _delayed_action_list_parse_action(const char *str, double *delay, const char **a char fbuf[16]; char buf[1024]; const char *p; - + buf[0] = 0; sscanf(str, "%10s %1000s", fbuf, buf); *action = eina_stringshare_add(buf); @@ -2353,10 +2365,9 @@ static void _delayed_action_list_parse(Delayed_Action *da, const char *params) { double delay = 2.0; - const char *p, - *a1start = NULL, *a1stop = NULL, - *a2start = NULL, *a2stop = NULL; - + const char *p, *a1start = NULL, *a1stop = NULL; + const char *a2start = NULL, *a2stop = NULL; + // FORMAT: "[0.0 default_action param1 param2] [x.x action2 param1 param2]" p = params; while (*p) @@ -2383,13 +2394,13 @@ _delayed_action_list_parse(Delayed_Action *da, const char *params) { char *a1, *a2; const char *action, *params; - + a1 = alloca(a1stop - a1start + 1); ecore_strlcpy(a1, a1start, a1stop - a1start + 1); action = NULL; params = NULL; _delayed_action_list_parse_action(a1, &delay, &da->def.action, &da->def.params); - + a2 = alloca(a1stop - a1start + 1); ecore_strlcpy(a2, a2start, a2stop - a2start + 1); _delayed_action_list_parse_action(a2, &delay, &da->delayed.action, &da->delayed.params); @@ -2401,7 +2412,7 @@ static void _delayed_action_key_add(E_Object *obj, const char *params, Ecore_Event_Key *ev) { Delayed_Action *da; - + da = E_NEW(Delayed_Action, 1); if (!da) return; if (obj) @@ -2420,7 +2431,7 @@ _delayed_action_key_del(E_Object *obj, const char *params, Ecore_Event_Key *ev) { Eina_List *l; Delayed_Action *da; - + EINA_LIST_FOREACH(_delayed_actions, l, da) { if ((da->obj == obj) && (!da->mouse) && @@ -2438,7 +2449,7 @@ static void _delayed_action_mouse_add(E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev) { Delayed_Action *da; - + da = E_NEW(Delayed_Action, 1); if (!da) return; if (obj) @@ -2457,7 +2468,7 @@ _delayed_action_mouse_del(E_Object *obj, const char *params, Ecore_Event_Mouse_B { Eina_List *l; Delayed_Action *da; - + EINA_LIST_FOREACH(_delayed_actions, l, da) { if ((da->obj == obj) && (da->mouse) && @@ -2476,14 +2487,17 @@ ACT_FN_GO_KEY(delayed_action) { _delayed_action_key_add(obj, params, ev); } + ACT_FN_GO_MOUSE(delayed_action) { _delayed_action_mouse_add(obj, params, ev); } + ACT_FN_END_KEY(delayed_action) { _delayed_action_key_del(obj, params, ev); } + ACT_FN_END_MOUSE(delayed_action) { _delayed_action_mouse_del(obj, params, ev); @@ -2541,7 +2555,7 @@ e_actions_init(void) ACT_GO(window_lower); e_action_predef_name_set(_("Window : Actions"), _("Lower"), "window_lower", NULL, NULL, 0); - + /* window_close */ ACT_GO(window_close); e_action_predef_name_set(_("Window : Actions"), _("Close"), @@ -2551,21 +2565,21 @@ e_actions_init(void) ACT_GO(window_kill); e_action_predef_name_set(_("Window : Actions"), _("Kill"), "window_kill", NULL, NULL, 0); - + /* window_sticky_toggle */ ACT_GO(window_sticky_toggle); e_action_predef_name_set(_("Window : State"), _("Sticky Mode Toggle"), "window_sticky_toggle", NULL, NULL, 0); - + ACT_GO(window_sticky); /* window_iconic_toggle */ ACT_GO(window_iconic_toggle); e_action_predef_name_set(_("Window : State"), _("Iconic Mode Toggle"), "window_iconic_toggle", NULL, NULL, 0); - + ACT_GO(window_iconic); - + /* window_fullscreen_toggle */ ACT_GO(window_fullscreen_toggle); e_action_predef_name_set(_("Window : State"), _("Fullscreen Mode Toggle"), @@ -2593,7 +2607,7 @@ e_actions_init(void) "window_maximized_toggle", "fill", NULL, 0); ACT_GO(window_maximized); - + /* window_shaded_toggle */ ACT_GO(window_shaded_toggle); e_action_predef_name_set(_("Window : State"), _("Shade Up Mode Toggle"), @@ -2606,14 +2620,14 @@ e_actions_init(void) "window_shaded_toggle", "right", NULL, 0); e_action_predef_name_set(_("Window : State"), _("Shade Mode Toggle"), "window_shaded_toggle", NULL, NULL, 0); - + ACT_GO(window_shaded); - + /* window_borderless_toggle */ ACT_GO(window_borderless_toggle); e_action_predef_name_set(_("Window : State"), _("Toggle Borderless State"), "window_borderless_toggle", NULL, NULL, 0); - + /* window_pinned_toggle */ ACT_GO(window_pinned_toggle); e_action_predef_name_set(_("Window : State"), _("Toggle Pinned State"), @@ -2655,7 +2669,7 @@ e_actions_init(void) e_action_predef_name_set(_("Desktop"), _("Flip Desktop Linearly..."), "desk_linear_flip_by", NULL, "syntax: N-offset, example: -2", 1); - + /* desk_linear_flip_to */ ACT_GO(desk_linear_flip_to); e_action_predef_name_set(_("Desktop"), _("Switch To Desktop 0"), @@ -2747,7 +2761,6 @@ e_actions_init(void) "desk_linear_flip_to_all", NULL, "syntax: N, example: 1", 1); - /* screen_send_to */ ACT_GO(screen_send_to); e_action_predef_name_set(_("Screen"), _("Send Mouse To Screen 0"), @@ -2757,6 +2770,7 @@ e_actions_init(void) e_action_predef_name_set(_("Screen"), _("Send Mouse To Screen..."), "screen_send_to", NULL, "syntax: N, example: 0", 1); + /* screen_send_by */ ACT_GO(screen_send_by); e_action_predef_name_set(_("Screen"), _("Send Mouse Forward 1 Screen"), @@ -2766,7 +2780,7 @@ e_actions_init(void) e_action_predef_name_set(_("Screen"), _("Send Mouse Forward/Back Screens..."), "screen_send_by", NULL, "syntax: N-offset, example: -2", 1); - + /* window_move_to_center */ ACT_GO(window_move_to_center); e_action_predef_name_set(_("Window : Actions"), "Move To Center", @@ -2793,7 +2807,7 @@ e_actions_init(void) e_action_predef_name_set(_("Window : Actions"), "Push in Direction...", "window_push", NULL, "syntax: direction, example: up, down, left, right", 1); - + /* window_drag_icon */ ACT_GO(window_drag_icon); e_action_predef_name_set(_("Window : Actions"), "Drag Icon...", @@ -2839,7 +2853,7 @@ e_actions_init(void) ACT_GO(app); e_action_predef_name_set(_("Launch"), _("Application"), "app", NULL, "syntax: , example:", 1); - + ACT_GO(restart); e_action_predef_name_set(_("Enlightenment"), _("Restart"), "restart", NULL, NULL, 0); @@ -2885,10 +2899,10 @@ e_actions_init(void) ACT_GO(hibernate); e_action_predef_name_set(_("System"), _("Hibernate"), "hibernate", NULL, NULL, 0); - + ACT_GO(pointer_resize_push); ACT_GO(pointer_resize_pop); - + /* desk_lock */ ACT_GO(desk_lock); e_action_predef_name_set(_("Desktop"), _("Lock"), "desk_lock", @@ -2898,7 +2912,7 @@ e_actions_init(void) ACT_GO(cleanup_windows); e_action_predef_name_set(_("Desktop"), _("Cleanup Windows"), "cleanup_windows", NULL, NULL, 0); - + /* delayed_action */ ACT_GO_KEY(delayed_action); e_action_predef_name_set(_("Generic : Actions"), _("Delayed Action"), @@ -2954,14 +2968,14 @@ e_action_del(const char *name) E_Action *act; act = eina_hash_find(actions, name); - if (act) - _e_action_free(act); + if (act) _e_action_free(act); } EAPI E_Action * e_action_find(const char *name) { E_Action *act; + act = eina_hash_find(actions, name); return act; } @@ -2999,12 +3013,11 @@ e_action_predef_name_set(const char *act_grp, const char *act_name, const char * E_Action_Description *actd = NULL; Eina_List *l; - if (!act_grp || !act_name) return; + if ((!act_grp) || (!act_name)) return; EINA_LIST_FOREACH(action_groups, l, actg) { - if (!strcmp(actg->act_grp, act_grp)) - break; + if (!strcmp(actg->act_grp, act_grp)) break; actg = NULL; } @@ -3018,14 +3031,12 @@ e_action_predef_name_set(const char *act_grp, const char *act_name, const char * action_groups = eina_list_append(action_groups, actg); action_groups = - eina_list_sort(action_groups, eina_list_count(action_groups), - _action_groups_sort_cb); + eina_list_sort(action_groups, -1, _action_groups_sort_cb); } EINA_LIST_FOREACH(actg->acts, l, actd) { - if (!strcmp(actd->act_name, act_name)) - break; + if (!strcmp(actd->act_name, act_name)) break; actd = NULL; } @@ -3052,8 +3063,7 @@ e_action_predef_name_del(const char *act_grp, const char *act_name) EINA_LIST_FOREACH(action_groups, l, actg) { - if (!strcmp(actg->act_grp, act_grp)) - break; + if (!strcmp(actg->act_grp, act_grp)) break; actg = NULL; } @@ -3071,7 +3081,7 @@ e_action_predef_name_del(const char *act_grp, const char *act_name) if (actd->param_example) eina_stringshare_del(actd->param_example); E_FREE(actd); - + if (!eina_list_count(actg->acts)) { action_groups = eina_list_remove(action_groups, actg); @@ -3134,17 +3144,25 @@ _e_actions_maximize_parse(const char *params) ret = sscanf(params, "%20s %20s", s1, s2); if (ret == 2) { - if (!strcmp(s2, "horizontal")) max = E_MAXIMIZE_HORIZONTAL; - else if (!strcmp(s2, "vertical")) max = E_MAXIMIZE_VERTICAL; - else max = E_MAXIMIZE_BOTH; + if (!strcmp(s2, "horizontal")) + max = E_MAXIMIZE_HORIZONTAL; + else if (!strcmp(s2, "vertical")) + max = E_MAXIMIZE_VERTICAL; + else + max = E_MAXIMIZE_BOTH; } if (ret >= 1) { - if (!strcmp(s1, "fullscreen")) max |= E_MAXIMIZE_FULLSCREEN; - else if (!strcmp(s1, "smart")) max |= E_MAXIMIZE_SMART; - else if (!strcmp(s1, "expand")) max |= E_MAXIMIZE_EXPAND; - else if (!strcmp(s1, "fill")) max |= E_MAXIMIZE_FILL; - else max |= (e_config->maximize_policy & E_MAXIMIZE_TYPE); + if (!strcmp(s1, "fullscreen")) + max |= E_MAXIMIZE_FULLSCREEN; + else if (!strcmp(s1, "smart")) + max |= E_MAXIMIZE_SMART; + else if (!strcmp(s1, "expand")) + max |= E_MAXIMIZE_EXPAND; + else if (!strcmp(s1, "fill")) + max |= E_MAXIMIZE_FILL; + else + max |= (e_config->maximize_policy & E_MAXIMIZE_TYPE); } else max = e_config->maximize_policy; @@ -3156,11 +3174,7 @@ _action_groups_sort_cb(const void *d1, const void *d2) { const E_Action_Group *g1, *g2; - g1 = d1; - g2 = d2; - - if (!g1) return 1; - if (!g2) return -1; - + if (!(g1 = d1)) return 1; + if (!(g2 = d2)) return -1; return strcmp(g1->act_grp, g2->act_grp); }