From: NeilBrown Date: Wed, 2 Dec 2015 01:05:06 +0000 (+1100) Subject: Move root popups to the tile-root. X-Git-Tag: lca2016~143 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=47efba7733ccd0e6b83fea7b35c68cb25dfbfd4e;p=edlib.git Move root popups to the tile-root. Having popups always attached to tiles seems clean and will make pane-movement easier. Signed-off-by: NeilBrown --- diff --git a/lib-keymap.c b/lib-keymap.c index 7d996b84..1aae71da 100644 --- a/lib-keymap.c +++ b/lib-keymap.c @@ -55,10 +55,6 @@ DEF_CMD(keymap_handle) return 1; } - if (kd->global && strcmp(ci->key, "global-key-root") == 0) { - ci->focus = ci->home; - return 1; - } if (kd->global && strncmp(ci->key, "local-", 6) == 0) { if (strcmp(ci->key, "local-set-key") == 0 || strcmp(ci->key, "local-add-keymap") == 0 || diff --git a/lib-popup.c b/lib-popup.c index 40d018c8..8b04d8fd 100644 --- a/lib-popup.c +++ b/lib-popup.c @@ -140,7 +140,7 @@ DEF_CMD(popup_attach) if (strchr(style, 'D')) { int x = 0, y = 0; pane_to_root(ci->focus, &x, &y, &z, NULL, NULL); - root = call_pane("global-key-root", ci->focus, 0, NULL, 0); + root = call_pane("RootPane", ci->focus, 0, NULL, 0); } else root = call_pane("ThisPane", ci->focus, 0, NULL, 0); if (!root) diff --git a/lib-tile.c b/lib-tile.c index e71e5c26..34afbf68 100644 --- a/lib-tile.c +++ b/lib-tile.c @@ -578,6 +578,18 @@ DEF_CMD(tile_this) return 1; } +DEF_CMD(tile_root) +{ + struct pane *p = ci->home; + struct tileinfo *ti = p->data; + while (ti->direction != Neither) { + p = p->parent; + ti = p->data; + } + ci->focus = p; + return 1; +} + void edlib_init(struct editor *ed) { tile_map = key_alloc(); @@ -585,6 +597,7 @@ void edlib_init(struct editor *ed) key_add(tile_map, "WindowOP", &tile_command); key_add(tile_map, "OtherPane", &tile_other); key_add(tile_map, "ThisPane", &tile_this); + key_add(tile_map, "RootPane", &tile_root); key_add(ed->commands, "attach-tile", &tile_attach); }