mouse clicks on keypad buttons don't get highlighted
Opened this issue · 1 comments
fokoid commented
- the keypad window keys are supposed to highlight when the relevant input is being triggered
- this works for actual keyboard input
- it does not currently work for mouseclicks on the buttons
- this is due to the way immediate mode works
- in particular, we don't know if the button is clicked until after we draw it so the highlighting decision is based on state from previous frame
- however, the key press state is reset at the start of each frame based on the keyboard
- thus clicks never get a chance to cause highlighting
- they do get detected correctly as key inputs to the VM, though
fokoid commented
a few ideas to fix
- keep separate state inside the keypad window to track the button click status and keep this in sync somehow with the key capture state (ugly)
- create our own keypad widget (harder but nicer solution). widget would do the following in order:
- allocates the entire rect
- detects mouse down and maps to the correct key based on pointer coordinates
- finally draws the visuals including the highlight based on the current frame