Skip to content

Extend events system, make mouse handling consistent#1928

Merged
natoscott merged 2 commits intohtop-dev:mainfrom
fasterit:extend-events-system-make-mouse-handling-consistent
Mar 27, 2026
Merged

Extend events system, make mouse handling consistent#1928
natoscott merged 2 commits intohtop-dev:mainfrom
fasterit:extend-events-system-make-mouse-handling-consistent

Conversation

@fasterit
Copy link
Copy Markdown
Member

Fixes: #1760
Improves over: #1783

Extends the events with a lost focus one and makes the screens, meters and columns editing handle that properly.
Since we have that consistent then, I spliced out the second commit to also make the function bar consistent between the meters and the screens setup. The meters one was a bit out-of-the-usual. The shortcuts (space to change meter mode ("style"), enter to accept, cursor keys to move) all still work.

When playing around in Setup for hours the UI inconsistency ... hurts ... so I fixed that quite early but I want to give you all the bikeshedding options 😄. Commit #1 builds fine separately.

Assisted-by: Microsoft Copilot/Claude Sonnet 4.6

Daniel Lange added 2 commits March 26, 2026 11:27
…d move explicitly across screens / meters / columns

* click selects, double click enters rename (screens) or move mode (elsewhere)
* clicking elsewhere finishes the current action via lost focus event

Fixes: htop-dev#1760
Improves over: htop-dev#1783
@BenBE BenBE added the enhancement Extension or improvement to existing feature label Mar 26, 2026
@BenBE BenBE added this to the 3.5.0 milestone Mar 26, 2026
Copy link
Copy Markdown
Member

@BenBE BenBE left a comment

Choose a reason for hiding this comment

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

LGTM.

@fasterit fasterit changed the title Extend events system make mouse handling consistent Extend events system, make mouse handling consistent Mar 26, 2026
@natoscott natoscott merged commit c36c9cb into htop-dev:main Mar 27, 2026
20 checks passed
Comment thread ColumnsPanel.c
free(this);
}

static void ColumnsPanel_cancelMoving(ColumnsPanel* this) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this function work only if this->moving is true?

I see a room to improve the quality of this code. Maybe I should file a PR for it. For example, moving the this->moving conditionals from the callers to here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not worth it imo. The "local" checks are unlikely to succeed and faster than unconditional function calls with all the stack magic and call/ret.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not worth it imo. The "local" checks are unlikely to succeed and faster than unconditional function calls with all the stack magic and call/ret.

I consider it's the compiler's job to move the this->moving flag check to outside the function for performance. My reason for putting it in the function is to make it safer (think of when a future developer calls the function without checking the state first). Also it's less redundancy in the source code level.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

... on the price of reduced readability. We both have good arguments but this is a matter of taste in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Extension or improvement to existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Screens not working

4 participants