Skip to content

mouse handler and collect + store section areas for click locations#129

Draft
otomist wants to merge 1 commit intopythops:masterfrom
otomist:mouse-clicks-help-section
Draft

mouse handler and collect + store section areas for click locations#129
otomist wants to merge 1 commit intopythops:masterfrom
otomist:mouse-clicks-help-section

Conversation

@otomist
Copy link

@otomist otomist commented Feb 27, 2026

This PR is to add mouse down event handling so users can click and connect to Bluetooth keyboards when they don't have a wired option available for the keyboard.

Currently in draft mode because I wanted to get approval on the basic logic before making all the changes for different screen sizes.

fixes: #100

let row = mouse_event.row;

if let Some(bounds) = app.adapter_block_bounds {
if col >= bounds.x
Copy link
Author

Choose a reason for hiding this comment

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

These checks for location happen multiple times in this function. I can probably make this a bit more DRY to reduce number of changes.

use crossterm::event::{MouseButton, MouseEventKind};

match mouse_event.kind {
MouseEventKind::Down(MouseButton::Left) => {
Copy link
Author

Choose a reason for hiding this comment

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

In the name of small PRs and changes I'm only going to add mouse down in this PR but I can get double clicking, right clicking, and scroll working later.


fn to_section(&self, y: u16) -> HelpSection {
HelpSection {
label: self.label().trim().to_string(),
Copy link
Author

Choose a reason for hiding this comment

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

Label is mostly used for debug I can prob remove it when I implement the calls to the help button functions.

section_indexes.push((nav_item, 0));

vec![Line::from(all_spans)]
} else {
Copy link
Author

Choose a reason for hiding this comment

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

If this code looks ok to you I'll go ahead and add the rest of the cases for screen sizes. @pythops

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.

Missing mouse support prevents connecting when keyboard is pairing

1 participant