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

Commit b678651

Browse files
authored
Merge pull request #724 from sdroege/0.15-backports
0.15 backports
2 parents ae6eda4 + 5f678e7 commit b678651

File tree

13 files changed

+113
-53
lines changed

13 files changed

+113
-53
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- uses: actions-rs/cargo@v1
3838
with:
3939
command: doc
40-
args: -p atk -p atk-sys -p gdk -p gdk-sys -p gdkx11 -p gdkx11-sys -p gtk -p gtk3-macros -p gtk-sys --features dox --no-deps
40+
args: -p atk -p atk-sys -p gdk -p gdk-sys -p gdkx11 -p gdkx11-sys -p gtk -p gtk3-macros -p gtk-sys -p gdkwayland -p gdkwayland-sys --features dox --no-deps
4141
- run: echo "RELEASE=$(echo '${{ github.event.release.tag_name }}' | grep -Po '(\d+)\.(\d+)')" >> ${GITHUB_ENV}
4242
- run: echo "DEST=stable/0.15" >> ${GITHUB_ENV}
4343
- name: Grab gtk-rs LOGO

examples/basic_subclass/simple_application/imp.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl ApplicationImpl for SimpleApplication {
2929
/// aksed to present itself.
3030
fn activate(&self, app: &Self::Type) {
3131
let app = app.downcast_ref::<super::SimpleApplication>().unwrap();
32-
let priv_ = SimpleApplication::from_instance(app);
33-
let window = priv_
32+
let imp = app.imp();
33+
let window = imp
3434
.window
3535
.get()
3636
.expect("Should always be initiliazed in gio_application_startup");
@@ -49,10 +49,9 @@ impl ApplicationImpl for SimpleApplication {
4949
self.parent_startup(app);
5050

5151
let app = app.downcast_ref::<super::SimpleApplication>().unwrap();
52-
let priv_ = SimpleApplication::from_instance(app);
52+
let imp = app.imp();
5353
let window = SimpleWindow::new(app);
54-
priv_
55-
.window
54+
imp.window
5655
.set(window)
5756
.expect("Failed to initialize application window");
5857
}

examples/basic_subclass/simple_window/imp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ impl ObjectImpl for SimpleWindow {
4141
// Connect our method `on_increment_clicked` to be called
4242
// when the increment button is clicked.
4343
increment.connect_clicked(clone!(@weak obj => move |_| {
44-
let priv_ = SimpleWindow::from_instance(&obj);
45-
priv_.on_increment_clicked();
44+
let imp = obj.imp();
45+
imp.on_increment_clicked();
4646
}));
4747

4848
obj.add(&label);

examples/composite_template/example_application_window/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ impl ExampleApplicationWindow {
1818
fn init_label(&self) {
1919
// To access fields such as template children, you must get
2020
// the private struct.
21-
let self_ = imp::ExampleApplicationWindow::from_instance(self);
22-
self_
23-
.subtitle
21+
let imp = self.imp();
22+
imp.subtitle
2423
.set_text("This is an example window made using composite templates");
2524
}
2625
}

examples/list_box_model/model/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ impl Model {
1919
}
2020

2121
pub fn append(&self, obj: &RowData) {
22-
let self_ = imp::Model::from_instance(self);
22+
let imp = self.imp();
2323
let index = {
2424
// Borrow the data only once and ensure the borrow guard is dropped
2525
// before we emit the items_changed signal because the view
2626
// could call get_item / get_n_item from the signal handler to update its state
27-
let mut data = self_.0.borrow_mut();
27+
let mut data = imp.0.borrow_mut();
2828
data.push(obj.clone());
2929
data.len() - 1
3030
};
@@ -33,8 +33,8 @@ impl Model {
3333
}
3434

3535
pub fn remove(&self, index: u32) {
36-
let self_ = imp::Model::from_instance(self);
37-
self_.0.borrow_mut().remove(index as usize);
36+
let imp = self.imp();
37+
imp.0.borrow_mut().remove(index as usize);
3838
// Emits a signal that 1 item was removed, 0 added at the position index
3939
self.items_changed(index, 1, 0);
4040
}

gdk/src/geometry.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@ glib::wrapper! {
1010
}
1111

1212
impl Geometry {
13+
#[allow(clippy::too_many_arguments)]
14+
pub fn new(
15+
min_width: i32,
16+
min_height: i32,
17+
max_width: i32,
18+
max_height: i32,
19+
base_width: i32,
20+
base_height: i32,
21+
width_inc: i32,
22+
height_inc: i32,
23+
min_aspect: f64,
24+
max_aspect: f64,
25+
win_gravity: Gravity,
26+
) -> Self {
27+
assert_initialized_main_thread!();
28+
unsafe {
29+
Geometry::unsafe_from(ffi::GdkGeometry {
30+
min_width,
31+
min_height,
32+
max_width,
33+
max_height,
34+
base_width,
35+
base_height,
36+
width_inc,
37+
height_inc,
38+
min_aspect,
39+
max_aspect,
40+
win_gravity: win_gravity.into_glib(),
41+
})
42+
}
43+
}
44+
1345
pub fn min_width(&self) -> i32 {
1446
self.inner.min_width
1547
}

gdkwayland/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3+
#![cfg_attr(feature = "dox", feature(doc_cfg))]
34
#![doc = include_str!("../README.md")]
45

6+
pub use ffi;
57
pub use gdk;
68

79
mod wayland_device;

gdkwayland/sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(feature = "dox", feature(doc_cfg))]
2+
13
use gdk::{GdkAtom, GdkDevicePadFeature};
24
use glib::{gpointer, GType};
35
use libc::{c_char, c_int, c_uint};

gtk/Gir.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,6 +2276,8 @@ manual_traits = ["TextBufferExtManual"]
22762276
name = "Gtk.TextIter"
22772277
status = "generate"
22782278
boxed_inline = true
2279+
[[object.derive]]
2280+
name = "Debug"
22792281
[[object.function]]
22802282
name = "get_attributes"
22812283
manual = true
@@ -2394,6 +2396,8 @@ generate_builder = true
23942396
name = "Gtk.TreeIter"
23952397
status = "generate"
23962398
boxed_inline = true
2399+
[[object.derive]]
2400+
name = "Debug"
23972401

23982402
[[object]]
23992403
name = "Gtk.TreeModel"

gtk/src/auto/text_iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use glib::translate::*;
1212
use std::cmp;
1313

1414
glib::wrapper! {
15+
#[derive(Debug)]
1516
pub struct TextIter(BoxedInline<ffi::GtkTextIter>);
1617

1718
match fn {

0 commit comments

Comments
 (0)