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

Fix consume status of mouse events in custom capture #967

Closed
wants to merge 1 commit into from

Conversation

GiGurra
Copy link

@GiGurra GiGurra commented Apr 19, 2024

At present, it is not possible to consume events in the mouse event capture function, even if you return nil. This causes (among other things) Application.draw() to not fire properly, and essentially, means that any gui state changes you make inside the capture function, isn't rendered.

This PR hopefully fixes that. I couldn't find any tests to modify/change, do you need any other info?

The following code (from the Application event loop) shows where the draw call would be skipped when the wrong consume status is returned

case *tcell.EventMouse:
	consumed, isMouseDownAction := a.fireMouseActions(event)
	if consumed {
		a.draw()
	}
	a.lastMouseButtons = event.Buttons()
	if isMouseDownAction {
		a.mouseDownX, a.mouseDownY = event.Position()
	}

@GiGurra GiGurra changed the title Consume mouse events in custom capture Fix consume status of mouse events in custom capture Apr 19, 2024
@rivo rivo closed this in 0ac5f73 May 19, 2024
@rivo
Copy link
Owner

rivo commented May 19, 2024

See #972 (comment) for details.

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

2 participants