Extend events system, make mouse handling consistent#1928
Conversation
…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
| free(this); | ||
| } | ||
|
|
||
| static void ColumnsPanel_cancelMoving(ColumnsPanel* this) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
... on the price of reduced readability. We both have good arguments but this is a matter of taste in the end.
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