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

Using keyboard letters #53

Closed
moozer opened this issue Sep 6, 2018 · 5 comments
Closed

Using keyboard letters #53

moozer opened this issue Sep 6, 2018 · 5 comments

Comments

@moozer
Copy link

moozer commented Sep 6, 2018

Is it possible to make a config where e.g pressing the "b" key on the keyboard maps to drawing with blue?

something like

"red Pen" = PEN (size=5 color="red");
"blue Pen" = "red Pen" (color="blue");

"Virtual core keyboard"[b] = "blue Pen";

@bk138
Copy link
Owner

bk138 commented Sep 7, 2018

Sure it is. Contributions are always welcome!

@moozer
Copy link
Author

moozer commented Sep 7, 2018

Ok, so I decided not to give up in advance ...
Looking through the code I find it readable even with my very rusty C skills.

You define the keys the config file reader parses. It is limited to button and modifiers (ctrl/alt/etc)

gromit-mpx/src/config.c

Lines 148 to 165 in 3f85689

g_scanner_scope_add_symbol (scanner, 0, "PEN", (gpointer) GROMIT_PEN);
g_scanner_scope_add_symbol (scanner, 0, "ERASER", (gpointer) GROMIT_ERASER);
g_scanner_scope_add_symbol (scanner, 0, "RECOLOR",(gpointer) GROMIT_RECOLOR);
g_scanner_scope_add_symbol (scanner, 1, "BUTTON1", (gpointer) 1);
g_scanner_scope_add_symbol (scanner, 1, "BUTTON2", (gpointer) 2);
g_scanner_scope_add_symbol (scanner, 1, "BUTTON3", (gpointer) 3);
g_scanner_scope_add_symbol (scanner, 1, "BUTTON4", (gpointer) 4);
g_scanner_scope_add_symbol (scanner, 1, "BUTTON5", (gpointer) 5);
g_scanner_scope_add_symbol (scanner, 1, "SHIFT", (gpointer) 11);
g_scanner_scope_add_symbol (scanner, 1, "CONTROL", (gpointer) 12);
g_scanner_scope_add_symbol (scanner, 1, "META", (gpointer) 13);
g_scanner_scope_add_symbol (scanner, 1, "ALT", (gpointer) 13);
g_scanner_scope_add_symbol (scanner, 2, "size", (gpointer) 1);
g_scanner_scope_add_symbol (scanner, 2, "color", (gpointer) 2);
g_scanner_scope_add_symbol (scanner, 2, "arrowsize", (gpointer) 3);
g_scanner_scope_add_symbol (scanner, 2, "minsize", (gpointer) 4);

In order to expand to the entire keyboard, we would need to define all keys on the keyboard.

And then in the code, start looking somewhere around here

if (gdk_device_get_source(device) != GDK_SOURCE_KEYBOARD && gdk_device_get_n_axes(device) >= 2)

@bk138
Copy link
Owner

bk138 commented Jul 3, 2019

General update: issues with Gromit-MPX can now be funded at https://issuehunt.io/r/bk138/gromit-mpx

@bk138
Copy link
Owner

bk138 commented Dec 5, 2020

@moozer Do you want e.g. 'b' to select a specific tool or act as an additional modifier to Alt,Shift,Ctrl?

@bk138
Copy link
Owner

bk138 commented Jan 24, 2021

Tentatively closing as there's requested info missing. Feel free to re-open if there's news.

@bk138 bk138 closed this as completed Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants