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

add properties for back/forward mouse buttons to button and eventbox #346

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

end-4
Copy link
Contributor

@end-4 end-4 commented Mar 11, 2024

For mice with side buttons

  • Adds the following props to Widget.Button and Widget.EventBox

    • on-back-click
    • on-forward-click
    • on-back-click-release
    • on-forward-click-release
  • Note: There doesn't seem to be Gdk consts for values 8 and 9 so I declared consts for them. Hopefully that's alright

for mice with side buttons
@Aylur
Copy link
Owner

Aylur commented Mar 17, 2024

I am kind of hesitant to add this, this makes sense based on the pattern I followed, but maybe we should make on_clicked the only property and make it more generic?

@end-4
Copy link
Contributor Author

end-4 commented Mar 18, 2024

I guess. Someone in discord told me about mice with 12 side buttons lol
Though no one likes breaking changes...

@NicolaiVdS
Copy link
Contributor

What imo would make sense is adding a on-middle-click and on-middle-click-release

@end-4
Copy link
Contributor Author

end-4 commented Mar 18, 2024

What imo would make sense is adding a on-middle-click and on-middle-click-release

what
https://aylur.github.io/ags-docs/config/widgets/#button

@NicolaiVdS
Copy link
Contributor

What imo would make sense is adding a on-middle-click and on-middle-click-release

what https://aylur.github.io/ags-docs/config/widgets/#button

ok nevermind looked over it

@end-4
Copy link
Contributor Author

end-4 commented Mar 18, 2024

maybe we should make on_clicked the only property and make it more generic?

  • I realized on_clicked is already a thing currently, so I suggest the name on_mouse_button
  • A more generic prop would probably make ags' code cleaner, but would that make it less convenient for users? I'm not sure since I don't know a lot of Js.

@Aylur
Copy link
Owner

Aylur commented Mar 21, 2024

the most convenient is probably adding this as it is
I'm thinking about something like

type State = "clicked" | "released"
type Button = "primary" | "secondary" | "middle" | "back" | "forward"

Button({
  onMouseButton(self, opts: { event: Gdk.Event, state: State, button: Button }) {
    if (state === "clicked" && button === "primary") {
      // onPrimaryClickRelease
    }
  }
})

but the issue with this is that it would require bloat to check for the clicked state, when usually only the clicked state is desired
so maybe on-mouse-button and on-mouse-button-released?

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.

None yet

3 participants