Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for multiple keymap/menufunc to km_dokey_event() #3954

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucilanga
Copy link
Contributor

@lucilanga lucilanga commented Aug 4, 2023

I just wanted to get the ball rolling on this.
On the long run, if this is going to fly I believe it requires a third component.
That is the menu domain we've been talking the last time.
I'm not fully certain how this is going to fall into place.
We were discussing having :

DomainPager = { OpPager, pager_function_dispatcher() }

but perhaps we can do a global domain table where we could find our dispatcher() based on the calling parameters.

void *hsmap[] = { &Keymaps[MENU_FOLDER], &Keymaps[MENU_GENERIC], 0 };
void *hsfuncs[] = { OpBrowser, OpGeneric, 0 };
op = km_dokey2(hsmap, hsfuncs);

obviously OpBrowser will trigger browser_function_dispatcher() and OpGeneric will trigger global dispatcher.
There is the matter of menu dispatcher called infrequently or index dispatcher for that matter, I'm not sure what to do about them.

Moving on, we import OpAlias, OpGeneric from functions.h but we have a local functions.h in each dialog's directory, perhaps we can move those to keymap.h.

I was setup to use structs for function prototypes but I'd fallen on void. I was not sure about the final prototype and wanted to avoid: { { param}, {param}, {0} }. I've kept the original prototypes in keymap.h though. Also I've made km_dokey_event2() as per your initial thought on this, it's easier to switch back.

Finally I've ignored mw_get_field() and the _notify part for that matter as well, I believe the whole PR is going to be in need for a makeover. Though the way I'm dragging things perhaps I should consider doing the sidebar things the way are right now and get it out of the way.

PS. If this is going to trigger build breakage I've no idea how to test 'em beforehand

@lucilanga lucilanga self-assigned this Aug 4, 2023
@lucilanga lucilanga requested a review from a team as a code owner August 4, 2023 22:43
alias/dlg_alias.c Fixed Show fixed Hide fixed
browser/dlg_browser.c Fixed Show fixed Hide fixed
keymap.h Fixed Show fixed Hide fixed
history/dlg_history.c Fixed Show fixed Hide fixed
index/dlg_index.c Fixed Show fixed Hide fixed
pager/dlg_pager.c Fixed Show fixed Hide fixed
@lucilanga lucilanga marked this pull request as draft August 4, 2023 22:49
@lucilanga lucilanga added type:enhancement Feature Request topic:refactoring Code refactoring type:discuss Your views/opinions are requested and removed type:enhancement Feature Request labels Aug 4, 2023
void *hsmap[] = { &Keymaps[MENU_ALIAS], &Keymaps[MENU_GENERIC], 0 };
void *hsfuncs[] = { OpAlias, 0 };
op = km_dokey2(hsmap, hsfuncs, GETCH_NO_FLAGS);
// op = km_dokey(MENU_ALIAS, GETCH_NO_FLAGS);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
void *hsmap[] = { &Keymaps[MENU_FOLDER], &Keymaps[MENU_GENERIC], 0 };
void *hsfuncs[] = { OpBrowser, OpGeneric, 0 };
op = km_dokey2(hsmap, hsfuncs, GETCH_NO_FLAGS);
// op = km_dokey(MENU_FOLDER, GETCH_NO_FLAGS);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
*/
struct KeymapSeq
{
// struct Keymaps *name;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
void *hsmap[] = { &Keymaps[MENU_DIALOG], &Keymaps[MENU_GENERIC], 0 };
void *hsfuncs[] = { OpDialog, OpGeneric, 0 };
op = km_dokey2(hsmap, hsfuncs, GETCH_NO_FLAGS);
// op = km_dokey(MENU_DIALOG, GETCH_NO_FLAGS);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
index/dlg_index.c Fixed Show fixed Hide fixed
void *hsmap[] = { &Keymaps[MENU_PAGER], &Keymaps[MENU_GENERIC], 0 };
void *hsfuncs[] = { OpPager, 0 };
op = km_dokey2(hsmap, hsfuncs, GETCH_NO_FLAGS);
// op = km_dokey(MENU_PAGER, GETCH_NO_FLAGS);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@flatcap flatcap force-pushed the devel/key-handling branch 2 times, most recently from 2f6b533 to e33492e Compare October 29, 2023 16:23
@flatcap flatcap force-pushed the devel/key-handling branch 2 times, most recently from 9deb06f to d730e22 Compare November 16, 2023 19:39
@flatcap flatcap force-pushed the devel/key-handling branch 3 times, most recently from 57cec06 to dff703f Compare March 29, 2024 01:43
void *hsmap[] = { &Keymaps[MENU_INDEX], &Keymaps[MENU_GENERIC], 0 };
const void *hsfuncs[] = { OpIndex, OpGeneric, 0 };
op = km_dokey2(hsmap, hsfuncs, GETCH_NO_FLAGS);
// op = km_dokey(MENU_INDEX, GETCH_NO_FLAGS);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:refactoring Code refactoring type:discuss Your views/opinions are requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant