Closed
Conversation
tmccombs
suggested changes
Sep 5, 2025
Contributor
tmccombs
left a comment
There was a problem hiding this comment.
I left a few comments, but this PR also makes a lot of changes. Could it be split up into smaller pull requests so the changes could be reviewed in isolation?
| switch (key_state) { | ||
| case WL_KEYBOARD_KEY_STATE_PRESSED: | ||
| switch (keysym) { | ||
| case XKB_KEY_Return: |
| int key_size; | ||
| key_size = xkb_state_key_get_utf8(seat->xkb_state, key + 8, NULL, 0) + 1; | ||
| if (key_size) { | ||
| pressed_key = (char *) malloc(key_size * sizeof(char)); |
Contributor
There was a problem hiding this comment.
Could we avoid allocating every time a key is pressed?
Couldn't we just use a char[1], since the only keyboard selectors we allow are single ascii characters, and should thus fit in a single byte? If the result doesn't fit in a single byte, then it isn't a key we care about.
| #define FONT_SIZE 14 | ||
| #define FONT_COLOR 0xFFFFFFFF | ||
| #define CHOICE_FONT_COLOR 0xFCBA03FF | ||
| #define KEYBOAD_SELECTORS "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
Contributor
There was a problem hiding this comment.
Suggested change
| #define KEYBOAD_SELECTORS "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
| #define KEYBOARD_SELECTORS "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to make a selection via keyboard and added this functionality. I also added some more options like:
-L): The font-color used for writing the labels and dimensions.-S): The font-color which is used when an area is selected.-m): Splits the outputs or the given restricted areas in rows/columns.-l): Shows the label. The user can press a key and it will select the first match.-g): You can change the font size with this.-x): Used code from Crosshairs #95-X): You can set the crosshair color with this.This is an example how we could make use of this:
And this is how I make use of this (first select the x, y coords and then use swaymsg to click it...like..what if someday the mouse is broken?)
foo.mp4