Skip to content

Commit

Permalink
Mouse kind of works on the menu, still lot to work on ##panels
Browse files Browse the repository at this point in the history
  • Loading branch information
Vane11ope authored and radare committed Jul 15, 2019
1 parent 0e4a3a9 commit 2299cc8
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions libr/core/panels.c
Original file line number Diff line number Diff line change
Expand Up @@ -5801,29 +5801,45 @@ void __panels_process(RCore *core, RPanels *panels) {
if (r_cons_get_click (&x, &y)) {
char *word = getWordFromCanvas (core, panels, x, y);
if (panels->mode == PANEL_MODE_MENU) {
key = '\n';
RPanelsMenu *menu = panels->panelsMenu;
RPanelsMenuItem *parent = menu->history[menu->depth - 1];
for (i = 0; i < parent->n_sub; i++) {
if (!strcmp (word, parent->sub[i]->get_name_cb (core, parent->sub[i]->base_name))) {
parent->selectedIndex = i;
(void)(parent->sub[parent->selectedIndex]->cb (core));
free (word);
}
}
goto repeat;
} else if (y == 1) { // click on first line (The menu
for (i = 0; i < COUNT (menus); i++) {
if (!strcmp (word, menus[i])) {
__setMode (core, PANEL_MODE_MENU);
__clearPanelsMenu (core);
RPanelsMenu *menu = panels->panelsMenu;
RPanelsMenuItem *parent = menu->history[menu->depth - 1];
parent->selectedIndex = i;
RPanelsMenuItem *child = parent->sub[parent->selectedIndex];
(void)(child->cb (core));
free (word);
goto repeat;
}
}
if (!strcmp (word, "Tab")) {
__handle_tab_new (core);
free (word);
goto repeat;
}
if (word[0] == '[' && word[1] && word[2] == ']') {
// do nothing
goto repeat;
}
if (atoi (word)) {
// XXX doesnt seems to update anything else than the selected tab
__handle_tab_nth (core, word[0]);
if (panels_root->root_state != DEFAULT) {
goto exit;
}
goto repeat;
}
__setMode (core, PANEL_MODE_MENU);
__clearPanelsMenu (core);
__getCurPanel (panels)->view->refresh = true;
key = 'j';
} else {
// TODO: select nth panel here
if (r_str_endswith (word, "X]")) {
Expand Down

0 comments on commit 2299cc8

Please sign in to comment.