Skip to content

Commit 7272eff

Browse files
gtk/gdk: mark Snapshot as not final and implement necessary traits
Fixes #799
1 parent 49f43cc commit 7272eff

File tree

23 files changed

+423
-179
lines changed

23 files changed

+423
-179
lines changed

examples/custom_paintable/custom_paintable/imp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ impl PaintableImpl for CustomPaintable {
2929
}
3030

3131
fn snapshot(&self, snapshot: &gdk::Snapshot, width: f64, height: f64) {
32-
let snapshot = snapshot.downcast_ref::<gtk::Snapshot>().unwrap();
3332
// Draw a linear gradient
3433
snapshot.append_linear_gradient(
3534
&graphene::Rect::new(0.0, 0.0, width as f32, height as f32),

gdk4-wayland/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ b5068ede6c51)
1+
Generated by gir (https://github.com/gtk-rs/gir @ b3147f2b6043)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7fa401e3ee5d)

gdk4-wayland/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ b5068ede6c51)
1+
Generated by gir (https://github.com/gtk-rs/gir @ b3147f2b6043)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7fa401e3ee5d)

gdk4-x11/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ b5068ede6c51)
1+
Generated by gir (https://github.com/gtk-rs/gir @ b3147f2b6043)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7fa401e3ee5d)

gdk4-x11/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ b5068ede6c51)
1+
Generated by gir (https://github.com/gtk-rs/gir @ b3147f2b6043)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7fa401e3ee5d)

gdk4/Gir.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ generate = [
5353
"Gdk.ScrollEvent",
5454
"Gdk.ScrollUnit",
5555
"Gdk.SeatCapabilities",
56-
"Gdk.Snapshot",
5756
"Gdk.SubpixelLayout",
5857
"Gdk.SurfaceEdge",
5958
"Gdk.TextureError",
@@ -559,6 +558,11 @@ name = "Gdk.Seat"
559558
status = "generate"
560559
final_type = false
561560

561+
[[object]]
562+
name = "Gdk.Snapshot"
563+
status = "generate"
564+
final_type = false
565+
562566
[[object]]
563567
name = "Gdk.Surface"
564568
status = "generate"

gdk4/src/auto/paintable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub trait PaintableExt: 'static {
7676
fn invalidate_size(&self);
7777

7878
#[doc(alias = "gdk_paintable_snapshot")]
79-
fn snapshot(&self, snapshot: &Snapshot, width: f64, height: f64);
79+
fn snapshot(&self, snapshot: &impl IsA<Snapshot>, width: f64, height: f64);
8080

8181
#[doc(alias = "invalidate-contents")]
8282
fn connect_invalidate_contents<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
@@ -145,11 +145,11 @@ impl<O: IsA<Paintable>> PaintableExt for O {
145145
}
146146
}
147147

148-
fn snapshot(&self, snapshot: &Snapshot, width: f64, height: f64) {
148+
fn snapshot(&self, snapshot: &impl IsA<Snapshot>, width: f64, height: f64) {
149149
unsafe {
150150
ffi::gdk_paintable_snapshot(
151151
self.as_ref().to_glib_none().0,
152-
snapshot.to_glib_none().0,
152+
snapshot.as_ref().to_glib_none().0,
153153
width,
154154
height,
155155
);

gdk4/src/auto/snapshot.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ glib::wrapper! {
1313
}
1414
}
1515

16-
impl Snapshot {}
16+
impl Snapshot {
17+
pub const NONE: Option<&'static Snapshot> = None;
18+
}
1719

1820
impl fmt::Display for Snapshot {
1921
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

gdk4/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ b5068ede6c51)
1+
Generated by gir (https://github.com/gtk-rs/gir @ b3147f2b6043)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7fa401e3ee5d)

gdk4/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ b5068ede6c51)
1+
Generated by gir (https://github.com/gtk-rs/gir @ b3147f2b6043)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 7fa401e3ee5d)

0 commit comments

Comments
 (0)