In a Rust GTK4 application, an event handler needs to send a message to its root, which is a subclass of ApplicationWindow. I can get the root in the handler by "button.property("root").unwrap(), but what I get is a Widget:
Some(
Widget {
inner: TypedObjectRef {
inner: 0x00007f91c808a820,
type: Controller,
},
},
)
The subclass is a Controller, so this is the object I want - but the system sees it as a Widget. Is it possible to cast this as a Controller to access the method I need? Currently I'm accessing the Controller as a static object, but I'd like to get rid of my statics and use the reference available in the data structures. I've looked into upcasting and maybe forcing something with unsafe, but I'm hoping there is a right way to do this.