From 3e3dc6dcc52dce6c9e058b5d761d65a1f3c61381 Mon Sep 17 00:00:00 2001 From: Nicolas Marcotte Date: Fri, 15 May 2015 16:00:31 +0900 Subject: [PATCH] added a macro and a fucntion to switch to desktop D on screen S as specified in https://phab.enlightenment.org/T2218 Summary: Merge branch 'master' of https://git.enlightenment.org/core/enlightenment initnal implementation of https://phab.enlightenment.org/T2218 Reviewers: raster Subscribers: raster, cedric Differential Revision: https://phab.enlightenment.org/D2231 Fixed: Modified patch to use existing macros for walking all screens. --- src/bin/e_actions.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index e2bdc5b49..7183129a1 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -1569,13 +1569,36 @@ ACT_FN_GO(desk_linear_flip_to, ) } } -#define DESK_ACTION_ALL(zone, act) \ - E_Zone * zone; \ - const Eina_List *lz; \ - \ - EINA_LIST_FOREACH(e_comp->zones, lz, zone) { \ - act; \ - } \ +#define DESK_ACTION_ALL(zone, act) \ + E_Zone *zone; \ + const Eina_List *lz; \ + \ + EINA_LIST_FOREACH(e_comp->zones, lz, zone) { \ + act; \ + } + +/***************************************************************************/ +ACT_FN_GO(desk_linear_flip_to_screen, ) +{ + if (params) + { + int dx = 0, ds = 0; + + if (sscanf(params, "%i %i", &dx, &ds) == 2) + { + int current_screen = 0; + + DESK_ACTION_ALL(zone, + if (current_screen == ds) + { + e_zone_desk_linear_flip_to(zone, dx); + break; + } + else current_screen++; + ); + } + } +} /***************************************************************************/ ACT_FN_GO(desk_flip_by_all, ) @@ -3112,7 +3135,12 @@ e_actions_init(void) e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop To..."), "desk_flip_to", NULL, "syntax: X Y, example: 1 2", 1); - + /* desk_linear_flip_to_screen */ + ACT_GO(desk_linear_flip_to_screen); + e_action_predef_name_set(N_("Desktop"), N_("Switch Desktop To... On Screen..."), + "desk_linear_flip_to_screen", NULL, + "syntax: D S, example: 0 1", 1); + /* desk_linear_flip_by */ ACT_GO(desk_linear_flip_by); e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Linearly..."),