Skip to content

widgets: add onclick feature #736

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

Merged
merged 20 commits into from
May 5, 2025
Merged

widgets: add onclick feature #736

merged 20 commits into from
May 5, 2025

Conversation

PaideiaDilemma
Copy link
Collaborator

Picks up the contribution from @Memoraike (thanks :))
Implements #366.

Memoraike and others added 14 commits January 17, 2025 16:38
- renderer: move getOrCreateWidgetsFor method declaration to public section
- config: add onclick special config value to label
 - add CLICKABLE macro for onclick configuration
 - replace direct onclick assignment with CLICKABLE macro
 - ensure pointer is available before setting cursor shape
 - initialize cursor shape device if not already done
 - implement onHover method to manage widget hover states
 - update cursor shape based on hover status
 - ensure all outputs are redrawn after state changes
 - add setHover and isHovered methods to manage hover state
 - implement containsPoint method for hit testing
 - override getBoundingBox in CLabel for accurate positioning
 - add onHover method in CLabel to change cursor shape
 - invoke onHover method with current mouse location
 - add getBoundingBox method to calculate the widget's bounding box
 - implement onHover method to update cursor shape on hover
 - modify cursor shape setting to only apply when onclickCommand is not empty
 - Improve hover state tracking for widgets
 - reduce unnecessary redraw calls by tracking hover changes
 - remove redundant renderAllOutputs() call
@PaideiaDilemma
Copy link
Collaborator Author

Currently on-click is implemented for labels and onHover changes the cursor when on the input-field.

Do we want to implement the following things here already or in a future MR?

  • on-click for shape and image.
  • visual feedback for onClick (and maybe for onHover)

@JunaidQrysh
Copy link

Currently on-click is implemented for labels and onHover changes the cursor when on the input-field.

Do we want to implement the following things here already or in a future MR?

  • on-click for shape and image.
  • visual feedback for onClick (and maybe for onHover)

i think they should be implemented in this MR as they will unlock a lot more creative options

@rotmh
Copy link

rotmh commented Apr 10, 2025

I don't have any say here... :)

But in my opinion:

on-click for shape and image.

Should probably be implemented in this MR, because it's part of the same premise as on-click for labels, but:

visual feedback for onClick (and maybe for onHover)

I think should be a part of a separate MR, because it's seems like a separate feature.

@PaideiaDilemma
Copy link
Collaborator Author

PaideiaDilemma commented Apr 11, 2025

Added onclick for shape and image.

The input-field has no onclick cmd for now, we might want to use it to move the cursor within the input field in the future.

Then i noticed it triggers onclick for widgets on different monitors than my cursor is on. (I have two 1080p monitors and a single shape widget would trigger the onclick command twice)
I implemented handling for the enter and leave events of wl_pointer to localize onclick and hover to the currently focused output and fixed up the positions a bit.

@PaideiaDilemma PaideiaDilemma deleted the onclick branch April 11, 2025 10:09
@PaideiaDilemma
Copy link
Collaborator Author

ups, sorry. didn't mean to delete the branch

@PaideiaDilemma PaideiaDilemma requested a review from vaxerski April 11, 2025 10:31
@JunaidQrysh
Copy link

@PaideiaDilemma can you please add visual feedback when cursor is on a label or image; i have setup reboot icon
it would be good if it says "Reboot" when the cursor is on that icon.

@PaideiaDilemma
Copy link
Collaborator Author

@JunaidQrysh yeah i want that as well but not in this PR. We can add it later

@PaideiaDilemma PaideiaDilemma requested a review from vaxerski April 25, 2025 13:12
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

at your discretion

@PaideiaDilemma PaideiaDilemma merged commit e3bd47e into main May 5, 2025
2 checks passed
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.

6 participants