diff --git a/examples/virtual_methods/base_button/mod.rs b/examples/virtual_methods/base_button/mod.rs index 75cbf279260b..afb76398665a 100644 --- a/examples/virtual_methods/base_button/mod.rs +++ b/examples/virtual_methods/base_button/mod.rs @@ -63,6 +63,8 @@ impl> BaseButtonExt for O {} pub trait BaseButtonImpl: ButtonImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { /// Default implementation of a virtual method. /// @@ -91,6 +93,8 @@ where pub trait BaseButtonImplExt: BaseButtonImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { /// Retrieves the parent class' implementation of the virtual method and /// calls it. @@ -113,12 +117,20 @@ where } } -impl BaseButtonImplExt for T where ::Type: IsA {} +impl BaseButtonImplExt for T +where + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, +{ +} /// This allows to implement subclasses of `BaseButton`. unsafe impl IsSubclassable for BaseButton where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { /// Called whenever the class of a `BaseButton` subclass is initialized, /// i.e. usually right before the first instance of it is created. diff --git a/gdk4/src/subclass/content_provider.rs b/gdk4/src/subclass/content_provider.rs index 114ecad20e59..1886d1e85e30 100644 --- a/gdk4/src/subclass/content_provider.rs +++ b/gdk4/src/subclass/content_provider.rs @@ -12,6 +12,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, Clipboard, ContentFormats, Co pub trait ContentProviderImpl: ObjectImpl where ::Type: IsA, + ::Type: IsA, { fn content_changed(&self) { self.parent_content_changed() @@ -50,6 +51,7 @@ where pub trait ContentProviderImplExt: ContentProviderImpl where ::Type: IsA, + ::Type: IsA, { fn parent_content_changed(&self) { unsafe { @@ -261,14 +263,17 @@ where } } -impl ContentProviderImplExt for T where - ::Type: IsA +impl ContentProviderImplExt for T +where + ::Type: IsA, + ::Type: IsA, { } unsafe impl IsSubclassable for ContentProvider where ::Type: IsA, + ::Type: IsA, { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); @@ -289,6 +294,7 @@ unsafe extern "C" fn content_provider_content_changed( ptr: *mut ffi::GdkContentProvider, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -301,6 +307,7 @@ unsafe extern "C" fn content_provider_attach_clipboard( clipboard_ptr: *mut ffi::GdkClipboard, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -314,6 +321,7 @@ unsafe extern "C" fn content_provider_detach_clipboard( clipboard_ptr: *mut ffi::GdkClipboard, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -327,6 +335,7 @@ unsafe extern "C" fn content_provider_formats( ) -> *mut ffi::GdkContentFormats where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -339,6 +348,7 @@ unsafe extern "C" fn content_provider_storable_formats( ) -> *mut ffi::GdkContentFormats where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -356,6 +366,7 @@ unsafe extern "C" fn content_provider_write_mime_type_async::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -418,6 +429,7 @@ unsafe extern "C" fn content_provider_get_value( ) -> glib::ffi::gboolean where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); diff --git a/gdk4/src/subclass/paintable.rs b/gdk4/src/subclass/paintable.rs index 7a447cbb9391..98d2aeb896d3 100644 --- a/gdk4/src/subclass/paintable.rs +++ b/gdk4/src/subclass/paintable.rs @@ -11,6 +11,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, Paintable, PaintableFlags, Sn pub trait PaintableImpl: ObjectImpl where ::Type: IsA, + ::Type: IsA, { #[doc(alias = "get_current_image")] fn current_image(&self) -> Paintable { @@ -43,6 +44,7 @@ where pub trait PaintableImplExt: PaintableImpl where ::Type: IsA, + ::Type: IsA, { fn parent_current_image(&self) -> Paintable { unsafe { @@ -132,11 +134,17 @@ where } } -impl PaintableImplExt for T where ::Type: IsA {} +impl PaintableImplExt for T +where + ::Type: IsA, + ::Type: IsA, +{ +} unsafe impl IsImplementable for Paintable where ::Type: IsA, + ::Type: IsA, { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); @@ -155,6 +163,7 @@ unsafe extern "C" fn paintable_get_current_image( ) -> *mut ffi::GdkPaintable where ::Type: IsA, + ::Type: IsA, { let instance = &*(paintable as *mut T::Instance); let imp = instance.imp(); @@ -167,6 +176,7 @@ unsafe extern "C" fn paintable_get_flags( ) -> ffi::GdkPaintableFlags where ::Type: IsA, + ::Type: IsA, { let instance = &*(paintable as *mut T::Instance); let imp = instance.imp(); @@ -179,6 +189,7 @@ unsafe extern "C" fn paintable_get_intrinsic_width( ) -> i32 where ::Type: IsA, + ::Type: IsA, { let instance = &*(paintable as *mut T::Instance); let imp = instance.imp(); @@ -191,6 +202,7 @@ unsafe extern "C" fn paintable_get_intrinsic_height( ) -> i32 where ::Type: IsA, + ::Type: IsA, { let instance = &*(paintable as *mut T::Instance); let imp = instance.imp(); @@ -203,6 +215,7 @@ unsafe extern "C" fn paintable_get_intrinsic_aspect_ratio( ) -> f64 where ::Type: IsA, + ::Type: IsA, { let instance = &*(paintable as *mut T::Instance); let imp = instance.imp(); @@ -217,6 +230,7 @@ unsafe extern "C" fn paintable_snapshot( height: f64, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(paintable as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/accessible.rs b/gtk4/src/subclass/accessible.rs index 80c3eb920a2c..cd8e98e7ac0b 100644 --- a/gtk4/src/subclass/accessible.rs +++ b/gtk4/src/subclass/accessible.rs @@ -15,6 +15,7 @@ use crate::{ pub trait AccessibleImpl: ObjectImpl where ::Type: IsA, + ::Type: IsA, { #[doc(alias = "get_platform_state")] fn platform_state(&self, state: AccessiblePlatformState) -> bool { @@ -50,6 +51,7 @@ where pub trait AccessibleImplExt: AccessibleImpl where ::Type: IsA, + ::Type: IsA, { fn parent_platform_state(&self, state: AccessiblePlatformState) -> bool { unsafe { @@ -167,11 +169,17 @@ where } } -impl AccessibleImplExt for T where ::Type: IsA {} +impl AccessibleImplExt for T +where + ::Type: IsA, + ::Type: IsA, +{ +} unsafe impl IsImplementable for Accessible where ::Type: IsA, + ::Type: IsA, { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); @@ -191,6 +199,7 @@ unsafe extern "C" fn accessible_get_platform_state( ) -> glib::ffi::gboolean where ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible as *mut T::Instance); let imp = instance.imp(); @@ -207,6 +216,7 @@ unsafe extern "C" fn accessible_get_bounds( ) -> glib::ffi::gboolean where ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible as *mut T::Instance); let imp = instance.imp(); @@ -228,6 +238,7 @@ unsafe extern "C" fn accessible_get_at_context( ) -> *mut ffi::GtkATContext where ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible as *mut T::Instance); let imp = instance.imp(); @@ -240,6 +251,7 @@ unsafe extern "C" fn accessible_get_accessible_parent( ) -> *mut ffi::GtkAccessible where ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible as *mut T::Instance); let imp = instance.imp(); @@ -252,6 +264,7 @@ unsafe extern "C" fn accessible_get_first_accessible_child( ) -> *mut ffi::GtkAccessible where ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible as *mut T::Instance); let imp = instance.imp(); @@ -264,6 +277,7 @@ unsafe extern "C" fn accessible_get_next_accessible_sibling( ) -> *mut ffi::GtkAccessible where ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/accessible_range.rs b/gtk4/src/subclass/accessible_range.rs index cdf190cf4bf9..59d52b5e7097 100644 --- a/gtk4/src/subclass/accessible_range.rs +++ b/gtk4/src/subclass/accessible_range.rs @@ -6,11 +6,13 @@ use glib::translate::*; -use crate::{ffi, prelude::*, subclass::prelude::*, AccessibleRange}; +use crate::{ffi, prelude::*, subclass::prelude::*, AccessibleRange, Widget}; pub trait AccessibleRangeImpl: WidgetImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { fn set_current_value(&self, value: f64) -> bool { self.parent_set_current_value(value) @@ -20,6 +22,8 @@ where pub trait AccessibleRangeImplExt: AccessibleRangeImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { // Returns true if the operation was performed, false otherwise fn parent_set_current_value(&self, value: f64) -> bool { @@ -43,14 +47,19 @@ where } } -impl AccessibleRangeImplExt for T where - ::Type: IsA +impl AccessibleRangeImplExt for T +where + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } unsafe impl IsImplementable for AccessibleRange where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); @@ -65,6 +74,8 @@ unsafe extern "C" fn accessible_range_set_current_value( ) -> glib::ffi::gboolean where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { let instance = &*(accessible_range as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/actionable.rs b/gtk4/src/subclass/actionable.rs index 448936960b14..213e791f252c 100644 --- a/gtk4/src/subclass/actionable.rs +++ b/gtk4/src/subclass/actionable.rs @@ -6,11 +6,13 @@ use glib::{translate::*, GString, Variant}; -use crate::{ffi, prelude::*, subclass::prelude::*, Actionable}; +use crate::{ffi, prelude::*, subclass::prelude::*, Actionable, Widget}; pub trait ActionableImpl: WidgetImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { #[doc(alias = "get_action_name")] fn action_name(&self) -> Option; @@ -23,6 +25,8 @@ where pub trait ActionableImplExt: ActionableImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { fn parent_action_name(&self) -> Option { unsafe { @@ -91,11 +95,19 @@ where } } -impl ActionableImplExt for T where ::Type: IsA {} +impl ActionableImplExt for T +where + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, +{ +} unsafe impl IsImplementable for Actionable where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); @@ -112,6 +124,8 @@ unsafe extern "C" fn actionable_get_action_name( ) -> *const libc::c_char where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { let instance = &*(actionable as *mut T::Instance); let imp = instance.imp(); @@ -124,6 +138,8 @@ unsafe extern "C" fn actionable_get_action_target_value( ) -> *mut glib::ffi::GVariant where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { let instance = &*(actionable as *mut T::Instance); let imp = instance.imp(); @@ -136,6 +152,8 @@ unsafe extern "C" fn actionable_set_action_name( name: *const libc::c_char, ) where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { let instance = &*(actionable as *mut T::Instance); let imp = instance.imp(); @@ -148,6 +166,8 @@ unsafe extern "C" fn actionable_set_action_target_value( value: *mut glib::ffi::GVariant, ) where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { let instance = &*(actionable as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/adjustment.rs b/gtk4/src/subclass/adjustment.rs index a7f218969371..48ba7d7c83aa 100644 --- a/gtk4/src/subclass/adjustment.rs +++ b/gtk4/src/subclass/adjustment.rs @@ -10,6 +10,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, Adjustment}; pub trait AdjustmentImpl: ObjectImpl where ::Type: IsA, + ::Type: IsA, { fn changed(&self) { self.parent_changed() @@ -23,6 +24,7 @@ where pub trait AdjustmentImplExt: AdjustmentImpl where ::Type: IsA, + ::Type: IsA, { fn parent_changed(&self) { unsafe { @@ -45,11 +47,17 @@ where } } -impl AdjustmentImplExt for T where ::Type: IsA {} +impl AdjustmentImplExt for T +where + ::Type: IsA, + ::Type: IsA, +{ +} unsafe impl IsSubclassable for Adjustment where ::Type: IsA, + ::Type: IsA, { fn class_init(class: &mut glib::Class) { Self::parent_class_init::(class); @@ -65,6 +73,7 @@ where unsafe extern "C" fn adjustment_changed(ptr: *mut ffi::GtkAdjustment) where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -75,6 +84,7 @@ where unsafe extern "C" fn adjustment_value_changed(ptr: *mut ffi::GtkAdjustment) where ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/application.rs b/gtk4/src/subclass/application.rs index 841b2745195d..0c9e0b7d75c6 100644 --- a/gtk4/src/subclass/application.rs +++ b/gtk4/src/subclass/application.rs @@ -11,6 +11,7 @@ pub trait GtkApplicationImpl: ApplicationImpl + ObjectImpl where ::Type: IsA, ::Type: IsA, + ::Type: IsA, { fn window_added(&self, window: &Window) { self.parent_window_added(window) @@ -25,6 +26,7 @@ pub trait GtkApplicationImplExt: GtkApplicationImpl where ::Type: IsA, ::Type: IsA, + ::Type: IsA, { fn parent_window_added(&self, window: &Window) { unsafe { @@ -57,6 +59,7 @@ impl GtkApplicationImplExt for T where ::Type: IsA, ::Type: IsA, + ::Type: IsA, { } @@ -64,6 +67,7 @@ unsafe impl IsSubclassable for Application where ::Type: IsA, ::Type: IsA, + ::Type: IsA, { fn class_init(class: &mut ::glib::Class) { // Override the original `GtkApplication` startup implementation so that @@ -118,6 +122,7 @@ unsafe extern "C" fn application_window_added( ) where ::Type: IsA, ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); @@ -131,6 +136,7 @@ unsafe extern "C" fn application_window_removed( ) where ::Type: IsA, ::Type: IsA, + ::Type: IsA, { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/application_window.rs b/gtk4/src/subclass/application_window.rs index ba58c37261f7..ba880b7edfae 100644 --- a/gtk4/src/subclass/application_window.rs +++ b/gtk4/src/subclass/application_window.rs @@ -4,15 +4,22 @@ //! Traits intended for subclassing //! [`ApplicationWindow`](crate::ApplicationWindow). -use crate::{prelude::*, subclass::prelude::*, ApplicationWindow}; +use crate::{prelude::*, subclass::prelude::*, ApplicationWindow, Widget, Window}; pub trait ApplicationWindowImpl: WindowImpl + 'static where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } -unsafe impl IsSubclassable for ApplicationWindow where - ::Type: IsA +unsafe impl IsSubclassable for ApplicationWindow +where + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } diff --git a/gtk4/src/subclass/box_.rs b/gtk4/src/subclass/box_.rs index 9d23a22ee9fe..6b9bdf44f837 100644 --- a/gtk4/src/subclass/box_.rs +++ b/gtk4/src/subclass/box_.rs @@ -3,15 +3,20 @@ // rustdoc-stripper-ignore-next //! Traits intended for subclassing [`Box`](crate::Box). -use crate::{prelude::*, subclass::prelude::*, Box}; +use crate::{prelude::*, subclass::prelude::*, Box, Widget}; pub trait BoxImpl: WidgetImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } -unsafe impl IsSubclassable for Box where - ::Type: IsA +unsafe impl IsSubclassable for Box +where + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } diff --git a/gtk4/src/subclass/buildable.rs b/gtk4/src/subclass/buildable.rs index 86a4ee419ccc..01918dc97a44 100644 --- a/gtk4/src/subclass/buildable.rs +++ b/gtk4/src/subclass/buildable.rs @@ -13,6 +13,7 @@ use crate::{ffi, prelude::*, subclass::prelude::*, Buildable, Builder}; pub trait BuildableImpl: ObjectImpl where ::Type: IsA, + ::Type: IsA, { fn set_id(&self, id: &str) { self.parent_set_id(id) @@ -65,6 +66,7 @@ where pub trait BuildableImplExt: BuildableImpl where ::Type: IsA, + ::Type: IsA, { fn parent_set_id(&self, id: &str) { unsafe { @@ -191,11 +193,17 @@ where } } -impl BuildableImplExt for T where ::Type: IsA {} +impl BuildableImplExt for T +where + ::Type: IsA, + ::Type: IsA, +{ +} unsafe impl IsImplementable for Buildable where ::Type: IsA, + ::Type: IsA, { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); @@ -219,6 +227,7 @@ unsafe extern "C" fn buildable_set_id( id: *const libc::c_char, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); @@ -232,6 +241,7 @@ unsafe extern "C" fn buildable_get_id( ) -> *const libc::c_char where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); @@ -246,6 +256,7 @@ unsafe extern "C" fn buildable_add_child( typeptr: *const libc::c_char, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); @@ -265,6 +276,7 @@ unsafe extern "C" fn buildable_set_buildable_property( valueptr: *const glib::gobject_ffi::GValue, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); @@ -284,6 +296,7 @@ unsafe extern "C" fn buildable_construct_child( ) -> *mut glib::gobject_ffi::GObject where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); @@ -298,6 +311,7 @@ unsafe extern "C" fn buildable_parser_finished( builderptr: *mut ffi::GtkBuilder, ) where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); @@ -312,6 +326,7 @@ unsafe extern "C" fn buildable_get_internal_child( ) -> *mut glib::gobject_ffi::GObject where ::Type: IsA, + ::Type: IsA, { let instance = &*(buildable as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/builder_scope.rs b/gtk4/src/subclass/builder_scope.rs index 85ab235f40bc..09dfb7bfff52 100644 --- a/gtk4/src/subclass/builder_scope.rs +++ b/gtk4/src/subclass/builder_scope.rs @@ -14,17 +14,23 @@ use crate::{ pub trait BuilderCScopeImpl: BuilderScopeImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } -unsafe impl IsSubclassable for BuilderCScope where - ::Type: IsA +unsafe impl IsSubclassable for BuilderCScope +where + ::Type: IsA, + ::Type: IsA, + ::Type: IsA, { } pub trait BuilderScopeImpl: ObjectImpl where ::Type: IsA, + ::Type: IsA, { #[doc(alias = "get_type_from_name")] fn type_from_name(&self, builder: &Builder, type_name: &str) -> glib::Type { @@ -48,6 +54,7 @@ where pub trait BuilderScopeImplExt: BuilderScopeImpl where ::Type: IsA, + ::Type: IsA, { fn parent_type_from_name(&self, builder: &Builder, type_name: &str) -> glib::Type { unsafe { @@ -128,14 +135,17 @@ where } } -impl BuilderScopeImplExt for T where - ::Type: IsA +impl BuilderScopeImplExt for T +where + ::Type: IsA, + ::Type: IsA, { } unsafe impl IsImplementable for BuilderScope where ::Type: IsA, + ::Type: IsA, { fn interface_init(iface: &mut glib::Interface) { let iface = iface.as_mut(); @@ -155,6 +165,7 @@ unsafe extern "C" fn builder_scope_get_type_from_name( ) -> glib::ffi::GType where ::Type: IsA, + ::Type: IsA, { let instance = &*(builder_scope as *mut T::Instance); let imp = instance.imp(); @@ -171,6 +182,7 @@ unsafe extern "C" fn builder_scope_get_type_from_function( ) -> glib::ffi::GType where ::Type: IsA, + ::Type: IsA, { let instance = &*(builder_scope as *mut T::Instance); let imp = instance.imp(); @@ -190,6 +202,7 @@ unsafe extern "C" fn builder_scope_create_closure( ) -> *mut glib::gobject_ffi::GClosure where ::Type: IsA, + ::Type: IsA, { let instance = &*(builder_scope as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/button.rs b/gtk4/src/subclass/button.rs index 53f0a082eda1..4f2b9e8fd4c5 100644 --- a/gtk4/src/subclass/button.rs +++ b/gtk4/src/subclass/button.rs @@ -5,11 +5,13 @@ use glib::translate::*; -use crate::{ffi, prelude::*, subclass::prelude::*, Button}; +use crate::{ffi, prelude::*, subclass::prelude::*, Button, Widget}; pub trait ButtonImpl: WidgetImpl where ::Type: IsA, + ::Type: IsA, + ::Type: IsA