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

Commit 7bc2398

Browse files
authored
Merge pull request #746 from pbor/backport-0.15
Backport stuff for 0.15
2 parents 807522a + 80d2076 commit 7bc2398

25 files changed

+127
-23
lines changed

.github/workflows/windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010

1111
gvsbuild:
1212
name: build GTK binaries with gvsbuild
13-
runs-on: windows-latest
13+
runs-on: windows-2019
1414

1515
env:
1616
# git revision of gvsbuild we use for to build GTK and the other dependencies
17-
gvsbuildref: ce4c9de92dc3487d15b8f5ecc200705f951b6ae8
17+
gvsbuildref: 861244f84a04da49172c23646d9e23885094cab4
1818

1919
# bump this number if you want to force a rebuild of gvsbuild with the same revision
2020
gvsbuildupdate: 1
@@ -64,7 +64,7 @@ jobs:
6464

6565
build:
6666
name: build gtk-rs on Windows
67-
runs-on: windows-latest
67+
runs-on: windows-2019
6868
needs: gvsbuild
6969

7070
strategy:

atk/src/auto/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

atk/sys/tests/abi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl Results {
110110
}
111111

112112
#[test]
113+
#[cfg(target_os = "linux")]
113114
fn cross_validate_constants_with_c() {
114115
let mut c_constants: Vec<(String, String)> = Vec::new();
115116

@@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() {
150151
}
151152

152153
#[test]
154+
#[cfg(target_os = "linux")]
153155
fn cross_validate_layout_with_c() {
154156
let mut c_layouts = Vec::new();
155157

atk/sys/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

gdk/src/auto/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

gdk/sys/tests/abi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl Results {
110110
}
111111

112112
#[test]
113+
#[cfg(target_os = "linux")]
113114
fn cross_validate_constants_with_c() {
114115
let mut c_constants: Vec<(String, String)> = Vec::new();
115116

@@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() {
150151
}
151152

152153
#[test]
154+
#[cfg(target_os = "linux")]
153155
fn cross_validate_layout_with_c() {
154156
let mut c_layouts = Vec::new();
155157

gdk/sys/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

gdkwayland/src/wayland_window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl WaylandWindow {
4949
let window = from_glib_borrow(window);
5050
let handle: Borrowed<glib::GString> = from_glib_borrow(handle);
5151
let callback: &P = &*(user_data as *mut _);
52-
(*callback)(&window, &handle.as_str());
52+
(*callback)(&window, handle.as_str());
5353
}
5454
unsafe extern "C" fn destroy_notify<P: Fn(&WaylandWindow, &str) + 'static>(
5555
data: glib::ffi::gpointer,

gdkx11/src/auto/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

gdkx11/src/auto/x11_app_launch_context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ glib::wrapper! {
1313
}
1414
}
1515

16+
impl X11AppLaunchContext {}
17+
1618
impl fmt::Display for X11AppLaunchContext {
1719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1820
f.write_str("X11AppLaunchContext")

gdkx11/src/auto/x11_device_core.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ glib::wrapper! {
1313
}
1414
}
1515

16+
impl X11DeviceCore {}
17+
1618
impl fmt::Display for X11DeviceCore {
1719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1820
f.write_str("X11DeviceCore")

gdkx11/src/auto/x11_display_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ glib::wrapper! {
1313
}
1414
}
1515

16+
impl X11DisplayManager {}
17+
1618
impl fmt::Display for X11DisplayManager {
1719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1820
f.write_str("X11DisplayManager")

gdkx11/src/auto/x11_drag_context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ glib::wrapper! {
1313
}
1414
}
1515

16+
impl X11DragContext {}
17+
1618
impl fmt::Display for X11DragContext {
1719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1820
f.write_str("X11DragContext")

gdkx11/src/auto/x11_visual.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ glib::wrapper! {
1313
}
1414
}
1515

16+
impl X11Visual {}
17+
1618
impl fmt::Display for X11Visual {
1719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1820
f.write_str("X11Visual")

gdkx11/src/auto/x11gl_context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ glib::wrapper! {
1313
}
1414
}
1515

16+
impl X11GLContext {}
17+
1618
impl fmt::Display for X11GLContext {
1719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1820
f.write_str("X11GLContext")

gdkx11/sys/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

gtk/src/auto/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

gtk/src/stack_switcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<O: IsA<StackSwitcher>> StackSwitcherExtManual for O {
6565
f: glib::ffi::gpointer,
6666
) {
6767
let f: &F = &*(f as *const F);
68-
f(&StackSwitcher::from_glib_borrow(this).unsafe_cast_ref())
68+
f(StackSwitcher::from_glib_borrow(this).unsafe_cast_ref())
6969
}
7070
unsafe {
7171
let f: Box_<F> = Box_::new(f);

gtk/src/subclass/entry.rs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use glib::subclass::prelude::*;
4+
use glib::translate::*;
5+
use glib::Cast;
6+
7+
use super::widget::WidgetImpl;
8+
use crate::Entry;
9+
use crate::Widget;
10+
11+
pub trait EntryImpl: EntryImplExt + WidgetImpl {
12+
fn populate_popup(&self, entry: &Self::Type, popup: &Widget) {
13+
self.parent_populate_popup(entry, popup)
14+
}
15+
16+
fn activate(&self, entry: &Self::Type) {
17+
self.parent_activate(entry)
18+
}
19+
}
20+
21+
pub trait EntryImplExt: ObjectSubclass {
22+
fn parent_populate_popup(&self, entry: &Self::Type, popup: &Widget);
23+
fn parent_activate(&self, entry: &Self::Type);
24+
}
25+
26+
impl<T: EntryImpl> EntryImplExt for T {
27+
fn parent_populate_popup(&self, entry: &Self::Type, popup: &Widget) {
28+
unsafe {
29+
let data = T::type_data();
30+
let parent_class = data.as_ref().parent_class() as *mut ffi::GtkEntryClass;
31+
if let Some(f) = (*parent_class).populate_popup {
32+
f(
33+
entry.unsafe_cast_ref::<Entry>().to_glib_none().0,
34+
popup.to_glib_none().0,
35+
)
36+
}
37+
}
38+
}
39+
40+
fn parent_activate(&self, entry: &Self::Type) {
41+
unsafe {
42+
let data = T::type_data();
43+
let parent_class = data.as_ref().parent_class() as *mut ffi::GtkEntryClass;
44+
if let Some(f) = (*parent_class).activate {
45+
f(entry.unsafe_cast_ref::<Entry>().to_glib_none().0)
46+
}
47+
}
48+
}
49+
}
50+
51+
unsafe impl<T: EntryImpl> IsSubclassable<T> for Entry {
52+
fn class_init(class: &mut glib::Class<Self>) {
53+
Self::parent_class_init::<T>(class);
54+
55+
if !crate::rt::is_initialized() {
56+
panic!("GTK has to be initialized first");
57+
}
58+
59+
let klass = class.as_mut();
60+
klass.populate_popup = Some(entry_populate_popup::<T>);
61+
klass.activate = Some(entry_activate::<T>);
62+
}
63+
}
64+
65+
unsafe extern "C" fn entry_populate_popup<T: EntryImpl>(
66+
ptr: *mut ffi::GtkEntry,
67+
popupptr: *mut ffi::GtkWidget,
68+
) {
69+
let instance = &*(ptr as *mut T::Instance);
70+
let imp = instance.imp();
71+
let wrap: Borrowed<Entry> = from_glib_borrow(ptr);
72+
let popup: Borrowed<Widget> = from_glib_borrow(popupptr);
73+
74+
imp.populate_popup(wrap.unsafe_cast_ref(), &popup)
75+
}
76+
77+
unsafe extern "C" fn entry_activate<T: EntryImpl>(ptr: *mut ffi::GtkEntry) {
78+
let instance = &*(ptr as *mut T::Instance);
79+
let imp = instance.imp();
80+
let wrap: Borrowed<Entry> = from_glib_borrow(ptr);
81+
82+
imp.activate(wrap.unsafe_cast_ref())
83+
}

gtk/src/subclass/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub mod cell_renderer_toggle;
1717
pub mod container;
1818
pub mod dialog;
1919
pub mod drawing_area;
20+
pub mod entry;
2021
pub mod event_box;
2122
pub mod fixed;
2223
pub mod header_bar;
@@ -56,6 +57,7 @@ pub mod prelude {
5657
pub use super::container::{ContainerClassSubclassExt, ContainerImpl, ContainerImplExt};
5758
pub use super::dialog::{DialogImpl, DialogImplExt};
5859
pub use super::drawing_area::DrawingAreaImpl;
60+
pub use super::entry::{EntryImpl, EntryImplExt};
5961
pub use super::event_box::EventBoxImpl;
6062
pub use super::fixed::FixedImpl;
6163
pub use super::header_bar::HeaderBarImpl;

gtk/sys/tests/abi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl Results {
110110
}
111111

112112
#[test]
113+
#[cfg(target_os = "linux")]
113114
fn cross_validate_constants_with_c() {
114115
let mut c_constants: Vec<(String, String)> = Vec::new();
115116

@@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() {
150151
}
151152

152153
#[test]
154+
#[cfg(target_os = "linux")]
153155
fn cross_validate_layout_with_c() {
154156
let mut c_layouts = Vec::new();
155157

gtk/sys/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5)
1+
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234)

rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
edition = "2021"

0 commit comments

Comments
 (0)