Repository: gtk-rs/gtk3-rs (language: rust)

Issue:
Update to wayland-client 0.30
CC @GuillaumeGomez 


Discussion / hints:

Fix patch:
diff --git a/atk/src/auto/versions.txt b/atk/src/auto/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/atk/src/auto/versions.txt
+++ b/atk/src/auto/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/atk/sys/versions.txt b/atk/sys/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/atk/sys/versions.txt
+++ b/atk/sys/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/gdk/Gir.toml b/gdk/Gir.toml
index 7e95d010fb8f..166f6ee08c44 100644
--- a/gdk/Gir.toml
+++ b/gdk/Gir.toml
@@ -40,13 +40,11 @@ generate = [
     "Gdk.InputSource",
     "Gdk.ModifierIntent",
     "Gdk.ModifierType",
-    "Gdk.Monitor",
     "Gdk.NotifyType",
     "Gdk.OwnerChange",
     "Gdk.PropertyState",
     "Gdk.PropMode",
     "Gdk.ScrollDirection",
-    "Gdk.Seat",
     "Gdk.SeatCapabilities",
     "Gdk.SettingAction",
     "Gdk.SubpixelLayout",
@@ -240,6 +238,8 @@ status = "generate"
 [[object]]
 name = "Gdk.Device"
 status = "generate"
+final_type = false
+manual_traits = ["DeviceExtManual"]
     [[object.function]]
     name = "get_display"
         [object.function.return]
@@ -368,6 +368,11 @@ status = "generate"
     name = "lookup_key"
     manual = true
 
+[[object]]
+name = "Gdk.Monitor"
+status = "generate"
+final_type = false
+
 [[object]]
 name = "Gdk.Rectangle"
 status = "generate"
@@ -421,6 +426,11 @@ status = "generate"
     # the actual method getter after auto-renaming.
     rename = "screen_width_mm"
 
+[[object]]
+name = "Gdk.Seat"
+status = "generate"
+final_type = false
+
 [[object]]
 name = "Gdk.Visual"
 status = "generate"
diff --git a/gdk/src/auto/device.rs b/gdk/src/auto/device.rs
index ec15bfb7095b..f5ebe6791a43 100644
--- a/gdk/src/auto/device.rs
+++ b/gdk/src/auto/device.rs
@@ -23,63 +23,227 @@ glib::wrapper! {
 }
 
 impl Device {
+    pub const NONE: Option<&'static Device> = None;
+}
+
+pub trait DeviceExt: 'static {
     #[doc(alias = "gdk_device_get_associated_device")]
     #[doc(alias = "get_associated_device")]
     #[must_use]
-    pub fn associated_device(&self) -> Option<Device> {
-        unsafe { from_glib_none(ffi::gdk_device_get_associated_device(self.to_glib_none().0)) }
-    }
+    fn associated_device(&self) -> Option<Device>;
 
     #[doc(alias = "gdk_device_get_axes")]
     #[doc(alias = "get_axes")]
-    pub fn axes(&self) -> AxisFlags {
-        unsafe { from_glib(ffi::gdk_device_get_axes(self.to_glib_none().0)) }
-    }
+    fn axes(&self) -> AxisFlags;
 
     //#[doc(alias = "gdk_device_get_axis")]
     //#[doc(alias = "get_axis")]
-    //pub fn axis(&self, axes: &[f64], use_: AxisUse) -> Option<f64> {
-    //    unsafe { TODO: call ffi:gdk_device_get_axis() }
-    //}
+    //fn axis(&self, axes: &[f64], use_: AxisUse) -> Option<f64>;
 
     #[doc(alias = "gdk_device_get_axis_use")]
     #[doc(alias = "get_axis_use")]
-    pub fn axis_use(&self, index_: u32) -> AxisUse {
-        unsafe { from_glib(ffi::gdk_device_get_axis_use(self.to_glib_none().0, index_)) }
-    }
+    fn axis_use(&self, index_: u32) -> AxisUse;
 
     //#[doc(alias = "gdk_device_get_axis_value")]
     //#[doc(alias = "get_axis_value")]
-    //pub fn axis_value(&self, axes: &[f64], axis_label: &Atom) -> Option<f64> {
-    //    unsafe { TODO: call ffi:gdk_device_get_axis_value() }
-    //}
+    //fn axis_value(&self, axes: &[f64], axis_label: &Atom) -> Option<f64>;
 
     #[doc(alias = "gdk_device_get_device_type")]
     #[doc(alias = "get_device_type")]
-    pub fn device_type(&self) -> DeviceType {
-        unsafe { from_glib(ffi::gdk_device_get_device_type(self.to_glib_none().0)) }
-    }
+    fn device_type(&self) -> DeviceType;
 
     #[doc(alias = "gdk_device_get_display")]
     #[doc(alias = "get_display")]
-    pub fn display(&self) -> Display {
-        unsafe { from_glib_none(ffi::gdk_device_get_display(self.to_glib_none().0)) }
-    }
+    fn display(&self) -> Display;
 
     #[doc(alias = "gdk_device_get_has_cursor")]
     #[doc(alias = "get_has_cursor")]
-    pub fn has_cursor(&self) -> bool {
-        unsafe { from_glib(ffi::gdk_device_get_has_cursor(self.to_glib_none().0)) }
-    }
+    fn has_cursor(&self) -> bool;
 
     #[doc(alias = "gdk_device_get_key")]
     #[doc(alias = "get_key")]
-    pub fn key(&self, index_: u32) -> Option<(u32, ModifierType)> {
+    fn key(&self, index_: u32) -> Option<(u32, ModifierType)>;
+
+    #[doc(alias = "gdk_device_get_last_event_window")]
+    #[doc(alias = "get_last_event_window")]
+    fn last_event_window(&self) -> Option<Window>;
+
+    #[doc(alias = "gdk_device_get_mode")]
+    #[doc(alias = "get_mode")]
+    fn mode(&self) -> InputMode;
+
+    #[doc(alias = "gdk_device_get_n_axes")]
+    #[doc(alias = "get_n_axes")]
+    fn n_axes(&self) -> i32;
+
+    #[doc(alias = "gdk_device_get_n_keys")]
+    #[doc(alias = "get_n_keys")]
+    fn n_keys(&self) -> i32;
+
+    #[doc(alias = "gdk_device_get_name")]
+    #[doc(alias = "get_name")]
+    fn name(&self) -> Option<glib::GString>;
+
+    #[doc(alias = "gdk_device_get_position")]
+    #[doc(alias = "get_position")]
+    fn position(&self) -> (Screen, i32, i32);
+
+    #[doc(alias = "gdk_device_get_position_double")]
+    #[doc(alias = "get_position_double")]
+    fn position_double(&self) -> (Screen, f64, f64);
+
+    #[doc(alias = "gdk_device_get_product_id")]
+    #[doc(alias = "get_product_id")]
+    fn product_id(&self) -> Option<glib::GString>;
+
+    #[doc(alias = "gdk_device_get_seat")]
+    #[doc(alias = "get_seat")]
+    fn seat(&self) -> Option<Seat>;
+
+    #[doc(alias = "gdk_device_get_source")]
+    #[doc(alias = "get_source")]
+    fn source(&self) -> InputSource;
+
+    //#[doc(alias = "gdk_device_get_state")]
+    //#[doc(alias = "get_state")]
+    //fn state(&self, window: &Window, axes: &[f64]) -> ModifierType;
+
+    #[doc(alias = "gdk_device_get_vendor_id")]
+    #[doc(alias = "get_vendor_id")]
+    fn vendor_id(&self) -> Option<glib::GString>;
+
+    #[doc(alias = "gdk_device_get_window_at_position")]
+    #[doc(alias = "get_window_at_position")]
+    fn window_at_position(&self) -> (Option<Window>, i32, i32);
+
+    #[doc(alias = "gdk_device_get_window_at_position_double")]
+    #[doc(alias = "get_window_at_position_double")]
+    fn window_at_position_double(&self) -> (Option<Window>, f64, f64);
+
+    #[doc(alias = "gdk_device_list_axes")]
+    fn list_axes(&self) -> Vec<Atom>;
+
+    #[doc(alias = "gdk_device_list_slave_devices")]
+    fn list_slave_devices(&self) -> Vec<Device>;
+
+    #[doc(alias = "gdk_device_set_axis_use")]
+    fn set_axis_use(&self, index_: u32, use_: AxisUse);
+
+    #[doc(alias = "gdk_device_set_key")]
+    fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType);
+
+    #[doc(alias = "gdk_device_set_mode")]
+    fn set_mode(&self, mode: InputMode) -> bool;
+
+    #[doc(alias = "gdk_device_warp")]
+    fn warp(&self, screen: &Screen, x: i32, y: i32);
+
+    #[doc(alias = "device-manager")]
+    fn device_manager(&self) -> Option<DeviceManager>;
+
+    #[doc(alias = "input-mode")]
+    fn input_mode(&self) -> InputMode;
+
+    #[doc(alias = "input-mode")]
+    fn set_input_mode(&self, input_mode: InputMode);
+
+    #[doc(alias = "input-source")]
+    fn input_source(&self) -> InputSource;
+
+    #[doc(alias = "num-touches")]
+    fn num_touches(&self) -> u32;
+
+    fn set_seat<P: IsA<Seat>>(&self, seat: Option<&P>);
+
+    fn tool(&self) -> Option<DeviceTool>;
+
+    #[doc(alias = "type")]
+    fn type_(&self) -> DeviceType;
+
+    #[doc(alias = "changed")]
+    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "tool-changed")]
+    fn connect_tool_changed<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "associated-device")]
+    fn connect_associated_device_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "axes")]
+    fn connect_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "input-mode")]
+    fn connect_input_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "n-axes")]
+    fn connect_n_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "seat")]
+    fn connect_seat_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "tool")]
+    fn connect_tool_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "type")]
+    fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+}
+
+impl<O: IsA<Device>> DeviceExt for O {
+    fn associated_device(&self) -> Option<Device> {
+        unsafe {
+            from_glib_none(ffi::gdk_device_get_associated_device(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
+    }
+
+    fn axes(&self) -> AxisFlags {
+        unsafe { from_glib(ffi::gdk_device_get_axes(self.as_ref().to_glib_none().0)) }
+    }
+
+    //fn axis(&self, axes: &[f64], use_: AxisUse) -> Option<f64> {
+    //    unsafe { TODO: call ffi:gdk_device_get_axis() }
+    //}
+
+    fn axis_use(&self, index_: u32) -> AxisUse {
+        unsafe {
+            from_glib(ffi::gdk_device_get_axis_use(
+                self.as_ref().to_glib_none().0,
+                index_,
+            ))
+        }
+    }
+
+    //fn axis_value(&self, axes: &[f64], axis_label: &Atom) -> Option<f64> {
+    //    unsafe { TODO: call ffi:gdk_device_get_axis_value() }
+    //}
+
+    fn device_type(&self) -> DeviceType {
+        unsafe {
+            from_glib(ffi::gdk_device_get_device_type(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
+    }
+
+    fn display(&self) -> Display {
+        unsafe { from_glib_none(ffi::gdk_device_get_display(self.as_ref().to_glib_none().0)) }
+    }
+
+    fn has_cursor(&self) -> bool {
+        unsafe {
+            from_glib(ffi::gdk_device_get_has_cursor(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
+    }
+
+    fn key(&self, index_: u32) -> Option<(u32, ModifierType)> {
         unsafe {
             let mut keyval = mem::MaybeUninit::uninit();
             let mut modifiers = mem::MaybeUninit::uninit();
             let ret = from_glib(ffi::gdk_device_get_key(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 index_,
                 keyval.as_mut_ptr(),
                 modifiers.as_mut_ptr(),
@@ -92,45 +256,37 @@ impl Device {
         }
     }
 
-    #[doc(alias = "gdk_device_get_last_event_window")]
-    #[doc(alias = "get_last_event_window")]
-    pub fn last_event_window(&self) -> Option<Window> {
-        unsafe { from_glib_none(ffi::gdk_device_get_last_event_window(self.to_glib_none().0)) }
+    fn last_event_window(&self) -> Option<Window> {
+        unsafe {
+            from_glib_none(ffi::gdk_device_get_last_event_window(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
     }
 
-    #[doc(alias = "gdk_device_get_mode")]
-    #[doc(alias = "get_mode")]
-    pub fn mode(&self) -> InputMode {
-        unsafe { from_glib(ffi::gdk_device_get_mode(self.to_glib_none().0)) }
+    fn mode(&self) -> InputMode {
+        unsafe { from_glib(ffi::gdk_device_get_mode(self.as_ref().to_glib_none().0)) }
     }
 
-    #[doc(alias = "gdk_device_get_n_axes")]
-    #[doc(alias = "get_n_axes")]
-    pub fn n_axes(&self) -> i32 {
-        unsafe { ffi::gdk_device_get_n_axes(self.to_glib_none().0) }
+    fn n_axes(&self) -> i32 {
+        unsafe { ffi::gdk_device_get_n_axes(self.as_ref().to_glib_none().0) }
     }
 
-    #[doc(alias = "gdk_device_get_n_keys")]
-    #[doc(alias = "get_n_keys")]
-    pub fn n_keys(&self) -> i32 {
-        unsafe { ffi::gdk_device_get_n_keys(self.to_glib_none().0) }
+    fn n_keys(&self) -> i32 {
+        unsafe { ffi::gdk_device_get_n_keys(self.as_ref().to_glib_none().0) }
     }
 
-    #[doc(alias = "gdk_device_get_name")]
-    #[doc(alias = "get_name")]
-    pub fn name(&self) -> Option<glib::GString> {
-        unsafe { from_glib_none(ffi::gdk_device_get_name(self.to_glib_none().0)) }
+    fn name(&self) -> Option<glib::GString> {
+        unsafe { from_glib_none(ffi::gdk_device_get_name(self.as_ref().to_glib_none().0)) }
     }
 
-    #[doc(alias = "gdk_device_get_position")]
-    #[doc(alias = "get_position")]
-    pub fn position(&self) -> (Screen, i32, i32) {
+    fn position(&self) -> (Screen, i32, i32) {
         unsafe {
             let mut screen = ptr::null_mut();
             let mut x = mem::MaybeUninit::uninit();
             let mut y = mem::MaybeUninit::uninit();
             ffi::gdk_device_get_position(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 &mut screen,
                 x.as_mut_ptr(),
                 y.as_mut_ptr(),
@@ -139,15 +295,13 @@ impl Device {
         }
     }
 
-    #[doc(alias = "gdk_device_get_position_double")]
-    #[doc(alias = "get_position_double")]
-    pub fn position_double(&self) -> (Screen, f64, f64) {
+    fn position_double(&self) -> (Screen, f64, f64) {
         unsafe {
             let mut screen = ptr::null_mut();
             let mut x = mem::MaybeUninit::uninit();
             let mut y = mem::MaybeUninit::uninit();
             ffi::gdk_device_get_position_double(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 &mut screen,
                 x.as_mut_ptr(),
                 y.as_mut_ptr(),
@@ -156,44 +310,40 @@ impl Device {
         }
     }
 
-    #[doc(alias = "gdk_device_get_product_id")]
-    #[doc(alias = "get_product_id")]
-    pub fn product_id(&self) -> Option<glib::GString> {
-        unsafe { from_glib_none(ffi::gdk_device_get_product_id(self.to_glib_none().0)) }
+    fn product_id(&self) -> Option<glib::GString> {
+        unsafe {
+            from_glib_none(ffi::gdk_device_get_product_id(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
     }
 
-    #[doc(alias = "gdk_device_get_seat")]
-    #[doc(alias = "get_seat")]
-    pub fn seat(&self) -> Option<Seat> {
-        unsafe { from_glib_none(ffi::gdk_device_get_seat(self.to_glib_none().0)) }
+    fn seat(&self) -> Option<Seat> {
+        unsafe { from_glib_none(ffi::gdk_device_get_seat(self.as_ref().to_glib_none().0)) }
     }
 
-    #[doc(alias = "gdk_device_get_source")]
-    #[doc(alias = "get_source")]
-    pub fn source(&self) -> InputSource {
-        unsafe { from_glib(ffi::gdk_device_get_source(self.to_glib_none().0)) }
+    fn source(&self) -> InputSource {
+        unsafe { from_glib(ffi::gdk_device_get_source(self.as_ref().to_glib_none().0)) }
     }
 
-    //#[doc(alias = "gdk_device_get_state")]
-    //#[doc(alias = "get_state")]
-    //pub fn state(&self, window: &Window, axes: &[f64]) -> ModifierType {
+    //fn state(&self, window: &Window, axes: &[f64]) -> ModifierType {
     //    unsafe { TODO: call ffi:gdk_device_get_state() }
     //}
 
-    #[doc(alias = "gdk_device_get_vendor_id")]
-    #[doc(alias = "get_vendor_id")]
-    pub fn vendor_id(&self) -> Option<glib::GString> {
-        unsafe { from_glib_none(ffi::gdk_device_get_vendor_id(self.to_glib_none().0)) }
+    fn vendor_id(&self) -> Option<glib::GString> {
+        unsafe {
+            from_glib_none(ffi::gdk_device_get_vendor_id(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
     }
 
-    #[doc(alias = "gdk_device_get_window_at_position")]
-    #[doc(alias = "get_window_at_position")]
-    pub fn window_at_position(&self) -> (Option<Window>, i32, i32) {
+    fn window_at_position(&self) -> (Option<Window>, i32, i32) {
         unsafe {
             let mut win_x = mem::MaybeUninit::uninit();
             let mut win_y = mem::MaybeUninit::uninit();
             let ret = from_glib_none(ffi::gdk_device_get_window_at_position(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 win_x.as_mut_ptr(),
                 win_y.as_mut_ptr(),
             ));
@@ -201,14 +351,12 @@ impl Device {
         }
     }
 
-    #[doc(alias = "gdk_device_get_window_at_position_double")]
-    #[doc(alias = "get_window_at_position_double")]
-    pub fn window_at_position_double(&self) -> (Option<Window>, f64, f64) {
+    fn window_at_position_double(&self) -> (Option<Window>, f64, f64) {
         unsafe {
             let mut win_x = mem::MaybeUninit::uninit();
             let mut win_y = mem::MaybeUninit::uninit();
             let ret = from_glib_none(ffi::gdk_device_get_window_at_position_double(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 win_x.as_mut_ptr(),
                 win_y.as_mut_ptr(),
             ));
@@ -216,101 +364,98 @@ impl Device {
         }
     }
 
-    #[doc(alias = "gdk_device_list_axes")]
-    pub fn list_axes(&self) -> Vec<Atom> {
+    fn list_axes(&self) -> Vec<Atom> {
         unsafe {
             FromGlibPtrContainer::from_glib_container(ffi::gdk_device_list_axes(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
             ))
         }
     }
 
-    #[doc(alias = "gdk_device_list_slave_devices")]
-    pub fn list_slave_devices(&self) -> Vec<Device> {
+    fn list_slave_devices(&self) -> Vec<Device> {
         unsafe {
             FromGlibPtrContainer::from_glib_container(ffi::gdk_device_list_slave_devices(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
             ))
         }
     }
 
-    #[doc(alias = "gdk_device_set_axis_use")]
-    pub fn set_axis_use(&self, index_: u32, use_: AxisUse) {
+    fn set_axis_use(&self, index_: u32, use_: AxisUse) {
         unsafe {
-            ffi::gdk_device_set_axis_use(self.to_glib_none().0, index_, use_.into_glib());
+            ffi::gdk_device_set_axis_use(self.as_ref().to_glib_none().0, index_, use_.into_glib());
         }
     }
 
-    #[doc(alias = "gdk_device_set_key")]
-    pub fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType) {
+    fn set_key(&self, index_: u32, keyval: u32, modifiers: ModifierType) {
         unsafe {
-            ffi::gdk_device_set_key(self.to_glib_none().0, index_, keyval, modifiers.into_glib());
+            ffi::gdk_device_set_key(
+                self.as_ref().to_glib_none().0,
+                index_,
+                keyval,
+                modifiers.into_glib(),
+            );
         }
     }
 
-    #[doc(alias = "gdk_device_set_mode")]
-    pub fn set_mode(&self, mode: InputMode) -> bool {
+    fn set_mode(&self, mode: InputMode) -> bool {
         unsafe {
             from_glib(ffi::gdk_device_set_mode(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 mode.into_glib(),
             ))
         }
     }
 
-    #[doc(alias = "gdk_device_warp")]
-    pub fn warp(&self, screen: &Screen, x: i32, y: i32) {
+    fn warp(&self, screen: &Screen, x: i32, y: i32) {
         unsafe {
-            ffi::gdk_device_warp(self.to_glib_none().0, screen.to_glib_none().0, x, y);
+            ffi::gdk_device_warp(
+                self.as_ref().to_glib_none().0,
+                screen.to_glib_none().0,
+                x,
+                y,
+            );
         }
     }
 
-    #[doc(alias = "device-manager")]
-    pub fn device_manager(&self) -> Option<DeviceManager> {
-        glib::ObjectExt::property(self, "device-manager")
+    fn device_manager(&self) -> Option<DeviceManager> {
+        glib::ObjectExt::property(self.as_ref(), "device-manager")
     }
 
-    #[doc(alias = "input-mode")]
-    pub fn input_mode(&self) -> InputMode {
-        glib::ObjectExt::property(self, "input-mode")
+    fn input_mode(&self) -> InputMode {
+        glib::ObjectExt::property(self.as_ref(), "input-mode")
     }
 
-    #[doc(alias = "input-mode")]
-    pub fn set_input_mode(&self, input_mode: InputMode) {
-        glib::ObjectExt::set_property(self, "input-mode", &input_mode)
+    fn set_input_mode(&self, input_mode: InputMode) {
+        glib::ObjectExt::set_property(self.as_ref(), "input-mode", &input_mode)
     }
 
-    #[doc(alias = "input-source")]
-    pub fn input_source(&self) -> InputSource {
-        glib::ObjectExt::property(self, "input-source")
+    fn input_source(&self) -> InputSource {
+        glib::ObjectExt::property(self.as_ref(), "input-source")
     }
 
-    #[doc(alias = "num-touches")]
-    pub fn num_touches(&self) -> u32 {
-        glib::ObjectExt::property(self, "num-touches")
+    fn num_touches(&self) -> u32 {
+        glib::ObjectExt::property(self.as_ref(), "num-touches")
     }
 
-    pub fn set_seat(&self, seat: Option<&Seat>) {
-        glib::ObjectExt::set_property(self, "seat", &seat)
+    fn set_seat<P: IsA<Seat>>(&self, seat: Option<&P>) {
+        glib::ObjectExt::set_property(self.as_ref(), "seat", &seat)
     }
 
-    pub fn tool(&self) -> Option<DeviceTool> {
-        glib::ObjectExt::property(self, "tool")
+    fn tool(&self) -> Option<DeviceTool> {
+        glib::ObjectExt::property(self.as_ref(), "tool")
     }
 
-    #[doc(alias = "type")]
-    pub fn type_(&self) -> DeviceType {
-        glib::ObjectExt::property(self, "type")
+    fn type_(&self) -> DeviceType {
+        glib::ObjectExt::property(self.as_ref(), "type")
     }
 
-    #[doc(alias = "changed")]
-    pub fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn changed_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn changed_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -318,25 +463,27 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"changed\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    changed_trampoline::<F> as *const (),
+                    changed_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "tool-changed")]
-    pub fn connect_tool_changed<F: Fn(&Self, &DeviceTool) + 'static>(
-        &self,
-        f: F,
-    ) -> SignalHandlerId {
-        unsafe extern "C" fn tool_changed_trampoline<F: Fn(&Device, &DeviceTool) + 'static>(
+    fn connect_tool_changed<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn tool_changed_trampoline<
+            P: IsA<Device>,
+            F: Fn(&P, &DeviceTool) + 'static,
+        >(
             this: *mut ffi::GdkDevice,
             tool: *mut ffi::GdkDeviceTool,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this), &from_glib_borrow(tool))
+            f(
+                Device::from_glib_borrow(this).unsafe_cast_ref(),
+                &from_glib_borrow(tool),
+            )
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -344,25 +491,24 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"tool-changed\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    tool_changed_trampoline::<F> as *const (),
+                    tool_changed_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "associated-device")]
-    pub fn connect_associated_device_notify<F: Fn(&Self) + 'static>(
-        &self,
-        f: F,
-    ) -> SignalHandlerId {
-        unsafe extern "C" fn notify_associated_device_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_associated_device_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_associated_device_trampoline<
+            P: IsA<Device>,
+            F: Fn(&P) + 'static,
+        >(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -370,22 +516,21 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::associated-device\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_associated_device_trampoline::<F> as *const (),
+                    notify_associated_device_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "axes")]
-    pub fn connect_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_axes_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_axes_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -393,22 +538,21 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::axes\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_axes_trampoline::<F> as *const (),
+                    notify_axes_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "input-mode")]
-    pub fn connect_input_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_input_mode_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_input_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_input_mode_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -416,22 +560,21 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::input-mode\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_input_mode_trampoline::<F> as *const (),
+                    notify_input_mode_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "n-axes")]
-    pub fn connect_n_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_n_axes_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_n_axes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_n_axes_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -439,22 +582,21 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::n-axes\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_n_axes_trampoline::<F> as *const (),
+                    notify_n_axes_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "seat")]
-    pub fn connect_seat_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_seat_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_seat_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_seat_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -462,22 +604,21 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::seat\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_seat_trampoline::<F> as *const (),
+                    notify_seat_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "tool")]
-    pub fn connect_tool_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_tool_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_tool_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_tool_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -485,22 +626,21 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::tool\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_tool_trampoline::<F> as *const (),
+                    notify_tool_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "type")]
-    pub fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_type_trampoline<F: Fn(&Device) + 'static>(
+    fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_type_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkDevice,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Device::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -508,7 +648,7 @@ impl Device {
                 self.as_ptr() as *mut _,
                 b"notify::type\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_type_trampoline::<F> as *const (),
+                    notify_type_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
diff --git a/gdk/src/auto/display.rs b/gdk/src/auto/display.rs
index ff649edf718e..fc0475391395 100644
--- a/gdk/src/auto/display.rs
+++ b/gdk/src/auto/display.rs
@@ -35,11 +35,11 @@ impl Display {
     }
 
     #[doc(alias = "gdk_display_device_is_grabbed")]
-    pub fn device_is_grabbed(&self, device: &Device) -> bool {
+    pub fn device_is_grabbed(&self, device: &impl IsA<Device>) -> bool {
         unsafe {
             from_glib(ffi::gdk_display_device_is_grabbed(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
             ))
         }
     }
diff --git a/gdk/src/auto/drag_context.rs b/gdk/src/auto/drag_context.rs
index 5aa8a2f50e8b..3427dcad53ff 100644
--- a/gdk/src/auto/drag_context.rs
+++ b/gdk/src/auto/drag_context.rs
@@ -101,9 +101,12 @@ impl DragContext {
     }
 
     #[doc(alias = "gdk_drag_context_set_device")]
-    pub fn set_device(&self, device: &Device) {
+    pub fn set_device(&self, device: &impl IsA<Device>) {
         unsafe {
-            ffi::gdk_drag_context_set_device(self.to_glib_none().0, device.to_glib_none().0);
+            ffi::gdk_drag_context_set_device(
+                self.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
+            );
         }
     }
 
diff --git a/gdk/src/auto/mod.rs b/gdk/src/auto/mod.rs
index ca1d172951c5..f4709f13f465 100644
--- a/gdk/src/auto/mod.rs
+++ b/gdk/src/auto/mod.rs
@@ -118,5 +118,8 @@ pub mod functions;
 
 #[doc(hidden)]
 pub mod traits {
+    pub use super::device::DeviceExt;
     pub use super::device_pad::DevicePadExt;
+    pub use super::monitor::MonitorExt;
+    pub use super::seat::SeatExt;
 }
diff --git a/gdk/src/auto/monitor.rs b/gdk/src/auto/monitor.rs
index 1fd64e5ad903..bfc42afc2a22 100644
--- a/gdk/src/auto/monitor.rs
+++ b/gdk/src/auto/monitor.rs
@@ -20,87 +20,158 @@ glib::wrapper! {
 }
 
 impl Monitor {
+    pub const NONE: Option<&'static Monitor> = None;
+}
+
+pub trait MonitorExt: 'static {
     #[doc(alias = "gdk_monitor_get_display")]
     #[doc(alias = "get_display")]
-    pub fn display(&self) -> Option<Display> {
-        unsafe { from_glib_none(ffi::gdk_monitor_get_display(self.to_glib_none().0)) }
-    }
+    fn display(&self) -> Option<Display>;
 
     #[doc(alias = "gdk_monitor_get_geometry")]
     #[doc(alias = "get_geometry")]
-    pub fn geometry(&self) -> Rectangle {
-        unsafe {
-            let mut geometry = Rectangle::uninitialized();
-            ffi::gdk_monitor_get_geometry(self.to_glib_none().0, geometry.to_glib_none_mut().0);
-            geometry
-        }
-    }
+    fn geometry(&self) -> Rectangle;
 
     #[doc(alias = "gdk_monitor_get_height_mm")]
     #[doc(alias = "get_height_mm")]
-    pub fn height_mm(&self) -> i32 {
-        unsafe { ffi::gdk_monitor_get_height_mm(self.to_glib_none().0) }
-    }
+    fn height_mm(&self) -> i32;
 
     #[doc(alias = "gdk_monitor_get_manufacturer")]
     #[doc(alias = "get_manufacturer")]
-    pub fn manufacturer(&self) -> Option<glib::GString> {
-        unsafe { from_glib_none(ffi::gdk_monitor_get_manufacturer(self.to_glib_none().0)) }
-    }
+    fn manufacturer(&self) -> Option<glib::GString>;
 
     #[doc(alias = "gdk_monitor_get_model")]
     #[doc(alias = "get_model")]
-    pub fn model(&self) -> Option<glib::GString> {
-        unsafe { from_glib_none(ffi::gdk_monitor_get_model(self.to_glib_none().0)) }
-    }
+    fn model(&self) -> Option<glib::GString>;
 
     #[doc(alias = "gdk_monitor_get_refresh_rate")]
     #[doc(alias = "get_refresh_rate")]
-    pub fn refresh_rate(&self) -> i32 {
-        unsafe { ffi::gdk_monitor_get_refresh_rate(self.to_glib_none().0) }
-    }
+    fn refresh_rate(&self) -> i32;
 
     #[doc(alias = "gdk_monitor_get_scale_factor")]
     #[doc(alias = "get_scale_factor")]
-    pub fn scale_factor(&self) -> i32 {
-        unsafe { ffi::gdk_monitor_get_scale_factor(self.to_glib_none().0) }
-    }
+    fn scale_factor(&self) -> i32;
 
     #[doc(alias = "gdk_monitor_get_subpixel_layout")]
     #[doc(alias = "get_subpixel_layout")]
-    pub fn subpixel_layout(&self) -> SubpixelLayout {
-        unsafe { from_glib(ffi::gdk_monitor_get_subpixel_layout(self.to_glib_none().0)) }
-    }
+    fn subpixel_layout(&self) -> SubpixelLayout;
 
     #[doc(alias = "gdk_monitor_get_width_mm")]
     #[doc(alias = "get_width_mm")]
-    pub fn width_mm(&self) -> i32 {
-        unsafe { ffi::gdk_monitor_get_width_mm(self.to_glib_none().0) }
-    }
+    fn width_mm(&self) -> i32;
 
     #[doc(alias = "gdk_monitor_get_workarea")]
     #[doc(alias = "get_workarea")]
-    pub fn workarea(&self) -> Rectangle {
+    fn workarea(&self) -> Rectangle;
+
+    #[doc(alias = "gdk_monitor_is_primary")]
+    fn is_primary(&self) -> bool;
+
+    #[doc(alias = "invalidate")]
+    fn connect_invalidate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "geometry")]
+    fn connect_geometry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "height-mm")]
+    fn connect_height_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "manufacturer")]
+    fn connect_manufacturer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "model")]
+    fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "refresh-rate")]
+    fn connect_refresh_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "scale-factor")]
+    fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "subpixel-layout")]
+    fn connect_subpixel_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "width-mm")]
+    fn connect_width_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "workarea")]
+    fn connect_workarea_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
+}
+
+impl<O: IsA<Monitor>> MonitorExt for O {
+    fn display(&self) -> Option<Display> {
+        unsafe { from_glib_none(ffi::gdk_monitor_get_display(self.as_ref().to_glib_none().0)) }
+    }
+
+    fn geometry(&self) -> Rectangle {
+        unsafe {
+            let mut geometry = Rectangle::uninitialized();
+            ffi::gdk_monitor_get_geometry(
+                self.as_ref().to_glib_none().0,
+                geometry.to_glib_none_mut().0,
+            );
+            geometry
+        }
+    }
+
+    fn height_mm(&self) -> i32 {
+        unsafe { ffi::gdk_monitor_get_height_mm(self.as_ref().to_glib_none().0) }
+    }
+
+    fn manufacturer(&self) -> Option<glib::GString> {
+        unsafe {
+            from_glib_none(ffi::gdk_monitor_get_manufacturer(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
+    }
+
+    fn model(&self) -> Option<glib::GString> {
+        unsafe { from_glib_none(ffi::gdk_monitor_get_model(self.as_ref().to_glib_none().0)) }
+    }
+
+    fn refresh_rate(&self) -> i32 {
+        unsafe { ffi::gdk_monitor_get_refresh_rate(self.as_ref().to_glib_none().0) }
+    }
+
+    fn scale_factor(&self) -> i32 {
+        unsafe { ffi::gdk_monitor_get_scale_factor(self.as_ref().to_glib_none().0) }
+    }
+
+    fn subpixel_layout(&self) -> SubpixelLayout {
+        unsafe {
+            from_glib(ffi::gdk_monitor_get_subpixel_layout(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
+    }
+
+    fn width_mm(&self) -> i32 {
+        unsafe { ffi::gdk_monitor_get_width_mm(self.as_ref().to_glib_none().0) }
+    }
+
+    fn workarea(&self) -> Rectangle {
         unsafe {
             let mut workarea = Rectangle::uninitialized();
-            ffi::gdk_monitor_get_workarea(self.to_glib_none().0, workarea.to_glib_none_mut().0);
+            ffi::gdk_monitor_get_workarea(
+                self.as_ref().to_glib_none().0,
+                workarea.to_glib_none_mut().0,
+            );
             workarea
         }
     }
 
-    #[doc(alias = "gdk_monitor_is_primary")]
-    pub fn is_primary(&self) -> bool {
-        unsafe { from_glib(ffi::gdk_monitor_is_primary(self.to_glib_none().0)) }
+    fn is_primary(&self) -> bool {
+        unsafe { from_glib(ffi::gdk_monitor_is_primary(self.as_ref().to_glib_none().0)) }
     }
 
-    #[doc(alias = "invalidate")]
-    pub fn connect_invalidate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn invalidate_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_invalidate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn invalidate_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkMonitor,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -108,22 +179,21 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"invalidate\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    invalidate_trampoline::<F> as *const (),
+                    invalidate_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "geometry")]
-    pub fn connect_geometry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_geometry_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_geometry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_geometry_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -131,22 +201,21 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::geometry\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_geometry_trampoline::<F> as *const (),
+                    notify_geometry_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "height-mm")]
-    pub fn connect_height_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_height_mm_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_height_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_height_mm_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -154,22 +223,24 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::height-mm\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_height_mm_trampoline::<F> as *const (),
+                    notify_height_mm_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "manufacturer")]
-    pub fn connect_manufacturer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_manufacturer_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_manufacturer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_manufacturer_trampoline<
+            P: IsA<Monitor>,
+            F: Fn(&P) + 'static,
+        >(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -177,22 +248,21 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::manufacturer\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_manufacturer_trampoline::<F> as *const (),
+                    notify_manufacturer_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "model")]
-    pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_model_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_model_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -200,22 +270,24 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::model\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_model_trampoline::<F> as *const (),
+                    notify_model_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "refresh-rate")]
-    pub fn connect_refresh_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_refresh_rate_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_refresh_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_refresh_rate_trampoline<
+            P: IsA<Monitor>,
+            F: Fn(&P) + 'static,
+        >(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -223,22 +295,24 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::refresh-rate\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_refresh_rate_trampoline::<F> as *const (),
+                    notify_refresh_rate_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "scale-factor")]
-    pub fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_scale_factor_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_scale_factor_trampoline<
+            P: IsA<Monitor>,
+            F: Fn(&P) + 'static,
+        >(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -246,22 +320,24 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::scale-factor\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_scale_factor_trampoline::<F> as *const (),
+                    notify_scale_factor_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "subpixel-layout")]
-    pub fn connect_subpixel_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_subpixel_layout_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_subpixel_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_subpixel_layout_trampoline<
+            P: IsA<Monitor>,
+            F: Fn(&P) + 'static,
+        >(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -269,22 +345,21 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::subpixel-layout\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_subpixel_layout_trampoline::<F> as *const (),
+                    notify_subpixel_layout_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "width-mm")]
-    pub fn connect_width_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_width_mm_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_width_mm_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_width_mm_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -292,22 +367,21 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::width-mm\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_width_mm_trampoline::<F> as *const (),
+                    notify_width_mm_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "workarea")]
-    pub fn connect_workarea_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn notify_workarea_trampoline<F: Fn(&Monitor) + 'static>(
+    fn connect_workarea_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn notify_workarea_trampoline<P: IsA<Monitor>, F: Fn(&P) + 'static>(
             this: *mut ffi::GdkMonitor,
             _param_spec: glib::ffi::gpointer,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this))
+            f(Monitor::from_glib_borrow(this).unsafe_cast_ref())
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -315,7 +389,7 @@ impl Monitor {
                 self.as_ptr() as *mut _,
                 b"notify::workarea\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    notify_workarea_trampoline::<F> as *const (),
+                    notify_workarea_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
diff --git a/gdk/src/auto/seat.rs b/gdk/src/auto/seat.rs
index 349abc3def31..7a52c15c17ee 100644
--- a/gdk/src/auto/seat.rs
+++ b/gdk/src/auto/seat.rs
@@ -20,43 +20,88 @@ glib::wrapper! {
 }
 
 impl Seat {
+    pub const NONE: Option<&'static Seat> = None;
+}
+
+pub trait SeatExt: 'static {
     #[doc(alias = "gdk_seat_get_capabilities")]
     #[doc(alias = "get_capabilities")]
-    pub fn capabilities(&self) -> SeatCapabilities {
-        unsafe { from_glib(ffi::gdk_seat_get_capabilities(self.to_glib_none().0)) }
-    }
+    fn capabilities(&self) -> SeatCapabilities;
 
     #[doc(alias = "gdk_seat_get_display")]
     #[doc(alias = "get_display")]
-    pub fn display(&self) -> Option<Display> {
-        unsafe { from_glib_none(ffi::gdk_seat_get_display(self.to_glib_none().0)) }
-    }
+    fn display(&self) -> Option<Display>;
 
     #[doc(alias = "gdk_seat_get_keyboard")]
     #[doc(alias = "get_keyboard")]
-    pub fn keyboard(&self) -> Option<Device> {
-        unsafe { from_glib_none(ffi::gdk_seat_get_keyboard(self.to_glib_none().0)) }
-    }
+    fn keyboard(&self) -> Option<Device>;
 
     #[doc(alias = "gdk_seat_get_pointer")]
     #[doc(alias = "get_pointer")]
-    pub fn pointer(&self) -> Option<Device> {
-        unsafe { from_glib_none(ffi::gdk_seat_get_pointer(self.to_glib_none().0)) }
-    }
+    fn pointer(&self) -> Option<Device>;
 
     #[doc(alias = "gdk_seat_get_slaves")]
     #[doc(alias = "get_slaves")]
-    pub fn slaves(&self, capabilities: SeatCapabilities) -> Vec<Device> {
+    fn slaves(&self, capabilities: SeatCapabilities) -> Vec<Device>;
+
+    #[doc(alias = "gdk_seat_grab")]
+    fn grab(
+        &self,
+        window: &Window,
+        capabilities: SeatCapabilities,
+        owner_events: bool,
+        cursor: Option<&Cursor>,
+        event: Option<&Event>,
+        prepare_func: Option<&mut dyn (FnMut(&Seat, &Window))>,
+    ) -> GrabStatus;
+
+    #[doc(alias = "gdk_seat_ungrab")]
+    fn ungrab(&self);
+
+    #[doc(alias = "device-added")]
+    fn connect_device_added<F: Fn(&Self, &Device) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "device-removed")]
+    fn connect_device_removed<F: Fn(&Self, &Device) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "tool-added")]
+    fn connect_tool_added<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId;
+
+    #[doc(alias = "tool-removed")]
+    fn connect_tool_removed<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId;
+}
+
+impl<O: IsA<Seat>> SeatExt for O {
+    fn capabilities(&self) -> SeatCapabilities {
+        unsafe {
+            from_glib(ffi::gdk_seat_get_capabilities(
+                self.as_ref().to_glib_none().0,
+            ))
+        }
+    }
+
+    fn display(&self) -> Option<Display> {
+        unsafe { from_glib_none(ffi::gdk_seat_get_display(self.as_ref().to_glib_none().0)) }
+    }
+
+    fn keyboard(&self) -> Option<Device> {
+        unsafe { from_glib_none(ffi::gdk_seat_get_keyboard(self.as_ref().to_glib_none().0)) }
+    }
+
+    fn pointer(&self) -> Option<Device> {
+        unsafe { from_glib_none(ffi::gdk_seat_get_pointer(self.as_ref().to_glib_none().0)) }
+    }
+
+    fn slaves(&self, capabilities: SeatCapabilities) -> Vec<Device> {
         unsafe {
             FromGlibPtrContainer::from_glib_container(ffi::gdk_seat_get_slaves(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 capabilities.into_glib(),
             ))
         }
     }
 
-    #[doc(alias = "gdk_seat_grab")]
-    pub fn grab(
+    fn grab(
         &self,
         window: &Window,
         capabilities: SeatCapabilities,
@@ -89,7 +134,7 @@ impl Seat {
         let super_callback0: &Option<&mut dyn (FnMut(&Seat, &Window))> = &prepare_func_data;
         unsafe {
             from_glib(ffi::gdk_seat_grab(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 window.to_glib_none().0,
                 capabilities.into_glib(),
                 owner_events.into_glib(),
@@ -101,22 +146,23 @@ impl Seat {
         }
     }
 
-    #[doc(alias = "gdk_seat_ungrab")]
-    pub fn ungrab(&self) {
+    fn ungrab(&self) {
         unsafe {
-            ffi::gdk_seat_ungrab(self.to_glib_none().0);
+            ffi::gdk_seat_ungrab(self.as_ref().to_glib_none().0);
         }
     }
 
-    #[doc(alias = "device-added")]
-    pub fn connect_device_added<F: Fn(&Self, &Device) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn device_added_trampoline<F: Fn(&Seat, &Device) + 'static>(
+    fn connect_device_added<F: Fn(&Self, &Device) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn device_added_trampoline<P: IsA<Seat>, F: Fn(&P, &Device) + 'static>(
             this: *mut ffi::GdkSeat,
             device: *mut ffi::GdkDevice,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this), &from_glib_borrow(device))
+            f(
+                Seat::from_glib_borrow(this).unsafe_cast_ref(),
+                &from_glib_borrow(device),
+            )
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -124,22 +170,27 @@ impl Seat {
                 self.as_ptr() as *mut _,
                 b"device-added\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    device_added_trampoline::<F> as *const (),
+                    device_added_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "device-removed")]
-    pub fn connect_device_removed<F: Fn(&Self, &Device) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn device_removed_trampoline<F: Fn(&Seat, &Device) + 'static>(
+    fn connect_device_removed<F: Fn(&Self, &Device) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn device_removed_trampoline<
+            P: IsA<Seat>,
+            F: Fn(&P, &Device) + 'static,
+        >(
             this: *mut ffi::GdkSeat,
             device: *mut ffi::GdkDevice,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this), &from_glib_borrow(device))
+            f(
+                Seat::from_glib_borrow(this).unsafe_cast_ref(),
+                &from_glib_borrow(device),
+            )
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -147,22 +198,27 @@ impl Seat {
                 self.as_ptr() as *mut _,
                 b"device-removed\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    device_removed_trampoline::<F> as *const (),
+                    device_removed_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "tool-added")]
-    pub fn connect_tool_added<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn tool_added_trampoline<F: Fn(&Seat, &DeviceTool) + 'static>(
+    fn connect_tool_added<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn tool_added_trampoline<
+            P: IsA<Seat>,
+            F: Fn(&P, &DeviceTool) + 'static,
+        >(
             this: *mut ffi::GdkSeat,
             tool: *mut ffi::GdkDeviceTool,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this), &from_glib_borrow(tool))
+            f(
+                Seat::from_glib_borrow(this).unsafe_cast_ref(),
+                &from_glib_borrow(tool),
+            )
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -170,25 +226,27 @@ impl Seat {
                 self.as_ptr() as *mut _,
                 b"tool-added\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    tool_added_trampoline::<F> as *const (),
+                    tool_added_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
         }
     }
 
-    #[doc(alias = "tool-removed")]
-    pub fn connect_tool_removed<F: Fn(&Self, &DeviceTool) + 'static>(
-        &self,
-        f: F,
-    ) -> SignalHandlerId {
-        unsafe extern "C" fn tool_removed_trampoline<F: Fn(&Seat, &DeviceTool) + 'static>(
+    fn connect_tool_removed<F: Fn(&Self, &DeviceTool) + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn tool_removed_trampoline<
+            P: IsA<Seat>,
+            F: Fn(&P, &DeviceTool) + 'static,
+        >(
             this: *mut ffi::GdkSeat,
             tool: *mut ffi::GdkDeviceTool,
             f: glib::ffi::gpointer,
         ) {
             let f: &F = &*(f as *const F);
-            f(&from_glib_borrow(this), &from_glib_borrow(tool))
+            f(
+                Seat::from_glib_borrow(this).unsafe_cast_ref(),
+                &from_glib_borrow(tool),
+            )
         }
         unsafe {
             let f: Box_<F> = Box_::new(f);
@@ -196,7 +254,7 @@ impl Seat {
                 self.as_ptr() as *mut _,
                 b"tool-removed\0".as_ptr() as *const _,
                 Some(transmute::<_, unsafe extern "C" fn()>(
-                    tool_removed_trampoline::<F> as *const (),
+                    tool_removed_trampoline::<Self, F> as *const (),
                 )),
                 Box_::into_raw(f),
             )
diff --git a/gdk/src/auto/versions.txt b/gdk/src/auto/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/gdk/src/auto/versions.txt
+++ b/gdk/src/auto/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/gdk/src/auto/window.rs b/gdk/src/auto/window.rs
index fc01593a8f70..e8257c4f8c18 100644
--- a/gdk/src/auto/window.rs
+++ b/gdk/src/auto/window.rs
@@ -65,7 +65,7 @@ impl Window {
     #[doc(alias = "gdk_window_begin_move_drag_for_device")]
     pub fn begin_move_drag_for_device(
         &self,
-        device: &Device,
+        device: &impl IsA<Device>,
         button: i32,
         root_x: i32,
         root_y: i32,
@@ -74,7 +74,7 @@ impl Window {
         unsafe {
             ffi::gdk_window_begin_move_drag_for_device(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
                 button,
                 root_x,
                 root_y,
@@ -108,7 +108,7 @@ impl Window {
     pub fn begin_resize_drag_for_device(
         &self,
         edge: WindowEdge,
-        device: &Device,
+        device: &impl IsA<Device>,
         button: i32,
         root_x: i32,
         root_y: i32,
@@ -118,7 +118,7 @@ impl Window {
             ffi::gdk_window_begin_resize_drag_for_device(
                 self.to_glib_none().0,
                 edge.into_glib(),
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
                 button,
                 root_x,
                 root_y,
@@ -300,36 +300,39 @@ impl Window {
 
     #[doc(alias = "gdk_window_get_device_cursor")]
     #[doc(alias = "get_device_cursor")]
-    pub fn device_cursor(&self, device: &Device) -> Option<Cursor> {
+    pub fn device_cursor(&self, device: &impl IsA<Device>) -> Option<Cursor> {
         unsafe {
             from_glib_none(ffi::gdk_window_get_device_cursor(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
             ))
         }
     }
 
     #[doc(alias = "gdk_window_get_device_events")]
     #[doc(alias = "get_device_events")]
-    pub fn device_events(&self, device: &Device) -> EventMask {
+    pub fn device_events(&self, device: &impl IsA<Device>) -> EventMask {
         unsafe {
             from_glib(ffi::gdk_window_get_device_events(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
             ))
         }
     }
 
     #[doc(alias = "gdk_window_get_device_position")]
     #[doc(alias = "get_device_position")]
-    pub fn device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType) {
+    pub fn device_position(
+        &self,
+        device: &impl IsA<Device>,
+    ) -> (Option<Window>, i32, i32, ModifierType) {
         unsafe {
             let mut x = mem::MaybeUninit::uninit();
             let mut y = mem::MaybeUninit::uninit();
             let mut mask = mem::MaybeUninit::uninit();
             let ret = from_glib_none(ffi::gdk_window_get_device_position(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
                 x.as_mut_ptr(),
                 y.as_mut_ptr(),
                 mask.as_mut_ptr(),
@@ -347,7 +350,7 @@ impl Window {
     #[doc(alias = "get_device_position_double")]
     pub fn device_position_double(
         &self,
-        device: &Device,
+        device: &impl IsA<Device>,
     ) -> (Option<Window>, f64, f64, ModifierType) {
         unsafe {
             let mut x = mem::MaybeUninit::uninit();
@@ -355,7 +358,7 @@ impl Window {
             let mut mask = mem::MaybeUninit::uninit();
             let ret = from_glib_none(ffi::gdk_window_get_device_position_double(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
                 x.as_mut_ptr(),
                 y.as_mut_ptr(),
                 mask.as_mut_ptr(),
@@ -936,22 +939,22 @@ impl Window {
     }
 
     #[doc(alias = "gdk_window_set_device_cursor")]
-    pub fn set_device_cursor(&self, device: &Device, cursor: &Cursor) {
+    pub fn set_device_cursor(&self, device: &impl IsA<Device>, cursor: &Cursor) {
         unsafe {
             ffi::gdk_window_set_device_cursor(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
                 cursor.to_glib_none().0,
             );
         }
     }
 
     #[doc(alias = "gdk_window_set_device_events")]
-    pub fn set_device_events(&self, device: &Device, event_mask: EventMask) {
+    pub fn set_device_events(&self, device: &impl IsA<Device>, event_mask: EventMask) {
         unsafe {
             ffi::gdk_window_set_device_events(
                 self.to_glib_none().0,
-                device.to_glib_none().0,
+                device.as_ref().to_glib_none().0,
                 event_mask.into_glib(),
             );
         }
diff --git a/gdk/src/device.rs b/gdk/src/device.rs
index 61bf9a011aab..7ee3c5c8396c 100644
--- a/gdk/src/device.rs
+++ b/gdk/src/device.rs
@@ -10,13 +10,21 @@ use glib::translate::*;
 use std::mem;
 use std::ptr;
 
-impl Device {
+pub trait DeviceExtManual: 'static {
     #[doc(alias = "gdk_device_get_axis")]
     #[doc(alias = "get_axis")]
-    pub fn is_axis(&self, axes: &mut [f64], use_: AxisUse, value: &mut f64) -> bool {
+    fn is_axis(&self, axes: &mut [f64], use_: AxisUse, value: &mut f64) -> bool;
+
+    #[doc(alias = "gdk_device_get_history")]
+    #[doc(alias = "get_history")]
+    fn history<P: IsA<Window>>(&self, window: &P, start: u32, stop: u32) -> Vec<TimeCoord>;
+}
+
+impl<O: IsA<Device>> DeviceExtManual for O {
+    fn is_axis(&self, axes: &mut [f64], use_: AxisUse, value: &mut f64) -> bool {
         unsafe {
             from_glib(ffi::gdk_device_get_axis(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 axes.as_mut_ptr(),
                 use_.into_glib(),
                 value,
@@ -24,14 +32,12 @@ impl Device {
         }
     }
 
-    #[doc(alias = "gdk_device_get_history")]
-    #[doc(alias = "get_history")]
-    pub fn history<P: IsA<Window>>(&self, window: &P, start: u32, stop: u32) -> Vec<TimeCoord> {
+    fn history<P: IsA<Window>>(&self, window: &P, start: u32, stop: u32) -> Vec<TimeCoord> {
         unsafe {
             let mut events = ptr::null_mut();
             let mut n_events = mem::MaybeUninit::uninit();
             let ret: bool = from_glib(ffi::gdk_device_get_history(
-                self.to_glib_none().0,
+                self.as_ref().to_glib_none().0,
                 window.as_ref().to_glib_none().0,
                 start,
                 stop,
diff --git a/gdk/src/prelude.rs b/gdk/src/prelude.rs
index d8635a3740a3..c81c710727c5 100644
--- a/gdk/src/prelude.rs
+++ b/gdk/src/prelude.rs
@@ -4,6 +4,7 @@
 
 pub use crate::auto::traits::*;
 pub use crate::cairo_interaction::{GdkContextExt, GdkPixbufExt, GdkSurfaceExt};
+pub use crate::device::DeviceExtManual;
 pub use crate::display::DisplayExtManual;
 pub use crate::window::WindowExtManual;
 
diff --git a/gdk/sys/versions.txt b/gdk/sys/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/gdk/sys/versions.txt
+++ b/gdk/sys/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/gdkwayland/Cargo.toml b/gdkwayland/Cargo.toml
index 744b2824cee5..8812d19c39b8 100644
--- a/gdkwayland/Cargo.toml
+++ b/gdkwayland/Cargo.toml
@@ -25,7 +25,8 @@ ffi = { path = "./sys", package = "gdkwayland-sys" }
 gdk = { path = "../gdk" }
 glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
 libc = "0.2"
-wayland-client = { version = "0.29", features = ["use_system_lib"] }
+wayland-client = "0.30"
+wayland-backend = { version = "0.1", features = ["client_system"] }
 
 [dev-dependencies]
 gir-format-check = "^0.1"
diff --git a/gdkwayland/src/wayland_device.rs b/gdkwayland/src/wayland_device.rs
index 60cb8f6e2b5f..da0d9a6ade99 100644
--- a/gdkwayland/src/wayland_device.rs
+++ b/gdkwayland/src/wayland_device.rs
@@ -1,10 +1,11 @@
 // Take a look at the license at the top of the repository in the LICENSE file.
 
+use gdk::prelude::*;
 use gdk::DevicePadFeature;
 use glib::translate::*;
 
+use wayland_client::backend::ObjectId;
 use wayland_client::protocol::{wl_keyboard::WlKeyboard, wl_pointer::WlPointer, wl_seat::WlSeat};
-use wayland_client::sys::client::wl_proxy;
 use wayland_client::Proxy;
 
 glib::wrapper! {
@@ -31,28 +32,53 @@ impl WaylandDevice {
 
     #[doc(alias = "gdk_wayland_device_get_wl_seat")]
     #[doc(alias = "get_wl_seat")]
-    pub fn wl_seat(&self) -> WlSeat {
+    pub fn wl_seat(&self) -> Option<WlSeat> {
         unsafe {
-            let ptr = ffi::gdk_wayland_device_get_wl_seat(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let seat_ptr = ffi::gdk_wayland_device_get_wl_seat(self.to_glib_none().0);
+            if seat_ptr.is_null() {
+                None
+            } else {
+                let display = self.display().unsafe_cast::<crate::WaylandDisplay>();
+                let cnx = display.connection();
+                let id = ObjectId::from_ptr(WlSeat::interface(), seat_ptr as *mut _).unwrap();
+
+                WlSeat::from_id(&cnx, id).ok()
+            }
         }
     }
 
     #[doc(alias = "gdk_wayland_device_get_wl_keyboard")]
     #[doc(alias = "get_wl_keyboard")]
-    pub fn wl_keyboard(&self) -> WlKeyboard {
+    pub fn wl_keyboard(&self) -> Option<WlKeyboard> {
+        let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
         unsafe {
-            let ptr = ffi::gdk_wayland_device_get_wl_keyboard(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let keyboard_ptr = ffi::gdk_wayland_device_get_wl_keyboard(self.to_glib_none().0);
+            if keyboard_ptr.is_null() {
+                None
+            } else {
+                let cnx = display.connection();
+                let id =
+                    ObjectId::from_ptr(WlKeyboard::interface(), keyboard_ptr as *mut _).unwrap();
+
+                WlKeyboard::from_id(&cnx, id).ok()
+            }
         }
     }
 
     #[doc(alias = "gdk_wayland_device_get_wl_pointer")]
     #[doc(alias = "get_wl_pointer")]
-    pub fn wl_pointer(&self) -> WlPointer {
+    pub fn wl_pointer(&self) -> Option<WlPointer> {
+        let display = self.display().downcast::<crate::WaylandDisplay>().unwrap();
         unsafe {
-            let ptr = ffi::gdk_wayland_device_get_wl_pointer(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let pointer_ptr = ffi::gdk_wayland_device_get_wl_pointer(self.to_glib_none().0);
+            if pointer_ptr.is_null() {
+                None
+            } else {
+                let cnx = display.connection();
+                let id = ObjectId::from_ptr(WlPointer::interface(), pointer_ptr as *mut _).unwrap();
+
+                WlPointer::from_id(&cnx, id).ok()
+            }
         }
     }
 }
diff --git a/gdkwayland/src/wayland_display.rs b/gdkwayland/src/wayland_display.rs
index a22544b25e29..2b6714854ba4 100644
--- a/gdkwayland/src/wayland_display.rs
+++ b/gdkwayland/src/wayland_display.rs
@@ -1,11 +1,16 @@
 // Take a look at the license at the top of the repository in the LICENSE file.
 
+use glib::once_cell::sync::Lazy;
 use glib::translate::*;
+use glib::{ObjectExt, Quark};
 
+use wayland_client::backend::ObjectId;
 use wayland_client::protocol::{wl_compositor::WlCompositor, wl_display::WlDisplay};
-use wayland_client::sys::client::wl_proxy;
 use wayland_client::Proxy;
 
+static WAYLAND_DISPLAY_CONNECTION_QUARK: Lazy<Quark> =
+    Lazy::new(|| Quark::from_str("gtk-rs-wayland-display-connection-quark"));
+
 glib::wrapper! {
     #[doc(alias = "GdkWaylandDisplay")]
     pub struct WaylandDisplay(Object<ffi::GdkWaylandDisplay>) @extends gdk::Display;
@@ -18,19 +23,34 @@ glib::wrapper! {
 impl WaylandDisplay {
     #[doc(alias = "gdk_wayland_display_get_wl_compositor")]
     #[doc(alias = "get_wl_compositor")]
-    pub fn wl_compositor(&self) -> WlCompositor {
+    pub fn wl_compositor(&self) -> Option<WlCompositor> {
         unsafe {
-            let ptr = ffi::gdk_wayland_display_get_wl_compositor(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let compositor_ptr = ffi::gdk_wayland_display_get_wl_compositor(self.to_glib_none().0);
+            if compositor_ptr.is_null() {
+                None
+            } else {
+                let cnx = self.connection();
+                let id = ObjectId::from_ptr(WlCompositor::interface(), compositor_ptr as *mut _)
+                    .unwrap();
+
+                WlCompositor::from_id(&cnx, id).ok()
+            }
         }
     }
 
     #[doc(alias = "gdk_wayland_display_get_wl_display")]
     #[doc(alias = "get_wl_display")]
-    pub fn wl_display(&self) -> WlDisplay {
+    pub fn wl_display(&self) -> Option<WlDisplay> {
         unsafe {
-            let ptr = ffi::gdk_wayland_display_get_wl_display(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let display_ptr = ffi::gdk_wayland_display_get_wl_display(self.to_glib_none().0);
+            if display_ptr.is_null() {
+                None
+            } else {
+                let cnx = self.connection();
+                let id = ObjectId::from_ptr(WlDisplay::interface(), display_ptr as *mut _).unwrap();
+
+                WlDisplay::from_id(&cnx, id).ok()
+            }
         }
     }
 
@@ -69,4 +89,25 @@ impl WaylandDisplay {
             ))
         }
     }
+
+    pub(crate) fn connection(&self) -> wayland_client::Connection {
+        unsafe {
+            match self
+                .qdata::<Option<wayland_client::Connection>>(*WAYLAND_DISPLAY_CONNECTION_QUARK)
+            {
+                Some(conn) => conn.as_ref().clone().unwrap(),
+                None => {
+                    let display_ptr =
+                        ffi::gdk_wayland_display_get_wl_display(self.to_glib_none().0);
+                    let backend = wayland_backend::sys::client::Backend::from_foreign_display(
+                        display_ptr as *mut _,
+                    );
+                    let conn = wayland_client::Connection::from_backend(backend);
+                    self.set_qdata(*WAYLAND_DISPLAY_CONNECTION_QUARK, conn.clone());
+
+                    conn
+                }
+            }
+        }
+    }
 }
diff --git a/gdkwayland/src/wayland_monitor.rs b/gdkwayland/src/wayland_monitor.rs
index 57a3f5131e8a..64c8daef72b3 100644
--- a/gdkwayland/src/wayland_monitor.rs
+++ b/gdkwayland/src/wayland_monitor.rs
@@ -1,8 +1,10 @@
 // Take a look at the license at the top of the repository in the LICENSE file.
 
+use gdk::prelude::*;
 use glib::translate::ToGlibPtr;
+
+use wayland_client::backend::ObjectId;
 use wayland_client::protocol::wl_output::WlOutput;
-use wayland_client::sys::client::wl_proxy;
 use wayland_client::Proxy;
 
 glib::wrapper! {
@@ -17,10 +19,18 @@ glib::wrapper! {
 impl WaylandMonitor {
     #[doc(alias = "gdk_wayland_monitor_get_wl_output")]
     #[doc(alias = "get_wl_output")]
-    pub fn wl_output(&self) -> WlOutput {
+    pub fn wl_output(&self) -> Option<WlOutput> {
         unsafe {
-            let ptr = ffi::gdk_wayland_monitor_get_wl_output(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let output_ptr = ffi::gdk_wayland_monitor_get_wl_output(self.to_glib_none().0);
+            if output_ptr.is_null() {
+                None
+            } else {
+                let display = self.display()?.unsafe_cast::<crate::WaylandDisplay>();
+                let cnx = display.connection();
+                let id = ObjectId::from_ptr(WlOutput::interface(), output_ptr as *mut _).unwrap();
+
+                WlOutput::from_id(&cnx, id).ok()
+            }
         }
     }
 }
diff --git a/gdkwayland/src/wayland_seat.rs b/gdkwayland/src/wayland_seat.rs
index 713e632fd919..e1d388c3141c 100644
--- a/gdkwayland/src/wayland_seat.rs
+++ b/gdkwayland/src/wayland_seat.rs
@@ -1,8 +1,10 @@
 // Take a look at the license at the top of the repository in the LICENSE file.
 
+use gdk::prelude::*;
 use glib::translate::ToGlibPtr;
+
+use wayland_client::backend::ObjectId;
 use wayland_client::protocol::wl_seat::WlSeat;
-use wayland_client::sys::client::wl_proxy;
 use wayland_client::Proxy;
 
 glib::wrapper! {
@@ -17,10 +19,18 @@ glib::wrapper! {
 impl WaylandSeat {
     #[doc(alias = "gdk_wayland_seat_get_wl_seat")]
     #[doc(alias = "get_wl_seat")]
-    pub fn wl_seat(&self) -> WlSeat {
+    pub fn wl_seat(&self) -> Option<WlSeat> {
         unsafe {
-            let ptr = ffi::gdk_wayland_seat_get_wl_seat(self.to_glib_none().0);
-            Proxy::from_c_ptr(ptr as *mut wl_proxy).into()
+            let seat_ptr = ffi::gdk_wayland_seat_get_wl_seat(self.to_glib_none().0);
+            if seat_ptr.is_null() {
+                None
+            } else {
+                let display = self.display()?.unsafe_cast::<crate::WaylandDisplay>();
+                let cnx = display.connection();
+                let id = ObjectId::from_ptr(WlSeat::interface(), seat_ptr as *mut _).unwrap();
+
+                WlSeat::from_id(&cnx, id).ok()
+            }
         }
     }
 }
diff --git a/gdkx11/src/auto/versions.txt b/gdkx11/src/auto/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/gdkx11/src/auto/versions.txt
+++ b/gdkx11/src/auto/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/gdkx11/sys/versions.txt b/gdkx11/sys/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/gdkx11/sys/versions.txt
+++ b/gdkx11/sys/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/gir-files b/gir-files
index 5eb11fc69910..4eaad6a722bf 160000
--- a/gir-files
+++ b/gir-files
@@ -1,1 +1,1 @@
-Subproject commit 5eb11fc699108e254a19675b5a9cd19626367584
+Subproject commit 4eaad6a722bf41028ea9210d2c356b7078b25008
diff --git a/gtk/src/auto/versions.txt b/gtk/src/auto/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/gtk/src/auto/versions.txt
+++ b/gtk/src/auto/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)
diff --git a/gtk/sys/versions.txt b/gtk/sys/versions.txt
index 59d6f66a7070..426a123aa75b 100644
--- a/gtk/sys/versions.txt
+++ b/gtk/sys/versions.txt
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 047f55810b96)
-from gir-files (https://github.com/gtk-rs/gir-files @ 5eb11fc69910)
+from gir-files (https://github.com/gtk-rs/gir-files @ 4eaad6a722bf)


Test patch: