diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index adb540aba182..da2694b9cf89 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,11 +10,11 @@ jobs: gvsbuild: name: build GTK binaries with gvsbuild - runs-on: windows-latest + runs-on: windows-2019 env: # git revision of gvsbuild we use for to build GTK and the other dependencies - gvsbuildref: ce4c9de92dc3487d15b8f5ecc200705f951b6ae8 + gvsbuildref: 861244f84a04da49172c23646d9e23885094cab4 # bump this number if you want to force a rebuild of gvsbuild with the same revision gvsbuildupdate: 1 @@ -64,7 +64,7 @@ jobs: build: name: build gtk-rs on Windows - runs-on: windows-latest + runs-on: windows-2019 needs: gvsbuild strategy: diff --git a/atk/src/auto/versions.txt b/atk/src/auto/versions.txt index 41fa549b0413..dbe00cf3e2b5 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 @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/atk/sys/tests/abi.rs b/atk/sys/tests/abi.rs index 1751b83cb557..16d1713af095 100644 --- a/atk/sys/tests/abi.rs +++ b/atk/sys/tests/abi.rs @@ -110,6 +110,7 @@ impl Results { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_constants_with_c() { let mut c_constants: Vec<(String, String)> = Vec::new(); @@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_layout_with_c() { let mut c_layouts = Vec::new(); diff --git a/atk/sys/versions.txt b/atk/sys/versions.txt index 41fa549b0413..dbe00cf3e2b5 100644 --- a/atk/sys/versions.txt +++ b/atk/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/gdk/src/auto/versions.txt b/gdk/src/auto/versions.txt index 41fa549b0413..dbe00cf3e2b5 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 @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/gdk/sys/tests/abi.rs b/gdk/sys/tests/abi.rs index b19c0c767a5f..649e0fbf8ff9 100644 --- a/gdk/sys/tests/abi.rs +++ b/gdk/sys/tests/abi.rs @@ -110,6 +110,7 @@ impl Results { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_constants_with_c() { let mut c_constants: Vec<(String, String)> = Vec::new(); @@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_layout_with_c() { let mut c_layouts = Vec::new(); diff --git a/gdk/sys/versions.txt b/gdk/sys/versions.txt index 41fa549b0413..dbe00cf3e2b5 100644 --- a/gdk/sys/versions.txt +++ b/gdk/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/gdkwayland/src/wayland_window.rs b/gdkwayland/src/wayland_window.rs index 518a228da2c0..ed5fb8ce1e37 100644 --- a/gdkwayland/src/wayland_window.rs +++ b/gdkwayland/src/wayland_window.rs @@ -49,7 +49,7 @@ impl WaylandWindow { let window = from_glib_borrow(window); let handle: Borrowed = from_glib_borrow(handle); let callback: &P = &*(user_data as *mut _); - (*callback)(&window, &handle.as_str()); + (*callback)(&window, handle.as_str()); } unsafe extern "C" fn destroy_notify( data: glib::ffi::gpointer, diff --git a/gdkx11/src/auto/versions.txt b/gdkx11/src/auto/versions.txt index 41fa549b0413..dbe00cf3e2b5 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 @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/gdkx11/src/auto/x11_app_launch_context.rs b/gdkx11/src/auto/x11_app_launch_context.rs index f7f2718e4ef1..7976049dd4ab 100644 --- a/gdkx11/src/auto/x11_app_launch_context.rs +++ b/gdkx11/src/auto/x11_app_launch_context.rs @@ -13,6 +13,8 @@ glib::wrapper! { } } +impl X11AppLaunchContext {} + impl fmt::Display for X11AppLaunchContext { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11AppLaunchContext") diff --git a/gdkx11/src/auto/x11_device_core.rs b/gdkx11/src/auto/x11_device_core.rs index aac78887e981..4fd0722bde31 100644 --- a/gdkx11/src/auto/x11_device_core.rs +++ b/gdkx11/src/auto/x11_device_core.rs @@ -13,6 +13,8 @@ glib::wrapper! { } } +impl X11DeviceCore {} + impl fmt::Display for X11DeviceCore { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11DeviceCore") diff --git a/gdkx11/src/auto/x11_display_manager.rs b/gdkx11/src/auto/x11_display_manager.rs index 368c4a3b6965..ad4189ca8480 100644 --- a/gdkx11/src/auto/x11_display_manager.rs +++ b/gdkx11/src/auto/x11_display_manager.rs @@ -13,6 +13,8 @@ glib::wrapper! { } } +impl X11DisplayManager {} + impl fmt::Display for X11DisplayManager { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11DisplayManager") diff --git a/gdkx11/src/auto/x11_drag_context.rs b/gdkx11/src/auto/x11_drag_context.rs index 8e3601397d0a..6ea10353ee41 100644 --- a/gdkx11/src/auto/x11_drag_context.rs +++ b/gdkx11/src/auto/x11_drag_context.rs @@ -13,6 +13,8 @@ glib::wrapper! { } } +impl X11DragContext {} + impl fmt::Display for X11DragContext { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11DragContext") diff --git a/gdkx11/src/auto/x11_visual.rs b/gdkx11/src/auto/x11_visual.rs index 0f0287ac6e53..d3694c1db083 100644 --- a/gdkx11/src/auto/x11_visual.rs +++ b/gdkx11/src/auto/x11_visual.rs @@ -13,6 +13,8 @@ glib::wrapper! { } } +impl X11Visual {} + impl fmt::Display for X11Visual { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11Visual") diff --git a/gdkx11/src/auto/x11gl_context.rs b/gdkx11/src/auto/x11gl_context.rs index f582f0367af8..de3f64d820b6 100644 --- a/gdkx11/src/auto/x11gl_context.rs +++ b/gdkx11/src/auto/x11gl_context.rs @@ -13,6 +13,8 @@ glib::wrapper! { } } +impl X11GLContext {} + impl fmt::Display for X11GLContext { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("X11GLContext") diff --git a/gdkx11/sys/versions.txt b/gdkx11/sys/versions.txt index 41fa549b0413..dbe00cf3e2b5 100644 --- a/gdkx11/sys/versions.txt +++ b/gdkx11/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/gir b/gir index 78e3d3c22343..c8a7a13d2c4d 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit 78e3d3c223436bd056b312fe54d845eea8d29f27 +Subproject commit c8a7a13d2c4d3a57ae646e38a821d57243cf7983 diff --git a/gir-files b/gir-files index 68003b4b40e5..75db22efb234 160000 --- a/gir-files +++ b/gir-files @@ -1 +1 @@ -Subproject commit 68003b4b40e5371e759725527e6490c9913bcbbf +Subproject commit 75db22efb23487a7aa01c25a59c35e9e33f2497a diff --git a/gtk/src/auto/versions.txt b/gtk/src/auto/versions.txt index 41fa549b0413..dbe00cf3e2b5 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 @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/gtk/src/stack_switcher.rs b/gtk/src/stack_switcher.rs index 6c41d99cdfb9..270073f335cf 100644 --- a/gtk/src/stack_switcher.rs +++ b/gtk/src/stack_switcher.rs @@ -65,7 +65,7 @@ impl> StackSwitcherExtManual for O { f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); - f(&StackSwitcher::from_glib_borrow(this).unsafe_cast_ref()) + f(StackSwitcher::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); diff --git a/gtk/src/subclass/entry.rs b/gtk/src/subclass/entry.rs new file mode 100644 index 000000000000..3aa631970780 --- /dev/null +++ b/gtk/src/subclass/entry.rs @@ -0,0 +1,83 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +use glib::subclass::prelude::*; +use glib::translate::*; +use glib::Cast; + +use super::widget::WidgetImpl; +use crate::Entry; +use crate::Widget; + +pub trait EntryImpl: EntryImplExt + WidgetImpl { + fn populate_popup(&self, entry: &Self::Type, popup: &Widget) { + self.parent_populate_popup(entry, popup) + } + + fn activate(&self, entry: &Self::Type) { + self.parent_activate(entry) + } +} + +pub trait EntryImplExt: ObjectSubclass { + fn parent_populate_popup(&self, entry: &Self::Type, popup: &Widget); + fn parent_activate(&self, entry: &Self::Type); +} + +impl EntryImplExt for T { + fn parent_populate_popup(&self, entry: &Self::Type, popup: &Widget) { + unsafe { + let data = T::type_data(); + let parent_class = data.as_ref().parent_class() as *mut ffi::GtkEntryClass; + if let Some(f) = (*parent_class).populate_popup { + f( + entry.unsafe_cast_ref::().to_glib_none().0, + popup.to_glib_none().0, + ) + } + } + } + + fn parent_activate(&self, entry: &Self::Type) { + unsafe { + let data = T::type_data(); + let parent_class = data.as_ref().parent_class() as *mut ffi::GtkEntryClass; + if let Some(f) = (*parent_class).activate { + f(entry.unsafe_cast_ref::().to_glib_none().0) + } + } + } +} + +unsafe impl IsSubclassable for Entry { + fn class_init(class: &mut glib::Class) { + Self::parent_class_init::(class); + + if !crate::rt::is_initialized() { + panic!("GTK has to be initialized first"); + } + + let klass = class.as_mut(); + klass.populate_popup = Some(entry_populate_popup::); + klass.activate = Some(entry_activate::); + } +} + +unsafe extern "C" fn entry_populate_popup( + ptr: *mut ffi::GtkEntry, + popupptr: *mut ffi::GtkWidget, +) { + let instance = &*(ptr as *mut T::Instance); + let imp = instance.imp(); + let wrap: Borrowed = from_glib_borrow(ptr); + let popup: Borrowed = from_glib_borrow(popupptr); + + imp.populate_popup(wrap.unsafe_cast_ref(), &popup) +} + +unsafe extern "C" fn entry_activate(ptr: *mut ffi::GtkEntry) { + let instance = &*(ptr as *mut T::Instance); + let imp = instance.imp(); + let wrap: Borrowed = from_glib_borrow(ptr); + + imp.activate(wrap.unsafe_cast_ref()) +} diff --git a/gtk/src/subclass/mod.rs b/gtk/src/subclass/mod.rs index 5c194ee14c2d..6776c940d393 100644 --- a/gtk/src/subclass/mod.rs +++ b/gtk/src/subclass/mod.rs @@ -17,6 +17,7 @@ pub mod cell_renderer_toggle; pub mod container; pub mod dialog; pub mod drawing_area; +pub mod entry; pub mod event_box; pub mod fixed; pub mod header_bar; @@ -56,6 +57,7 @@ pub mod prelude { pub use super::container::{ContainerClassSubclassExt, ContainerImpl, ContainerImplExt}; pub use super::dialog::{DialogImpl, DialogImplExt}; pub use super::drawing_area::DrawingAreaImpl; + pub use super::entry::{EntryImpl, EntryImplExt}; pub use super::event_box::EventBoxImpl; pub use super::fixed::FixedImpl; pub use super::header_bar::HeaderBarImpl; diff --git a/gtk/sys/tests/abi.rs b/gtk/sys/tests/abi.rs index 7e0f27d62f5c..9939d3df81b8 100644 --- a/gtk/sys/tests/abi.rs +++ b/gtk/sys/tests/abi.rs @@ -110,6 +110,7 @@ impl Results { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_constants_with_c() { let mut c_constants: Vec<(String, String)> = Vec::new(); @@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_layout_with_c() { let mut c_layouts = Vec::new(); diff --git a/gtk/sys/versions.txt b/gtk/sys/versions.txt index 41fa549b0413..dbe00cf3e2b5 100644 --- a/gtk/sys/versions.txt +++ b/gtk/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 78e3d3c22343) -from gir-files (https://github.com/gtk-rs/gir-files @ 68003b4b40e5) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (https://github.com/gtk-rs/gir-files @ 75db22efb234) diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 000000000000..3a26366d4da6 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +edition = "2021"