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

bug/missing-docs: manual wgpu integration using iced-runtime not handling any keyboard/mouse events. #2445

Closed
2 tasks done
imgurbot12 opened this issue May 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@imgurbot12
Copy link

imgurbot12 commented May 19, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

Hello! I am attempting to implement a lockscreen for wayland using the ext-session-lock-v1 protocol.

Due to limitations of the protocol, the compositor assigns the program specially designated wayland surfaces to draw the UI on top of. Limitations in winit and other windowing solutions means i cannot wrap the existing surface in other libraries and am forced to implement my own rendering runtime myself. I've begun using iced_runtime and iced_wgpu together to handle drawing directly via wgpu. However, I've run into trouble when trying to pass keyboard & mouse events from wayland.

According to the existing documentation, I should be able to queue events via the program State.queue_events call.

After a lot of testing and logging whats happening, I've found that for some reason it seems like all of the events are being ignored. Here's a sample from the logs im collecting after the output of State.update

ignored events [Mouse(CursorMoved { position: Point { x: 912.7422, y: 522.5742 } }), Mouse(CursorMoved { position: Point { x: 912.7422, y: 523.5742 } }), Mouse(ButtonPressed(Right)), Mouse(CursorMoved { position: Point { x: 911.7422, y: 523.5742 } }), Mouse(CursorMoved { position: Point { x: 911.7422, y: 524.5742 } }), Mouse(CursorMoved { position: Point { x: 911.7422, y: 525.5742 } }), Mouse(CursorMoved { position: Point { x: 911.7422, y: 526.5742 } })]
ignored events [Mouse(CursorMoved { position: Point { x: 911.7422, y: 527.5742 } }), Mouse(CursorMoved { position: Point { x: 911.7422, y: 528.5742 } }), Mouse(CursorMoved { position: Point { x: 911.7422, y: 529.5742 } })]
ignored events [Mouse(ButtonPressed(Left))]
ignored events [Mouse(ButtonReleased(Left))]

I've referenced the existing integration example and even scanned through iced-winit to see if I could find any information or documentation that could help me resolve this issue.

For further reference, the entire iced integration and code for the implementation is available here. It's part of the larger codebase of this repo

I would greatly appreciate any support or recommendations if possible. Thank you!

What is the expected behavior?

keyboard and mouse events should be handled and processed by the iced's program runtime

Version

master

Operating System

Linux

Do you have any log output?

No response

@imgurbot12 imgurbot12 added the bug Something isn't working label May 19, 2024
@imgurbot12 imgurbot12 changed the title manual wgpu integration using iced-runtime not handling any keyboard/mouse events. bug/missing-docs: manual wgpu integration using iced-runtime not handling any keyboard/mouse events. May 19, 2024
@imgurbot12
Copy link
Author

imgurbot12 commented May 20, 2024

Oh my god, i figured it out after a total of a week trying to work this out.

APPARENTLY, deep nested in the bottom of the text-widget code. Events are ignored altogether if an on_input handler isn't set for the widget. I had assumed that regardless of whether something was being done with the input I would still be able to click on and type in the field object but apparently not. I'm unaware if this behavior is documented but it does not seem to be included in the TextWidget description in iced_widgets.

That would've nice to know as I assumed there was a major problem with the event-loop/processing rather than the widget just rejecting it for an unknown reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant