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

[WIP] Touch support #143

Draft
wants to merge 3 commits into
base: wayland
Choose a base branch
from
Draft

[WIP] Touch support #143

wants to merge 3 commits into from

Conversation

chayleaf
Copy link

@chayleaf chayleaf commented Aug 24, 2024

See #122

This implements touch support in the following way:

  • Holding the screen and moving your finger up/down scrolls down/up. Scroll speed is hardcoded, and the mouse position is set to the initial tap position.
  • A short tap emulates a return button press.
  • A long tap that didn't move far enough to scroll emulates an escape button press (ideally, -click-to-exit would work, then this would be unnecessary)
    This is obviously not ideal, so I'd like some feedback on how a proper implementation should look like

Maybe programmable gesture support should be added? this would be useful for e.g. mode switching. I have no idea how the config for that should look though.

Copy link
Owner

@lbonn lbonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot really test this right now but it seems fine to have it merged as a first iteration :)

Thanks!

@@ -526,6 +526,100 @@ static const struct wl_keyboard_listener wayland_keyboard_listener = {
.repeat_info = wayland_keyboard_repeat_info,
};

static void wayland_touch_down(void *data, struct wl_touch *wl_touch,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is a bit inconsistent with the rest of the file.

Could you please run clang-format on the lines you've added?

return;
}
int key = KEY_ENTER;
if (time - self->touches[id].start_time > 200) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe define this 200 as a constant with a proper name at the top of this function?

}

static int32_t y_offset_to_line_offset(int32_t y_offset) {
static const int32_t line_height = 20;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this "20" is some kind of hard-coded sensitivity?

It is fine for now but maybe add a TODO comment like "TODO: make sensitivity parametrizable"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants