-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
mousegrid: implement grid-based mouse navigation #24811
base: develop
Are you sure you want to change the base?
Conversation
Add 2 modes of "grid-based" mouse cursor movement schemes: 1. Specifying an absolute x-y coordinate using 26-character alphabet 2. Iteratively picking a 3x3 direction to zoom in towards Both of these pose as an absolute positiong digitizer.
All the keys definitiely don't need to be in the I haven't added any tests, but happy to add some if it looks like this feature might be worth merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This set of changes will do for now, will do another pass once addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be 0.0.7
as this version of keycodes is already locked-in on master
. You'll need another file, keycodes_0.0.7.hjson
with content {}
too.
@@ -0,0 +1,116 @@ | |||
{ | |||
"keycodes": { | |||
"0x00E8": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start these at a higher keycode range -- this low is a bit too close to pure USB HID keycodes.
Perhaps starting at 0x77C0
?
|0 |`MG_L` |`MG_C`|`MG_R` | | ||
|+1|`MG_BL`|`MG_B`|`MG_BR`| | ||
|
||
In first interation, the whole screen is divided into a 3x3 grid to pick from, while second iteration picks within the 3x3 subgrid of the "quadrant" picked in the first iteration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically we'd need to be a 2x2 grid for quadrants to work as a term. Given that the grid size is configurable, perhaps we swap to segments?
In first interation, the whole screen is divided into a 3x3 grid to pick from, while second iteration picks within the 3x3 subgrid of the "quadrant" picked in the first iteration. | |
In first interation, the whole screen is divided into a 3x3 grid to pick from, while second iteration picks within the 3x3 subgrid of the segment picked in the first iteration. |
|
||
In first interation, the whole screen is divided into a 3x3 grid to pick from, while second iteration picks within the 3x3 subgrid of the "quadrant" picked in the first iteration. | ||
|
||
Since the "quadrants" are not visualized on screen while navigating, if a movement target is kind of between two quadrants, it can be difficult to tell which one is the "correct" coordinate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the "quadrants" are not visualized on screen while navigating, if a movement target is kind of between two quadrants, it can be difficult to tell which one is the "correct" coordinate. | |
Since the segments aren't displayed on screen while navigating, it can be difficult to determine which segment is 'correct' when a movement target spans two segments. |
|
||
Since the "quadrants" are not visualized on screen while navigating, if a movement target is kind of between two quadrants, it can be difficult to tell which one is the "correct" coordinate. | ||
|
||
In order to be forgiving of some inaccuracy, the default configuration leaves a little bit of buffer by zooming in slightly less than would be required for the 1/9th of the "quadrant". This means that for slightly inaccurate path can still reach the target but may require an extra keystroke. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to be forgiving of some inaccuracy, the default configuration leaves a little bit of buffer by zooming in slightly less than would be required for the 1/9th of the "quadrant". This means that for slightly inaccurate path can still reach the target but may require an extra keystroke. | |
The default configuration accounts for some inaccuracy by zooming in slightly less than what would be required for exactly 1/9th-sized segments. This allows slightly inaccurate paths to still reach the target, though it may require an extra keystroke. |
// Little bit of overlap when using directional grid to further refine cursor | ||
// position. | ||
#ifndef MG_ALPHABET_RESCALE_MULTIPLIER | ||
# define MG_ALPHABET_RESCALE_MULTIPLIER 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# define MG_ALPHABET_RESCALE_MULTIPLIER 2.0 | |
# define MG_ALPHABET_RESCALE_MULTIPLIER 2.0f |
} | ||
|
||
void cancel_animation(void) { | ||
animation_since = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
animation_since = 0; | |
cancel_deferred_exec(animation_token); |
default: | ||
dx = 0; | ||
dy = 0; | ||
animation_since = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
animation_since = 0; | |
cancel_animation(); |
if (animation_since == 0) { | ||
// Animation has been cancelled. | ||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (animation_since == 0) { | |
// Animation has been cancelled. | |
return 0; | |
} |
// Little bit of overlap when using directional grid to further refine cursor | ||
// position. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please describe this value's usage a bit more:
// Little bit of overlap when using directional grid to further refine cursor | |
// position. | |
// Little bit of overlap when using directional grid to further refine cursor | |
// position. Lower values mean XXXXXXX, higher values mean YYYYYY. |
Also, bunch of build failures due to:
|
Add 2 modes of "grid-based" mouse cursor movement schemes:
Both of these pose as an absolute positiong digitizer.
Description
Complements mouse keys by allowing for moving the cursor to the right part of the screen rapidly.
I've only just implemented the alphabet-based method so I haven't tried to use that mode very much yet. But I have used the direction-based method lightly over the past weeks and in some cases I prefer it over reaching for an actual pointing device. So I think something like this could be pretty nice.
See the documentation for an overview of how to use this.
Types of Changes
Issues Fixed or Closed by This PR
Checklist