Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 6623273

Browse files
Make gdk::Device, gdk::Monitor and gdk::Seat non-final types
1 parent e9db20a commit 6623273

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

gdk/Gir.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ generate = [
4040
"Gdk.InputSource",
4141
"Gdk.ModifierIntent",
4242
"Gdk.ModifierType",
43-
"Gdk.Monitor",
4443
"Gdk.NotifyType",
4544
"Gdk.OwnerChange",
4645
"Gdk.PropertyState",
4746
"Gdk.PropMode",
4847
"Gdk.ScrollDirection",
49-
"Gdk.Seat",
5048
"Gdk.SeatCapabilities",
5149
"Gdk.SettingAction",
5250
"Gdk.SubpixelLayout",
@@ -240,6 +238,8 @@ status = "generate"
240238
[[object]]
241239
name = "Gdk.Device"
242240
status = "generate"
241+
final_type = false
242+
manual_traits = ["DeviceExtManual"]
243243
[[object.function]]
244244
name = "get_display"
245245
[object.function.return]
@@ -368,6 +368,11 @@ status = "generate"
368368
name = "lookup_key"
369369
manual = true
370370

371+
[[object]]
372+
name = "Gdk.Monitor"
373+
status = "generate"
374+
final_type = false
375+
371376
[[object]]
372377
name = "Gdk.Rectangle"
373378
status = "generate"
@@ -421,6 +426,11 @@ status = "generate"
421426
# the actual method getter after auto-renaming.
422427
rename = "screen_width_mm"
423428

429+
[[object]]
430+
name = "Gdk.Seat"
431+
status = "generate"
432+
final_type = false
433+
424434
[[object]]
425435
name = "Gdk.Visual"
426436
status = "generate"

gdk/src/device.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,34 @@ use glib::translate::*;
1010
use std::mem;
1111
use std::ptr;
1212

13-
impl Device {
13+
pub trait DeviceExtManual: 'static {
1414
#[doc(alias = "gdk_device_get_axis")]
1515
#[doc(alias = "get_axis")]
16-
pub fn is_axis(&self, axes: &mut [f64], use_: AxisUse, value: &mut f64) -> bool {
16+
fn is_axis(&self, axes: &mut [f64], use_: AxisUse, value: &mut f64) -> bool;
17+
18+
#[doc(alias = "gdk_device_get_history")]
19+
#[doc(alias = "get_history")]
20+
fn history<P: IsA<Window>>(&self, window: &P, start: u32, stop: u32) -> Vec<TimeCoord>;
21+
}
22+
23+
impl<O: IsA<Device>> DeviceExtManual for O {
24+
fn is_axis(&self, axes: &mut [f64], use_: AxisUse, value: &mut f64) -> bool {
1725
unsafe {
1826
from_glib(ffi::gdk_device_get_axis(
19-
self.to_glib_none().0,
27+
self.as_ref().to_glib_none().0,
2028
axes.as_mut_ptr(),
2129
use_.into_glib(),
2230
value,
2331
))
2432
}
2533
}
2634

27-
#[doc(alias = "gdk_device_get_history")]
28-
#[doc(alias = "get_history")]
29-
pub fn history<P: IsA<Window>>(&self, window: &P, start: u32, stop: u32) -> Vec<TimeCoord> {
35+
fn history<P: IsA<Window>>(&self, window: &P, start: u32, stop: u32) -> Vec<TimeCoord> {
3036
unsafe {
3137
let mut events = ptr::null_mut();
3238
let mut n_events = mem::MaybeUninit::uninit();
3339
let ret: bool = from_glib(ffi::gdk_device_get_history(
34-
self.to_glib_none().0,
40+
self.as_ref().to_glib_none().0,
3541
window.as_ref().to_glib_none().0,
3642
start,
3743
stop,

gdk/src/prelude.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
pub use crate::auto::traits::*;
66
pub use crate::cairo_interaction::{GdkContextExt, GdkPixbufExt, GdkSurfaceExt};
7+
pub use crate::device::DeviceExtManual;
78
pub use crate::display::DisplayExtManual;
89
pub use crate::window::WindowExtManual;
910

0 commit comments

Comments
 (0)