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] the trait ObjectType is not implemented for Event #737

Closed
jangernert opened this issue Nov 28, 2021 · 3 comments
Closed

[BUG] the trait ObjectType is not implemented for Event #737

jangernert opened this issue Nov 28, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@jangernert
Copy link

jangernert commented Nov 28, 2021

Bug description

The webkit2gtk5-rs bindings contain IsA<gdk::Event> which fails to build with the message

error[E0277]: the trait bound `Event: ObjectType` is not satisfied
  --> webkit2gtk/src/auto/input_method_context.rs:32:49
   |
32 |     fn filter_key_event(&self, key_event: &impl IsA<gdk::Event>) -> bool;
   |                                                 ^^^^^^^^^^^^^^^ the trait `ObjectType` is not implemented for `Event`
   |
note: required by a bound in `IsA`
  --> /home/jeanluc/.cargo/git/checkouts/gtk-rs-core-7be42ca38bd6361c/1728bcb/glib/src/object.rs:85:25
   |
85 | pub unsafe trait IsA<T: ObjectType>: ObjectType + AsRef<T> + 'static {}
   |                         ^^^^^^^^^^ required by this bound in `IsA`

error[E0277]: the trait bound `Event: ObjectType` is not satisfied
   --> webkit2gtk/src/auto/input_method_context.rs:116:49
    |
116 |     fn filter_key_event(&self, key_event: &impl IsA<gdk::Event>) -> bool {
    |                                                 ^^^^^^^^^^^^^^^ the trait `ObjectType` is not implemented for `Event`
    |
note: required by a bound in `IsA`
   --> /home/jeanluc/.cargo/git/checkouts/gtk-rs-core-7be42ca38bd6361c/1728bcb/glib/src/object.rs:85:25
    |
85  | pub unsafe trait IsA<T: ObjectType>: ObjectType + AsRef<T> + 'static {}
    |                         ^^^^^^^^^^ required by this bound in `IsA`

I'm not entirely sure if this is an issue with the webkit bindings or gtk4-rs.

@jangernert jangernert added the bug Something isn't working label Nov 28, 2021
@bilelmoussaoui
Copy link
Member

That's not an issue, gdk::Event is not an object. Gir generates a IsA relation which is not possible, instead you should manually override the methods for now and use AsRef<gdk::Event>

@bilelmoussaoui
Copy link
Member

See gtk-rs/gir#1069 for the gir issue

@jangernert
Copy link
Author

Thanks for the info

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

2 participants