From fc925218b2f182d2096bc028075b3cd7575540ea Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 4 Nov 2020 22:28:21 +0100 Subject: [PATCH 1/3] Regenerate with gtk 3.99.3 Fixes #29 --- gdk4/src/auto/content_formats.rs | 4 +- gdk4/src/auto/enums.rs | 18 +- gdk4/src/auto/flags.rs | 63 --- gdk4/src/auto/frame_clock.rs | 4 + gdk4/src/auto/functions.rs | 6 + gdk4/src/auto/mod.rs | 1 - gdk4/src/auto/popup.rs | 31 ++ gdk4/src/auto/surface.rs | 93 +++-- gdk4/src/auto/toplevel.rs | 25 +- gdk4/src/auto/toplevel_layout.rs | 18 +- gdk4/src/auto/versions.txt | 2 +- gdk4/src/cairo_interaction.rs | 26 +- gdk4/sys/src/lib.rs | 100 ++--- gdk4/sys/tests/abi.rs | 61 +-- gdk4/sys/versions.txt | 2 +- gir-files | 2 +- gsk4/src/auto/enums.rs | 46 ++- gsk4/src/auto/text_node.rs | 13 +- gsk4/src/auto/versions.txt | 2 +- gsk4/sys/src/lib.rs | 298 +++++++++++++- gsk4/sys/tests/abi.rs | 57 ++- gsk4/sys/versions.txt | 2 +- gtk4/src/auto/about_dialog.rs | 12 +- gtk4/src/auto/accessible.rs | 43 +- gtk4/src/auto/any_filter.rs | 3 +- gtk4/src/auto/at_context.rs | 31 +- gtk4/src/auto/buildable.rs | 95 +---- gtk4/src/auto/check_button.rs | 245 +++++++++--- gtk4/src/auto/color_button.rs | 86 +--- gtk4/src/auto/column_view.rs | 11 +- gtk4/src/auto/column_view_column.rs | 15 +- gtk4/src/auto/constants.rs | 486 ----------------------- gtk4/src/auto/custom_filter.rs | 4 +- gtk4/src/auto/directory_list.rs | 43 -- gtk4/src/auto/every_filter.rs | 3 +- gtk4/src/auto/file_filter.rs | 10 + gtk4/src/auto/flags.rs | 65 +-- gtk4/src/auto/functions.rs | 40 +- gtk4/src/auto/gesture.rs | 80 +++- gtk4/src/auto/grid.rs | 30 +- gtk4/src/auto/grid_layout_child.rs | 98 ++--- gtk4/src/auto/grid_view.rs | 24 +- gtk4/src/auto/icon_theme.rs | 18 +- gtk4/src/auto/list_box.rs | 6 + gtk4/src/auto/list_view.rs | 24 +- gtk4/src/auto/mod.rs | 90 ----- gtk4/src/auto/multi_sorter.rs | 3 +- gtk4/src/auto/native.rs | 2 +- gtk4/src/auto/password_entry.rs | 31 ++ gtk4/src/auto/popover.rs | 26 ++ gtk4/src/auto/recent_info.rs | 22 +- gtk4/src/auto/scrolled_window.rs | 17 - gtk4/src/auto/selection_filter_model.rs | 10 - gtk4/src/auto/shortcuts_window.rs | 2 +- gtk4/src/auto/snapshot.rs | 62 +++ gtk4/src/auto/spin_button.rs | 36 +- gtk4/src/auto/stack.rs | 13 +- gtk4/src/auto/text.rs | 122 +++--- gtk4/src/auto/text_buffer.rs | 42 +- gtk4/src/auto/toggle_button.rs | 46 +++ gtk4/src/auto/tree_list_row_sorter.rs | 3 +- gtk4/src/auto/tree_store.rs | 13 +- gtk4/src/auto/versions.txt | 2 +- gtk4/src/auto/widget.rs | 18 +- gtk4/sys/src/lib.rs | 502 +++++++----------------- gtk4/sys/tests/abi.rs | 115 +----- gtk4/sys/versions.txt | 2 +- 67 files changed, 1452 insertions(+), 2073 deletions(-) diff --git a/gdk4/src/auto/content_formats.rs b/gdk4/src/auto/content_formats.rs index 4ff38cc2187f..cebba8a23090 100644 --- a/gdk4/src/auto/content_formats.rs +++ b/gdk4/src/auto/content_formats.rs @@ -121,7 +121,7 @@ impl ContentFormats { pub fn union_deserialize_gtypes(&self) -> Option { unsafe { from_glib_full(gdk_sys::gdk_content_formats_union_deserialize_gtypes( - self.to_glib_none().0, + self.to_glib_full(), )) } } @@ -129,7 +129,7 @@ impl ContentFormats { pub fn union_deserialize_mime_types(&self) -> Option { unsafe { from_glib_full(gdk_sys::gdk_content_formats_union_deserialize_mime_types( - self.to_glib_none().0, + self.to_glib_full(), )) } } diff --git a/gdk4/src/auto/enums.rs b/gdk4/src/auto/enums.rs index d1a20f3588e8..19dbae4e5b9a 100644 --- a/gdk4/src/auto/enums.rs +++ b/gdk4/src/auto/enums.rs @@ -1120,6 +1120,7 @@ impl SetValue for KeyMatch { pub enum MemoryFormat { B8g8r8a8Premultiplied, A8r8g8b8Premultiplied, + R8g8b8a8Premultiplied, B8g8r8a8, A8r8g8b8, R8g8b8a8, @@ -1139,6 +1140,7 @@ impl fmt::Display for MemoryFormat { match *self { MemoryFormat::B8g8r8a8Premultiplied => "B8g8r8a8Premultiplied", MemoryFormat::A8r8g8b8Premultiplied => "A8r8g8b8Premultiplied", + MemoryFormat::R8g8b8a8Premultiplied => "R8g8b8a8Premultiplied", MemoryFormat::B8g8r8a8 => "B8g8r8a8", MemoryFormat::A8r8g8b8 => "A8r8g8b8", MemoryFormat::R8g8b8a8 => "R8g8b8a8", @@ -1160,6 +1162,7 @@ impl ToGlib for MemoryFormat { match *self { MemoryFormat::B8g8r8a8Premultiplied => gdk_sys::GDK_MEMORY_B8G8R8A8_PREMULTIPLIED, MemoryFormat::A8r8g8b8Premultiplied => gdk_sys::GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, + MemoryFormat::R8g8b8a8Premultiplied => gdk_sys::GDK_MEMORY_R8G8B8A8_PREMULTIPLIED, MemoryFormat::B8g8r8a8 => gdk_sys::GDK_MEMORY_B8G8R8A8, MemoryFormat::A8r8g8b8 => gdk_sys::GDK_MEMORY_A8R8G8B8, MemoryFormat::R8g8b8a8 => gdk_sys::GDK_MEMORY_R8G8B8A8, @@ -1179,13 +1182,14 @@ impl FromGlib for MemoryFormat { match value { 0 => MemoryFormat::B8g8r8a8Premultiplied, 1 => MemoryFormat::A8r8g8b8Premultiplied, - 2 => MemoryFormat::B8g8r8a8, - 3 => MemoryFormat::A8r8g8b8, - 4 => MemoryFormat::R8g8b8a8, - 5 => MemoryFormat::A8b8g8r8, - 6 => MemoryFormat::R8g8b8, - 7 => MemoryFormat::B8g8r8, - 8 => MemoryFormat::NFormats, + 2 => MemoryFormat::R8g8b8a8Premultiplied, + 3 => MemoryFormat::B8g8r8a8, + 4 => MemoryFormat::A8r8g8b8, + 5 => MemoryFormat::R8g8b8a8, + 6 => MemoryFormat::A8b8g8r8, + 7 => MemoryFormat::R8g8b8, + 8 => MemoryFormat::B8g8r8, + 9 => MemoryFormat::NFormats, value => MemoryFormat::__Unknown(value), } } diff --git a/gdk4/src/auto/flags.rs b/gdk4/src/auto/flags.rs index 57ada409ba3b..aa801eb3fae5 100644 --- a/gdk4/src/auto/flags.rs +++ b/gdk4/src/auto/flags.rs @@ -387,66 +387,3 @@ impl SetValue for SeatCapabilities { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } - -bitflags! { - pub struct SurfaceState: u32 { - const WITHDRAWN = 1; - const MINIMIZED = 2; - const MAXIMIZED = 4; - const STICKY = 8; - const FULLSCREEN = 16; - const ABOVE = 32; - const BELOW = 64; - const FOCUSED = 128; - const TILED = 256; - const TOP_TILED = 512; - const TOP_RESIZABLE = 1024; - const RIGHT_TILED = 2048; - const RIGHT_RESIZABLE = 4096; - const BOTTOM_TILED = 8192; - const BOTTOM_RESIZABLE = 16384; - const LEFT_TILED = 32768; - const LEFT_RESIZABLE = 65536; - } -} - -#[doc(hidden)] -impl ToGlib for SurfaceState { - type GlibType = gdk_sys::GdkSurfaceState; - - fn to_glib(&self) -> gdk_sys::GdkSurfaceState { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib for SurfaceState { - fn from_glib(value: gdk_sys::GdkSurfaceState) -> SurfaceState { - skip_assert_initialized!(); - SurfaceState::from_bits_truncate(value) - } -} - -impl StaticType for SurfaceState { - fn static_type() -> Type { - unsafe { from_glib(gdk_sys::gdk_surface_state_get_type()) } - } -} - -impl<'a> FromValueOptional<'a> for SurfaceState { - unsafe fn from_value_optional(value: &Value) -> Option { - Some(FromValue::from_value(value)) - } -} - -impl<'a> FromValue<'a> for SurfaceState { - unsafe fn from_value(value: &Value) -> Self { - from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl SetValue for SurfaceState { - unsafe fn set_value(value: &mut Value, this: &Self) { - gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) - } -} diff --git a/gdk4/src/auto/frame_clock.rs b/gdk4/src/auto/frame_clock.rs index d41a25e273ab..0181080585c0 100644 --- a/gdk4/src/auto/frame_clock.rs +++ b/gdk4/src/auto/frame_clock.rs @@ -44,6 +44,10 @@ impl FrameClock { } } + pub fn get_fps(&self) -> f64 { + unsafe { gdk_sys::gdk_frame_clock_get_fps(self.to_glib_none().0) } + } + pub fn get_frame_counter(&self) -> i64 { unsafe { gdk_sys::gdk_frame_clock_get_frame_counter(self.to_glib_none().0) } } diff --git a/gdk4/src/auto/functions.rs b/gdk4/src/auto/functions.rs index fcd0e7c4756f..c0bf8052ca2d 100644 --- a/gdk4/src/auto/functions.rs +++ b/gdk4/src/auto/functions.rs @@ -5,6 +5,7 @@ use cairo; use gdk_pixbuf; use gdk_sys; +use glib; use glib::object::IsA; use glib::translate::*; use glib::GString; @@ -159,6 +160,11 @@ pub fn set_allowed_backends(backends: &str) { } } +pub fn toplevel_size_get_type() -> glib::types::Type { + assert_initialized_main_thread!(); + unsafe { from_glib(gdk_sys::gdk_toplevel_size_get_type()) } +} + pub fn unicode_to_keyval(wc: u32) -> u32 { assert_initialized_main_thread!(); unsafe { gdk_sys::gdk_unicode_to_keyval(wc) } diff --git a/gdk4/src/auto/mod.rs b/gdk4/src/auto/mod.rs index 8249e7940772..cc034c30f4dc 100644 --- a/gdk4/src/auto/mod.rs +++ b/gdk4/src/auto/mod.rs @@ -198,7 +198,6 @@ pub use self::flags::FrameClockPhase; pub use self::flags::ModifierType; pub use self::flags::PaintableFlags; pub use self::flags::SeatCapabilities; -pub use self::flags::SurfaceState; pub mod functions; diff --git a/gdk4/src/auto/popup.rs b/gdk4/src/auto/popup.rs index 9b4f488e53b0..d418a1522a1a 100644 --- a/gdk4/src/auto/popup.rs +++ b/gdk4/src/auto/popup.rs @@ -3,9 +3,15 @@ // DO NOT EDIT use gdk_sys; +use glib::object::Cast; use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib_sys; +use std::boxed::Box as Box_; use std::fmt; +use std::mem::transmute; use Gravity; use PopupLayout; use Surface; @@ -34,6 +40,8 @@ pub trait PopupExt: 'static { fn get_surface_anchor(&self) -> Gravity; fn present(&self, width: i32, height: i32, layout: &PopupLayout) -> bool; + + fn connect_popup_layout_changed(&self, f: F) -> SignalHandlerId; } impl> PopupExt for O { @@ -87,6 +95,29 @@ impl> PopupExt for O { )) } } + + fn connect_popup_layout_changed(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn popup_layout_changed_trampoline( + this: *mut gdk_sys::GdkPopup, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&Popup::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"popup-layout-changed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + popup_layout_changed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } } impl fmt::Display for Popup { diff --git a/gdk4/src/auto/surface.rs b/gdk4/src/auto/surface.rs index 7ff65686994f..0ecdfc4119d7 100644 --- a/gdk4/src/auto/surface.rs +++ b/gdk4/src/auto/surface.rs @@ -47,15 +47,9 @@ impl Surface { } } - pub fn new_toplevel(display: &Display, width: i32, height: i32) -> Surface { + pub fn new_toplevel(display: &Display) -> Surface { skip_assert_initialized!(); - unsafe { - from_glib_full(gdk_sys::gdk_surface_new_toplevel( - display.to_glib_none().0, - width, - height, - )) - } + unsafe { from_glib_full(gdk_sys::gdk_surface_new_toplevel(display.to_glib_none().0)) } } pub fn beep(&self) { @@ -115,22 +109,26 @@ impl Surface { } } - pub fn get_device_position(&self, device: &Device) -> (f64, f64, ModifierType) { + pub fn get_device_position(&self, device: &Device) -> Option<(f64, f64, ModifierType)> { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); let mut mask = mem::MaybeUninit::uninit(); - gdk_sys::gdk_surface_get_device_position( + let ret = from_glib(gdk_sys::gdk_surface_get_device_position( self.to_glib_none().0, device.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), mask.as_mut_ptr(), - ); + )); let x = x.assume_init(); let y = y.assume_init(); let mask = mask.assume_init(); - (x, y, from_glib(mask)) + if ret { + Some((x, y, from_glib(mask))) + } else { + None + } } } @@ -289,27 +287,6 @@ impl Surface { } } - pub fn connect_popup_layout_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn popup_layout_changed_trampoline( - this: *mut gdk_sys::GdkSurface, - f: glib_sys::gpointer, - ) { - let f: &F = &*(f as *const F); - f(&from_glib_borrow(this)) - } - unsafe { - let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"popup-layout-changed\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - popup_layout_changed_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - pub fn connect_render bool + 'static>( &self, f: F, @@ -388,6 +365,31 @@ impl Surface { } } + pub fn connect_property_height_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_height_trampoline( + this: *mut gdk_sys::GdkSurface, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::height\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_height_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + pub fn connect_property_mapped_notify( &self, f: F, @@ -412,6 +414,31 @@ impl Surface { ) } } + + pub fn connect_property_width_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_width_trampoline( + this: *mut gdk_sys::GdkSurface, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::width\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_width_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } } impl fmt::Display for Surface { diff --git a/gdk4/src/auto/toplevel.rs b/gdk4/src/auto/toplevel.rs index 3271ad151b19..9e35458af0fd 100644 --- a/gdk4/src/auto/toplevel.rs +++ b/gdk4/src/auto/toplevel.rs @@ -21,7 +21,6 @@ use Event; use FullscreenMode; use Surface; use SurfaceEdge; -use SurfaceState; use Texture; use ToplevelLayout; @@ -50,7 +49,7 @@ pub trait ToplevelExt: 'static { fn focus(&self, timestamp: u32); - fn get_state(&self) -> SurfaceState; + //fn get_state(&self) -> /*Ignored*/ToplevelState; fn inhibit_system_shortcuts>(&self, event: Option<&P>); @@ -58,7 +57,7 @@ pub trait ToplevelExt: 'static { fn minimize(&self) -> bool; - fn present(&self, width: i32, height: i32, layout: &ToplevelLayout) -> bool; + fn present(&self, layout: &ToplevelLayout) -> bool; fn restore_system_shortcuts(&self); @@ -100,6 +99,8 @@ pub trait ToplevelExt: 'static { fn get_property_transient_for(&self) -> Option; + //fn connect_compute_size(&self, f: F) -> SignalHandlerId; + fn connect_property_decorated_notify(&self, f: F) -> SignalHandlerId; fn connect_property_deletable_notify(&self, f: F) -> SignalHandlerId; @@ -172,13 +173,9 @@ impl> ToplevelExt for O { } } - fn get_state(&self) -> SurfaceState { - unsafe { - from_glib(gdk_sys::gdk_toplevel_get_state( - self.as_ref().to_glib_none().0, - )) - } - } + //fn get_state(&self) -> /*Ignored*/ToplevelState { + // unsafe { TODO: call gdk_sys:gdk_toplevel_get_state() } + //} fn inhibit_system_shortcuts>(&self, event: Option<&P>) { unsafe { @@ -201,12 +198,10 @@ impl> ToplevelExt for O { } } - fn present(&self, width: i32, height: i32, layout: &ToplevelLayout) -> bool { + fn present(&self, layout: &ToplevelLayout) -> bool { unsafe { from_glib(gdk_sys::gdk_toplevel_present( self.as_ref().to_glib_none().0, - width, - height, layout.to_glib_none().0, )) } @@ -427,6 +422,10 @@ impl> ToplevelExt for O { } } + //fn connect_compute_size(&self, f: F) -> SignalHandlerId { + // Out size: Gdk.ToplevelSize + //} + fn connect_property_decorated_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_decorated_trampoline( this: *mut gdk_sys::GdkToplevel, diff --git a/gdk4/src/auto/toplevel_layout.rs b/gdk4/src/auto/toplevel_layout.rs index 609fca60b82a..4a567f4b6a96 100644 --- a/gdk4/src/auto/toplevel_layout.rs +++ b/gdk4/src/auto/toplevel_layout.rs @@ -18,9 +18,9 @@ glib_wrapper! { } impl ToplevelLayout { - pub fn new(min_width: i32, min_height: i32) -> ToplevelLayout { + pub fn new() -> ToplevelLayout { assert_initialized_main_thread!(); - unsafe { from_glib_full(gdk_sys::gdk_toplevel_layout_new(min_width, min_height)) } + unsafe { from_glib_full(gdk_sys::gdk_toplevel_layout_new()) } } pub fn copy(&self) -> Option { @@ -60,14 +60,6 @@ impl ToplevelLayout { } } - pub fn get_min_height(&self) -> i32 { - unsafe { gdk_sys::gdk_toplevel_layout_get_min_height(self.to_glib_none().0) } - } - - pub fn get_min_width(&self) -> i32 { - unsafe { gdk_sys::gdk_toplevel_layout_get_min_width(self.to_glib_none().0) } - } - pub fn get_resizable(&self) -> bool { unsafe { from_glib(gdk_sys::gdk_toplevel_layout_get_resizable( @@ -99,6 +91,12 @@ impl ToplevelLayout { } } +impl Default for ToplevelLayout { + fn default() -> Self { + Self::new() + } +} + impl PartialEq for ToplevelLayout { #[inline] fn eq(&self, other: &Self) -> bool { diff --git a/gdk4/src/auto/versions.txt b/gdk4/src/auto/versions.txt index 7ed425ecd43e..a84a9493a8ec 100644 --- a/gdk4/src/auto/versions.txt +++ b/gdk4/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 2f86b9a) -from gir-files (https://github.com/gtk-rs/gir-files @ cb01ad7) +from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1) diff --git a/gdk4/src/cairo_interaction.rs b/gdk4/src/cairo_interaction.rs index e6b40d1cec73..c8a9b3769511 100644 --- a/gdk4/src/cairo_interaction.rs +++ b/gdk4/src/cairo_interaction.rs @@ -6,17 +6,10 @@ use cairo::{Context, Region}; use gdk_pixbuf::Pixbuf; use gdk_sys; use glib::translate::*; -use {GLContext, Rectangle, Surface, RGBA}; +use {Rectangle, Surface, RGBA}; pub trait GdkCairoSurfaceExt { fn create_region(&self) -> Option; - unsafe fn upload_to_gl( - &self, - target: i32, - width: i32, - height: i32, - context: Option<&GLContext>, - ); } impl GdkCairoSurfaceExt for cairo::Surface { @@ -27,23 +20,6 @@ impl GdkCairoSurfaceExt for cairo::Surface { )) } } - - unsafe fn upload_to_gl( - &self, - target: i32, - width: i32, - height: i32, - context: Option<&GLContext>, - ) { - assert_initialized_main_thread!(); - gdk_sys::gdk_cairo_surface_upload_to_gl( - mut_override(self.to_glib_none().0), - target, - width, - height, - context.to_glib_none().0, - ); - } } pub trait GdkCairoContextExt { diff --git a/gdk4/sys/src/lib.rs b/gdk4/sys/src/lib.rs index 2e12153f6416..92e9542b4ee4 100644 --- a/gdk4/sys/src/lib.rs +++ b/gdk4/sys/src/lib.rs @@ -145,13 +145,14 @@ pub const GDK_KEY_MATCH_EXACT: GdkKeyMatch = 2; pub type GdkMemoryFormat = c_int; pub const GDK_MEMORY_B8G8R8A8_PREMULTIPLIED: GdkMemoryFormat = 0; pub const GDK_MEMORY_A8R8G8B8_PREMULTIPLIED: GdkMemoryFormat = 1; -pub const GDK_MEMORY_B8G8R8A8: GdkMemoryFormat = 2; -pub const GDK_MEMORY_A8R8G8B8: GdkMemoryFormat = 3; -pub const GDK_MEMORY_R8G8B8A8: GdkMemoryFormat = 4; -pub const GDK_MEMORY_A8B8G8R8: GdkMemoryFormat = 5; -pub const GDK_MEMORY_R8G8B8: GdkMemoryFormat = 6; -pub const GDK_MEMORY_B8G8R8: GdkMemoryFormat = 7; -pub const GDK_MEMORY_N_FORMATS: GdkMemoryFormat = 8; +pub const GDK_MEMORY_R8G8B8A8_PREMULTIPLIED: GdkMemoryFormat = 2; +pub const GDK_MEMORY_B8G8R8A8: GdkMemoryFormat = 3; +pub const GDK_MEMORY_A8R8G8B8: GdkMemoryFormat = 4; +pub const GDK_MEMORY_R8G8B8A8: GdkMemoryFormat = 5; +pub const GDK_MEMORY_A8B8G8R8: GdkMemoryFormat = 6; +pub const GDK_MEMORY_R8G8B8: GdkMemoryFormat = 7; +pub const GDK_MEMORY_B8G8R8: GdkMemoryFormat = 8; +pub const GDK_MEMORY_N_FORMATS: GdkMemoryFormat = 9; pub type GdkNotifyType = c_int; pub const GDK_NOTIFY_ANCESTOR: GdkNotifyType = 0; @@ -2554,24 +2555,24 @@ pub const GDK_SEAT_CAPABILITY_TABLET_PAD: GdkSeatCapabilities = 16; pub const GDK_SEAT_CAPABILITY_ALL_POINTING: GdkSeatCapabilities = 7; pub const GDK_SEAT_CAPABILITY_ALL: GdkSeatCapabilities = 15; -pub type GdkSurfaceState = c_uint; -pub const GDK_SURFACE_STATE_WITHDRAWN: GdkSurfaceState = 1; -pub const GDK_SURFACE_STATE_MINIMIZED: GdkSurfaceState = 2; -pub const GDK_SURFACE_STATE_MAXIMIZED: GdkSurfaceState = 4; -pub const GDK_SURFACE_STATE_STICKY: GdkSurfaceState = 8; -pub const GDK_SURFACE_STATE_FULLSCREEN: GdkSurfaceState = 16; -pub const GDK_SURFACE_STATE_ABOVE: GdkSurfaceState = 32; -pub const GDK_SURFACE_STATE_BELOW: GdkSurfaceState = 64; -pub const GDK_SURFACE_STATE_FOCUSED: GdkSurfaceState = 128; -pub const GDK_SURFACE_STATE_TILED: GdkSurfaceState = 256; -pub const GDK_SURFACE_STATE_TOP_TILED: GdkSurfaceState = 512; -pub const GDK_SURFACE_STATE_TOP_RESIZABLE: GdkSurfaceState = 1024; -pub const GDK_SURFACE_STATE_RIGHT_TILED: GdkSurfaceState = 2048; -pub const GDK_SURFACE_STATE_RIGHT_RESIZABLE: GdkSurfaceState = 4096; -pub const GDK_SURFACE_STATE_BOTTOM_TILED: GdkSurfaceState = 8192; -pub const GDK_SURFACE_STATE_BOTTOM_RESIZABLE: GdkSurfaceState = 16384; -pub const GDK_SURFACE_STATE_LEFT_TILED: GdkSurfaceState = 32768; -pub const GDK_SURFACE_STATE_LEFT_RESIZABLE: GdkSurfaceState = 65536; +pub type GdkToplevelState = c_uint; +pub const GDK_TOPLEVEL_STATE_WITHDRAWN: GdkToplevelState = 1; +pub const GDK_TOPLEVEL_STATE_MINIMIZED: GdkToplevelState = 2; +pub const GDK_TOPLEVEL_STATE_MAXIMIZED: GdkToplevelState = 4; +pub const GDK_TOPLEVEL_STATE_STICKY: GdkToplevelState = 8; +pub const GDK_TOPLEVEL_STATE_FULLSCREEN: GdkToplevelState = 16; +pub const GDK_TOPLEVEL_STATE_ABOVE: GdkToplevelState = 32; +pub const GDK_TOPLEVEL_STATE_BELOW: GdkToplevelState = 64; +pub const GDK_TOPLEVEL_STATE_FOCUSED: GdkToplevelState = 128; +pub const GDK_TOPLEVEL_STATE_TILED: GdkToplevelState = 256; +pub const GDK_TOPLEVEL_STATE_TOP_TILED: GdkToplevelState = 512; +pub const GDK_TOPLEVEL_STATE_TOP_RESIZABLE: GdkToplevelState = 1024; +pub const GDK_TOPLEVEL_STATE_RIGHT_TILED: GdkToplevelState = 2048; +pub const GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE: GdkToplevelState = 4096; +pub const GDK_TOPLEVEL_STATE_BOTTOM_TILED: GdkToplevelState = 8192; +pub const GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE: GdkToplevelState = 16384; +pub const GDK_TOPLEVEL_STATE_LEFT_TILED: GdkToplevelState = 32768; +pub const GDK_TOPLEVEL_STATE_LEFT_RESIZABLE: GdkToplevelState = 65536; // Callbacks pub type GdkContentDeserializeFunc = Option; @@ -2881,6 +2882,11 @@ impl ::std::fmt::Debug for GdkToplevelLayout { } } +#[repr(C)] +pub struct _GdkToplevelSize(c_void); + +pub type GdkToplevelSize = *mut _GdkToplevelSize; + // Classes #[repr(C)] pub struct GdkAppLaunchContext(c_void); @@ -3458,9 +3464,9 @@ extern "C" { pub fn gdk_seat_capabilities_get_type() -> GType; //========================================================================= - // GdkSurfaceState + // GdkToplevelState //========================================================================= - pub fn gdk_surface_state_get_type() -> GType; + pub fn gdk_toplevel_state_get_type() -> GType; //========================================================================= // GdkContentFormats @@ -3633,7 +3639,7 @@ extern "C" { // GdkToplevelLayout //========================================================================= pub fn gdk_toplevel_layout_get_type() -> GType; - pub fn gdk_toplevel_layout_new(min_width: c_int, min_height: c_int) -> *mut GdkToplevelLayout; + pub fn gdk_toplevel_layout_new() -> *mut GdkToplevelLayout; pub fn gdk_toplevel_layout_copy(layout: *mut GdkToplevelLayout) -> *mut GdkToplevelLayout; pub fn gdk_toplevel_layout_equal( layout: *mut GdkToplevelLayout, @@ -3644,8 +3650,6 @@ extern "C" { layout: *mut GdkToplevelLayout, ) -> *mut GdkMonitor; pub fn gdk_toplevel_layout_get_maximized(layout: *mut GdkToplevelLayout) -> gboolean; - pub fn gdk_toplevel_layout_get_min_height(layout: *mut GdkToplevelLayout) -> c_int; - pub fn gdk_toplevel_layout_get_min_width(layout: *mut GdkToplevelLayout) -> c_int; pub fn gdk_toplevel_layout_get_resizable(layout: *mut GdkToplevelLayout) -> gboolean; pub fn gdk_toplevel_layout_ref(layout: *mut GdkToplevelLayout) -> *mut GdkToplevelLayout; pub fn gdk_toplevel_layout_set_fullscreen( @@ -3657,6 +3661,21 @@ extern "C" { pub fn gdk_toplevel_layout_set_resizable(layout: *mut GdkToplevelLayout, resizable: gboolean); pub fn gdk_toplevel_layout_unref(layout: *mut GdkToplevelLayout); + //========================================================================= + // GdkToplevelSize + //========================================================================= + pub fn gdk_toplevel_size_get_bounds( + size: *mut GdkToplevelSize, + bounds_width: *mut c_int, + bounds_height: *mut c_int, + ); + pub fn gdk_toplevel_size_set_min_size( + size: *mut GdkToplevelSize, + min_width: c_int, + min_height: c_int, + ); + pub fn gdk_toplevel_size_set_size(size: *mut GdkToplevelSize, width: c_int, height: c_int); + //========================================================================= // GdkAppLaunchContext //========================================================================= @@ -4170,6 +4189,7 @@ extern "C" { pub fn gdk_frame_clock_get_current_timings( frame_clock: *mut GdkFrameClock, ) -> *mut GdkFrameTimings; + pub fn gdk_frame_clock_get_fps(frame_clock: *mut GdkFrameClock) -> c_double; pub fn gdk_frame_clock_get_frame_counter(frame_clock: *mut GdkFrameClock) -> i64; pub fn gdk_frame_clock_get_frame_time(frame_clock: *mut GdkFrameClock) -> i64; pub fn gdk_frame_clock_get_history_start(frame_clock: *mut GdkFrameClock) -> i64; @@ -4359,11 +4379,7 @@ extern "C" { //========================================================================= pub fn gdk_surface_get_type() -> GType; pub fn gdk_surface_new_popup(parent: *mut GdkSurface, autohide: gboolean) -> *mut GdkSurface; - pub fn gdk_surface_new_toplevel( - display: *mut GdkDisplay, - width: c_int, - height: c_int, - ) -> *mut GdkSurface; + pub fn gdk_surface_new_toplevel(display: *mut GdkDisplay) -> *mut GdkSurface; pub fn gdk_surface_beep(surface: *mut GdkSurface); pub fn gdk_surface_create_cairo_context(surface: *mut GdkSurface) -> *mut GdkCairoContext; pub fn gdk_surface_create_gl_context( @@ -4392,7 +4408,7 @@ extern "C" { x: *mut c_double, y: *mut c_double, mask: *mut GdkModifierType, - ); + ) -> gboolean; pub fn gdk_surface_get_display(surface: *mut GdkSurface) -> *mut GdkDisplay; pub fn gdk_surface_get_frame_clock(surface: *mut GdkSurface) -> *mut GdkFrameClock; pub fn gdk_surface_get_height(surface: *mut GdkSurface) -> c_int; @@ -4568,14 +4584,12 @@ extern "C" { timestamp: u32, ); pub fn gdk_toplevel_focus(toplevel: *mut GdkToplevel, timestamp: u32); - pub fn gdk_toplevel_get_state(toplevel: *mut GdkToplevel) -> GdkSurfaceState; + pub fn gdk_toplevel_get_state(toplevel: *mut GdkToplevel) -> GdkToplevelState; pub fn gdk_toplevel_inhibit_system_shortcuts(toplevel: *mut GdkToplevel, event: *mut GdkEvent); pub fn gdk_toplevel_lower(toplevel: *mut GdkToplevel) -> gboolean; pub fn gdk_toplevel_minimize(toplevel: *mut GdkToplevel) -> gboolean; pub fn gdk_toplevel_present( toplevel: *mut GdkToplevel, - width: c_int, - height: c_int, layout: *mut GdkToplevelLayout, ) -> gboolean; pub fn gdk_toplevel_restore_system_shortcuts(toplevel: *mut GdkToplevel); @@ -4618,13 +4632,6 @@ extern "C" { pixbuf_y: c_double, ); pub fn gdk_cairo_set_source_rgba(cr: *mut cairo::cairo_t, rgba: *const GdkRGBA); - pub fn gdk_cairo_surface_upload_to_gl( - surface: *mut cairo::cairo_surface_t, - target: c_int, - width: c_int, - height: c_int, - context: *mut GdkGLContext, - ); pub fn gdk_content_deserialize_async( stream: *mut gio::GInputStream, mime_type: *const c_char, @@ -4714,6 +4721,7 @@ extern "C" { ) -> *mut gdk_pixbuf::GdkPixbuf; pub fn gdk_pixbuf_get_from_texture(texture: *mut GdkTexture) -> *mut gdk_pixbuf::GdkPixbuf; pub fn gdk_set_allowed_backends(backends: *const c_char); + pub fn gdk_toplevel_size_get_type() -> GType; pub fn gdk_unicode_to_keyval(wc: u32) -> c_uint; } diff --git a/gdk4/sys/tests/abi.rs b/gdk4/sys/tests/abi.rs index f3ebfcf21f69..6eaa932d960f 100644 --- a/gdk4/sys/tests/abi.rs +++ b/gdk4/sys/tests/abi.rs @@ -470,17 +470,17 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ }, ), ( - "GdkSurfaceState", + "GdkTimeCoord", Layout { - size: size_of::(), - alignment: align_of::(), + size: size_of::(), + alignment: align_of::(), }, ), ( - "GdkTimeCoord", + "GdkToplevelState", Layout { - size: size_of::(), - alignment: align_of::(), + size: size_of::(), + alignment: align_of::(), }, ), ( @@ -2897,15 +2897,16 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("GDK_KEY_zstroke", "16777654"), ("(gint) GDK_LEAVE_NOTIFY", "7"), ("(guint) GDK_LOCK_MASK", "2"), - ("(gint) GDK_MEMORY_A8B8G8R8", "5"), - ("(gint) GDK_MEMORY_A8R8G8B8", "3"), + ("(gint) GDK_MEMORY_A8B8G8R8", "6"), + ("(gint) GDK_MEMORY_A8R8G8B8", "4"), ("(gint) GDK_MEMORY_A8R8G8B8_PREMULTIPLIED", "1"), - ("(gint) GDK_MEMORY_B8G8R8", "7"), - ("(gint) GDK_MEMORY_B8G8R8A8", "2"), + ("(gint) GDK_MEMORY_B8G8R8", "8"), + ("(gint) GDK_MEMORY_B8G8R8A8", "3"), ("(gint) GDK_MEMORY_B8G8R8A8_PREMULTIPLIED", "0"), - ("(gint) GDK_MEMORY_N_FORMATS", "8"), - ("(gint) GDK_MEMORY_R8G8B8", "6"), - ("(gint) GDK_MEMORY_R8G8B8A8", "4"), + ("(gint) GDK_MEMORY_N_FORMATS", "9"), + ("(gint) GDK_MEMORY_R8G8B8", "7"), + ("(gint) GDK_MEMORY_R8G8B8A8", "5"), + ("(gint) GDK_MEMORY_R8G8B8A8_PREMULTIPLIED", "2"), ("(guint) GDK_META_MASK", "268435456"), ("GDK_MODIFIER_MASK", "469769999"), ("(gint) GDK_MOTION_NOTIFY", "1"), @@ -2962,23 +2963,23 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) GDK_SURFACE_EDGE_SOUTH_EAST", "7"), ("(gint) GDK_SURFACE_EDGE_SOUTH_WEST", "5"), ("(gint) GDK_SURFACE_EDGE_WEST", "3"), - ("(guint) GDK_SURFACE_STATE_ABOVE", "32"), - ("(guint) GDK_SURFACE_STATE_BELOW", "64"), - ("(guint) GDK_SURFACE_STATE_BOTTOM_RESIZABLE", "16384"), - ("(guint) GDK_SURFACE_STATE_BOTTOM_TILED", "8192"), - ("(guint) GDK_SURFACE_STATE_FOCUSED", "128"), - ("(guint) GDK_SURFACE_STATE_FULLSCREEN", "16"), - ("(guint) GDK_SURFACE_STATE_LEFT_RESIZABLE", "65536"), - ("(guint) GDK_SURFACE_STATE_LEFT_TILED", "32768"), - ("(guint) GDK_SURFACE_STATE_MAXIMIZED", "4"), - ("(guint) GDK_SURFACE_STATE_MINIMIZED", "2"), - ("(guint) GDK_SURFACE_STATE_RIGHT_RESIZABLE", "4096"), - ("(guint) GDK_SURFACE_STATE_RIGHT_TILED", "2048"), - ("(guint) GDK_SURFACE_STATE_STICKY", "8"), - ("(guint) GDK_SURFACE_STATE_TILED", "256"), - ("(guint) GDK_SURFACE_STATE_TOP_RESIZABLE", "1024"), - ("(guint) GDK_SURFACE_STATE_TOP_TILED", "512"), - ("(guint) GDK_SURFACE_STATE_WITHDRAWN", "1"), + ("(guint) GDK_TOPLEVEL_STATE_ABOVE", "32"), + ("(guint) GDK_TOPLEVEL_STATE_BELOW", "64"), + ("(guint) GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE", "16384"), + ("(guint) GDK_TOPLEVEL_STATE_BOTTOM_TILED", "8192"), + ("(guint) GDK_TOPLEVEL_STATE_FOCUSED", "128"), + ("(guint) GDK_TOPLEVEL_STATE_FULLSCREEN", "16"), + ("(guint) GDK_TOPLEVEL_STATE_LEFT_RESIZABLE", "65536"), + ("(guint) GDK_TOPLEVEL_STATE_LEFT_TILED", "32768"), + ("(guint) GDK_TOPLEVEL_STATE_MAXIMIZED", "4"), + ("(guint) GDK_TOPLEVEL_STATE_MINIMIZED", "2"), + ("(guint) GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE", "4096"), + ("(guint) GDK_TOPLEVEL_STATE_RIGHT_TILED", "2048"), + ("(guint) GDK_TOPLEVEL_STATE_STICKY", "8"), + ("(guint) GDK_TOPLEVEL_STATE_TILED", "256"), + ("(guint) GDK_TOPLEVEL_STATE_TOP_RESIZABLE", "1024"), + ("(guint) GDK_TOPLEVEL_STATE_TOP_TILED", "512"), + ("(guint) GDK_TOPLEVEL_STATE_WITHDRAWN", "1"), ("(gint) GDK_TOUCHPAD_GESTURE_PHASE_BEGIN", "0"), ("(gint) GDK_TOUCHPAD_GESTURE_PHASE_CANCEL", "3"), ("(gint) GDK_TOUCHPAD_GESTURE_PHASE_END", "2"), diff --git a/gdk4/sys/versions.txt b/gdk4/sys/versions.txt index 7ed425ecd43e..a84a9493a8ec 100644 --- a/gdk4/sys/versions.txt +++ b/gdk4/sys/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 2f86b9a) -from gir-files (https://github.com/gtk-rs/gir-files @ cb01ad7) +from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1) diff --git a/gir-files b/gir-files index cb01ad7f0c8d..8de1aa1dceab 160000 --- a/gir-files +++ b/gir-files @@ -1 +1 @@ -Subproject commit cb01ad7f0c8d319b4fcf5439706a20897d7a0707 +Subproject commit 8de1aa1dceabd8196922e1dba11c098271042f7e diff --git a/gsk4/src/auto/enums.rs b/gsk4/src/auto/enums.rs index 385664ea17c3..6a6a2ada73ea 100644 --- a/gsk4/src/auto/enums.rs +++ b/gsk4/src/auto/enums.rs @@ -232,6 +232,8 @@ pub enum RenderNodeType { ColorNode, LinearGradientNode, RepeatingLinearGradientNode, + RadialGradientNode, + RepeatingRadialGradientNode, BorderNode, TextureNode, InsetShadowNode, @@ -248,6 +250,7 @@ pub enum RenderNodeType { TextNode, BlurNode, DebugNode, + GlShaderNode, #[doc(hidden)] __Unknown(i32), } @@ -264,6 +267,8 @@ impl fmt::Display for RenderNodeType { RenderNodeType::ColorNode => "ColorNode", RenderNodeType::LinearGradientNode => "LinearGradientNode", RenderNodeType::RepeatingLinearGradientNode => "RepeatingLinearGradientNode", + RenderNodeType::RadialGradientNode => "RadialGradientNode", + RenderNodeType::RepeatingRadialGradientNode => "RepeatingRadialGradientNode", RenderNodeType::BorderNode => "BorderNode", RenderNodeType::TextureNode => "TextureNode", RenderNodeType::InsetShadowNode => "InsetShadowNode", @@ -280,6 +285,7 @@ impl fmt::Display for RenderNodeType { RenderNodeType::TextNode => "TextNode", RenderNodeType::BlurNode => "BlurNode", RenderNodeType::DebugNode => "DebugNode", + RenderNodeType::GlShaderNode => "GlShaderNode", _ => "Unknown", } ) @@ -300,6 +306,10 @@ impl ToGlib for RenderNodeType { RenderNodeType::RepeatingLinearGradientNode => { gsk_sys::GSK_REPEATING_LINEAR_GRADIENT_NODE } + RenderNodeType::RadialGradientNode => gsk_sys::GSK_RADIAL_GRADIENT_NODE, + RenderNodeType::RepeatingRadialGradientNode => { + gsk_sys::GSK_REPEATING_RADIAL_GRADIENT_NODE + } RenderNodeType::BorderNode => gsk_sys::GSK_BORDER_NODE, RenderNodeType::TextureNode => gsk_sys::GSK_TEXTURE_NODE, RenderNodeType::InsetShadowNode => gsk_sys::GSK_INSET_SHADOW_NODE, @@ -316,6 +326,7 @@ impl ToGlib for RenderNodeType { RenderNodeType::TextNode => gsk_sys::GSK_TEXT_NODE, RenderNodeType::BlurNode => gsk_sys::GSK_BLUR_NODE, RenderNodeType::DebugNode => gsk_sys::GSK_DEBUG_NODE, + RenderNodeType::GlShaderNode => gsk_sys::GSK_GL_SHADER_NODE, RenderNodeType::__Unknown(value) => value, } } @@ -332,22 +343,25 @@ impl FromGlib for RenderNodeType { 3 => RenderNodeType::ColorNode, 4 => RenderNodeType::LinearGradientNode, 5 => RenderNodeType::RepeatingLinearGradientNode, - 6 => RenderNodeType::BorderNode, - 7 => RenderNodeType::TextureNode, - 8 => RenderNodeType::InsetShadowNode, - 9 => RenderNodeType::OutsetShadowNode, - 10 => RenderNodeType::TransformNode, - 11 => RenderNodeType::OpacityNode, - 12 => RenderNodeType::ColorMatrixNode, - 13 => RenderNodeType::RepeatNode, - 14 => RenderNodeType::ClipNode, - 15 => RenderNodeType::RoundedClipNode, - 16 => RenderNodeType::ShadowNode, - 17 => RenderNodeType::BlendNode, - 18 => RenderNodeType::CrossFadeNode, - 19 => RenderNodeType::TextNode, - 20 => RenderNodeType::BlurNode, - 21 => RenderNodeType::DebugNode, + 6 => RenderNodeType::RadialGradientNode, + 7 => RenderNodeType::RepeatingRadialGradientNode, + 8 => RenderNodeType::BorderNode, + 9 => RenderNodeType::TextureNode, + 10 => RenderNodeType::InsetShadowNode, + 11 => RenderNodeType::OutsetShadowNode, + 12 => RenderNodeType::TransformNode, + 13 => RenderNodeType::OpacityNode, + 14 => RenderNodeType::ColorMatrixNode, + 15 => RenderNodeType::RepeatNode, + 16 => RenderNodeType::ClipNode, + 17 => RenderNodeType::RoundedClipNode, + 18 => RenderNodeType::ShadowNode, + 19 => RenderNodeType::BlendNode, + 20 => RenderNodeType::CrossFadeNode, + 21 => RenderNodeType::TextNode, + 22 => RenderNodeType::BlurNode, + 23 => RenderNodeType::DebugNode, + 24 => RenderNodeType::GlShaderNode, value => RenderNodeType::__Unknown(value), } } diff --git a/gsk4/src/auto/text_node.rs b/gsk4/src/auto/text_node.rs index 4bd040604d29..33e5cedea645 100644 --- a/gsk4/src/auto/text_node.rs +++ b/gsk4/src/auto/text_node.rs @@ -57,18 +57,13 @@ impl TextNode { unsafe { from_glib_none(gsk_sys::gsk_text_node_peek_color(self.to_glib_none().0)) } } + pub fn peek_font(&self) -> Option { + unsafe { from_glib_none(gsk_sys::gsk_text_node_peek_font(self.to_glib_none().0)) } + } + //pub fn peek_glyphs(&self) -> /*Ignored*/Vec { // unsafe { TODO: call gsk_sys:gsk_text_node_peek_glyphs() } //} - - pub fn peek_font>(node: &P) -> Option { - skip_assert_initialized!(); - unsafe { - from_glib_none(gsk_sys::gsk_text_node_peek_font( - node.as_ref().to_glib_none().0, - )) - } - } } impl fmt::Display for TextNode { diff --git a/gsk4/src/auto/versions.txt b/gsk4/src/auto/versions.txt index 7ed425ecd43e..a84a9493a8ec 100644 --- a/gsk4/src/auto/versions.txt +++ b/gsk4/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 2f86b9a) -from gir-files (https://github.com/gtk-rs/gir-files @ cb01ad7) +from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1) diff --git a/gsk4/sys/src/lib.rs b/gsk4/sys/src/lib.rs index d78566c4c60d..59a9e2464265 100644 --- a/gsk4/sys/src/lib.rs +++ b/gsk4/sys/src/lib.rs @@ -51,6 +51,16 @@ pub const GSK_CORNER_TOP_RIGHT: GskCorner = 1; pub const GSK_CORNER_BOTTOM_RIGHT: GskCorner = 2; pub const GSK_CORNER_BOTTOM_LEFT: GskCorner = 3; +pub type GskGLUniformType = c_int; +pub const GSK_GL_UNIFORM_TYPE_NONE: GskGLUniformType = 0; +pub const GSK_GL_UNIFORM_TYPE_FLOAT: GskGLUniformType = 1; +pub const GSK_GL_UNIFORM_TYPE_INT: GskGLUniformType = 2; +pub const GSK_GL_UNIFORM_TYPE_UINT: GskGLUniformType = 3; +pub const GSK_GL_UNIFORM_TYPE_BOOL: GskGLUniformType = 4; +pub const GSK_GL_UNIFORM_TYPE_VEC2: GskGLUniformType = 5; +pub const GSK_GL_UNIFORM_TYPE_VEC3: GskGLUniformType = 6; +pub const GSK_GL_UNIFORM_TYPE_VEC4: GskGLUniformType = 7; + pub type GskRenderNodeType = c_int; pub const GSK_NOT_A_RENDER_NODE: GskRenderNodeType = 0; pub const GSK_CONTAINER_NODE: GskRenderNodeType = 1; @@ -58,22 +68,25 @@ pub const GSK_CAIRO_NODE: GskRenderNodeType = 2; pub const GSK_COLOR_NODE: GskRenderNodeType = 3; pub const GSK_LINEAR_GRADIENT_NODE: GskRenderNodeType = 4; pub const GSK_REPEATING_LINEAR_GRADIENT_NODE: GskRenderNodeType = 5; -pub const GSK_BORDER_NODE: GskRenderNodeType = 6; -pub const GSK_TEXTURE_NODE: GskRenderNodeType = 7; -pub const GSK_INSET_SHADOW_NODE: GskRenderNodeType = 8; -pub const GSK_OUTSET_SHADOW_NODE: GskRenderNodeType = 9; -pub const GSK_TRANSFORM_NODE: GskRenderNodeType = 10; -pub const GSK_OPACITY_NODE: GskRenderNodeType = 11; -pub const GSK_COLOR_MATRIX_NODE: GskRenderNodeType = 12; -pub const GSK_REPEAT_NODE: GskRenderNodeType = 13; -pub const GSK_CLIP_NODE: GskRenderNodeType = 14; -pub const GSK_ROUNDED_CLIP_NODE: GskRenderNodeType = 15; -pub const GSK_SHADOW_NODE: GskRenderNodeType = 16; -pub const GSK_BLEND_NODE: GskRenderNodeType = 17; -pub const GSK_CROSS_FADE_NODE: GskRenderNodeType = 18; -pub const GSK_TEXT_NODE: GskRenderNodeType = 19; -pub const GSK_BLUR_NODE: GskRenderNodeType = 20; -pub const GSK_DEBUG_NODE: GskRenderNodeType = 21; +pub const GSK_RADIAL_GRADIENT_NODE: GskRenderNodeType = 6; +pub const GSK_REPEATING_RADIAL_GRADIENT_NODE: GskRenderNodeType = 7; +pub const GSK_BORDER_NODE: GskRenderNodeType = 8; +pub const GSK_TEXTURE_NODE: GskRenderNodeType = 9; +pub const GSK_INSET_SHADOW_NODE: GskRenderNodeType = 10; +pub const GSK_OUTSET_SHADOW_NODE: GskRenderNodeType = 11; +pub const GSK_TRANSFORM_NODE: GskRenderNodeType = 12; +pub const GSK_OPACITY_NODE: GskRenderNodeType = 13; +pub const GSK_COLOR_MATRIX_NODE: GskRenderNodeType = 14; +pub const GSK_REPEAT_NODE: GskRenderNodeType = 15; +pub const GSK_CLIP_NODE: GskRenderNodeType = 16; +pub const GSK_ROUNDED_CLIP_NODE: GskRenderNodeType = 17; +pub const GSK_SHADOW_NODE: GskRenderNodeType = 18; +pub const GSK_BLEND_NODE: GskRenderNodeType = 19; +pub const GSK_CROSS_FADE_NODE: GskRenderNodeType = 20; +pub const GSK_TEXT_NODE: GskRenderNodeType = 21; +pub const GSK_BLUR_NODE: GskRenderNodeType = 22; +pub const GSK_DEBUG_NODE: GskRenderNodeType = 23; +pub const GSK_GL_SHADER_NODE: GskRenderNodeType = 24; pub type GskScalingFilter = c_int; pub const GSK_SCALING_FILTER_LINEAR: GskScalingFilter = 0; @@ -130,6 +143,20 @@ pub struct _GskGLRendererClass(c_void); pub type GskGLRendererClass = *mut _GskGLRendererClass; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GskGLShaderClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for GskGLShaderClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GskGLShaderClass @ {:?}", self as *const _)) + .field("parent_class", &self.parent_class) + .finish() + } +} + #[repr(C)] pub struct _GskRendererClass(c_void); @@ -151,6 +178,16 @@ impl ::std::fmt::Debug for GskRoundedRect { } } +#[repr(C)] +pub struct GskShaderArgsBuilder(c_void); + +impl ::std::fmt::Debug for GskShaderArgsBuilder { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GskShaderArgsBuilder @ {:?}", self as *const _)) + .finish() + } +} + #[repr(C)] #[derive(Copy, Clone)] pub struct GskShadow { @@ -317,6 +354,26 @@ impl ::std::fmt::Debug for GskGLRenderer { } } +#[repr(C)] +pub struct GskGLShader(c_void); + +impl ::std::fmt::Debug for GskGLShader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GskGLShader @ {:?}", self as *const _)) + .finish() + } +} + +#[repr(C)] +pub struct GskGLShaderNode(c_void); + +impl ::std::fmt::Debug for GskGLShaderNode { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GskGLShaderNode @ {:?}", self as *const _)) + .finish() + } +} + #[repr(C)] pub struct GskInsetShadowNode(c_void); @@ -357,6 +414,16 @@ impl ::std::fmt::Debug for GskOutsetShadowNode { } } +#[repr(C)] +pub struct GskRadialGradientNode(c_void); + +impl ::std::fmt::Debug for GskRadialGradientNode { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GskRadialGradientNode @ {:?}", self as *const _)) + .finish() + } +} + #[repr(C)] pub struct GskRenderNode(c_void); @@ -400,6 +467,19 @@ impl ::std::fmt::Debug for GskRepeatingLinearGradientNode { } } +#[repr(C)] +pub struct GskRepeatingRadialGradientNode(c_void); + +impl ::std::fmt::Debug for GskRepeatingRadialGradientNode { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!( + "GskRepeatingRadialGradientNode @ {:?}", + self as *const _ + )) + .finish() + } +} + #[repr(C)] pub struct GskRoundedClipNode(c_void); @@ -473,6 +553,11 @@ extern "C" { //========================================================================= pub fn gsk_corner_get_type() -> GType; + //========================================================================= + // GskGLUniformType + //========================================================================= + pub fn gsk_gl_uniform_type_get_type() -> GType; + //========================================================================= // GskRenderNodeType //========================================================================= @@ -541,6 +626,59 @@ extern "C" { left: c_float, ) -> *mut GskRoundedRect; + //========================================================================= + // GskShaderArgsBuilder + //========================================================================= + pub fn gsk_shader_args_builder_get_type() -> GType; + pub fn gsk_shader_args_builder_new( + shader: *mut GskGLShader, + initial_values: *mut glib::GBytes, + ) -> *mut GskShaderArgsBuilder; + pub fn gsk_shader_args_builder_free_to_args( + builder: *mut GskShaderArgsBuilder, + ) -> *mut glib::GBytes; + pub fn gsk_shader_args_builder_ref( + builder: *mut GskShaderArgsBuilder, + ) -> *mut GskShaderArgsBuilder; + pub fn gsk_shader_args_builder_set_bool( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: gboolean, + ); + pub fn gsk_shader_args_builder_set_float( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: c_float, + ); + pub fn gsk_shader_args_builder_set_int( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: i32, + ); + pub fn gsk_shader_args_builder_set_uint( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: u32, + ); + pub fn gsk_shader_args_builder_set_vec2( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: *const graphene::graphene_vec2_t, + ); + pub fn gsk_shader_args_builder_set_vec3( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: *const graphene::graphene_vec3_t, + ); + pub fn gsk_shader_args_builder_set_vec4( + builder: *mut GskShaderArgsBuilder, + idx: c_int, + value: *const graphene::graphene_vec4_t, + ); + pub fn gsk_shader_args_builder_to_args(builder: *mut GskShaderArgsBuilder) + -> *mut glib::GBytes; + pub fn gsk_shader_args_builder_unref(builder: *mut GskShaderArgsBuilder); + //========================================================================= // GskTransform //========================================================================= @@ -761,6 +899,90 @@ extern "C" { pub fn gsk_gl_renderer_get_type() -> GType; pub fn gsk_gl_renderer_new() -> *mut GskRenderer; + //========================================================================= + // GskGLShader + //========================================================================= + pub fn gsk_gl_shader_get_type() -> GType; + pub fn gsk_gl_shader_new_from_bytes(sourcecode: *mut glib::GBytes) -> *mut GskGLShader; + pub fn gsk_gl_shader_new_from_resource(resource_path: *const c_char) -> *mut GskGLShader; + pub fn gsk_gl_shader_compile( + shader: *mut GskGLShader, + renderer: *mut GskRenderer, + error: *mut *mut glib::GError, + ) -> gboolean; + pub fn gsk_gl_shader_find_uniform_by_name( + shader: *mut GskGLShader, + name: *const c_char, + ) -> c_int; + pub fn gsk_gl_shader_format_args(shader: *mut GskGLShader, ...) -> *mut glib::GBytes; + //pub fn gsk_gl_shader_format_args_va(shader: *mut GskGLShader, uniforms: /*Unimplemented*/va_list) -> *mut glib::GBytes; + pub fn gsk_gl_shader_get_arg_bool( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + ) -> gboolean; + pub fn gsk_gl_shader_get_arg_float( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + ) -> c_float; + pub fn gsk_gl_shader_get_arg_int( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + ) -> i32; + pub fn gsk_gl_shader_get_arg_uint( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + ) -> u32; + pub fn gsk_gl_shader_get_arg_vec2( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + out_value: *mut graphene::graphene_vec2_t, + ); + pub fn gsk_gl_shader_get_arg_vec3( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + out_value: *mut graphene::graphene_vec3_t, + ); + pub fn gsk_gl_shader_get_arg_vec4( + shader: *mut GskGLShader, + args: *mut glib::GBytes, + idx: c_int, + out_value: *mut graphene::graphene_vec4_t, + ); + pub fn gsk_gl_shader_get_args_size(shader: *mut GskGLShader) -> size_t; + pub fn gsk_gl_shader_get_n_textures(shader: *mut GskGLShader) -> c_int; + pub fn gsk_gl_shader_get_n_uniforms(shader: *mut GskGLShader) -> c_int; + pub fn gsk_gl_shader_get_resource(shader: *mut GskGLShader) -> *const c_char; + pub fn gsk_gl_shader_get_source(shader: *mut GskGLShader) -> *mut glib::GBytes; + pub fn gsk_gl_shader_get_uniform_name(shader: *mut GskGLShader, idx: c_int) -> *const c_char; + pub fn gsk_gl_shader_get_uniform_offset(shader: *mut GskGLShader, idx: c_int) -> c_int; + pub fn gsk_gl_shader_get_uniform_type(shader: *mut GskGLShader, idx: c_int) + -> GskGLUniformType; + + //========================================================================= + // GskGLShaderNode + //========================================================================= + pub fn gsk_gl_shader_node_get_type() -> GType; + pub fn gsk_gl_shader_node_new( + shader: *mut GskGLShader, + bounds: *const graphene::graphene_rect_t, + args: *mut glib::GBytes, + children: *mut *mut GskRenderNode, + n_children: c_uint, + ) -> *mut GskGLShaderNode; + pub fn gsk_gl_shader_node_get_args(node: *mut GskGLShaderNode) -> *mut glib::GBytes; + pub fn gsk_gl_shader_node_get_child( + node: *mut GskGLShaderNode, + idx: c_uint, + ) -> *mut GskRenderNode; + pub fn gsk_gl_shader_node_get_n_children(node: *mut GskGLShaderNode) -> c_uint; + pub fn gsk_gl_shader_node_get_shader(node: *mut GskGLShaderNode) -> *mut GskGLShader; + //========================================================================= // GskInsetShadowNode //========================================================================= @@ -836,6 +1058,33 @@ extern "C" { node: *mut GskOutsetShadowNode, ) -> *const GskRoundedRect; + //========================================================================= + // GskRadialGradientNode + //========================================================================= + pub fn gsk_radial_gradient_node_get_type() -> GType; + pub fn gsk_radial_gradient_node_new( + bounds: *const graphene::graphene_rect_t, + center: *const graphene::graphene_point_t, + hradius: c_float, + vradius: c_float, + start: c_float, + end: c_float, + color_stops: *const GskColorStop, + n_color_stops: size_t, + ) -> *mut GskRadialGradientNode; + pub fn gsk_radial_gradient_node_get_end(node: *mut GskRadialGradientNode) -> c_float; + pub fn gsk_radial_gradient_node_get_hradius(node: *mut GskRadialGradientNode) -> c_float; + pub fn gsk_radial_gradient_node_get_n_color_stops(node: *mut GskRadialGradientNode) -> size_t; + pub fn gsk_radial_gradient_node_get_start(node: *mut GskRadialGradientNode) -> c_float; + pub fn gsk_radial_gradient_node_get_vradius(node: *mut GskRadialGradientNode) -> c_float; + pub fn gsk_radial_gradient_node_peek_center( + node: *mut GskRadialGradientNode, + ) -> *const graphene::graphene_point_t; + pub fn gsk_radial_gradient_node_peek_color_stops( + node: *mut GskRadialGradientNode, + n_stops: *mut size_t, + ) -> *const GskColorStop; + //========================================================================= // GskRenderNode //========================================================================= @@ -910,6 +1159,21 @@ extern "C" { n_color_stops: size_t, ) -> *mut GskRepeatingLinearGradientNode; + //========================================================================= + // GskRepeatingRadialGradientNode + //========================================================================= + pub fn gsk_repeating_radial_gradient_node_get_type() -> GType; + pub fn gsk_repeating_radial_gradient_node_new( + bounds: *const graphene::graphene_rect_t, + center: *const graphene::graphene_point_t, + hradius: c_float, + vradius: c_float, + start: c_float, + end: c_float, + color_stops: *const GskColorStop, + n_color_stops: size_t, + ) -> *mut GskRepeatingRadialGradientNode; + //========================================================================= // GskRoundedClipNode //========================================================================= @@ -944,11 +1208,11 @@ extern "C" { color: *const gdk::GdkRGBA, offset: *const graphene::graphene_point_t, ) -> *mut GskTextNode; - pub fn gsk_text_node_peek_font(node: *mut GskRenderNode) -> *mut pango::PangoFont; pub fn gsk_text_node_get_num_glyphs(node: *mut GskTextNode) -> c_uint; pub fn gsk_text_node_get_offset(node: *mut GskTextNode) -> *const graphene::graphene_point_t; pub fn gsk_text_node_has_color_glyphs(node: *mut GskTextNode) -> gboolean; pub fn gsk_text_node_peek_color(node: *mut GskTextNode) -> *const gdk::GdkRGBA; + pub fn gsk_text_node_peek_font(node: *mut GskTextNode) -> *mut pango::PangoFont; pub fn gsk_text_node_peek_glyphs( node: *mut GskTextNode, n_glyphs: *mut c_uint, diff --git a/gsk4/sys/tests/abi.rs b/gsk4/sys/tests/abi.rs index 7fbc7f3b7310..fd486432dda6 100644 --- a/gsk4/sys/tests/abi.rs +++ b/gsk4/sys/tests/abi.rs @@ -273,6 +273,20 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ alignment: align_of::(), }, ), + ( + "GskGLShaderClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GskGLUniformType", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), ( "GskRenderNodeType", Layout { @@ -334,37 +348,48 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) GSK_BLEND_MODE_SATURATION", "14"), ("(gint) GSK_BLEND_MODE_SCREEN", "2"), ("(gint) GSK_BLEND_MODE_SOFT_LIGHT", "9"), - ("(gint) GSK_BLEND_NODE", "17"), - ("(gint) GSK_BLUR_NODE", "20"), - ("(gint) GSK_BORDER_NODE", "6"), + ("(gint) GSK_BLEND_NODE", "19"), + ("(gint) GSK_BLUR_NODE", "22"), + ("(gint) GSK_BORDER_NODE", "8"), ("(gint) GSK_CAIRO_NODE", "2"), - ("(gint) GSK_CLIP_NODE", "14"), - ("(gint) GSK_COLOR_MATRIX_NODE", "12"), + ("(gint) GSK_CLIP_NODE", "16"), + ("(gint) GSK_COLOR_MATRIX_NODE", "14"), ("(gint) GSK_COLOR_NODE", "3"), ("(gint) GSK_CONTAINER_NODE", "1"), ("(gint) GSK_CORNER_BOTTOM_LEFT", "3"), ("(gint) GSK_CORNER_BOTTOM_RIGHT", "2"), ("(gint) GSK_CORNER_TOP_LEFT", "0"), ("(gint) GSK_CORNER_TOP_RIGHT", "1"), - ("(gint) GSK_CROSS_FADE_NODE", "18"), - ("(gint) GSK_DEBUG_NODE", "21"), - ("(gint) GSK_INSET_SHADOW_NODE", "8"), + ("(gint) GSK_CROSS_FADE_NODE", "20"), + ("(gint) GSK_DEBUG_NODE", "23"), + ("(gint) GSK_GL_SHADER_NODE", "24"), + ("(gint) GSK_GL_UNIFORM_TYPE_BOOL", "4"), + ("(gint) GSK_GL_UNIFORM_TYPE_FLOAT", "1"), + ("(gint) GSK_GL_UNIFORM_TYPE_INT", "2"), + ("(gint) GSK_GL_UNIFORM_TYPE_NONE", "0"), + ("(gint) GSK_GL_UNIFORM_TYPE_UINT", "3"), + ("(gint) GSK_GL_UNIFORM_TYPE_VEC2", "5"), + ("(gint) GSK_GL_UNIFORM_TYPE_VEC3", "6"), + ("(gint) GSK_GL_UNIFORM_TYPE_VEC4", "7"), + ("(gint) GSK_INSET_SHADOW_NODE", "10"), ("(gint) GSK_LINEAR_GRADIENT_NODE", "4"), ("(gint) GSK_NOT_A_RENDER_NODE", "0"), - ("(gint) GSK_OPACITY_NODE", "11"), - ("(gint) GSK_OUTSET_SHADOW_NODE", "9"), + ("(gint) GSK_OPACITY_NODE", "13"), + ("(gint) GSK_OUTSET_SHADOW_NODE", "11"), + ("(gint) GSK_RADIAL_GRADIENT_NODE", "6"), ("(gint) GSK_REPEATING_LINEAR_GRADIENT_NODE", "5"), - ("(gint) GSK_REPEAT_NODE", "13"), - ("(gint) GSK_ROUNDED_CLIP_NODE", "15"), + ("(gint) GSK_REPEATING_RADIAL_GRADIENT_NODE", "7"), + ("(gint) GSK_REPEAT_NODE", "15"), + ("(gint) GSK_ROUNDED_CLIP_NODE", "17"), ("(gint) GSK_SCALING_FILTER_LINEAR", "0"), ("(gint) GSK_SCALING_FILTER_NEAREST", "1"), ("(gint) GSK_SCALING_FILTER_TRILINEAR", "2"), ("(gint) GSK_SERIALIZATION_INVALID_DATA", "2"), ("(gint) GSK_SERIALIZATION_UNSUPPORTED_FORMAT", "0"), ("(gint) GSK_SERIALIZATION_UNSUPPORTED_VERSION", "1"), - ("(gint) GSK_SHADOW_NODE", "16"), - ("(gint) GSK_TEXTURE_NODE", "7"), - ("(gint) GSK_TEXT_NODE", "19"), + ("(gint) GSK_SHADOW_NODE", "18"), + ("(gint) GSK_TEXTURE_NODE", "9"), + ("(gint) GSK_TEXT_NODE", "21"), ("(gint) GSK_TRANSFORM_CATEGORY_2D", "3"), ("(gint) GSK_TRANSFORM_CATEGORY_2D_AFFINE", "4"), ("(gint) GSK_TRANSFORM_CATEGORY_2D_TRANSLATE", "5"), @@ -372,5 +397,5 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) GSK_TRANSFORM_CATEGORY_ANY", "1"), ("(gint) GSK_TRANSFORM_CATEGORY_IDENTITY", "6"), ("(gint) GSK_TRANSFORM_CATEGORY_UNKNOWN", "0"), - ("(gint) GSK_TRANSFORM_NODE", "10"), + ("(gint) GSK_TRANSFORM_NODE", "12"), ]; diff --git a/gsk4/sys/versions.txt b/gsk4/sys/versions.txt index 7ed425ecd43e..a84a9493a8ec 100644 --- a/gsk4/sys/versions.txt +++ b/gsk4/sys/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 2f86b9a) -from gir-files (https://github.com/gtk-rs/gir-files @ cb01ad7) +from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1) diff --git a/gtk4/src/auto/about_dialog.rs b/gtk4/src/auto/about_dialog.rs index ba69be9683ba..34d31ddabd6a 100644 --- a/gtk4/src/auto/about_dialog.rs +++ b/gtk4/src/auto/about_dialog.rs @@ -24,7 +24,6 @@ use Align; use Application; use Buildable; use ConstraintTarget; -use Dialog; use LayoutManager; use License; use Native; @@ -35,7 +34,7 @@ use Widget; use Window; glib_wrapper! { - pub struct AboutDialog(Object) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager; + pub struct AboutDialog(Object) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager; match fn { get_type => || gtk_sys::gtk_about_dialog_get_type(), @@ -751,7 +750,6 @@ pub struct AboutDialogBuilder { website: Option, website_label: Option, wrap_license: Option, - use_header_bar: Option, application: Option, child: Option, decorated: Option, @@ -858,9 +856,6 @@ impl AboutDialogBuilder { if let Some(ref wrap_license) = self.wrap_license { properties.push(("wrap-license", wrap_license)); } - if let Some(ref use_header_bar) = self.use_header_bar { - properties.push(("use-header-bar", use_header_bar)); - } if let Some(ref application) = self.application { properties.push(("application", application)); } @@ -1095,11 +1090,6 @@ impl AboutDialogBuilder { self } - pub fn use_header_bar(mut self, use_header_bar: i32) -> Self { - self.use_header_bar = Some(use_header_bar); - self - } - pub fn application>(mut self, application: &P) -> Self { self.application = Some(application.clone().upcast()); self diff --git a/gtk4/src/auto/accessible.rs b/gtk4/src/auto/accessible.rs index b89966a8615c..8d6eac6373b2 100644 --- a/gtk4/src/auto/accessible.rs +++ b/gtk4/src/auto/accessible.rs @@ -2,7 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; @@ -41,15 +40,15 @@ pub trait AccessibleExt: 'static { //fn update_property(&self, first_property: AccessibleProperty, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); - fn update_property_value(&self, property: AccessibleProperty, value: &glib::Value); + //fn update_property_value(&self, properties: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 14 }, values: &[&glib::Value]); //fn update_relation(&self, first_relation: AccessibleRelation, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); - fn update_relation_value(&self, relation: AccessibleRelation, value: &glib::Value); + //fn update_relation_value(&self, relations: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 15 }, values: &[&glib::Value]); //fn update_state(&self, first_state: AccessibleState, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); - fn update_state_value(&self, state: AccessibleState, value: &glib::Value); + //fn update_state_value(&self, states: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 16 }, values: &[&glib::Value]); fn set_property_accessible_role(&self, accessible_role: AccessibleRole); @@ -96,43 +95,25 @@ impl> AccessibleExt for O { // unsafe { TODO: call gtk_sys:gtk_accessible_update_property() } //} - fn update_property_value(&self, property: AccessibleProperty, value: &glib::Value) { - unsafe { - gtk_sys::gtk_accessible_update_property_value( - self.as_ref().to_glib_none().0, - property.to_glib(), - value.to_glib_none().0, - ); - } - } + //fn update_property_value(&self, properties: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 14 }, values: &[&glib::Value]) { + // unsafe { TODO: call gtk_sys:gtk_accessible_update_property_value() } + //} //fn update_relation(&self, first_relation: AccessibleRelation, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call gtk_sys:gtk_accessible_update_relation() } //} - fn update_relation_value(&self, relation: AccessibleRelation, value: &glib::Value) { - unsafe { - gtk_sys::gtk_accessible_update_relation_value( - self.as_ref().to_glib_none().0, - relation.to_glib(), - value.to_glib_none().0, - ); - } - } + //fn update_relation_value(&self, relations: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 15 }, values: &[&glib::Value]) { + // unsafe { TODO: call gtk_sys:gtk_accessible_update_relation_value() } + //} //fn update_state(&self, first_state: AccessibleState, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call gtk_sys:gtk_accessible_update_state() } //} - fn update_state_value(&self, state: AccessibleState, value: &glib::Value) { - unsafe { - gtk_sys::gtk_accessible_update_state_value( - self.as_ref().to_glib_none().0, - state.to_glib(), - value.to_glib_none().0, - ); - } - } + //fn update_state_value(&self, states: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 16 }, values: &[&glib::Value]) { + // unsafe { TODO: call gtk_sys:gtk_accessible_update_state_value() } + //} fn set_property_accessible_role(&self, accessible_role: AccessibleRole) { unsafe { diff --git a/gtk4/src/auto/any_filter.rs b/gtk4/src/auto/any_filter.rs index d8d284b3ceee..1bd21b728a77 100644 --- a/gtk4/src/auto/any_filter.rs +++ b/gtk4/src/auto/any_filter.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use gio; -use glib::object::Cast; use glib::translate::*; use gtk_sys; use std::fmt; @@ -22,7 +21,7 @@ glib_wrapper! { impl AnyFilter { pub fn new() -> AnyFilter { assert_initialized_main_thread!(); - unsafe { Filter::from_glib_full(gtk_sys::gtk_any_filter_new()).unsafe_cast() } + unsafe { from_glib_full(gtk_sys::gtk_any_filter_new()) } } } diff --git a/gtk4/src/auto/at_context.rs b/gtk4/src/auto/at_context.rs index 4d89a890341d..6daea9a8dc42 100644 --- a/gtk4/src/auto/at_context.rs +++ b/gtk4/src/auto/at_context.rs @@ -3,9 +3,15 @@ // DO NOT EDIT use glib::object::IsA; +use glib::object::ObjectType as ObjectType_; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; use glib::translate::*; +use glib_sys; use gtk_sys; +use std::boxed::Box as Box_; use std::fmt; +use std::mem::transmute; use Accessible; use AccessibleRole; @@ -47,11 +53,26 @@ impl ATContext { } } - //pub fn connect_state_change(&self, f: F) -> SignalHandlerId { - // Unimplemented states: *.Pointer - // Unimplemented properties: *.Pointer - // Unimplemented relations: *.Pointer - //} + pub fn connect_state_change(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn state_change_trampoline( + this: *mut gtk_sys::GtkATContext, + f: glib_sys::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"state-change\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + state_change_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } } impl fmt::Display for ATContext { diff --git a/gtk4/src/auto/buildable.rs b/gtk4/src/auto/buildable.rs index e7f47bde56e1..6e2c27fefc3b 100644 --- a/gtk4/src/auto/buildable.rs +++ b/gtk4/src/auto/buildable.rs @@ -2,13 +2,11 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use glib; use glib::object::IsA; use glib::translate::*; use glib::GString; use gtk_sys; use std::fmt; -use Builder; glib_wrapper! { pub struct Buildable(Interface); @@ -21,104 +19,17 @@ glib_wrapper! { pub const NONE_BUILDABLE: Option<&Buildable> = None; pub trait BuildableExt: 'static { - fn add_child>(&self, builder: &Builder, child: &P, type_: Option<&str>); - - fn construct_child(&self, builder: &Builder, name: &str) -> Option; - - //fn custom_finished>(&self, builder: &Builder, child: Option<&P>, tagname: &str, data: /*Unimplemented*/Option); - - //fn custom_tag_end>(&self, builder: &Builder, child: Option<&P>, tagname: &str, data: /*Unimplemented*/Option); - - //fn custom_tag_start>(&self, builder: &Builder, child: Option<&P>, tagname: &str, data: /*Unimplemented*/&mut Option) -> Option; - - fn get_internal_child(&self, builder: &Builder, childname: &str) -> Option; - - fn get_name(&self) -> Option; - - fn parser_finished(&self, builder: &Builder); - - fn set_buildable_property(&self, builder: &Builder, name: &str, value: &glib::Value); - - fn set_name(&self, name: &str); + fn get_buildable_id(&self) -> Option; } impl> BuildableExt for O { - fn add_child>(&self, builder: &Builder, child: &P, type_: Option<&str>) { - unsafe { - gtk_sys::gtk_buildable_add_child( - self.as_ref().to_glib_none().0, - builder.to_glib_none().0, - child.as_ref().to_glib_none().0, - type_.to_glib_none().0, - ); - } - } - - fn construct_child(&self, builder: &Builder, name: &str) -> Option { + fn get_buildable_id(&self) -> Option { unsafe { - from_glib_full(gtk_sys::gtk_buildable_construct_child( + from_glib_none(gtk_sys::gtk_buildable_get_buildable_id( self.as_ref().to_glib_none().0, - builder.to_glib_none().0, - name.to_glib_none().0, )) } } - - //fn custom_finished>(&self, builder: &Builder, child: Option<&P>, tagname: &str, data: /*Unimplemented*/Option) { - // unsafe { TODO: call gtk_sys:gtk_buildable_custom_finished() } - //} - - //fn custom_tag_end>(&self, builder: &Builder, child: Option<&P>, tagname: &str, data: /*Unimplemented*/Option) { - // unsafe { TODO: call gtk_sys:gtk_buildable_custom_tag_end() } - //} - - //fn custom_tag_start>(&self, builder: &Builder, child: Option<&P>, tagname: &str, data: /*Unimplemented*/&mut Option) -> Option { - // unsafe { TODO: call gtk_sys:gtk_buildable_custom_tag_start() } - //} - - fn get_internal_child(&self, builder: &Builder, childname: &str) -> Option { - unsafe { - from_glib_none(gtk_sys::gtk_buildable_get_internal_child( - self.as_ref().to_glib_none().0, - builder.to_glib_none().0, - childname.to_glib_none().0, - )) - } - } - - fn get_name(&self) -> Option { - unsafe { - from_glib_none(gtk_sys::gtk_buildable_get_name( - self.as_ref().to_glib_none().0, - )) - } - } - - fn parser_finished(&self, builder: &Builder) { - unsafe { - gtk_sys::gtk_buildable_parser_finished( - self.as_ref().to_glib_none().0, - builder.to_glib_none().0, - ); - } - } - - fn set_buildable_property(&self, builder: &Builder, name: &str, value: &glib::Value) { - unsafe { - gtk_sys::gtk_buildable_set_buildable_property( - self.as_ref().to_glib_none().0, - builder.to_glib_none().0, - name.to_glib_none().0, - value.to_glib_none().0, - ); - } - } - - fn set_name(&self, name: &str) { - unsafe { - gtk_sys::gtk_buildable_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0); - } - } } impl fmt::Display for Buildable { diff --git a/gtk4/src/auto/check_button.rs b/gtk4/src/auto/check_button.rs index e31c54e571fd..ff9ff06c5f13 100644 --- a/gtk4/src/auto/check_button.rs +++ b/gtk4/src/auto/check_button.rs @@ -8,6 +8,7 @@ use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; +use glib::GString; use glib::StaticType; use glib::ToValue; use glib_sys; @@ -20,15 +21,13 @@ use AccessibleRole; use Actionable; use Align; use Buildable; -use Button; use ConstraintTarget; use LayoutManager; use Overflow; -use ToggleButton; use Widget; glib_wrapper! { - pub struct CheckButton(Object) @extends ToggleButton, Button, Widget, @implements Accessible, Buildable, ConstraintTarget, Actionable; + pub struct CheckButton(Object) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Actionable; match fn { get_type => || gtk_sys::gtk_check_button_get_type(), @@ -41,7 +40,7 @@ impl CheckButton { unsafe { Widget::from_glib_none(gtk_sys::gtk_check_button_new()).unsafe_cast() } } - pub fn with_label(label: &str) -> CheckButton { + pub fn with_label(label: Option<&str>) -> CheckButton { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(gtk_sys::gtk_check_button_new_with_label( @@ -51,7 +50,7 @@ impl CheckButton { } } - pub fn with_mnemonic(label: &str) -> CheckButton { + pub fn with_mnemonic(label: Option<&str>) -> CheckButton { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(gtk_sys::gtk_check_button_new_with_mnemonic( @@ -70,12 +69,9 @@ impl Default for CheckButton { #[derive(Clone, Default)] pub struct CheckButtonBuilder { - draw_indicator: Option, - inconsistent: Option, active: Option, - child: Option, - has_frame: Option, - icon_name: Option, + group: Option, + inconsistent: Option, label: Option, use_underline: Option, can_focus: Option, @@ -118,23 +114,14 @@ impl CheckButtonBuilder { pub fn build(self) -> CheckButton { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; - if let Some(ref draw_indicator) = self.draw_indicator { - properties.push(("draw-indicator", draw_indicator)); - } - if let Some(ref inconsistent) = self.inconsistent { - properties.push(("inconsistent", inconsistent)); - } if let Some(ref active) = self.active { properties.push(("active", active)); } - if let Some(ref child) = self.child { - properties.push(("child", child)); - } - if let Some(ref has_frame) = self.has_frame { - properties.push(("has-frame", has_frame)); + if let Some(ref group) = self.group { + properties.push(("group", group)); } - if let Some(ref icon_name) = self.icon_name { - properties.push(("icon-name", icon_name)); + if let Some(ref inconsistent) = self.inconsistent { + properties.push(("inconsistent", inconsistent)); } if let Some(ref label) = self.label { properties.push(("label", label)); @@ -242,33 +229,18 @@ impl CheckButtonBuilder { ret } - pub fn draw_indicator(mut self, draw_indicator: bool) -> Self { - self.draw_indicator = Some(draw_indicator); - self - } - - pub fn inconsistent(mut self, inconsistent: bool) -> Self { - self.inconsistent = Some(inconsistent); - self - } - pub fn active(mut self, active: bool) -> Self { self.active = Some(active); self } - pub fn child>(mut self, child: &P) -> Self { - self.child = Some(child.clone().upcast()); - self - } - - pub fn has_frame(mut self, has_frame: bool) -> Self { - self.has_frame = Some(has_frame); + pub fn group>(mut self, group: &P) -> Self { + self.group = Some(group.clone().upcast()); self } - pub fn icon_name(mut self, icon_name: &str) -> Self { - self.icon_name = Some(icon_name.to_string()); + pub fn inconsistent(mut self, inconsistent: bool) -> Self { + self.inconsistent = Some(inconsistent); self } @@ -441,27 +413,45 @@ impl CheckButtonBuilder { pub const NONE_CHECK_BUTTON: Option<&CheckButton> = None; pub trait CheckButtonExt: 'static { - fn get_draw_indicator(&self) -> bool; + fn get_active(&self) -> bool; fn get_inconsistent(&self) -> bool; - fn set_draw_indicator(&self, draw_indicator: bool); + fn get_label(&self) -> Option; + + fn get_use_underline(&self) -> bool; + + fn set_active(&self, setting: bool); + + fn set_group>(&self, group: Option<&P>); fn set_inconsistent(&self, inconsistent: bool); - fn connect_property_draw_indicator_notify( - &self, - f: F, - ) -> SignalHandlerId; + fn set_label(&self, label: Option<&str>); + + fn set_use_underline(&self, setting: bool); + + fn connect_toggled(&self, f: F) -> SignalHandlerId; + + fn connect_property_active_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_group_notify(&self, f: F) -> SignalHandlerId; fn connect_property_inconsistent_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_label_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_use_underline_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> CheckButtonExt for O { - fn get_draw_indicator(&self) -> bool { + fn get_active(&self) -> bool { unsafe { - from_glib(gtk_sys::gtk_check_button_get_draw_indicator( + from_glib(gtk_sys::gtk_check_button_get_active( self.as_ref().to_glib_none().0, )) } @@ -475,11 +465,33 @@ impl> CheckButtonExt for O { } } - fn set_draw_indicator(&self, draw_indicator: bool) { + fn get_label(&self) -> Option { + unsafe { + from_glib_none(gtk_sys::gtk_check_button_get_label( + self.as_ref().to_glib_none().0, + )) + } + } + + fn get_use_underline(&self) -> bool { unsafe { - gtk_sys::gtk_check_button_set_draw_indicator( + from_glib(gtk_sys::gtk_check_button_get_use_underline( self.as_ref().to_glib_none().0, - draw_indicator.to_glib(), + )) + } + } + + fn set_active(&self, setting: bool) { + unsafe { + gtk_sys::gtk_check_button_set_active(self.as_ref().to_glib_none().0, setting.to_glib()); + } + } + + fn set_group>(&self, group: Option<&P>) { + unsafe { + gtk_sys::gtk_check_button_set_group( + self.as_ref().to_glib_none().0, + group.map(|p| p.as_ref()).to_glib_none().0, ); } } @@ -493,11 +505,73 @@ impl> CheckButtonExt for O { } } - fn connect_property_draw_indicator_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_draw_indicator_trampoline( + fn set_label(&self, label: Option<&str>) { + unsafe { + gtk_sys::gtk_check_button_set_label( + self.as_ref().to_glib_none().0, + label.to_glib_none().0, + ); + } + } + + fn set_use_underline(&self, setting: bool) { + unsafe { + gtk_sys::gtk_check_button_set_use_underline( + self.as_ref().to_glib_none().0, + setting.to_glib(), + ); + } + } + + fn connect_toggled(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn toggled_trampoline( + this: *mut gtk_sys::GtkCheckButton, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&CheckButton::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"toggled\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + toggled_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_active_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_active_trampoline( + this: *mut gtk_sys::GtkCheckButton, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&CheckButton::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::active\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_active_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_group_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_group_trampoline( this: *mut gtk_sys::GtkCheckButton, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, @@ -511,9 +585,9 @@ impl> CheckButtonExt for O { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, - b"notify::draw-indicator\0".as_ptr() as *const _, + b"notify::group\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( - notify_draw_indicator_trampoline:: as *const (), + notify_group_trampoline:: as *const (), )), Box_::into_raw(f), ) @@ -546,6 +620,57 @@ impl> CheckButtonExt for O { ) } } + + fn connect_property_label_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_label_trampoline( + this: *mut gtk_sys::GtkCheckButton, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&CheckButton::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::label\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_label_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_use_underline_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_use_underline_trampoline( + this: *mut gtk_sys::GtkCheckButton, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&CheckButton::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::use-underline\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_use_underline_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } } impl fmt::Display for CheckButton { diff --git a/gtk4/src/auto/color_button.rs b/gtk4/src/auto/color_button.rs index f6a29d5217b2..24d59573506d 100644 --- a/gtk4/src/auto/color_button.rs +++ b/gtk4/src/auto/color_button.rs @@ -144,31 +144,6 @@ impl ColorButton { } } - pub fn connect_property_rgba_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_rgba_trampoline( - this: *mut gtk_sys::GtkColorButton, - _param_spec: glib_sys::gpointer, - f: glib_sys::gpointer, - ) { - let f: &F = &*(f as *const F); - f(&from_glib_borrow(this)) - } - unsafe { - let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::rgba\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - notify_rgba_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - pub fn connect_property_show_editor_notify( &self, f: F, @@ -218,31 +193,6 @@ impl ColorButton { ) } } - - pub fn connect_property_use_alpha_notify( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn notify_use_alpha_trampoline( - this: *mut gtk_sys::GtkColorButton, - _param_spec: glib_sys::gpointer, - f: glib_sys::gpointer, - ) { - let f: &F = &*(f as *const F); - f(&from_glib_borrow(this)) - } - unsafe { - let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::use-alpha\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - notify_use_alpha_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } } impl Default for ColorButton { @@ -254,10 +204,8 @@ impl Default for ColorButton { #[derive(Clone, Default)] pub struct ColorButtonBuilder { modal: Option, - rgba: Option, show_editor: Option, title: Option, - use_alpha: Option, can_focus: Option, can_target: Option, css_classes: Option>, @@ -288,6 +236,8 @@ pub struct ColorButtonBuilder { visible: Option, width_request: Option, accessible_role: Option, + rgba: Option, + use_alpha: Option, } impl ColorButtonBuilder { @@ -300,18 +250,12 @@ impl ColorButtonBuilder { if let Some(ref modal) = self.modal { properties.push(("modal", modal)); } - if let Some(ref rgba) = self.rgba { - properties.push(("rgba", rgba)); - } if let Some(ref show_editor) = self.show_editor { properties.push(("show-editor", show_editor)); } if let Some(ref title) = self.title { properties.push(("title", title)); } - if let Some(ref use_alpha) = self.use_alpha { - properties.push(("use-alpha", use_alpha)); - } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } @@ -402,6 +346,12 @@ impl ColorButtonBuilder { if let Some(ref accessible_role) = self.accessible_role { properties.push(("accessible-role", accessible_role)); } + if let Some(ref rgba) = self.rgba { + properties.push(("rgba", rgba)); + } + if let Some(ref use_alpha) = self.use_alpha { + properties.push(("use-alpha", use_alpha)); + } let ret = glib::Object::new(ColorButton::static_type(), &properties) .expect("object new") .downcast::() @@ -414,11 +364,6 @@ impl ColorButtonBuilder { self } - pub fn rgba(mut self, rgba: &gdk::RGBA) -> Self { - self.rgba = Some(rgba.clone()); - self - } - pub fn show_editor(mut self, show_editor: bool) -> Self { self.show_editor = Some(show_editor); self @@ -429,11 +374,6 @@ impl ColorButtonBuilder { self } - pub fn use_alpha(mut self, use_alpha: bool) -> Self { - self.use_alpha = Some(use_alpha); - self - } - pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self @@ -583,6 +523,16 @@ impl ColorButtonBuilder { self.accessible_role = Some(accessible_role); self } + + pub fn rgba(mut self, rgba: &gdk::RGBA) -> Self { + self.rgba = Some(rgba.clone()); + self + } + + pub fn use_alpha(mut self, use_alpha: bool) -> Self { + self.use_alpha = Some(use_alpha); + self + } } impl fmt::Display for ColorButton { diff --git a/gtk4/src/auto/column_view.rs b/gtk4/src/auto/column_view.rs index d049d7113740..80def8268bf4 100644 --- a/gtk4/src/auto/column_view.rs +++ b/gtk4/src/auto/column_view.rs @@ -29,6 +29,7 @@ use LayoutManager; use Overflow; use Scrollable; use ScrollablePolicy; +use SelectionModel; use SortType; use Sorter; use Widget; @@ -42,7 +43,7 @@ glib_wrapper! { } impl ColumnView { - pub fn new>(model: Option<&P>) -> ColumnView { + pub fn new>(model: Option<&P>) -> ColumnView { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(gtk_sys::gtk_column_view_new( @@ -70,7 +71,7 @@ impl ColumnView { } } - pub fn get_model(&self) -> Option { + pub fn get_model(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_column_view_get_model(self.to_glib_none().0)) } } @@ -135,7 +136,7 @@ impl ColumnView { } } - pub fn set_model>(&self, model: Option<&P>) { + pub fn set_model>(&self, model: Option<&P>) { unsafe { gtk_sys::gtk_column_view_set_model( self.to_glib_none().0, @@ -417,7 +418,7 @@ impl ColumnView { #[derive(Clone, Default)] pub struct ColumnViewBuilder { enable_rubberband: Option, - model: Option, + model: Option, reorderable: Option, show_column_separators: Option, show_row_separators: Option, @@ -597,7 +598,7 @@ impl ColumnViewBuilder { self } - pub fn model>(mut self, model: &P) -> Self { + pub fn model>(mut self, model: &P) -> Self { self.model = Some(model.clone().upcast()); self } diff --git a/gtk4/src/auto/column_view_column.rs b/gtk4/src/auto/column_view_column.rs index dcc95be9d847..ba57dd5dd7ff 100644 --- a/gtk4/src/auto/column_view_column.rs +++ b/gtk4/src/auto/column_view_column.rs @@ -30,20 +30,15 @@ glib_wrapper! { } impl ColumnViewColumn { - pub fn new(title: Option<&str>) -> ColumnViewColumn { - assert_initialized_main_thread!(); - unsafe { from_glib_full(gtk_sys::gtk_column_view_column_new(title.to_glib_none().0)) } - } - - pub fn with_factory>( + pub fn new>( title: Option<&str>, - factory: &P, + factory: Option<&P>, ) -> ColumnViewColumn { - skip_assert_initialized!(); + assert_initialized_main_thread!(); unsafe { - from_glib_full(gtk_sys::gtk_column_view_column_new_with_factory( + from_glib_full(gtk_sys::gtk_column_view_column_new( title.to_glib_none().0, - factory.as_ref().to_glib_full(), + factory.map(|p| p.as_ref()).to_glib_full(), )) } } diff --git a/gtk4/src/auto/constants.rs b/gtk4/src/auto/constants.rs index 4d3733f9f062..34f0c4d23e25 100644 --- a/gtk4/src/auto/constants.rs +++ b/gtk4/src/auto/constants.rs @@ -261,489 +261,3 @@ pub static PRINT_SETTINGS_WIN32_DRIVER_VERSION: once_cell::sync::Lazy<&'static s .to_str() .unwrap() }); -pub static STYLE_CLASS_ACCELERATOR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_ACCELERATOR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_ARROW: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_ARROW) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_BACKGROUND: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_BACKGROUND) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_BOTTOM: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_BOTTOM) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_BUTTON: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_BUTTON) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_CALENDAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_CALENDAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_CELL: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_CELL) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_CHECK: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_CHECK) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_COMBOBOX_ENTRY: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_COMBOBOX_ENTRY) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_CONTEXT_MENU: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_CONTEXT_MENU) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_CSD: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_CSD) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_CURSOR_HANDLE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_CURSOR_HANDLE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_DEFAULT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_DEFAULT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_DESTRUCTIVE_ACTION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_DESTRUCTIVE_ACTION) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_DIM_LABEL: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_DIM_LABEL) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_DND: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_DND) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_DOCK: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_DOCK) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_ENTRY: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_ENTRY) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_ERROR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_ERROR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_EXPANDER: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_EXPANDER) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_FLAT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_FLAT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_FRAME: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_FRAME) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_HEADER: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_HEADER) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_HIGHLIGHT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_HIGHLIGHT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_HORIZONTAL: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_HORIZONTAL) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_IMAGE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_IMAGE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_INFO: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_INFO) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_INSERTION_CURSOR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_INSERTION_CURSOR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_LABEL: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_LABEL) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_LEFT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_LEFT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_LEVEL_BAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_LEVEL_BAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_LINKED: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_LINKED) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_LIST: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_LIST) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_LIST_ROW: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_LIST_ROW) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_MARK: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_MARK) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_MENU: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_MENU) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_MENUBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_MENUBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_MENUITEM: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_MENUITEM) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_MESSAGE_DIALOG: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_MESSAGE_DIALOG) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_MONOSPACE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_MONOSPACE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_NEEDS_ATTENTION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_NEEDS_ATTENTION) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_NOTEBOOK: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_NOTEBOOK) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_OSD: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_OSD) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_OVERSHOOT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_OVERSHOOT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_PANE_SEPARATOR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_PANE_SEPARATOR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_PAPER: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_PAPER) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_POPOVER: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_POPOVER) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_POPUP: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_POPUP) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_PROGRESSBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_PROGRESSBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_PULSE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_PULSE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_QUESTION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_QUESTION) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_RADIO: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_RADIO) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_RAISED: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_RAISED) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_READ_ONLY: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_READ_ONLY) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_RIGHT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_RIGHT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_RUBBERBAND: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_RUBBERBAND) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SCALE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SCALE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SCALE_HAS_MARKS_ABOVE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SCALE_HAS_MARKS_BELOW: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SCROLLBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SCROLLBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SCROLLBARS_JUNCTION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SCROLLBARS_JUNCTION) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SEPARATOR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SEPARATOR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SIDEBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SIDEBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SLIDER: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SLIDER) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SPINBUTTON: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SPINBUTTON) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SPINNER: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SPINNER) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_STATUSBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_STATUSBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SUBTITLE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SUBTITLE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_SUGGESTED_ACTION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_SUGGESTED_ACTION) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TITLE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TITLE) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TITLEBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TITLEBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TOOLBAR: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TOOLBAR) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TOOLTIP: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TOOLTIP) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TOP: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TOP) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TOUCH_SELECTION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TOUCH_SELECTION) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_TROUGH: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_TROUGH) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_UNDERSHOOT: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_UNDERSHOOT) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_VERTICAL: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_VERTICAL) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_VIEW: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_VIEW) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_WARNING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_WARNING) - .to_str() - .unwrap() - }); -pub static STYLE_CLASS_WIDE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(gtk_sys::GTK_STYLE_CLASS_WIDE) - .to_str() - .unwrap() - }); diff --git a/gtk4/src/auto/custom_filter.rs b/gtk4/src/auto/custom_filter.rs index 94c9ee1fb1a3..d073b5ec1363 100644 --- a/gtk4/src/auto/custom_filter.rs +++ b/gtk4/src/auto/custom_filter.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use glib; -use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use gtk_sys; @@ -51,12 +50,11 @@ impl CustomFilter { let super_callback0: Box_ bool + 'static>>> = match_func_data; unsafe { - Filter::from_glib_full(gtk_sys::gtk_custom_filter_new( + from_glib_full(gtk_sys::gtk_custom_filter_new( match_func, Box_::into_raw(super_callback0) as *mut _, destroy_call2, )) - .unsafe_cast() } } } diff --git a/gtk4/src/auto/directory_list.rs b/gtk4/src/auto/directory_list.rs index f08726432f85..b9dd33d50cd1 100644 --- a/gtk4/src/auto/directory_list.rs +++ b/gtk4/src/auto/directory_list.rs @@ -118,8 +118,6 @@ pub trait DirectoryListExt: 'static { fn set_monitored(&self, monitored: bool); - fn get_property_item_type(&self) -> glib::types::Type; - fn get_property_loading(&self) -> bool; fn connect_property_attributes_notify(&self, f: F) -> SignalHandlerId; @@ -130,8 +128,6 @@ pub trait DirectoryListExt: 'static { fn connect_property_io_priority_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_item_type_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_loading_notify(&self, f: F) -> SignalHandlerId; fn connect_property_monitored_notify(&self, f: F) -> SignalHandlerId; @@ -218,21 +214,6 @@ impl> DirectoryListExt for O { } } - fn get_property_item_type(&self) -> glib::types::Type { - unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.to_glib_none().0 as *mut gobject_sys::GObject, - b"item-type\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `item-type` getter") - .unwrap() - } - } - fn get_property_loading(&self) -> bool { unsafe { let mut value = Value::from_type(::static_type()); @@ -344,30 +325,6 @@ impl> DirectoryListExt for O { } } - fn connect_property_item_type_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_item_type_trampoline( - this: *mut gtk_sys::GtkDirectoryList, - _param_spec: glib_sys::gpointer, - f: glib_sys::gpointer, - ) where - P: IsA, - { - let f: &F = &*(f as *const F); - f(&DirectoryList::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::item-type\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - notify_item_type_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) - } - } - fn connect_property_loading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_loading_trampoline( this: *mut gtk_sys::GtkDirectoryList, diff --git a/gtk4/src/auto/every_filter.rs b/gtk4/src/auto/every_filter.rs index 1c451ff29bfb..8849a49f9180 100644 --- a/gtk4/src/auto/every_filter.rs +++ b/gtk4/src/auto/every_filter.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use gio; -use glib::object::Cast; use glib::translate::*; use gtk_sys; use std::fmt; @@ -22,7 +21,7 @@ glib_wrapper! { impl EveryFilter { pub fn new() -> EveryFilter { assert_initialized_main_thread!(); - unsafe { Filter::from_glib_full(gtk_sys::gtk_every_filter_new()).unsafe_cast() } + unsafe { from_glib_full(gtk_sys::gtk_every_filter_new()) } } } diff --git a/gtk4/src/auto/file_filter.rs b/gtk4/src/auto/file_filter.rs index 1315636f65f7..d73dc2d95326 100644 --- a/gtk4/src/auto/file_filter.rs +++ b/gtk4/src/auto/file_filter.rs @@ -71,6 +71,16 @@ impl FileFilter { } } + pub fn get_name(&self) -> Option { + unsafe { from_glib_none(gtk_sys::gtk_file_filter_get_name(self.to_glib_none().0)) } + } + + pub fn set_name(&self, name: Option<&str>) { + unsafe { + gtk_sys::gtk_file_filter_set_name(self.to_glib_none().0, name.to_glib_none().0); + } + } + pub fn to_gvariant(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_file_filter_to_gvariant(self.to_glib_none().0)) } } diff --git a/gtk4/src/auto/flags.rs b/gtk4/src/auto/flags.rs index 88dfc4709fed..2fe251465be5 100644 --- a/gtk4/src/auto/flags.rs +++ b/gtk4/src/auto/flags.rs @@ -162,70 +162,6 @@ impl SetValue for CellRendererState { } } -bitflags! { - pub struct DebugFlag: u32 { - const TEXT = 1; - const TREE = 2; - const KEYBINDINGS = 4; - const MODULES = 8; - const GEOMETRY = 16; - const ICONTHEME = 32; - const PRINTING = 64; - const BUILDER = 128; - const SIZE_REQUEST = 256; - const NO_CSS_CACHE = 512; - const INTERACTIVE = 1024; - const TOUCHSCREEN = 2048; - const ACTIONS = 4096; - const LAYOUT = 8192; - const SNAPSHOT = 16384; - const CONSTRAINTS = 32768; - const BUILDER_OBJECTS = 65536; - const A11Y = 131072; - } -} - -#[doc(hidden)] -impl ToGlib for DebugFlag { - type GlibType = gtk_sys::GtkDebugFlag; - - fn to_glib(&self) -> gtk_sys::GtkDebugFlag { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib for DebugFlag { - fn from_glib(value: gtk_sys::GtkDebugFlag) -> DebugFlag { - skip_assert_initialized!(); - DebugFlag::from_bits_truncate(value) - } -} - -impl StaticType for DebugFlag { - fn static_type() -> Type { - unsafe { from_glib(gtk_sys::gtk_debug_flag_get_type()) } - } -} - -impl<'a> FromValueOptional<'a> for DebugFlag { - unsafe fn from_value_optional(value: &Value) -> Option { - Some(FromValue::from_value(value)) - } -} - -impl<'a> FromValue<'a> for DebugFlag { - unsafe fn from_value(value: &Value) -> Self { - from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl SetValue for DebugFlag { - unsafe fn set_value(value: &mut Value, this: &Self) { - gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) - } -} - bitflags! { pub struct DialogFlags: u32 { const MODAL = 1; @@ -441,6 +377,7 @@ bitflags! { const VERTICAL_WRITING = 256; const EMOJI = 512; const NO_EMOJI = 1024; + const PRIVATE = 2048; } } diff --git a/gtk4/src/auto/functions.rs b/gtk4/src/auto/functions.rs index 439cd77d7af0..84d0dda2d806 100644 --- a/gtk4/src/auto/functions.rs +++ b/gtk4/src/auto/functions.rs @@ -18,7 +18,6 @@ use AccessibleProperty; use AccessibleRelation; use AccessibleRole; use AccessibleState; -use Orientation; use PageSetup; use PrintSettings; use StyleContext; @@ -138,10 +137,9 @@ pub fn disable_setlocale() { // unsafe { TODO: call gtk_sys:gtk_distribute_natural_allocation() } //} -pub fn get_debug_flags() -> u32 { - assert_initialized_main_thread!(); - unsafe { gtk_sys::gtk_get_debug_flags() } -} +//pub fn get_debug_flags() -> /*Ignored*/DebugFlags { +// unsafe { TODO: call gtk_sys:gtk_get_debug_flags() } +//} pub fn get_default_language() -> Option { assert_initialized_main_thread!(); @@ -499,29 +497,6 @@ pub fn render_option>( } } -pub fn render_slider>( - context: &P, - cr: &cairo::Context, - x: f64, - y: f64, - width: f64, - height: f64, - orientation: Orientation, -) { - skip_assert_initialized!(); - unsafe { - gtk_sys::gtk_render_slider( - context.as_ref().to_glib_none().0, - mut_override(cr.to_glib_none().0), - x, - y, - width, - height, - orientation.to_glib(), - ); - } -} - pub fn rgb_to_hsv(r: f32, g: f32, b: f32) -> (f32, f32, f32) { assert_initialized_main_thread!(); unsafe { @@ -536,12 +511,9 @@ pub fn rgb_to_hsv(r: f32, g: f32, b: f32) -> (f32, f32, f32) { } } -pub fn set_debug_flags(flags: u32) { - assert_initialized_main_thread!(); - unsafe { - gtk_sys::gtk_set_debug_flags(flags); - } -} +//pub fn set_debug_flags(flags: /*Ignored*/DebugFlags) { +// unsafe { TODO: call gtk_sys:gtk_set_debug_flags() } +//} //pub fn show_about_dialog>(parent: Option<&P>, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call gtk_sys:gtk_show_about_dialog() } diff --git a/gtk4/src/auto/gesture.rs b/gtk4/src/auto/gesture.rs index f4c80a215a20..7a941c746adc 100644 --- a/gtk4/src/auto/gesture.rs +++ b/gtk4/src/auto/gesture.rs @@ -68,20 +68,32 @@ pub trait GestureExt: 'static { fn get_property_n_points(&self) -> u32; - fn connect_begin(&self, f: F) -> SignalHandlerId; + fn connect_begin) + 'static>( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_cancel(&self, f: F) -> SignalHandlerId; + fn connect_cancel) + 'static>( + &self, + f: F, + ) -> SignalHandlerId; - fn connect_end(&self, f: F) -> SignalHandlerId; + fn connect_end) + 'static>( + &self, + f: F, + ) -> SignalHandlerId; fn connect_sequence_state_changed< - F: Fn(&Self, &gdk::EventSequence, EventSequenceState) + 'static, + F: Fn(&Self, Option<&gdk::EventSequence>, EventSequenceState) + 'static, >( &self, f: F, ) -> SignalHandlerId; - fn connect_update(&self, f: F) -> SignalHandlerId; + fn connect_update) + 'static>( + &self, + f: F, + ) -> SignalHandlerId; } impl> GestureExt for O { @@ -272,8 +284,11 @@ impl> GestureExt for O { } } - fn connect_begin(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn begin_trampoline( + fn connect_begin) + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn begin_trampoline) + 'static>( this: *mut gtk_sys::GtkGesture, sequence: *mut gdk_sys::GdkEventSequence, f: glib_sys::gpointer, @@ -283,7 +298,9 @@ impl> GestureExt for O { let f: &F = &*(f as *const F); f( &Gesture::from_glib_borrow(this).unsafe_cast_ref(), - &from_glib_borrow(sequence), + Option::::from_glib_borrow(sequence) + .as_ref() + .as_ref(), ) } unsafe { @@ -299,8 +316,14 @@ impl> GestureExt for O { } } - fn connect_cancel(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn cancel_trampoline( + fn connect_cancel) + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn cancel_trampoline< + P, + F: Fn(&P, Option<&gdk::EventSequence>) + 'static, + >( this: *mut gtk_sys::GtkGesture, sequence: *mut gdk_sys::GdkEventSequence, f: glib_sys::gpointer, @@ -310,7 +333,9 @@ impl> GestureExt for O { let f: &F = &*(f as *const F); f( &Gesture::from_glib_borrow(this).unsafe_cast_ref(), - &from_glib_borrow(sequence), + Option::::from_glib_borrow(sequence) + .as_ref() + .as_ref(), ) } unsafe { @@ -326,8 +351,11 @@ impl> GestureExt for O { } } - fn connect_end(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn end_trampoline( + fn connect_end) + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn end_trampoline) + 'static>( this: *mut gtk_sys::GtkGesture, sequence: *mut gdk_sys::GdkEventSequence, f: glib_sys::gpointer, @@ -337,7 +365,9 @@ impl> GestureExt for O { let f: &F = &*(f as *const F); f( &Gesture::from_glib_borrow(this).unsafe_cast_ref(), - &from_glib_borrow(sequence), + Option::::from_glib_borrow(sequence) + .as_ref() + .as_ref(), ) } unsafe { @@ -354,14 +384,14 @@ impl> GestureExt for O { } fn connect_sequence_state_changed< - F: Fn(&Self, &gdk::EventSequence, EventSequenceState) + 'static, + F: Fn(&Self, Option<&gdk::EventSequence>, EventSequenceState) + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn sequence_state_changed_trampoline< P, - F: Fn(&P, &gdk::EventSequence, EventSequenceState) + 'static, + F: Fn(&P, Option<&gdk::EventSequence>, EventSequenceState) + 'static, >( this: *mut gtk_sys::GtkGesture, sequence: *mut gdk_sys::GdkEventSequence, @@ -373,7 +403,9 @@ impl> GestureExt for O { let f: &F = &*(f as *const F); f( &Gesture::from_glib_borrow(this).unsafe_cast_ref(), - &from_glib_borrow(sequence), + Option::::from_glib_borrow(sequence) + .as_ref() + .as_ref(), from_glib(state), ) } @@ -390,8 +422,14 @@ impl> GestureExt for O { } } - fn connect_update(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn update_trampoline( + fn connect_update) + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn update_trampoline< + P, + F: Fn(&P, Option<&gdk::EventSequence>) + 'static, + >( this: *mut gtk_sys::GtkGesture, sequence: *mut gdk_sys::GdkEventSequence, f: glib_sys::gpointer, @@ -401,7 +439,9 @@ impl> GestureExt for O { let f: &F = &*(f as *const F); f( &Gesture::from_glib_borrow(this).unsafe_cast_ref(), - &from_glib_borrow(sequence), + Option::::from_glib_borrow(sequence) + .as_ref() + .as_ref(), ) } unsafe { diff --git a/gtk4/src/auto/grid.rs b/gtk4/src/auto/grid.rs index 39fcaf81df12..19c89514a643 100644 --- a/gtk4/src/auto/grid.rs +++ b/gtk4/src/auto/grid.rs @@ -396,7 +396,7 @@ impl GridBuilder { pub const NONE_GRID: Option<&Grid> = None; pub trait GridExt: 'static { - fn attach>(&self, child: &P, left: i32, top: i32, width: i32, height: i32); + fn attach>(&self, child: &P, column: i32, row: i32, width: i32, height: i32); fn attach_next_to, Q: IsA>( &self, @@ -409,7 +409,7 @@ pub trait GridExt: 'static { fn get_baseline_row(&self) -> i32; - fn get_child_at(&self, left: i32, top: i32) -> Option; + fn get_child_at(&self, column: i32, row: i32) -> Option; fn get_column_homogeneous(&self) -> bool; @@ -469,13 +469,13 @@ pub trait GridExt: 'static { } impl> GridExt for O { - fn attach>(&self, child: &P, left: i32, top: i32, width: i32, height: i32) { + fn attach>(&self, child: &P, column: i32, row: i32, width: i32, height: i32) { unsafe { gtk_sys::gtk_grid_attach( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, - left, - top, + column, + row, width, height, ); @@ -506,12 +506,12 @@ impl> GridExt for O { unsafe { gtk_sys::gtk_grid_get_baseline_row(self.as_ref().to_glib_none().0) } } - fn get_child_at(&self, left: i32, top: i32) -> Option { + fn get_child_at(&self, column: i32, row: i32) -> Option { unsafe { from_glib_none(gtk_sys::gtk_grid_get_child_at( self.as_ref().to_glib_none().0, - left, - top, + column, + row, )) } } @@ -573,23 +573,23 @@ impl> GridExt for O { fn query_child>(&self, child: &P) -> (i32, i32, i32, i32) { unsafe { - let mut left = mem::MaybeUninit::uninit(); - let mut top = mem::MaybeUninit::uninit(); + let mut column = mem::MaybeUninit::uninit(); + let mut row = mem::MaybeUninit::uninit(); let mut width = mem::MaybeUninit::uninit(); let mut height = mem::MaybeUninit::uninit(); gtk_sys::gtk_grid_query_child( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, - left.as_mut_ptr(), - top.as_mut_ptr(), + column.as_mut_ptr(), + row.as_mut_ptr(), width.as_mut_ptr(), height.as_mut_ptr(), ); - let left = left.assume_init(); - let top = top.assume_init(); + let column = column.assume_init(); + let row = row.assume_init(); let width = width.assume_init(); let height = height.assume_init(); - (left, top, width, height) + (column, row, width, height) } } diff --git a/gtk4/src/auto/grid_layout_child.rs b/gtk4/src/auto/grid_layout_child.rs index 3bdf53bde61d..49852bcc1906 100644 --- a/gtk4/src/auto/grid_layout_child.rs +++ b/gtk4/src/auto/grid_layout_child.rs @@ -28,10 +28,10 @@ glib_wrapper! { #[derive(Clone, Default)] pub struct GridLayoutChildBuilder { + column: Option, column_span: Option, - left_attach: Option, + row: Option, row_span: Option, - top_attach: Option, child_widget: Option, layout_manager: Option, } @@ -43,18 +43,18 @@ impl GridLayoutChildBuilder { pub fn build(self) -> GridLayoutChild { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; + if let Some(ref column) = self.column { + properties.push(("column", column)); + } if let Some(ref column_span) = self.column_span { properties.push(("column-span", column_span)); } - if let Some(ref left_attach) = self.left_attach { - properties.push(("left-attach", left_attach)); + if let Some(ref row) = self.row { + properties.push(("row", row)); } if let Some(ref row_span) = self.row_span { properties.push(("row-span", row_span)); } - if let Some(ref top_attach) = self.top_attach { - properties.push(("top-attach", top_attach)); - } if let Some(ref child_widget) = self.child_widget { properties.push(("child-widget", child_widget)); } @@ -68,13 +68,18 @@ impl GridLayoutChildBuilder { ret } + pub fn column(mut self, column: i32) -> Self { + self.column = Some(column); + self + } + pub fn column_span(mut self, column_span: i32) -> Self { self.column_span = Some(column_span); self } - pub fn left_attach(mut self, left_attach: i32) -> Self { - self.left_attach = Some(left_attach); + pub fn row(mut self, row: i32) -> Self { + self.row = Some(row); self } @@ -83,11 +88,6 @@ impl GridLayoutChildBuilder { self } - pub fn top_attach(mut self, top_attach: i32) -> Self { - self.top_attach = Some(top_attach); - self - } - pub fn child_widget>(mut self, child_widget: &P) -> Self { self.child_widget = Some(child_widget.clone().upcast()); self @@ -102,46 +102,52 @@ impl GridLayoutChildBuilder { pub const NONE_GRID_LAYOUT_CHILD: Option<&GridLayoutChild> = None; pub trait GridLayoutChildExt: 'static { + fn get_column(&self) -> i32; + fn get_column_span(&self) -> i32; - fn get_left_attach(&self) -> i32; + fn get_row(&self) -> i32; fn get_row_span(&self) -> i32; - fn get_top_attach(&self) -> i32; + fn set_column(&self, column: i32); fn set_column_span(&self, span: i32); - fn set_left_attach(&self, attach: i32); + fn set_row(&self, row: i32); fn set_row_span(&self, span: i32); - fn set_top_attach(&self, attach: i32); + fn connect_property_column_notify(&self, f: F) -> SignalHandlerId; fn connect_property_column_span_notify(&self, f: F) -> SignalHandlerId; - fn connect_property_left_attach_notify(&self, f: F) -> SignalHandlerId; + fn connect_property_row_notify(&self, f: F) -> SignalHandlerId; fn connect_property_row_span_notify(&self, f: F) -> SignalHandlerId; - - fn connect_property_top_attach_notify(&self, f: F) -> SignalHandlerId; } impl> GridLayoutChildExt for O { + fn get_column(&self) -> i32 { + unsafe { gtk_sys::gtk_grid_layout_child_get_column(self.as_ref().to_glib_none().0) } + } + fn get_column_span(&self) -> i32 { unsafe { gtk_sys::gtk_grid_layout_child_get_column_span(self.as_ref().to_glib_none().0) } } - fn get_left_attach(&self) -> i32 { - unsafe { gtk_sys::gtk_grid_layout_child_get_left_attach(self.as_ref().to_glib_none().0) } + fn get_row(&self) -> i32 { + unsafe { gtk_sys::gtk_grid_layout_child_get_row(self.as_ref().to_glib_none().0) } } fn get_row_span(&self) -> i32 { unsafe { gtk_sys::gtk_grid_layout_child_get_row_span(self.as_ref().to_glib_none().0) } } - fn get_top_attach(&self) -> i32 { - unsafe { gtk_sys::gtk_grid_layout_child_get_top_attach(self.as_ref().to_glib_none().0) } + fn set_column(&self, column: i32) { + unsafe { + gtk_sys::gtk_grid_layout_child_set_column(self.as_ref().to_glib_none().0, column); + } } fn set_column_span(&self, span: i32) { @@ -150,9 +156,9 @@ impl> GridLayoutChildExt for O { } } - fn set_left_attach(&self, attach: i32) { + fn set_row(&self, row: i32) { unsafe { - gtk_sys::gtk_grid_layout_child_set_left_attach(self.as_ref().to_glib_none().0, attach); + gtk_sys::gtk_grid_layout_child_set_row(self.as_ref().to_glib_none().0, row); } } @@ -162,14 +168,8 @@ impl> GridLayoutChildExt for O { } } - fn set_top_attach(&self, attach: i32) { - unsafe { - gtk_sys::gtk_grid_layout_child_set_top_attach(self.as_ref().to_glib_none().0, attach); - } - } - - fn connect_property_column_span_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_column_span_trampoline( + fn connect_property_column_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_column_trampoline( this: *mut gtk_sys::GtkGridLayoutChild, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, @@ -183,17 +183,17 @@ impl> GridLayoutChildExt for O { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, - b"notify::column-span\0".as_ptr() as *const _, + b"notify::column\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( - notify_column_span_trampoline:: as *const (), + notify_column_trampoline:: as *const (), )), Box_::into_raw(f), ) } } - fn connect_property_left_attach_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_left_attach_trampoline( + fn connect_property_column_span_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_column_span_trampoline( this: *mut gtk_sys::GtkGridLayoutChild, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, @@ -207,17 +207,17 @@ impl> GridLayoutChildExt for O { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, - b"notify::left-attach\0".as_ptr() as *const _, + b"notify::column-span\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( - notify_left_attach_trampoline:: as *const (), + notify_column_span_trampoline:: as *const (), )), Box_::into_raw(f), ) } } - fn connect_property_row_span_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_row_span_trampoline( + fn connect_property_row_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_row_trampoline( this: *mut gtk_sys::GtkGridLayoutChild, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, @@ -231,17 +231,17 @@ impl> GridLayoutChildExt for O { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, - b"notify::row-span\0".as_ptr() as *const _, + b"notify::row\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( - notify_row_span_trampoline:: as *const (), + notify_row_trampoline:: as *const (), )), Box_::into_raw(f), ) } } - fn connect_property_top_attach_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_top_attach_trampoline( + fn connect_property_row_span_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_row_span_trampoline( this: *mut gtk_sys::GtkGridLayoutChild, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, @@ -255,9 +255,9 @@ impl> GridLayoutChildExt for O { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, - b"notify::top-attach\0".as_ptr() as *const _, + b"notify::row-span\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( - notify_top_attach_trampoline:: as *const (), + notify_row_span_trampoline:: as *const (), )), Box_::into_raw(f), ) diff --git a/gtk4/src/auto/grid_view.rs b/gtk4/src/auto/grid_view.rs index a44a656aa49b..3f26df119b42 100644 --- a/gtk4/src/auto/grid_view.rs +++ b/gtk4/src/auto/grid_view.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use gdk; -use gio; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; @@ -32,6 +31,7 @@ use Orientation; use Overflow; use Scrollable; use ScrollablePolicy; +use SelectionModel; use Widget; glib_wrapper! { @@ -43,23 +43,13 @@ glib_wrapper! { } impl GridView { - pub fn new>(model: Option<&P>) -> GridView { - assert_initialized_main_thread!(); - unsafe { - Widget::from_glib_none(gtk_sys::gtk_grid_view_new( - model.map(|p| p.as_ref()).to_glib_full(), - )) - .unsafe_cast() - } - } - - pub fn with_factory, Q: IsA>( + pub fn new, Q: IsA>( model: Option<&P>, factory: Option<&Q>, ) -> GridView { assert_initialized_main_thread!(); unsafe { - Widget::from_glib_none(gtk_sys::gtk_grid_view_new_with_factory( + Widget::from_glib_none(gtk_sys::gtk_grid_view_new( model.map(|p| p.as_ref()).to_glib_full(), factory.map(|p| p.as_ref()).to_glib_full(), )) @@ -87,7 +77,7 @@ impl GridView { unsafe { gtk_sys::gtk_grid_view_get_min_columns(self.to_glib_none().0) } } - pub fn get_model(&self) -> Option { + pub fn get_model(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_grid_view_get_model(self.to_glib_none().0)) } } @@ -129,7 +119,7 @@ impl GridView { } } - pub fn set_model>(&self, model: Option<&P>) { + pub fn set_model>(&self, model: Option<&P>) { unsafe { gtk_sys::gtk_grid_view_set_model( self.to_glib_none().0, @@ -326,7 +316,7 @@ pub struct GridViewBuilder { factory: Option, max_columns: Option, min_columns: Option, - model: Option, + model: Option, single_click_activate: Option, orientation: Option, can_focus: Option, @@ -522,7 +512,7 @@ impl GridViewBuilder { self } - pub fn model>(mut self, model: &P) -> Self { + pub fn model>(mut self, model: &P) -> Self { self.model = Some(model.clone().upcast()); self } diff --git a/gtk4/src/auto/icon_theme.rs b/gtk4/src/auto/icon_theme.rs index 55c815259e64..812c7da14600 100644 --- a/gtk4/src/auto/icon_theme.rs +++ b/gtk4/src/auto/icon_theme.rs @@ -54,6 +54,10 @@ impl IconTheme { } } + pub fn get_display(&self) -> Option { + unsafe { from_glib_none(gtk_sys::gtk_icon_theme_get_display(self.to_glib_none().0)) } + } + pub fn get_icon_names(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(gtk_sys::gtk_icon_theme_get_icon_names( @@ -152,20 +156,6 @@ impl IconTheme { } } - pub fn get_property_display(&self) -> Option { - unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"display\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `display` getter") - } - } - pub fn set_property_display(&self, display: Option<&gdk::Display>) { unsafe { gobject_sys::g_object_set_property( diff --git a/gtk4/src/auto/list_box.rs b/gtk4/src/auto/list_box.rs index 92cce28bcdad..60fb48b350dd 100644 --- a/gtk4/src/auto/list_box.rs +++ b/gtk4/src/auto/list_box.rs @@ -49,6 +49,12 @@ impl ListBox { unsafe { Widget::from_glib_none(gtk_sys::gtk_list_box_new()).unsafe_cast() } } + pub fn append>(&self, child: &P) { + unsafe { + gtk_sys::gtk_list_box_append(self.to_glib_none().0, child.as_ref().to_glib_none().0); + } + } + pub fn bind_model>( &self, model: Option<&P>, diff --git a/gtk4/src/auto/list_view.rs b/gtk4/src/auto/list_view.rs index 1cb1841ad160..6154afbd3cf8 100644 --- a/gtk4/src/auto/list_view.rs +++ b/gtk4/src/auto/list_view.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use gdk; -use gio; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; @@ -32,6 +31,7 @@ use Orientation; use Overflow; use Scrollable; use ScrollablePolicy; +use SelectionModel; use Widget; glib_wrapper! { @@ -43,23 +43,13 @@ glib_wrapper! { } impl ListView { - pub fn new>(model: Option<&P>) -> ListView { - assert_initialized_main_thread!(); - unsafe { - Widget::from_glib_none(gtk_sys::gtk_list_view_new( - model.map(|p| p.as_ref()).to_glib_full(), - )) - .unsafe_cast() - } - } - - pub fn with_factory, Q: IsA>( + pub fn new, Q: IsA>( model: Option<&P>, factory: Option<&Q>, ) -> ListView { assert_initialized_main_thread!(); unsafe { - Widget::from_glib_none(gtk_sys::gtk_list_view_new_with_factory( + Widget::from_glib_none(gtk_sys::gtk_list_view_new( model.map(|p| p.as_ref()).to_glib_full(), factory.map(|p| p.as_ref()).to_glib_full(), )) @@ -79,7 +69,7 @@ impl ListView { unsafe { from_glib_none(gtk_sys::gtk_list_view_get_factory(self.to_glib_none().0)) } } - pub fn get_model(&self) -> Option { + pub fn get_model(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_list_view_get_model(self.to_glib_none().0)) } } @@ -117,7 +107,7 @@ impl ListView { } } - pub fn set_model>(&self, model: Option<&P>) { + pub fn set_model>(&self, model: Option<&P>) { unsafe { gtk_sys::gtk_list_view_set_model( self.to_glib_none().0, @@ -296,7 +286,7 @@ impl ListView { pub struct ListViewBuilder { enable_rubberband: Option, factory: Option, - model: Option, + model: Option, show_separators: Option, single_click_activate: Option, orientation: Option, @@ -480,7 +470,7 @@ impl ListViewBuilder { self } - pub fn model>(mut self, model: &P) -> Self { + pub fn model>(mut self, model: &P) -> Self { self.model = Some(model.clone().upcast()); self } diff --git a/gtk4/src/auto/mod.rs b/gtk4/src/auto/mod.rs index 02019280e791..837db8c22c41 100644 --- a/gtk4/src/auto/mod.rs +++ b/gtk4/src/auto/mod.rs @@ -9,10 +9,6 @@ mod about_dialog; pub use self::about_dialog::AboutDialogBuilder; pub use self::about_dialog::{AboutDialog, AboutDialogClass}; -mod accel_label; -pub use self::accel_label::AccelLabelBuilder; -pub use self::accel_label::{AccelLabel, AccelLabelClass}; - mod accessible; pub use self::accessible::AccessibleExt; pub use self::accessible::{Accessible, NONE_ACCESSIBLE}; @@ -768,10 +764,6 @@ mod progress_bar; pub use self::progress_bar::ProgressBarBuilder; pub use self::progress_bar::{ProgressBar, ProgressBarClass}; -mod radio_button; -pub use self::radio_button::RadioButtonBuilder; -pub use self::radio_button::{RadioButton, RadioButtonClass}; - mod range; pub use self::range::RangeBuilder; pub use self::range::RangeExt; @@ -1242,7 +1234,6 @@ mod flags; pub use self::flags::ApplicationInhibitFlags; pub use self::flags::BuilderClosureFlags; pub use self::flags::CellRendererState; -pub use self::flags::DebugFlag; pub use self::flags::DialogFlags; pub use self::flags::EventControllerScrollFlags; pub use self::flags::FontChooserLevel; @@ -1307,87 +1298,6 @@ pub use self::constants::PRINT_SETTINGS_SCALE; pub use self::constants::PRINT_SETTINGS_USE_COLOR; pub use self::constants::PRINT_SETTINGS_WIN32_DRIVER_EXTRA; pub use self::constants::PRINT_SETTINGS_WIN32_DRIVER_VERSION; -pub use self::constants::STYLE_CLASS_ACCELERATOR; -pub use self::constants::STYLE_CLASS_ARROW; -pub use self::constants::STYLE_CLASS_BACKGROUND; -pub use self::constants::STYLE_CLASS_BOTTOM; -pub use self::constants::STYLE_CLASS_BUTTON; -pub use self::constants::STYLE_CLASS_CALENDAR; -pub use self::constants::STYLE_CLASS_CELL; -pub use self::constants::STYLE_CLASS_CHECK; -pub use self::constants::STYLE_CLASS_COMBOBOX_ENTRY; -pub use self::constants::STYLE_CLASS_CONTEXT_MENU; -pub use self::constants::STYLE_CLASS_CSD; -pub use self::constants::STYLE_CLASS_CURSOR_HANDLE; -pub use self::constants::STYLE_CLASS_DEFAULT; -pub use self::constants::STYLE_CLASS_DESTRUCTIVE_ACTION; -pub use self::constants::STYLE_CLASS_DIM_LABEL; -pub use self::constants::STYLE_CLASS_DND; -pub use self::constants::STYLE_CLASS_DOCK; -pub use self::constants::STYLE_CLASS_ENTRY; -pub use self::constants::STYLE_CLASS_ERROR; -pub use self::constants::STYLE_CLASS_EXPANDER; -pub use self::constants::STYLE_CLASS_FLAT; -pub use self::constants::STYLE_CLASS_FRAME; -pub use self::constants::STYLE_CLASS_HEADER; -pub use self::constants::STYLE_CLASS_HIGHLIGHT; -pub use self::constants::STYLE_CLASS_HORIZONTAL; -pub use self::constants::STYLE_CLASS_IMAGE; -pub use self::constants::STYLE_CLASS_INFO; -pub use self::constants::STYLE_CLASS_INSERTION_CURSOR; -pub use self::constants::STYLE_CLASS_LABEL; -pub use self::constants::STYLE_CLASS_LEFT; -pub use self::constants::STYLE_CLASS_LEVEL_BAR; -pub use self::constants::STYLE_CLASS_LINKED; -pub use self::constants::STYLE_CLASS_LIST; -pub use self::constants::STYLE_CLASS_LIST_ROW; -pub use self::constants::STYLE_CLASS_MARK; -pub use self::constants::STYLE_CLASS_MENU; -pub use self::constants::STYLE_CLASS_MENUBAR; -pub use self::constants::STYLE_CLASS_MENUITEM; -pub use self::constants::STYLE_CLASS_MESSAGE_DIALOG; -pub use self::constants::STYLE_CLASS_MONOSPACE; -pub use self::constants::STYLE_CLASS_NEEDS_ATTENTION; -pub use self::constants::STYLE_CLASS_NOTEBOOK; -pub use self::constants::STYLE_CLASS_OSD; -pub use self::constants::STYLE_CLASS_OVERSHOOT; -pub use self::constants::STYLE_CLASS_PANE_SEPARATOR; -pub use self::constants::STYLE_CLASS_PAPER; -pub use self::constants::STYLE_CLASS_POPOVER; -pub use self::constants::STYLE_CLASS_POPUP; -pub use self::constants::STYLE_CLASS_PROGRESSBAR; -pub use self::constants::STYLE_CLASS_PULSE; -pub use self::constants::STYLE_CLASS_QUESTION; -pub use self::constants::STYLE_CLASS_RADIO; -pub use self::constants::STYLE_CLASS_RAISED; -pub use self::constants::STYLE_CLASS_READ_ONLY; -pub use self::constants::STYLE_CLASS_RIGHT; -pub use self::constants::STYLE_CLASS_RUBBERBAND; -pub use self::constants::STYLE_CLASS_SCALE; -pub use self::constants::STYLE_CLASS_SCALE_HAS_MARKS_ABOVE; -pub use self::constants::STYLE_CLASS_SCALE_HAS_MARKS_BELOW; -pub use self::constants::STYLE_CLASS_SCROLLBAR; -pub use self::constants::STYLE_CLASS_SCROLLBARS_JUNCTION; -pub use self::constants::STYLE_CLASS_SEPARATOR; -pub use self::constants::STYLE_CLASS_SIDEBAR; -pub use self::constants::STYLE_CLASS_SLIDER; -pub use self::constants::STYLE_CLASS_SPINBUTTON; -pub use self::constants::STYLE_CLASS_SPINNER; -pub use self::constants::STYLE_CLASS_STATUSBAR; -pub use self::constants::STYLE_CLASS_SUBTITLE; -pub use self::constants::STYLE_CLASS_SUGGESTED_ACTION; -pub use self::constants::STYLE_CLASS_TITLE; -pub use self::constants::STYLE_CLASS_TITLEBAR; -pub use self::constants::STYLE_CLASS_TOOLBAR; -pub use self::constants::STYLE_CLASS_TOOLTIP; -pub use self::constants::STYLE_CLASS_TOP; -pub use self::constants::STYLE_CLASS_TOUCH_SELECTION; -pub use self::constants::STYLE_CLASS_TROUGH; -pub use self::constants::STYLE_CLASS_UNDERSHOOT; -pub use self::constants::STYLE_CLASS_VERTICAL; -pub use self::constants::STYLE_CLASS_VIEW; -pub use self::constants::STYLE_CLASS_WARNING; -pub use self::constants::STYLE_CLASS_WIDE; #[doc(hidden)] pub mod traits { diff --git a/gtk4/src/auto/multi_sorter.rs b/gtk4/src/auto/multi_sorter.rs index f39d600a8564..95d259c25bf9 100644 --- a/gtk4/src/auto/multi_sorter.rs +++ b/gtk4/src/auto/multi_sorter.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use gio; -use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use gtk_sys; @@ -22,7 +21,7 @@ glib_wrapper! { impl MultiSorter { pub fn new() -> MultiSorter { assert_initialized_main_thread!(); - unsafe { Sorter::from_glib_full(gtk_sys::gtk_multi_sorter_new()).unsafe_cast() } + unsafe { from_glib_full(gtk_sys::gtk_multi_sorter_new()) } } } diff --git a/gtk4/src/auto/native.rs b/gtk4/src/auto/native.rs index a67809d4adc1..1f42fcc2220d 100644 --- a/gtk4/src/auto/native.rs +++ b/gtk4/src/auto/native.rs @@ -23,7 +23,7 @@ glib_wrapper! { } impl Native { - pub fn get_for_surface(surface: &gdk::Surface) -> Option { + pub fn get_for_surface(surface: &gdk::Surface) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_none(gtk_sys::gtk_native_get_for_surface( diff --git a/gtk4/src/auto/password_entry.rs b/gtk4/src/auto/password_entry.rs index 537390b31c18..d58e08371eca 100644 --- a/gtk4/src/auto/password_entry.rs +++ b/gtk4/src/auto/password_entry.rs @@ -4,8 +4,10 @@ use gdk; use gio; +use glib; use glib::object::Cast; use glib::object::IsA; +use glib::object::ObjectExt; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; @@ -127,6 +129,35 @@ impl PasswordEntry { } } + pub fn connect_activate(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn activate_trampoline( + this: *mut gtk_sys::GtkPasswordEntry, + f: glib_sys::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"activate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + activate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + pub fn emit_activate(&self) { + let _ = unsafe { + glib::Object::from_glib_borrow(self.as_ptr() as *mut gobject_sys::GObject) + .emit("activate", &[]) + .unwrap() + }; + } + pub fn connect_property_activates_default_notify( &self, f: F, diff --git a/gtk4/src/auto/popover.rs b/gtk4/src/auto/popover.rs index fe61ce57ec6c..809f7b592737 100644 --- a/gtk4/src/auto/popover.rs +++ b/gtk4/src/auto/popover.rs @@ -18,6 +18,7 @@ use gobject_sys; use gtk_sys; use std::boxed::Box as Box_; use std::fmt; +use std::mem; use std::mem::transmute; use Accessible; use AccessibleRole; @@ -415,6 +416,8 @@ pub trait PopoverExt: 'static { fn get_mnemonics_visible(&self) -> bool; + fn get_offset(&self) -> (i32, i32); + fn get_pointing_to(&self) -> Option; fn get_position(&self) -> PositionType; @@ -433,6 +436,8 @@ pub trait PopoverExt: 'static { fn set_mnemonics_visible(&self, mnemonics_visible: bool); + fn set_offset(&self, x_offset: i32, y_offset: i32); + fn set_pointing_to(&self, rect: &gdk::Rectangle); fn set_position(&self, position: PositionType); @@ -499,6 +504,21 @@ impl> PopoverExt for O { } } + fn get_offset(&self) -> (i32, i32) { + unsafe { + let mut x_offset = mem::MaybeUninit::uninit(); + let mut y_offset = mem::MaybeUninit::uninit(); + gtk_sys::gtk_popover_get_offset( + self.as_ref().to_glib_none().0, + x_offset.as_mut_ptr(), + y_offset.as_mut_ptr(), + ); + let x_offset = x_offset.assume_init(); + let y_offset = y_offset.assume_init(); + (x_offset, y_offset) + } + } + fn get_pointing_to(&self) -> Option { unsafe { let mut rect = gdk::Rectangle::uninitialized(); @@ -573,6 +593,12 @@ impl> PopoverExt for O { } } + fn set_offset(&self, x_offset: i32, y_offset: i32) { + unsafe { + gtk_sys::gtk_popover_set_offset(self.as_ref().to_glib_none().0, x_offset, y_offset); + } + } + fn set_pointing_to(&self, rect: &gdk::Rectangle) { unsafe { gtk_sys::gtk_popover_set_pointing_to( diff --git a/gtk4/src/auto/recent_info.rs b/gtk4/src/auto/recent_info.rs index 4bcd84532485..08f6a7c9f8e7 100644 --- a/gtk4/src/auto/recent_info.rs +++ b/gtk4/src/auto/recent_info.rs @@ -7,7 +7,6 @@ use glib; use glib::translate::*; use glib::GString; use gtk_sys; -use libc; use std::mem; use std::ptr; @@ -46,30 +45,29 @@ impl RecentInfo { unsafe { from_glib(gtk_sys::gtk_recent_info_exists(self.to_glib_none().0)) } } - pub fn get_added(&self) -> libc::c_long { - unsafe { gtk_sys::gtk_recent_info_get_added(self.to_glib_none().0) } + pub fn get_added(&self) -> Option { + unsafe { from_glib_none(gtk_sys::gtk_recent_info_get_added(self.to_glib_none().0)) } } pub fn get_age(&self) -> i32 { unsafe { gtk_sys::gtk_recent_info_get_age(self.to_glib_none().0) } } - pub fn get_application_info(&self, app_name: &str) -> Option<(GString, u32, libc::c_long)> { + pub fn get_application_info(&self, app_name: &str) -> Option<(GString, u32, glib::DateTime)> { unsafe { let mut app_exec = ptr::null(); let mut count = mem::MaybeUninit::uninit(); - let mut time_ = mem::MaybeUninit::uninit(); + let mut stamp = ptr::null_mut(); let ret = from_glib(gtk_sys::gtk_recent_info_get_application_info( self.to_glib_none().0, app_name.to_glib_none().0, &mut app_exec, count.as_mut_ptr(), - time_.as_mut_ptr(), + &mut stamp, )); let count = count.assume_init(); - let time_ = time_.assume_init(); if ret { - Some((from_glib_none(app_exec), count, time_)) + Some((from_glib_none(app_exec), count, from_glib_none(stamp))) } else { None } @@ -129,8 +127,8 @@ impl RecentInfo { } } - pub fn get_modified(&self) -> libc::c_long { - unsafe { gtk_sys::gtk_recent_info_get_modified(self.to_glib_none().0) } + pub fn get_modified(&self) -> Option { + unsafe { from_glib_none(gtk_sys::gtk_recent_info_get_modified(self.to_glib_none().0)) } } pub fn get_private_hint(&self) -> bool { @@ -161,8 +159,8 @@ impl RecentInfo { } } - pub fn get_visited(&self) -> libc::c_long { - unsafe { gtk_sys::gtk_recent_info_get_visited(self.to_glib_none().0) } + pub fn get_visited(&self) -> Option { + unsafe { from_glib_none(gtk_sys::gtk_recent_info_get_visited(self.to_glib_none().0)) } } pub fn has_application(&self, app_name: &str) -> bool { diff --git a/gtk4/src/auto/scrolled_window.rs b/gtk4/src/auto/scrolled_window.rs index 9aa5ba7fdb03..c8619c980f29 100644 --- a/gtk4/src/auto/scrolled_window.rs +++ b/gtk4/src/auto/scrolled_window.rs @@ -50,14 +50,6 @@ impl ScrolledWindow { unsafe { Widget::from_glib_none(gtk_sys::gtk_scrolled_window_new()).unsafe_cast() } } - pub fn get_capture_button_press(&self) -> bool { - unsafe { - from_glib(gtk_sys::gtk_scrolled_window_get_capture_button_press( - self.to_glib_none().0, - )) - } - } - pub fn get_child(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_scrolled_window_get_child( @@ -177,15 +169,6 @@ impl ScrolledWindow { } } - pub fn set_capture_button_press(&self, capture_button_press: bool) { - unsafe { - gtk_sys::gtk_scrolled_window_set_capture_button_press( - self.to_glib_none().0, - capture_button_press.to_glib(), - ); - } - } - pub fn set_child>(&self, child: Option<&P>) { unsafe { gtk_sys::gtk_scrolled_window_set_child( diff --git a/gtk4/src/auto/selection_filter_model.rs b/gtk4/src/auto/selection_filter_model.rs index c3c68402596b..0d7141d85b50 100644 --- a/gtk4/src/auto/selection_filter_model.rs +++ b/gtk4/src/auto/selection_filter_model.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use gio; -use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; @@ -35,15 +34,6 @@ impl SelectionFilterModel { )) } } - - pub fn new_for_type(item_type: glib::types::Type) -> SelectionFilterModel { - assert_initialized_main_thread!(); - unsafe { - from_glib_full(gtk_sys::gtk_selection_filter_model_new_for_type( - item_type.to_glib(), - )) - } - } } #[derive(Clone, Default)] diff --git a/gtk4/src/auto/shortcuts_window.rs b/gtk4/src/auto/shortcuts_window.rs index 72a210db0dc0..17ea5e6f5efc 100644 --- a/gtk4/src/auto/shortcuts_window.rs +++ b/gtk4/src/auto/shortcuts_window.rs @@ -36,7 +36,7 @@ use Widget; use Window; glib_wrapper! { - pub struct ShortcutsWindow(Object) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager; + pub struct ShortcutsWindow(Object) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager; match fn { get_type => || gtk_sys::gtk_shortcuts_window_get_type(), diff --git a/gtk4/src/auto/snapshot.rs b/gtk4/src/auto/snapshot.rs index f3767e3d83a4..10674fe23f11 100644 --- a/gtk4/src/auto/snapshot.rs +++ b/gtk4/src/auto/snapshot.rs @@ -113,6 +113,58 @@ impl Snapshot { } } + pub fn append_radial_gradient( + &self, + bounds: &graphene::Rect, + center: &graphene::Point, + hradius: f32, + vradius: f32, + start: f32, + end: f32, + stops: &[&gsk::ColorStop], + ) { + let n_stops = stops.len() as usize; + unsafe { + gtk_sys::gtk_snapshot_append_radial_gradient( + self.to_glib_none().0, + bounds.to_glib_none().0, + center.to_glib_none().0, + hradius, + vradius, + start, + end, + stops.to_glib_none().0, + n_stops, + ); + } + } + + pub fn append_repeating_radial_gradient( + &self, + bounds: &graphene::Rect, + center: &graphene::Point, + hradius: f32, + vradius: f32, + start: f32, + end: f32, + stops: &[&gsk::ColorStop], + ) { + let n_stops = stops.len() as usize; + unsafe { + gtk_sys::gtk_snapshot_append_repeating_radial_gradient( + self.to_glib_none().0, + bounds.to_glib_none().0, + center.to_glib_none().0, + hradius, + vradius, + start, + end, + stops.to_glib_none().0, + n_stops, + ); + } + } + pub fn append_texture>(&self, texture: &P, bounds: &graphene::Rect) { unsafe { gtk_sys::gtk_snapshot_append_texture( @@ -136,6 +188,12 @@ impl Snapshot { } } + pub fn gl_shader_pop_texture(&self) { + unsafe { + gtk_sys::gtk_snapshot_gl_shader_pop_texture(self.to_glib_none().0); + } + } + pub fn perspective(&self, depth: f32) { unsafe { gtk_sys::gtk_snapshot_perspective(self.to_glib_none().0, depth); @@ -190,6 +248,10 @@ impl Snapshot { // unsafe { TODO: call gtk_sys:gtk_snapshot_push_debug() } //} + //pub fn push_gl_shader(&self, shader: /*Ignored*/&gsk::GLShader, bounds: &graphene::Rect, take_args: &glib::Bytes) { + // unsafe { TODO: call gtk_sys:gtk_snapshot_push_gl_shader() } + //} + pub fn push_opacity(&self, opacity: f64) { unsafe { gtk_sys::gtk_snapshot_push_opacity(self.to_glib_none().0, opacity); diff --git a/gtk4/src/auto/spin_button.rs b/gtk4/src/auto/spin_button.rs index e1141cc87e13..e1576dfd8e3d 100644 --- a/gtk4/src/auto/spin_button.rs +++ b/gtk4/src/auto/spin_button.rs @@ -13,7 +13,6 @@ use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; -use glib::Value; use glib_sys; use gobject_sys; use gtk_sys; @@ -95,6 +94,10 @@ impl SpinButton { } } + pub fn get_climb_rate(&self) -> f64 { + unsafe { gtk_sys::gtk_spin_button_get_climb_rate(self.to_glib_none().0) } + } + pub fn get_digits(&self) -> u32 { unsafe { gtk_sys::gtk_spin_button_get_digits(self.to_glib_none().0) } } @@ -170,6 +173,12 @@ impl SpinButton { } } + pub fn set_climb_rate(&self, climb_rate: f64) { + unsafe { + gtk_sys::gtk_spin_button_set_climb_rate(self.to_glib_none().0, climb_rate); + } + } + pub fn set_digits(&self, digits: u32) { unsafe { gtk_sys::gtk_spin_button_set_digits(self.to_glib_none().0, digits); @@ -233,31 +242,6 @@ impl SpinButton { } } - pub fn get_property_climb_rate(&self) -> f64 { - unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"climb-rate\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `climb-rate` getter") - .unwrap() - } - } - - pub fn set_property_climb_rate(&self, climb_rate: f64) { - unsafe { - gobject_sys::g_object_set_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"climb-rate\0".as_ptr() as *const _, - Value::from(&climb_rate).to_glib_none().0, - ); - } - } - pub fn connect_change_value( &self, f: F, diff --git a/gtk4/src/auto/stack.rs b/gtk4/src/auto/stack.rs index a021560642e3..9b2d7dff601d 100644 --- a/gtk4/src/auto/stack.rs +++ b/gtk4/src/auto/stack.rs @@ -43,7 +43,16 @@ impl Stack { unsafe { Widget::from_glib_none(gtk_sys::gtk_stack_new()).unsafe_cast() } } - pub fn add_named>(&self, child: &P, name: &str) -> Option { + pub fn add_child>(&self, child: &P) -> Option { + unsafe { + from_glib_none(gtk_sys::gtk_stack_add_child( + self.to_glib_none().0, + child.as_ref().to_glib_none().0, + )) + } + } + + pub fn add_named>(&self, child: &P, name: Option<&str>) -> Option { unsafe { from_glib_none(gtk_sys::gtk_stack_add_named( self.to_glib_none().0, @@ -56,7 +65,7 @@ impl Stack { pub fn add_titled>( &self, child: &P, - name: &str, + name: Option<&str>, title: &str, ) -> Option { unsafe { diff --git a/gtk4/src/auto/text.rs b/gtk4/src/auto/text.rs index 1ac0e31d3545..48089c0eb73a 100644 --- a/gtk4/src/auto/text.rs +++ b/gtk4/src/auto/text.rs @@ -74,6 +74,14 @@ impl Text { unsafe { from_glib_none(gtk_sys::gtk_text_get_buffer(self.to_glib_none().0)) } } + pub fn get_enable_emoji_completion(&self) -> bool { + unsafe { + from_glib(gtk_sys::gtk_text_get_enable_emoji_completion( + self.to_glib_none().0, + )) + } + } + pub fn get_extra_menu(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_text_get_extra_menu(self.to_glib_none().0)) } } @@ -106,6 +114,14 @@ impl Text { } } + pub fn get_propagate_text_width(&self) -> bool { + unsafe { + from_glib(gtk_sys::gtk_text_get_propagate_text_width( + self.to_glib_none().0, + )) + } + } + pub fn get_tabs(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_text_get_tabs(self.to_glib_none().0)) } } @@ -114,6 +130,14 @@ impl Text { unsafe { gtk_sys::gtk_text_get_text_length(self.to_glib_none().0) } } + pub fn get_truncate_multiline(&self) -> bool { + unsafe { + from_glib(gtk_sys::gtk_text_get_truncate_multiline( + self.to_glib_none().0, + )) + } + } + pub fn get_visibility(&self) -> bool { unsafe { from_glib(gtk_sys::gtk_text_get_visibility(self.to_glib_none().0)) } } @@ -144,6 +168,15 @@ impl Text { } } + pub fn set_enable_emoji_completion(&self, enable_emoji_completion: bool) { + unsafe { + gtk_sys::gtk_text_set_enable_emoji_completion( + self.to_glib_none().0, + enable_emoji_completion.to_glib(), + ); + } + } + pub fn set_extra_menu>(&self, model: Option<&P>) { unsafe { gtk_sys::gtk_text_set_extra_menu( @@ -189,46 +222,39 @@ impl Text { } } - pub fn set_tabs(&self, tabs: Option<&pango::TabArray>) { + pub fn set_propagate_text_width(&self, propagate_text_width: bool) { unsafe { - gtk_sys::gtk_text_set_tabs(self.to_glib_none().0, mut_override(tabs.to_glib_none().0)); + gtk_sys::gtk_text_set_propagate_text_width( + self.to_glib_none().0, + propagate_text_width.to_glib(), + ); } } - pub fn set_visibility(&self, visible: bool) { + pub fn set_tabs(&self, tabs: Option<&pango::TabArray>) { unsafe { - gtk_sys::gtk_text_set_visibility(self.to_glib_none().0, visible.to_glib()); + gtk_sys::gtk_text_set_tabs(self.to_glib_none().0, mut_override(tabs.to_glib_none().0)); } } - pub fn unset_invisible_char(&self) { + pub fn set_truncate_multiline(&self, truncate_multiline: bool) { unsafe { - gtk_sys::gtk_text_unset_invisible_char(self.to_glib_none().0); + gtk_sys::gtk_text_set_truncate_multiline( + self.to_glib_none().0, + truncate_multiline.to_glib(), + ); } } - pub fn get_property_enable_emoji_completion(&self) -> bool { + pub fn set_visibility(&self, visible: bool) { unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"enable-emoji-completion\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `enable-emoji-completion` getter") - .unwrap() + gtk_sys::gtk_text_set_visibility(self.to_glib_none().0, visible.to_glib()); } } - pub fn set_property_enable_emoji_completion(&self, enable_emoji_completion: bool) { + pub fn unset_invisible_char(&self) { unsafe { - gobject_sys::g_object_set_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"enable-emoji-completion\0".as_ptr() as *const _, - Value::from(&enable_emoji_completion).to_glib_none().0, - ); + gtk_sys::gtk_text_unset_invisible_char(self.to_glib_none().0); } } @@ -281,31 +307,6 @@ impl Text { } } - pub fn get_property_propagate_text_width(&self) -> bool { - unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"propagate-text-width\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `propagate-text-width` getter") - .unwrap() - } - } - - pub fn set_property_propagate_text_width(&self, propagate_text_width: bool) { - unsafe { - gobject_sys::g_object_set_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"propagate-text-width\0".as_ptr() as *const _, - Value::from(&propagate_text_width).to_glib_none().0, - ); - } - } - pub fn get_property_scroll_offset(&self) -> i32 { unsafe { let mut value = Value::from_type(::static_type()); @@ -321,31 +322,6 @@ impl Text { } } - pub fn get_property_truncate_multiline(&self) -> bool { - unsafe { - let mut value = Value::from_type(::static_type()); - gobject_sys::g_object_get_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"truncate-multiline\0".as_ptr() as *const _, - value.to_glib_none_mut().0, - ); - value - .get() - .expect("Return Value for property `truncate-multiline` getter") - .unwrap() - } - } - - pub fn set_property_truncate_multiline(&self, truncate_multiline: bool) { - unsafe { - gobject_sys::g_object_set_property( - self.as_ptr() as *mut gobject_sys::GObject, - b"truncate-multiline\0".as_ptr() as *const _, - Value::from(&truncate_multiline).to_glib_none().0, - ); - } - } - pub fn connect_property_activates_default_notify( &self, f: F, diff --git a/gtk4/src/auto/text_buffer.rs b/gtk4/src/auto/text_buffer.rs index 4a14a18f7df4..35ac835b4d75 100644 --- a/gtk4/src/auto/text_buffer.rs +++ b/gtk4/src/auto/text_buffer.rs @@ -155,11 +155,11 @@ pub trait TextBufferExt: 'static { fn get_iter_at_child_anchor>(&self, anchor: &P) -> TextIter; - fn get_iter_at_line(&self, line_number: i32) -> TextIter; + fn get_iter_at_line(&self, line_number: i32) -> Option; - fn get_iter_at_line_index(&self, line_number: i32, byte_index: i32) -> TextIter; + fn get_iter_at_line_index(&self, line_number: i32, byte_index: i32) -> Option; - fn get_iter_at_line_offset(&self, line_number: i32, char_offset: i32) -> TextIter; + fn get_iter_at_line_offset(&self, line_number: i32, char_offset: i32) -> Option; fn get_iter_at_mark>(&self, mark: &P) -> TextIter; @@ -600,41 +600,53 @@ impl> TextBufferExt for O { } } - fn get_iter_at_line(&self, line_number: i32) -> TextIter { + fn get_iter_at_line(&self, line_number: i32) -> Option { unsafe { let mut iter = TextIter::uninitialized(); - gtk_sys::gtk_text_buffer_get_iter_at_line( + let ret = from_glib(gtk_sys::gtk_text_buffer_get_iter_at_line( self.as_ref().to_glib_none().0, iter.to_glib_none_mut().0, line_number, - ); - iter + )); + if ret { + Some(iter) + } else { + None + } } } - fn get_iter_at_line_index(&self, line_number: i32, byte_index: i32) -> TextIter { + fn get_iter_at_line_index(&self, line_number: i32, byte_index: i32) -> Option { unsafe { let mut iter = TextIter::uninitialized(); - gtk_sys::gtk_text_buffer_get_iter_at_line_index( + let ret = from_glib(gtk_sys::gtk_text_buffer_get_iter_at_line_index( self.as_ref().to_glib_none().0, iter.to_glib_none_mut().0, line_number, byte_index, - ); - iter + )); + if ret { + Some(iter) + } else { + None + } } } - fn get_iter_at_line_offset(&self, line_number: i32, char_offset: i32) -> TextIter { + fn get_iter_at_line_offset(&self, line_number: i32, char_offset: i32) -> Option { unsafe { let mut iter = TextIter::uninitialized(); - gtk_sys::gtk_text_buffer_get_iter_at_line_offset( + let ret = from_glib(gtk_sys::gtk_text_buffer_get_iter_at_line_offset( self.as_ref().to_glib_none().0, iter.to_glib_none_mut().0, line_number, char_offset, - ); - iter + )); + if ret { + Some(iter) + } else { + None + } } } diff --git a/gtk4/src/auto/toggle_button.rs b/gtk4/src/auto/toggle_button.rs index 0ef8cda4852a..3ccbc37338af 100644 --- a/gtk4/src/auto/toggle_button.rs +++ b/gtk4/src/auto/toggle_button.rs @@ -70,6 +70,7 @@ impl Default for ToggleButton { #[derive(Clone, Default)] pub struct ToggleButtonBuilder { active: Option, + group: Option, child: Option, has_frame: Option, icon_name: Option, @@ -118,6 +119,9 @@ impl ToggleButtonBuilder { if let Some(ref active) = self.active { properties.push(("active", active)); } + if let Some(ref group) = self.group { + properties.push(("group", group)); + } if let Some(ref child) = self.child { properties.push(("child", child)); } @@ -238,6 +242,11 @@ impl ToggleButtonBuilder { self } + pub fn group>(mut self, group: &P) -> Self { + self.group = Some(group.clone().upcast()); + self + } + pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self @@ -426,11 +435,15 @@ pub trait ToggleButtonExt: 'static { fn set_active(&self, is_active: bool); + fn set_group>(&self, group: Option<&P>); + fn toggled(&self); fn connect_toggled(&self, f: F) -> SignalHandlerId; fn connect_property_active_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_group_notify(&self, f: F) -> SignalHandlerId; } impl> ToggleButtonExt for O { @@ -451,6 +464,15 @@ impl> ToggleButtonExt for O { } } + fn set_group>(&self, group: Option<&P>) { + unsafe { + gtk_sys::gtk_toggle_button_set_group( + self.as_ref().to_glib_none().0, + group.map(|p| p.as_ref()).to_glib_none().0, + ); + } + } + fn toggled(&self) { unsafe { gtk_sys::gtk_toggle_button_toggled(self.as_ref().to_glib_none().0); @@ -503,6 +525,30 @@ impl> ToggleButtonExt for O { ) } } + + fn connect_property_group_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_group_trampoline( + this: *mut gtk_sys::GtkToggleButton, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&ToggleButton::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::group\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_group_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } } impl fmt::Display for ToggleButton { diff --git a/gtk4/src/auto/tree_list_row_sorter.rs b/gtk4/src/auto/tree_list_row_sorter.rs index 6d06c70a1137..af01b0aac45f 100644 --- a/gtk4/src/auto/tree_list_row_sorter.rs +++ b/gtk4/src/auto/tree_list_row_sorter.rs @@ -28,10 +28,9 @@ impl TreeListRowSorter { pub fn new>(sorter: Option<&P>) -> TreeListRowSorter { assert_initialized_main_thread!(); unsafe { - Sorter::from_glib_full(gtk_sys::gtk_tree_list_row_sorter_new( + from_glib_full(gtk_sys::gtk_tree_list_row_sorter_new( sorter.map(|p| p.as_ref()).to_glib_full(), )) - .unsafe_cast() } } } diff --git a/gtk4/src/auto/tree_store.rs b/gtk4/src/auto/tree_store.rs index 45c8232a2b1b..49931bb5fc4e 100644 --- a/gtk4/src/auto/tree_store.rs +++ b/gtk4/src/auto/tree_store.rs @@ -60,7 +60,7 @@ pub trait TreeStoreExt: 'static { fn prepend(&self, parent: Option<&TreeIter>) -> TreeIter; - fn remove(&self, iter: &TreeIter) -> bool; + //fn remove(&self, iter: /*Unimplemented*/TreeIter) -> bool; //fn reorder(&self, parent: Option<&TreeIter>, new_order: &[i32]); @@ -201,14 +201,9 @@ impl> TreeStoreExt for O { } } - fn remove(&self, iter: &TreeIter) -> bool { - unsafe { - from_glib(gtk_sys::gtk_tree_store_remove( - self.as_ref().to_glib_none().0, - mut_override(iter.to_glib_none().0), - )) - } - } + //fn remove(&self, iter: /*Unimplemented*/TreeIter) -> bool { + // unsafe { TODO: call gtk_sys:gtk_tree_store_remove() } + //} //fn reorder(&self, parent: Option<&TreeIter>, new_order: &[i32]) { // unsafe { TODO: call gtk_sys:gtk_tree_store_reorder() } diff --git a/gtk4/src/auto/versions.txt b/gtk4/src/auto/versions.txt index 7ed425ecd43e..a84a9493a8ec 100644 --- a/gtk4/src/auto/versions.txt +++ b/gtk4/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 2f86b9a) -from gir-files (https://github.com/gtk-rs/gir-files @ cb01ad7) +from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1) diff --git a/gtk4/src/auto/widget.rs b/gtk4/src/auto/widget.rs index 21d56480efa4..e7f31251ec14 100644 --- a/gtk4/src/auto/widget.rs +++ b/gtk4/src/auto/widget.rs @@ -57,10 +57,6 @@ glib_wrapper! { } impl Widget { - //pub fn new(type_: glib::types::Type, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Widget { - // unsafe { TODO: call gtk_sys:gtk_widget_new() } - //} - pub fn get_default_direction() -> TextDirection { assert_initialized_main_thread!(); unsafe { from_glib(gtk_sys::gtk_widget_get_default_direction()) } @@ -191,6 +187,8 @@ pub trait WidgetExt: 'static { fn get_margin_top(&self) -> i32; + fn get_name(&self) -> Option; + fn get_native(&self) -> Option; fn get_next_sibling(&self) -> Option; @@ -359,6 +357,8 @@ pub trait WidgetExt: 'static { fn set_margin_top(&self, margin: i32); + fn set_name(&self, name: &str); + fn set_opacity(&self, opacity: f64); fn set_overflow(&self, overflow: Overflow); @@ -988,6 +988,10 @@ impl> WidgetExt for O { unsafe { gtk_sys::gtk_widget_get_margin_top(self.as_ref().to_glib_none().0) } } + fn get_name(&self) -> Option { + unsafe { from_glib_none(gtk_sys::gtk_widget_get_name(self.as_ref().to_glib_none().0)) } + } + fn get_native(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_widget_get_native( @@ -1633,6 +1637,12 @@ impl> WidgetExt for O { } } + fn set_name(&self, name: &str) { + unsafe { + gtk_sys::gtk_widget_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0); + } + } + fn set_opacity(&self, opacity: f64) { unsafe { gtk_sys::gtk_widget_set_opacity(self.as_ref().to_glib_none().0, opacity); diff --git a/gtk4/sys/src/lib.rs b/gtk4/sys/src/lib.rs index 318200106dbc..ea75a4d31cdc 100644 --- a/gtk4/sys/src/lib.rs +++ b/gtk4/sys/src/lib.rs @@ -886,102 +886,6 @@ pub const GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA: *const c_char = pub const GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION: *const c_char = b"win32-driver-version\0" as *const u8 as *const c_char; pub const GTK_PRIORITY_RESIZE: c_int = 110; -pub const GTK_STYLE_CLASS_ACCELERATOR: *const c_char = - b"accelerator\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_ARROW: *const c_char = b"arrow\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_BACKGROUND: *const c_char = b"background\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_BOTTOM: *const c_char = b"bottom\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_BUTTON: *const c_char = b"button\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_CALENDAR: *const c_char = b"calendar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_CELL: *const c_char = b"cell\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_CHECK: *const c_char = b"check\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_COMBOBOX_ENTRY: *const c_char = - b"combobox-entry\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_CONTEXT_MENU: *const c_char = - b"context-menu\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_CSD: *const c_char = b"csd\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_CURSOR_HANDLE: *const c_char = - b"cursor-handle\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_DEFAULT: *const c_char = b"default\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_DESTRUCTIVE_ACTION: *const c_char = - b"destructive-action\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_DIM_LABEL: *const c_char = b"dim-label\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_DND: *const c_char = b"dnd\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_DOCK: *const c_char = b"dock\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_ENTRY: *const c_char = b"entry\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_ERROR: *const c_char = b"error\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_EXPANDER: *const c_char = b"expander\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_FLAT: *const c_char = b"flat\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_FRAME: *const c_char = b"frame\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_HEADER: *const c_char = b"header\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_HIGHLIGHT: *const c_char = b"highlight\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_HORIZONTAL: *const c_char = b"horizontal\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_IMAGE: *const c_char = b"image\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_INFO: *const c_char = b"info\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_INSERTION_CURSOR: *const c_char = - b"insertion-cursor\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_LABEL: *const c_char = b"label\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_LEFT: *const c_char = b"left\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_LEVEL_BAR: *const c_char = b"level-bar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_LINKED: *const c_char = b"linked\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_LIST: *const c_char = b"list\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_LIST_ROW: *const c_char = b"list-row\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_MARK: *const c_char = b"mark\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_MENU: *const c_char = b"menu\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_MENUBAR: *const c_char = b"menubar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_MENUITEM: *const c_char = b"menuitem\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_MESSAGE_DIALOG: *const c_char = - b"message-dialog\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_MONOSPACE: *const c_char = b"monospace\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_NEEDS_ATTENTION: *const c_char = - b"needs-attention\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_NOTEBOOK: *const c_char = b"notebook\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_OSD: *const c_char = b"osd\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_OVERSHOOT: *const c_char = b"overshoot\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_PANE_SEPARATOR: *const c_char = - b"pane-separator\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_PAPER: *const c_char = b"paper\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_POPOVER: *const c_char = b"popover\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_POPUP: *const c_char = b"popup\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_PROGRESSBAR: *const c_char = - b"progressbar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_PULSE: *const c_char = b"pulse\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_QUESTION: *const c_char = b"question\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_RADIO: *const c_char = b"radio\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_RAISED: *const c_char = b"raised\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_READ_ONLY: *const c_char = b"read-only\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_RIGHT: *const c_char = b"right\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_RUBBERBAND: *const c_char = b"rubberband\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SCALE: *const c_char = b"scale\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE: *const c_char = - b"scale-has-marks-above\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW: *const c_char = - b"scale-has-marks-below\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SCROLLBAR: *const c_char = b"scrollbar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SCROLLBARS_JUNCTION: *const c_char = - b"scrollbars-junction\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SEPARATOR: *const c_char = b"separator\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SIDEBAR: *const c_char = b"sidebar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SLIDER: *const c_char = b"slider\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SPINBUTTON: *const c_char = b"spinbutton\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SPINNER: *const c_char = b"spinner\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_STATUSBAR: *const c_char = b"statusbar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SUBTITLE: *const c_char = b"subtitle\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_SUGGESTED_ACTION: *const c_char = - b"suggested-action\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TITLE: *const c_char = b"title\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TITLEBAR: *const c_char = b"titlebar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TOOLBAR: *const c_char = b"toolbar\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TOOLTIP: *const c_char = b"tooltip\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TOP: *const c_char = b"top\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TOUCH_SELECTION: *const c_char = - b"touch-selection\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_TROUGH: *const c_char = b"trough\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_UNDERSHOOT: *const c_char = b"undershoot\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_VERTICAL: *const c_char = b"vertical\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_VIEW: *const c_char = b"view\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_WARNING: *const c_char = b"warning\0" as *const u8 as *const c_char; -pub const GTK_STYLE_CLASS_WIDE: *const c_char = b"wide\0" as *const u8 as *const c_char; pub const GTK_STYLE_PROVIDER_PRIORITY_APPLICATION: c_int = 600; pub const GTK_STYLE_PROVIDER_PRIORITY_FALLBACK: c_int = 1; pub const GTK_STYLE_PROVIDER_PRIORITY_SETTINGS: c_int = 400; @@ -1010,25 +914,25 @@ pub const GTK_CELL_RENDERER_FOCUSED: GtkCellRendererState = 16; pub const GTK_CELL_RENDERER_EXPANDABLE: GtkCellRendererState = 32; pub const GTK_CELL_RENDERER_EXPANDED: GtkCellRendererState = 64; -pub type GtkDebugFlag = c_uint; -pub const GTK_DEBUG_TEXT: GtkDebugFlag = 1; -pub const GTK_DEBUG_TREE: GtkDebugFlag = 2; -pub const GTK_DEBUG_KEYBINDINGS: GtkDebugFlag = 4; -pub const GTK_DEBUG_MODULES: GtkDebugFlag = 8; -pub const GTK_DEBUG_GEOMETRY: GtkDebugFlag = 16; -pub const GTK_DEBUG_ICONTHEME: GtkDebugFlag = 32; -pub const GTK_DEBUG_PRINTING: GtkDebugFlag = 64; -pub const GTK_DEBUG_BUILDER: GtkDebugFlag = 128; -pub const GTK_DEBUG_SIZE_REQUEST: GtkDebugFlag = 256; -pub const GTK_DEBUG_NO_CSS_CACHE: GtkDebugFlag = 512; -pub const GTK_DEBUG_INTERACTIVE: GtkDebugFlag = 1024; -pub const GTK_DEBUG_TOUCHSCREEN: GtkDebugFlag = 2048; -pub const GTK_DEBUG_ACTIONS: GtkDebugFlag = 4096; -pub const GTK_DEBUG_LAYOUT: GtkDebugFlag = 8192; -pub const GTK_DEBUG_SNAPSHOT: GtkDebugFlag = 16384; -pub const GTK_DEBUG_CONSTRAINTS: GtkDebugFlag = 32768; -pub const GTK_DEBUG_BUILDER_OBJECTS: GtkDebugFlag = 65536; -pub const GTK_DEBUG_A11Y: GtkDebugFlag = 131072; +pub type GtkDebugFlags = c_uint; +pub const GTK_DEBUG_TEXT: GtkDebugFlags = 1; +pub const GTK_DEBUG_TREE: GtkDebugFlags = 2; +pub const GTK_DEBUG_KEYBINDINGS: GtkDebugFlags = 4; +pub const GTK_DEBUG_MODULES: GtkDebugFlags = 8; +pub const GTK_DEBUG_GEOMETRY: GtkDebugFlags = 16; +pub const GTK_DEBUG_ICONTHEME: GtkDebugFlags = 32; +pub const GTK_DEBUG_PRINTING: GtkDebugFlags = 64; +pub const GTK_DEBUG_BUILDER: GtkDebugFlags = 128; +pub const GTK_DEBUG_SIZE_REQUEST: GtkDebugFlags = 256; +pub const GTK_DEBUG_NO_CSS_CACHE: GtkDebugFlags = 512; +pub const GTK_DEBUG_INTERACTIVE: GtkDebugFlags = 1024; +pub const GTK_DEBUG_TOUCHSCREEN: GtkDebugFlags = 2048; +pub const GTK_DEBUG_ACTIONS: GtkDebugFlags = 4096; +pub const GTK_DEBUG_LAYOUT: GtkDebugFlags = 8192; +pub const GTK_DEBUG_SNAPSHOT: GtkDebugFlags = 16384; +pub const GTK_DEBUG_CONSTRAINTS: GtkDebugFlags = 32768; +pub const GTK_DEBUG_BUILDER_OBJECTS: GtkDebugFlags = 65536; +pub const GTK_DEBUG_A11Y: GtkDebugFlags = 131072; pub type GtkDialogFlags = c_uint; pub const GTK_DIALOG_MODAL: GtkDialogFlags = 1; @@ -1068,6 +972,7 @@ pub const GTK_INPUT_HINT_INHIBIT_OSK: GtkInputHints = 128; pub const GTK_INPUT_HINT_VERTICAL_WRITING: GtkInputHints = 256; pub const GTK_INPUT_HINT_EMOJI: GtkInputHints = 512; pub const GTK_INPUT_HINT_NO_EMOJI: GtkInputHints = 1024; +pub const GTK_INPUT_HINT_PRIVATE: GtkInputHints = 2048; pub type GtkPickFlags = c_uint; pub const GTK_PICK_DEFAULT: GtkPickFlags = 0; @@ -1120,7 +1025,6 @@ pub const GTK_TREE_MODEL_LIST_ONLY: GtkTreeModelFlags = 2; // Callbacks pub type GtkAssistantPageFunc = Option c_int>; -pub type GtkCallback = Option; pub type GtkCellAllocCallback = Option< unsafe extern "C" fn( *mut GtkCellRenderer, @@ -1507,8 +1411,8 @@ impl ::std::fmt::Debug for GtkBoxLayoutClass { #[derive(Copy, Clone)] pub struct GtkBuildableIface { pub g_iface: gobject::GTypeInterface, - pub set_name: Option, - pub get_name: Option *const c_char>, + pub set_id: Option, + pub get_id: Option *const c_char>, pub add_child: Option< unsafe extern "C" fn( *mut GtkBuildable, @@ -1574,8 +1478,8 @@ impl ::std::fmt::Debug for GtkBuildableIface { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GtkBuildableIface @ {:?}", self as *const _)) .field("g_iface", &self.g_iface) - .field("set_name", &self.set_name) - .field("get_name", &self.get_name) + .field("set_id", &self.set_id) + .field("get_id", &self.get_id) .field("add_child", &self.add_child) .field("set_buildable_property", &self.set_buildable_property) .field("construct_child", &self.construct_child) @@ -2130,7 +2034,8 @@ impl ::std::fmt::Debug for GtkCenterLayoutClass { #[repr(C)] #[derive(Copy, Clone)] pub struct GtkCheckButtonClass { - pub parent_class: GtkToggleButtonClass, + pub parent_class: GtkWidgetClass, + pub toggled: Option, pub padding: [gpointer; 8], } @@ -2138,6 +2043,7 @@ impl ::std::fmt::Debug for GtkCheckButtonClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GtkCheckButtonClass @ {:?}", self as *const _)) .field("parent_class", &self.parent_class) + .field("toggled", &self.toggled) .finish() } } @@ -3377,26 +3283,9 @@ impl ::std::fmt::Debug for GtkNativeDialogClass { } #[repr(C)] -#[derive(Copy, Clone)] -pub struct GtkNativeInterface { - pub g_iface: gobject::GTypeInterface, - pub get_surface: Option *mut gdk::GdkSurface>, - pub get_renderer: Option *mut gsk::GskRenderer>, - pub get_surface_transform: - Option, - pub check_resize: Option, -} +pub struct _GtkNativeInterface(c_void); -impl ::std::fmt::Debug for GtkNativeInterface { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("GtkNativeInterface @ {:?}", self as *const _)) - .field("get_surface", &self.get_surface) - .field("get_renderer", &self.get_renderer) - .field("get_surface_transform", &self.get_surface_transform) - .field("check_resize", &self.check_resize) - .finish() - } -} +pub type GtkNativeInterface = *mut _GtkNativeInterface; #[repr(C)] pub struct _GtkNeverTriggerClass(c_void); @@ -4010,11 +3899,6 @@ pub struct _GtkShortcutsShortcutClass(c_void); pub type GtkShortcutsShortcutClass = *mut _GtkShortcutsShortcutClass; -#[repr(C)] -pub struct _GtkShortcutsWindowClass(c_void); - -pub type GtkShortcutsWindowClass = *mut _GtkShortcutsWindowClass; - #[repr(C)] pub struct _GtkSignalActionClass(c_void); @@ -5067,16 +4951,6 @@ impl ::std::fmt::Debug for GtkAboutDialog { } } -#[repr(C)] -pub struct GtkAccelLabel(c_void); - -impl ::std::fmt::Debug for GtkAccelLabel { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("GtkAccelLabel @ {:?}", self as *const _)) - .finish() - } -} - #[repr(C)] pub struct GtkActionBar(c_void); @@ -5521,13 +5395,13 @@ impl ::std::fmt::Debug for GtkCenterLayout { #[repr(C)] #[derive(Copy, Clone)] pub struct GtkCheckButton { - pub toggle_button: GtkToggleButton, + pub parent_instance: GtkWidget, } impl ::std::fmt::Debug for GtkCheckButton { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GtkCheckButton @ {:?}", self as *const _)) - .field("toggle_button", &self.toggle_button) + .field("parent_instance", &self.parent_instance) .finish() } } @@ -6876,15 +6750,11 @@ impl ::std::fmt::Debug for GtkParamSpecExpression { } #[repr(C)] -#[derive(Copy, Clone)] -pub struct GtkPasswordEntry { - pub parent: GtkWidget, -} +pub struct GtkPasswordEntry(c_void); impl ::std::fmt::Debug for GtkPasswordEntry { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GtkPasswordEntry @ {:?}", self as *const _)) - .field("parent", &self.parent) .finish() } } @@ -6988,16 +6858,6 @@ impl ::std::fmt::Debug for GtkPropertyExpression { } } -#[repr(C)] -pub struct GtkRadioButton(c_void); - -impl ::std::fmt::Debug for GtkRadioButton { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("GtkRadioButton @ {:?}", self as *const _)) - .finish() - } -} - #[repr(C)] #[derive(Copy, Clone)] pub struct GtkRange { @@ -7215,15 +7075,11 @@ impl ::std::fmt::Debug for GtkShortcutsShortcut { } #[repr(C)] -#[derive(Copy, Clone)] -pub struct GtkShortcutsWindow { - pub window: GtkWindow, -} +pub struct GtkShortcutsWindow(c_void); impl ::std::fmt::Debug for GtkShortcutsWindow { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GtkShortcutsWindow @ {:?}", self as *const _)) - .field("window", &self.window) .finish() } } @@ -8517,9 +8373,9 @@ extern "C" { pub fn gtk_cell_renderer_state_get_type() -> GType; //========================================================================= - // GtkDebugFlag + // GtkDebugFlags //========================================================================= - pub fn gtk_debug_flag_get_type() -> GType; + pub fn gtk_debug_flags_get_type() -> GType; //========================================================================= // GtkDialogFlags @@ -8823,14 +8679,14 @@ extern "C" { error: *mut *mut glib::GError, ) -> *mut gio::GAppInfo; pub fn gtk_recent_info_exists(info: *mut GtkRecentInfo) -> gboolean; - pub fn gtk_recent_info_get_added(info: *mut GtkRecentInfo) -> c_long; + pub fn gtk_recent_info_get_added(info: *mut GtkRecentInfo) -> *mut glib::GDateTime; pub fn gtk_recent_info_get_age(info: *mut GtkRecentInfo) -> c_int; pub fn gtk_recent_info_get_application_info( info: *mut GtkRecentInfo, app_name: *const c_char, app_exec: *mut *const c_char, count: *mut c_uint, - time_: *mut c_long, + stamp: *mut *mut glib::GDateTime, ) -> gboolean; pub fn gtk_recent_info_get_applications( info: *mut GtkRecentInfo, @@ -8844,12 +8700,12 @@ extern "C" { length: *mut size_t, ) -> *mut *mut c_char; pub fn gtk_recent_info_get_mime_type(info: *mut GtkRecentInfo) -> *const c_char; - pub fn gtk_recent_info_get_modified(info: *mut GtkRecentInfo) -> c_long; + pub fn gtk_recent_info_get_modified(info: *mut GtkRecentInfo) -> *mut glib::GDateTime; pub fn gtk_recent_info_get_private_hint(info: *mut GtkRecentInfo) -> gboolean; pub fn gtk_recent_info_get_short_name(info: *mut GtkRecentInfo) -> *mut c_char; pub fn gtk_recent_info_get_uri(info: *mut GtkRecentInfo) -> *const c_char; pub fn gtk_recent_info_get_uri_display(info: *mut GtkRecentInfo) -> *mut c_char; - pub fn gtk_recent_info_get_visited(info: *mut GtkRecentInfo) -> c_long; + pub fn gtk_recent_info_get_visited(info: *mut GtkRecentInfo) -> *mut glib::GDateTime; pub fn gtk_recent_info_has_application( info: *mut GtkRecentInfo, app_name: *const c_char, @@ -9270,28 +9126,6 @@ extern "C" { ); pub fn gtk_about_dialog_set_wrap_license(about: *mut GtkAboutDialog, wrap_license: gboolean); - //========================================================================= - // GtkAccelLabel - //========================================================================= - pub fn gtk_accel_label_get_type() -> GType; - pub fn gtk_accel_label_new(string: *const c_char) -> *mut GtkWidget; - pub fn gtk_accel_label_get_accel( - accel_label: *mut GtkAccelLabel, - accelerator_key: *mut c_uint, - accelerator_mods: *mut gdk::GdkModifierType, - ); - pub fn gtk_accel_label_get_accel_width(accel_label: *mut GtkAccelLabel) -> c_uint; - pub fn gtk_accel_label_get_label(accel_label: *mut GtkAccelLabel) -> *const c_char; - pub fn gtk_accel_label_get_use_underline(accel_label: *mut GtkAccelLabel) -> gboolean; - pub fn gtk_accel_label_refetch(accel_label: *mut GtkAccelLabel) -> gboolean; - pub fn gtk_accel_label_set_accel( - accel_label: *mut GtkAccelLabel, - accelerator_key: c_uint, - accelerator_mods: gdk::GdkModifierType, - ); - pub fn gtk_accel_label_set_label(accel_label: *mut GtkAccelLabel, text: *const c_char); - pub fn gtk_accel_label_set_use_underline(accel_label: *mut GtkAccelLabel, setting: gboolean); - //========================================================================= // GtkActionBar //========================================================================= @@ -9379,7 +9213,7 @@ extern "C" { // GtkAnyFilter //========================================================================= pub fn gtk_any_filter_get_type() -> GType; - pub fn gtk_any_filter_new() -> *mut GtkFilter; + pub fn gtk_any_filter_new() -> *mut GtkAnyFilter; //========================================================================= // GtkAppChooserButton @@ -9660,7 +9494,7 @@ extern "C" { // GtkBoolFilter //========================================================================= pub fn gtk_bool_filter_get_type() -> GType; - pub fn gtk_bool_filter_new(expression: *mut GtkExpression) -> *mut GtkFilter; + pub fn gtk_bool_filter_new(expression: *mut GtkExpression) -> *mut GtkBoolFilter; pub fn gtk_bool_filter_get_expression(self_: *mut GtkBoolFilter) -> *mut GtkExpression; pub fn gtk_bool_filter_get_invert(self_: *mut GtkBoolFilter) -> gboolean; pub fn gtk_bool_filter_set_expression( @@ -9811,7 +9645,7 @@ extern "C" { // GtkBuilderCScope //========================================================================= pub fn gtk_builder_cscope_get_type() -> GType; - pub fn gtk_builder_cscope_new() -> *mut GtkBuilderScope; + pub fn gtk_builder_cscope_new() -> *mut GtkBuilderCScope; pub fn gtk_builder_cscope_add_callback_symbol( self_: *mut GtkBuilderCScope, callback_name: *const c_char, @@ -10441,16 +10275,18 @@ extern "C" { pub fn gtk_check_button_new() -> *mut GtkWidget; pub fn gtk_check_button_new_with_label(label: *const c_char) -> *mut GtkWidget; pub fn gtk_check_button_new_with_mnemonic(label: *const c_char) -> *mut GtkWidget; - pub fn gtk_check_button_get_draw_indicator(check_button: *mut GtkCheckButton) -> gboolean; + pub fn gtk_check_button_get_active(self_: *mut GtkCheckButton) -> gboolean; pub fn gtk_check_button_get_inconsistent(check_button: *mut GtkCheckButton) -> gboolean; - pub fn gtk_check_button_set_draw_indicator( - check_button: *mut GtkCheckButton, - draw_indicator: gboolean, - ); + pub fn gtk_check_button_get_label(self_: *mut GtkCheckButton) -> *const c_char; + pub fn gtk_check_button_get_use_underline(self_: *mut GtkCheckButton) -> gboolean; + pub fn gtk_check_button_set_active(self_: *mut GtkCheckButton, setting: gboolean); + pub fn gtk_check_button_set_group(self_: *mut GtkCheckButton, group: *mut GtkCheckButton); pub fn gtk_check_button_set_inconsistent( check_button: *mut GtkCheckButton, inconsistent: gboolean, ); + pub fn gtk_check_button_set_label(self_: *mut GtkCheckButton, label: *const c_char); + pub fn gtk_check_button_set_use_underline(self_: *mut GtkCheckButton, setting: gboolean); //========================================================================= // GtkClosureExpression @@ -10493,14 +10329,14 @@ extern "C" { // GtkColumnView //========================================================================= pub fn gtk_column_view_get_type() -> GType; - pub fn gtk_column_view_new(model: *mut gio::GListModel) -> *mut GtkWidget; + pub fn gtk_column_view_new(model: *mut GtkSelectionModel) -> *mut GtkWidget; pub fn gtk_column_view_append_column( self_: *mut GtkColumnView, column: *mut GtkColumnViewColumn, ); pub fn gtk_column_view_get_columns(self_: *mut GtkColumnView) -> *mut gio::GListModel; pub fn gtk_column_view_get_enable_rubberband(self_: *mut GtkColumnView) -> gboolean; - pub fn gtk_column_view_get_model(self_: *mut GtkColumnView) -> *mut gio::GListModel; + pub fn gtk_column_view_get_model(self_: *mut GtkColumnView) -> *mut GtkSelectionModel; pub fn gtk_column_view_get_reorderable(self_: *mut GtkColumnView) -> gboolean; pub fn gtk_column_view_get_show_column_separators(self_: *mut GtkColumnView) -> gboolean; pub fn gtk_column_view_get_show_row_separators(self_: *mut GtkColumnView) -> gboolean; @@ -10519,7 +10355,7 @@ extern "C" { self_: *mut GtkColumnView, enable_rubberband: gboolean, ); - pub fn gtk_column_view_set_model(self_: *mut GtkColumnView, model: *mut gio::GListModel); + pub fn gtk_column_view_set_model(self_: *mut GtkColumnView, model: *mut GtkSelectionModel); pub fn gtk_column_view_set_reorderable(self_: *mut GtkColumnView, reorderable: gboolean); pub fn gtk_column_view_set_show_column_separators( self_: *mut GtkColumnView, @@ -10543,8 +10379,7 @@ extern "C" { // GtkColumnViewColumn //========================================================================= pub fn gtk_column_view_column_get_type() -> GType; - pub fn gtk_column_view_column_new(title: *const c_char) -> *mut GtkColumnViewColumn; - pub fn gtk_column_view_column_new_with_factory( + pub fn gtk_column_view_column_new( title: *const c_char, factory: *mut GtkListItemFactory, ) -> *mut GtkColumnViewColumn; @@ -10850,7 +10685,7 @@ extern "C" { match_func: GtkCustomFilterFunc, user_data: gpointer, user_destroy: glib::GDestroyNotify, - ) -> *mut GtkFilter; + ) -> *mut GtkCustomFilter; pub fn gtk_custom_filter_set_filter_func( self_: *mut GtkCustomFilter, match_func: GtkCustomFilterFunc, @@ -10876,7 +10711,7 @@ extern "C" { sort_func: glib::GCompareDataFunc, user_data: gpointer, user_destroy: glib::GDestroyNotify, - ) -> *mut GtkSorter; + ) -> *mut GtkCustomSorter; pub fn gtk_custom_sorter_set_sort_func( self_: *mut GtkCustomSorter, sort_func: glib::GCompareDataFunc, @@ -11438,7 +11273,7 @@ extern "C" { // GtkEveryFilter //========================================================================= pub fn gtk_every_filter_get_type() -> GType; - pub fn gtk_every_filter_new() -> *mut GtkFilter; + pub fn gtk_every_filter_new() -> *mut GtkEveryFilter; //========================================================================= // GtkExpander @@ -11973,8 +11808,8 @@ extern "C" { pub fn gtk_grid_attach( grid: *mut GtkGrid, child: *mut GtkWidget, - left: c_int, - top: c_int, + column: c_int, + row: c_int, width: c_int, height: c_int, ); @@ -11987,7 +11822,7 @@ extern "C" { height: c_int, ); pub fn gtk_grid_get_baseline_row(grid: *mut GtkGrid) -> c_int; - pub fn gtk_grid_get_child_at(grid: *mut GtkGrid, left: c_int, top: c_int) -> *mut GtkWidget; + pub fn gtk_grid_get_child_at(grid: *mut GtkGrid, column: c_int, row: c_int) -> *mut GtkWidget; pub fn gtk_grid_get_column_homogeneous(grid: *mut GtkGrid) -> gboolean; pub fn gtk_grid_get_column_spacing(grid: *mut GtkGrid) -> c_uint; pub fn gtk_grid_get_row_baseline_position( @@ -12006,8 +11841,8 @@ extern "C" { pub fn gtk_grid_query_child( grid: *mut GtkGrid, child: *mut GtkWidget, - left: *mut c_int, - top: *mut c_int, + column: *mut c_int, + row: *mut c_int, width: *mut c_int, height: *mut c_int, ); @@ -12054,29 +11889,28 @@ extern "C" { // GtkGridLayoutChild //========================================================================= pub fn gtk_grid_layout_child_get_type() -> GType; + pub fn gtk_grid_layout_child_get_column(child: *mut GtkGridLayoutChild) -> c_int; pub fn gtk_grid_layout_child_get_column_span(child: *mut GtkGridLayoutChild) -> c_int; - pub fn gtk_grid_layout_child_get_left_attach(child: *mut GtkGridLayoutChild) -> c_int; + pub fn gtk_grid_layout_child_get_row(child: *mut GtkGridLayoutChild) -> c_int; pub fn gtk_grid_layout_child_get_row_span(child: *mut GtkGridLayoutChild) -> c_int; - pub fn gtk_grid_layout_child_get_top_attach(child: *mut GtkGridLayoutChild) -> c_int; + pub fn gtk_grid_layout_child_set_column(child: *mut GtkGridLayoutChild, column: c_int); pub fn gtk_grid_layout_child_set_column_span(child: *mut GtkGridLayoutChild, span: c_int); - pub fn gtk_grid_layout_child_set_left_attach(child: *mut GtkGridLayoutChild, attach: c_int); + pub fn gtk_grid_layout_child_set_row(child: *mut GtkGridLayoutChild, row: c_int); pub fn gtk_grid_layout_child_set_row_span(child: *mut GtkGridLayoutChild, span: c_int); - pub fn gtk_grid_layout_child_set_top_attach(child: *mut GtkGridLayoutChild, attach: c_int); //========================================================================= // GtkGridView //========================================================================= pub fn gtk_grid_view_get_type() -> GType; - pub fn gtk_grid_view_new(model: *mut gio::GListModel) -> *mut GtkWidget; - pub fn gtk_grid_view_new_with_factory( - model: *mut gio::GListModel, + pub fn gtk_grid_view_new( + model: *mut GtkSelectionModel, factory: *mut GtkListItemFactory, ) -> *mut GtkWidget; pub fn gtk_grid_view_get_enable_rubberband(self_: *mut GtkGridView) -> gboolean; pub fn gtk_grid_view_get_factory(self_: *mut GtkGridView) -> *mut GtkListItemFactory; pub fn gtk_grid_view_get_max_columns(self_: *mut GtkGridView) -> c_uint; pub fn gtk_grid_view_get_min_columns(self_: *mut GtkGridView) -> c_uint; - pub fn gtk_grid_view_get_model(self_: *mut GtkGridView) -> *mut gio::GListModel; + pub fn gtk_grid_view_get_model(self_: *mut GtkGridView) -> *mut GtkSelectionModel; pub fn gtk_grid_view_get_single_click_activate(self_: *mut GtkGridView) -> gboolean; pub fn gtk_grid_view_set_enable_rubberband( self_: *mut GtkGridView, @@ -12085,7 +11919,7 @@ extern "C" { pub fn gtk_grid_view_set_factory(self_: *mut GtkGridView, factory: *mut GtkListItemFactory); pub fn gtk_grid_view_set_max_columns(self_: *mut GtkGridView, max_columns: c_uint); pub fn gtk_grid_view_set_min_columns(self_: *mut GtkGridView, min_columns: c_uint); - pub fn gtk_grid_view_set_model(self_: *mut GtkGridView, model: *mut gio::GListModel); + pub fn gtk_grid_view_set_model(self_: *mut GtkGridView, model: *mut GtkSelectionModel); pub fn gtk_grid_view_set_single_click_activate( self_: *mut GtkGridView, single_click_activate: gboolean, @@ -12204,6 +12038,7 @@ extern "C" { pub fn gtk_icon_theme_get_for_display(display: *mut gdk::GdkDisplay) -> *mut GtkIconTheme; pub fn gtk_icon_theme_add_resource_path(self_: *mut GtkIconTheme, path: *const c_char); pub fn gtk_icon_theme_add_search_path(self_: *mut GtkIconTheme, path: *const c_char); + pub fn gtk_icon_theme_get_display(self_: *mut GtkIconTheme) -> *mut gdk::GdkDisplay; pub fn gtk_icon_theme_get_icon_names(self_: *mut GtkIconTheme) -> *mut *mut c_char; pub fn gtk_icon_theme_get_icon_sizes( self_: *mut GtkIconTheme, @@ -12626,6 +12461,7 @@ extern "C" { //========================================================================= pub fn gtk_list_box_get_type() -> GType; pub fn gtk_list_box_new() -> *mut GtkWidget; + pub fn gtk_list_box_append(box_: *mut GtkListBox, child: *mut GtkWidget); pub fn gtk_list_box_bind_model( box_: *mut GtkListBox, model: *mut gio::GListModel, @@ -12802,14 +12638,13 @@ extern "C" { // GtkListView //========================================================================= pub fn gtk_list_view_get_type() -> GType; - pub fn gtk_list_view_new(model: *mut gio::GListModel) -> *mut GtkWidget; - pub fn gtk_list_view_new_with_factory( - model: *mut gio::GListModel, + pub fn gtk_list_view_new( + model: *mut GtkSelectionModel, factory: *mut GtkListItemFactory, ) -> *mut GtkWidget; pub fn gtk_list_view_get_enable_rubberband(self_: *mut GtkListView) -> gboolean; pub fn gtk_list_view_get_factory(self_: *mut GtkListView) -> *mut GtkListItemFactory; - pub fn gtk_list_view_get_model(self_: *mut GtkListView) -> *mut gio::GListModel; + pub fn gtk_list_view_get_model(self_: *mut GtkListView) -> *mut GtkSelectionModel; pub fn gtk_list_view_get_show_separators(self_: *mut GtkListView) -> gboolean; pub fn gtk_list_view_get_single_click_activate(self_: *mut GtkListView) -> gboolean; pub fn gtk_list_view_set_enable_rubberband( @@ -12817,7 +12652,7 @@ extern "C" { enable_rubberband: gboolean, ); pub fn gtk_list_view_set_factory(self_: *mut GtkListView, factory: *mut GtkListItemFactory); - pub fn gtk_list_view_set_model(self_: *mut GtkListView, model: *mut gio::GListModel); + pub fn gtk_list_view_set_model(self_: *mut GtkListView, model: *mut GtkSelectionModel); pub fn gtk_list_view_set_show_separators(self_: *mut GtkListView, show_separators: gboolean); pub fn gtk_list_view_set_single_click_activate( self_: *mut GtkListView, @@ -13055,7 +12890,7 @@ extern "C" { // GtkMultiSorter //========================================================================= pub fn gtk_multi_sorter_get_type() -> GType; - pub fn gtk_multi_sorter_new() -> *mut GtkSorter; + pub fn gtk_multi_sorter_new() -> *mut GtkMultiSorter; pub fn gtk_multi_sorter_append(self_: *mut GtkMultiSorter, sorter: *mut GtkSorter); pub fn gtk_multi_sorter_remove(self_: *mut GtkMultiSorter, position: c_uint); @@ -13247,7 +13082,7 @@ extern "C" { // GtkNumericSorter //========================================================================= pub fn gtk_numeric_sorter_get_type() -> GType; - pub fn gtk_numeric_sorter_new(expression: *mut GtkExpression) -> *mut GtkSorter; + pub fn gtk_numeric_sorter_new(expression: *mut GtkExpression) -> *mut GtkNumericSorter; pub fn gtk_numeric_sorter_get_expression(self_: *mut GtkNumericSorter) -> *mut GtkExpression; pub fn gtk_numeric_sorter_get_sort_order(self_: *mut GtkNumericSorter) -> GtkSortType; pub fn gtk_numeric_sorter_set_expression( @@ -13490,6 +13325,11 @@ extern "C" { pub fn gtk_popover_get_child(popover: *mut GtkPopover) -> *mut GtkWidget; pub fn gtk_popover_get_has_arrow(popover: *mut GtkPopover) -> gboolean; pub fn gtk_popover_get_mnemonics_visible(popover: *mut GtkPopover) -> gboolean; + pub fn gtk_popover_get_offset( + popover: *mut GtkPopover, + x_offset: *mut c_int, + y_offset: *mut c_int, + ); pub fn gtk_popover_get_pointing_to( popover: *mut GtkPopover, rect: *mut gdk::GdkRectangle, @@ -13502,6 +13342,7 @@ extern "C" { pub fn gtk_popover_set_default_widget(popover: *mut GtkPopover, widget: *mut GtkWidget); pub fn gtk_popover_set_has_arrow(popover: *mut GtkPopover, has_arrow: gboolean); pub fn gtk_popover_set_mnemonics_visible(popover: *mut GtkPopover, mnemonics_visible: gboolean); + pub fn gtk_popover_set_offset(popover: *mut GtkPopover, x_offset: c_int, y_offset: c_int); pub fn gtk_popover_set_pointing_to(popover: *mut GtkPopover, rect: *const gdk::GdkRectangle); pub fn gtk_popover_set_position(popover: *mut GtkPopover, position: GtkPositionType); @@ -13890,37 +13731,6 @@ extern "C" { expression: *mut GtkPropertyExpression, ) -> *mut gobject::GParamSpec; - //========================================================================= - // GtkRadioButton - //========================================================================= - pub fn gtk_radio_button_get_type() -> GType; - pub fn gtk_radio_button_new(group: *mut glib::GSList) -> *mut GtkWidget; - pub fn gtk_radio_button_new_from_widget( - radio_group_member: *mut GtkRadioButton, - ) -> *mut GtkWidget; - pub fn gtk_radio_button_new_with_label( - group: *mut glib::GSList, - label: *const c_char, - ) -> *mut GtkWidget; - pub fn gtk_radio_button_new_with_label_from_widget( - radio_group_member: *mut GtkRadioButton, - label: *const c_char, - ) -> *mut GtkWidget; - pub fn gtk_radio_button_new_with_mnemonic( - group: *mut glib::GSList, - label: *const c_char, - ) -> *mut GtkWidget; - pub fn gtk_radio_button_new_with_mnemonic_from_widget( - radio_group_member: *mut GtkRadioButton, - label: *const c_char, - ) -> *mut GtkWidget; - pub fn gtk_radio_button_get_group(radio_button: *mut GtkRadioButton) -> *mut glib::GSList; - pub fn gtk_radio_button_join_group( - radio_button: *mut GtkRadioButton, - group_source: *mut GtkRadioButton, - ); - pub fn gtk_radio_button_set_group(radio_button: *mut GtkRadioButton, group: *mut glib::GSList); - //========================================================================= // GtkRange //========================================================================= @@ -14092,9 +13902,6 @@ extern "C" { //========================================================================= pub fn gtk_scrolled_window_get_type() -> GType; pub fn gtk_scrolled_window_new() -> *mut GtkWidget; - pub fn gtk_scrolled_window_get_capture_button_press( - scrolled_window: *mut GtkScrolledWindow, - ) -> gboolean; pub fn gtk_scrolled_window_get_child(scrolled_window: *mut GtkScrolledWindow) -> *mut GtkWidget; pub fn gtk_scrolled_window_get_hadjustment( @@ -14142,10 +13949,6 @@ extern "C" { pub fn gtk_scrolled_window_get_vscrollbar( scrolled_window: *mut GtkScrolledWindow, ) -> *mut GtkWidget; - pub fn gtk_scrolled_window_set_capture_button_press( - scrolled_window: *mut GtkScrolledWindow, - capture_button_press: gboolean, - ); pub fn gtk_scrolled_window_set_child( scrolled_window: *mut GtkScrolledWindow, child: *mut GtkWidget, @@ -14238,9 +14041,6 @@ extern "C" { pub fn gtk_selection_filter_model_new( model: *mut GtkSelectionModel, ) -> *mut GtkSelectionFilterModel; - pub fn gtk_selection_filter_model_new_for_type( - item_type: GType, - ) -> *mut GtkSelectionFilterModel; pub fn gtk_selection_filter_model_get_model( self_: *mut GtkSelectionFilterModel, ) -> *mut GtkSelectionModel; @@ -14509,6 +14309,17 @@ extern "C" { spread: c_float, blur_radius: c_float, ); + pub fn gtk_snapshot_append_radial_gradient( + snapshot: *mut GtkSnapshot, + bounds: *const graphene::graphene_rect_t, + center: *const graphene::graphene_point_t, + hradius: c_float, + vradius: c_float, + start: c_float, + end: c_float, + stops: *const gsk::GskColorStop, + n_stops: size_t, + ); pub fn gtk_snapshot_append_repeating_linear_gradient( snapshot: *mut GtkSnapshot, bounds: *const graphene::graphene_rect_t, @@ -14517,6 +14328,17 @@ extern "C" { stops: *const gsk::GskColorStop, n_stops: size_t, ); + pub fn gtk_snapshot_append_repeating_radial_gradient( + snapshot: *mut GtkSnapshot, + bounds: *const graphene::graphene_rect_t, + center: *const graphene::graphene_point_t, + hradius: c_float, + vradius: c_float, + start: c_float, + end: c_float, + stops: *const gsk::GskColorStop, + n_stops: size_t, + ); pub fn gtk_snapshot_append_texture( snapshot: *mut GtkSnapshot, texture: *mut gdk::GdkTexture, @@ -14527,6 +14349,7 @@ extern "C" { snapshot: *mut GtkSnapshot, size: *const graphene::graphene_size_t, ) -> *mut gdk::GdkPaintable; + pub fn gtk_snapshot_gl_shader_pop_texture(snapshot: *mut GtkSnapshot); pub fn gtk_snapshot_perspective(snapshot: *mut GtkSnapshot, depth: c_float); pub fn gtk_snapshot_pop(snapshot: *mut GtkSnapshot); pub fn gtk_snapshot_push_blend(snapshot: *mut GtkSnapshot, blend_mode: gsk::GskBlendMode); @@ -14542,6 +14365,12 @@ extern "C" { ); pub fn gtk_snapshot_push_cross_fade(snapshot: *mut GtkSnapshot, progress: c_double); pub fn gtk_snapshot_push_debug(snapshot: *mut GtkSnapshot, message: *const c_char, ...); + pub fn gtk_snapshot_push_gl_shader( + snapshot: *mut GtkSnapshot, + shader: *mut gsk::GskGLShader, + bounds: *const graphene::graphene_rect_t, + take_args: *mut glib::GBytes, + ); pub fn gtk_snapshot_push_opacity(snapshot: *mut GtkSnapshot, opacity: c_double); pub fn gtk_snapshot_push_repeat( snapshot: *mut GtkSnapshot, @@ -14680,6 +14509,7 @@ extern "C" { digits: c_uint, ); pub fn gtk_spin_button_get_adjustment(spin_button: *mut GtkSpinButton) -> *mut GtkAdjustment; + pub fn gtk_spin_button_get_climb_rate(spin_button: *mut GtkSpinButton) -> c_double; pub fn gtk_spin_button_get_digits(spin_button: *mut GtkSpinButton) -> c_uint; pub fn gtk_spin_button_get_increments( spin_button: *mut GtkSpinButton, @@ -14703,6 +14533,7 @@ extern "C" { spin_button: *mut GtkSpinButton, adjustment: *mut GtkAdjustment, ); + pub fn gtk_spin_button_set_climb_rate(spin_button: *mut GtkSpinButton, climb_rate: c_double); pub fn gtk_spin_button_set_digits(spin_button: *mut GtkSpinButton, digits: c_uint); pub fn gtk_spin_button_set_increments( spin_button: *mut GtkSpinButton, @@ -14743,6 +14574,7 @@ extern "C" { //========================================================================= pub fn gtk_stack_get_type() -> GType; pub fn gtk_stack_new() -> *mut GtkWidget; + pub fn gtk_stack_add_child(stack: *mut GtkStack, child: *mut GtkWidget) -> *mut GtkStackPage; pub fn gtk_stack_add_named( stack: *mut GtkStack, child: *mut GtkWidget, @@ -14840,7 +14672,7 @@ extern "C" { // GtkStringFilter //========================================================================= pub fn gtk_string_filter_get_type() -> GType; - pub fn gtk_string_filter_new(expression: *mut GtkExpression) -> *mut GtkFilter; + pub fn gtk_string_filter_new(expression: *mut GtkExpression) -> *mut GtkStringFilter; pub fn gtk_string_filter_get_expression(self_: *mut GtkStringFilter) -> *mut GtkExpression; pub fn gtk_string_filter_get_ignore_case(self_: *mut GtkStringFilter) -> gboolean; pub fn gtk_string_filter_get_match_mode( @@ -14886,7 +14718,7 @@ extern "C" { // GtkStringSorter //========================================================================= pub fn gtk_string_sorter_get_type() -> GType; - pub fn gtk_string_sorter_new(expression: *mut GtkExpression) -> *mut GtkSorter; + pub fn gtk_string_sorter_new(expression: *mut GtkExpression) -> *mut GtkStringSorter; pub fn gtk_string_sorter_get_expression(self_: *mut GtkStringSorter) -> *mut GtkExpression; pub fn gtk_string_sorter_get_ignore_case(self_: *mut GtkStringSorter) -> gboolean; pub fn gtk_string_sorter_set_expression( @@ -14967,6 +14799,7 @@ extern "C" { pub fn gtk_text_get_activates_default(self_: *mut GtkText) -> gboolean; pub fn gtk_text_get_attributes(self_: *mut GtkText) -> *mut pango::PangoAttrList; pub fn gtk_text_get_buffer(self_: *mut GtkText) -> *mut GtkEntryBuffer; + pub fn gtk_text_get_enable_emoji_completion(self_: *mut GtkText) -> gboolean; pub fn gtk_text_get_extra_menu(self_: *mut GtkText) -> *mut gio::GMenuModel; pub fn gtk_text_get_input_hints(self_: *mut GtkText) -> GtkInputHints; pub fn gtk_text_get_input_purpose(self_: *mut GtkText) -> GtkInputPurpose; @@ -14974,13 +14807,19 @@ extern "C" { pub fn gtk_text_get_max_length(self_: *mut GtkText) -> c_int; pub fn gtk_text_get_overwrite_mode(self_: *mut GtkText) -> gboolean; pub fn gtk_text_get_placeholder_text(self_: *mut GtkText) -> *const c_char; + pub fn gtk_text_get_propagate_text_width(self_: *mut GtkText) -> gboolean; pub fn gtk_text_get_tabs(self_: *mut GtkText) -> *mut pango::PangoTabArray; pub fn gtk_text_get_text_length(self_: *mut GtkText) -> u16; + pub fn gtk_text_get_truncate_multiline(self_: *mut GtkText) -> gboolean; pub fn gtk_text_get_visibility(self_: *mut GtkText) -> gboolean; pub fn gtk_text_grab_focus_without_selecting(self_: *mut GtkText) -> gboolean; pub fn gtk_text_set_activates_default(self_: *mut GtkText, activates: gboolean); pub fn gtk_text_set_attributes(self_: *mut GtkText, attrs: *mut pango::PangoAttrList); pub fn gtk_text_set_buffer(self_: *mut GtkText, buffer: *mut GtkEntryBuffer); + pub fn gtk_text_set_enable_emoji_completion( + self_: *mut GtkText, + enable_emoji_completion: gboolean, + ); pub fn gtk_text_set_extra_menu(self_: *mut GtkText, model: *mut gio::GMenuModel); pub fn gtk_text_set_input_hints(self_: *mut GtkText, hints: GtkInputHints); pub fn gtk_text_set_input_purpose(self_: *mut GtkText, purpose: GtkInputPurpose); @@ -14988,7 +14827,9 @@ extern "C" { pub fn gtk_text_set_max_length(self_: *mut GtkText, length: c_int); pub fn gtk_text_set_overwrite_mode(self_: *mut GtkText, overwrite: gboolean); pub fn gtk_text_set_placeholder_text(self_: *mut GtkText, text: *const c_char); + pub fn gtk_text_set_propagate_text_width(self_: *mut GtkText, propagate_text_width: gboolean); pub fn gtk_text_set_tabs(self_: *mut GtkText, tabs: *mut pango::PangoTabArray); + pub fn gtk_text_set_truncate_multiline(self_: *mut GtkText, truncate_multiline: gboolean); pub fn gtk_text_set_visibility(self_: *mut GtkText, visible: gboolean); pub fn gtk_text_unset_invisible_char(self_: *mut GtkText); @@ -15092,19 +14933,19 @@ extern "C" { buffer: *mut GtkTextBuffer, iter: *mut GtkTextIter, line_number: c_int, - ); + ) -> gboolean; pub fn gtk_text_buffer_get_iter_at_line_index( buffer: *mut GtkTextBuffer, iter: *mut GtkTextIter, line_number: c_int, byte_index: c_int, - ); + ) -> gboolean; pub fn gtk_text_buffer_get_iter_at_line_offset( buffer: *mut GtkTextBuffer, iter: *mut GtkTextIter, line_number: c_int, char_offset: c_int, - ); + ) -> gboolean; pub fn gtk_text_buffer_get_iter_at_mark( buffer: *mut GtkTextBuffer, iter: *mut GtkTextIter, @@ -15518,6 +15359,10 @@ extern "C" { pub fn gtk_toggle_button_new_with_mnemonic(label: *const c_char) -> *mut GtkWidget; pub fn gtk_toggle_button_get_active(toggle_button: *mut GtkToggleButton) -> gboolean; pub fn gtk_toggle_button_set_active(toggle_button: *mut GtkToggleButton, is_active: gboolean); + pub fn gtk_toggle_button_set_group( + toggle_button: *mut GtkToggleButton, + group: *mut GtkToggleButton, + ); pub fn gtk_toggle_button_toggled(toggle_button: *mut GtkToggleButton); //========================================================================= @@ -15592,7 +15437,7 @@ extern "C" { // GtkTreeListRowSorter //========================================================================= pub fn gtk_tree_list_row_sorter_get_type() -> GType; - pub fn gtk_tree_list_row_sorter_new(sorter: *mut GtkSorter) -> *mut GtkSorter; + pub fn gtk_tree_list_row_sorter_new(sorter: *mut GtkSorter) -> *mut GtkTreeListRowSorter; pub fn gtk_tree_list_row_sorter_get_sorter(self_: *mut GtkTreeListRowSorter) -> *mut GtkSorter; pub fn gtk_tree_list_row_sorter_set_sorter( self_: *mut GtkTreeListRowSorter, @@ -16347,7 +16192,6 @@ extern "C" { // GtkWidget //========================================================================= pub fn gtk_widget_get_type() -> GType; - pub fn gtk_widget_new(type_: GType, first_property_name: *const c_char, ...) -> *mut GtkWidget; pub fn gtk_widget_get_default_direction() -> GtkTextDirection; pub fn gtk_widget_set_default_direction(dir: GtkTextDirection); pub fn gtk_widget_action_set_enabled( @@ -16766,8 +16610,9 @@ extern "C" { ); pub fn gtk_accessible_update_property_value( self_: *mut GtkAccessible, - property: GtkAccessibleProperty, - value: *const gobject::GValue, + n_properties: c_int, + properties: *mut GtkAccessibleProperty, + values: *const gobject::GValue, ); pub fn gtk_accessible_update_relation( self_: *mut GtkAccessible, @@ -16776,8 +16621,9 @@ extern "C" { ); pub fn gtk_accessible_update_relation_value( self_: *mut GtkAccessible, - relation: GtkAccessibleRelation, - value: *const gobject::GValue, + n_relations: c_int, + relations: *mut GtkAccessibleRelation, + values: *const gobject::GValue, ); pub fn gtk_accessible_update_state( self_: *mut GtkAccessible, @@ -16786,8 +16632,9 @@ extern "C" { ); pub fn gtk_accessible_update_state_value( self_: *mut GtkAccessible, - state: GtkAccessibleState, - value: *const gobject::GValue, + n_states: c_int, + states: *mut GtkAccessibleState, + values: *const gobject::GValue, ); //========================================================================= @@ -16828,53 +16675,7 @@ extern "C" { // GtkBuildable //========================================================================= pub fn gtk_buildable_get_type() -> GType; - pub fn gtk_buildable_add_child( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - child: *mut gobject::GObject, - type_: *const c_char, - ); - pub fn gtk_buildable_construct_child( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - name: *const c_char, - ) -> *mut gobject::GObject; - pub fn gtk_buildable_custom_finished( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - child: *mut gobject::GObject, - tagname: *const c_char, - data: gpointer, - ); - pub fn gtk_buildable_custom_tag_end( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - child: *mut gobject::GObject, - tagname: *const c_char, - data: gpointer, - ); - pub fn gtk_buildable_custom_tag_start( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - child: *mut gobject::GObject, - tagname: *const c_char, - parser: *mut GtkBuildableParser, - data: *mut gpointer, - ) -> gboolean; - pub fn gtk_buildable_get_internal_child( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - childname: *const c_char, - ) -> *mut gobject::GObject; - pub fn gtk_buildable_get_name(buildable: *mut GtkBuildable) -> *const c_char; - pub fn gtk_buildable_parser_finished(buildable: *mut GtkBuildable, builder: *mut GtkBuilder); - pub fn gtk_buildable_set_buildable_property( - buildable: *mut GtkBuildable, - builder: *mut GtkBuilder, - name: *const c_char, - value: *const gobject::GValue, - ); - pub fn gtk_buildable_set_name(buildable: *mut GtkBuildable, name: *const c_char); + pub fn gtk_buildable_get_buildable_id(buildable: *mut GtkBuildable) -> *const c_char; //========================================================================= // GtkBuilderScope @@ -17131,7 +16932,7 @@ extern "C" { // GtkNative //========================================================================= pub fn gtk_native_get_type() -> GType; - pub fn gtk_native_get_for_surface(surface: *mut gdk::GdkSurface) -> *mut GtkWidget; + pub fn gtk_native_get_for_surface(surface: *mut gdk::GdkSurface) -> *mut GtkNative; pub fn gtk_native_check_resize(self_: *mut GtkNative); pub fn gtk_native_get_renderer(self_: *mut GtkNative) -> *mut gsk::GskRenderer; pub fn gtk_native_get_surface(self_: *mut GtkNative) -> *mut gdk::GdkSurface; @@ -17484,7 +17285,7 @@ extern "C" { sizes: *mut GtkRequestedSize, ) -> c_int; pub fn gtk_get_binary_age() -> c_uint; - pub fn gtk_get_debug_flags() -> c_uint; + pub fn gtk_get_debug_flags() -> GtkDebugFlags; pub fn gtk_get_default_language() -> *mut pango::PangoLanguage; pub fn gtk_get_interface_age() -> c_uint; pub fn gtk_get_locale_direction() -> GtkTextDirection; @@ -17624,15 +17425,6 @@ extern "C" { width: c_double, height: c_double, ); - pub fn gtk_render_slider( - context: *mut GtkStyleContext, - cr: *mut cairo::cairo_t, - x: c_double, - y: c_double, - width: c_double, - height: c_double, - orientation: GtkOrientation, - ); pub fn gtk_rgb_to_hsv( r: c_float, g: c_float, @@ -17641,7 +17433,7 @@ extern "C" { s: *mut c_float, v: *mut c_float, ); - pub fn gtk_set_debug_flags(flags: c_uint); + pub fn gtk_set_debug_flags(flags: GtkDebugFlags); pub fn gtk_show_about_dialog(parent: *mut GtkWindow, first_property_name: *const c_char, ...); pub fn gtk_show_uri(parent: *mut GtkWindow, uri: *const c_char, timestamp: u32); pub fn gtk_show_uri_full( diff --git a/gtk4/sys/tests/abi.rs b/gtk4/sys/tests/abi.rs index a9f7d9b68e10..5898ea5874f5 100644 --- a/gtk4/sys/tests/abi.rs +++ b/gtk4/sys/tests/abi.rs @@ -778,10 +778,10 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ }, ), ( - "GtkDebugFlag", + "GtkDebugFlags", Layout { - size: size_of::(), - alignment: align_of::(), + size: size_of::(), + alignment: align_of::(), }, ), ( @@ -1379,13 +1379,6 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ alignment: align_of::(), }, ), - ( - "GtkNativeInterface", - Layout { - size: size_of::(), - alignment: align_of::(), - }, - ), ( "GtkNoSelectionClass", Layout { @@ -1512,13 +1505,6 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ alignment: align_of::(), }, ), - ( - "GtkPasswordEntry", - Layout { - size: size_of::(), - alignment: align_of::(), - }, - ), ( "GtkPickFlags", Layout { @@ -1862,13 +1848,6 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[ alignment: align_of::(), }, ), - ( - "GtkShortcutsWindow", - Layout { - size: size_of::(), - alignment: align_of::(), - }, - ), ( "GtkSingleSelectionClass", Layout { @@ -2769,6 +2748,7 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(guint) GTK_INPUT_HINT_NONE", "0"), ("(guint) GTK_INPUT_HINT_NO_EMOJI", "1024"), ("(guint) GTK_INPUT_HINT_NO_SPELLCHECK", "2"), + ("(guint) GTK_INPUT_HINT_PRIVATE", "2048"), ("(guint) GTK_INPUT_HINT_SPELLCHECK", "1"), ("(guint) GTK_INPUT_HINT_UPPERCASE_CHARS", "16"), ("(guint) GTK_INPUT_HINT_UPPERCASE_SENTENCES", "64"), @@ -3133,93 +3113,6 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) GTK_STRING_FILTER_MATCH_MODE_EXACT", "0"), ("(gint) GTK_STRING_FILTER_MATCH_MODE_PREFIX", "2"), ("(gint) GTK_STRING_FILTER_MATCH_MODE_SUBSTRING", "1"), - ("GTK_STYLE_CLASS_ACCELERATOR", "accelerator"), - ("GTK_STYLE_CLASS_ARROW", "arrow"), - ("GTK_STYLE_CLASS_BACKGROUND", "background"), - ("GTK_STYLE_CLASS_BOTTOM", "bottom"), - ("GTK_STYLE_CLASS_BUTTON", "button"), - ("GTK_STYLE_CLASS_CALENDAR", "calendar"), - ("GTK_STYLE_CLASS_CELL", "cell"), - ("GTK_STYLE_CLASS_CHECK", "check"), - ("GTK_STYLE_CLASS_COMBOBOX_ENTRY", "combobox-entry"), - ("GTK_STYLE_CLASS_CONTEXT_MENU", "context-menu"), - ("GTK_STYLE_CLASS_CSD", "csd"), - ("GTK_STYLE_CLASS_CURSOR_HANDLE", "cursor-handle"), - ("GTK_STYLE_CLASS_DEFAULT", "default"), - ("GTK_STYLE_CLASS_DESTRUCTIVE_ACTION", "destructive-action"), - ("GTK_STYLE_CLASS_DIM_LABEL", "dim-label"), - ("GTK_STYLE_CLASS_DND", "dnd"), - ("GTK_STYLE_CLASS_DOCK", "dock"), - ("GTK_STYLE_CLASS_ENTRY", "entry"), - ("GTK_STYLE_CLASS_ERROR", "error"), - ("GTK_STYLE_CLASS_EXPANDER", "expander"), - ("GTK_STYLE_CLASS_FLAT", "flat"), - ("GTK_STYLE_CLASS_FRAME", "frame"), - ("GTK_STYLE_CLASS_HEADER", "header"), - ("GTK_STYLE_CLASS_HIGHLIGHT", "highlight"), - ("GTK_STYLE_CLASS_HORIZONTAL", "horizontal"), - ("GTK_STYLE_CLASS_IMAGE", "image"), - ("GTK_STYLE_CLASS_INFO", "info"), - ("GTK_STYLE_CLASS_INSERTION_CURSOR", "insertion-cursor"), - ("GTK_STYLE_CLASS_LABEL", "label"), - ("GTK_STYLE_CLASS_LEFT", "left"), - ("GTK_STYLE_CLASS_LEVEL_BAR", "level-bar"), - ("GTK_STYLE_CLASS_LINKED", "linked"), - ("GTK_STYLE_CLASS_LIST", "list"), - ("GTK_STYLE_CLASS_LIST_ROW", "list-row"), - ("GTK_STYLE_CLASS_MARK", "mark"), - ("GTK_STYLE_CLASS_MENU", "menu"), - ("GTK_STYLE_CLASS_MENUBAR", "menubar"), - ("GTK_STYLE_CLASS_MENUITEM", "menuitem"), - ("GTK_STYLE_CLASS_MESSAGE_DIALOG", "message-dialog"), - ("GTK_STYLE_CLASS_MONOSPACE", "monospace"), - ("GTK_STYLE_CLASS_NEEDS_ATTENTION", "needs-attention"), - ("GTK_STYLE_CLASS_NOTEBOOK", "notebook"), - ("GTK_STYLE_CLASS_OSD", "osd"), - ("GTK_STYLE_CLASS_OVERSHOOT", "overshoot"), - ("GTK_STYLE_CLASS_PANE_SEPARATOR", "pane-separator"), - ("GTK_STYLE_CLASS_PAPER", "paper"), - ("GTK_STYLE_CLASS_POPOVER", "popover"), - ("GTK_STYLE_CLASS_POPUP", "popup"), - ("GTK_STYLE_CLASS_PROGRESSBAR", "progressbar"), - ("GTK_STYLE_CLASS_PULSE", "pulse"), - ("GTK_STYLE_CLASS_QUESTION", "question"), - ("GTK_STYLE_CLASS_RADIO", "radio"), - ("GTK_STYLE_CLASS_RAISED", "raised"), - ("GTK_STYLE_CLASS_READ_ONLY", "read-only"), - ("GTK_STYLE_CLASS_RIGHT", "right"), - ("GTK_STYLE_CLASS_RUBBERBAND", "rubberband"), - ("GTK_STYLE_CLASS_SCALE", "scale"), - ( - "GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE", - "scale-has-marks-above", - ), - ( - "GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW", - "scale-has-marks-below", - ), - ("GTK_STYLE_CLASS_SCROLLBAR", "scrollbar"), - ("GTK_STYLE_CLASS_SCROLLBARS_JUNCTION", "scrollbars-junction"), - ("GTK_STYLE_CLASS_SEPARATOR", "separator"), - ("GTK_STYLE_CLASS_SIDEBAR", "sidebar"), - ("GTK_STYLE_CLASS_SLIDER", "slider"), - ("GTK_STYLE_CLASS_SPINBUTTON", "spinbutton"), - ("GTK_STYLE_CLASS_SPINNER", "spinner"), - ("GTK_STYLE_CLASS_STATUSBAR", "statusbar"), - ("GTK_STYLE_CLASS_SUBTITLE", "subtitle"), - ("GTK_STYLE_CLASS_SUGGESTED_ACTION", "suggested-action"), - ("GTK_STYLE_CLASS_TITLE", "title"), - ("GTK_STYLE_CLASS_TITLEBAR", "titlebar"), - ("GTK_STYLE_CLASS_TOOLBAR", "toolbar"), - ("GTK_STYLE_CLASS_TOOLTIP", "tooltip"), - ("GTK_STYLE_CLASS_TOP", "top"), - ("GTK_STYLE_CLASS_TOUCH_SELECTION", "touch-selection"), - ("GTK_STYLE_CLASS_TROUGH", "trough"), - ("GTK_STYLE_CLASS_UNDERSHOOT", "undershoot"), - ("GTK_STYLE_CLASS_VERTICAL", "vertical"), - ("GTK_STYLE_CLASS_VIEW", "view"), - ("GTK_STYLE_CLASS_WARNING", "warning"), - ("GTK_STYLE_CLASS_WIDE", "wide"), ("(guint) GTK_STYLE_CONTEXT_PRINT_NONE", "0"), ("(guint) GTK_STYLE_CONTEXT_PRINT_RECURSE", "1"), ("(guint) GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE", "4"), diff --git a/gtk4/sys/versions.txt b/gtk4/sys/versions.txt index 7ed425ecd43e..a84a9493a8ec 100644 --- a/gtk4/sys/versions.txt +++ b/gtk4/sys/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 2f86b9a) -from gir-files (https://github.com/gtk-rs/gir-files @ cb01ad7) +from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1) From c11739887c42d909445341b793bcc15b9bbe4a9e Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 5 Nov 2020 10:16:55 +0100 Subject: [PATCH 2/3] gtk3.99.3: generate missing enums --- gdk4/Gir.toml | 1 + gdk4/src/auto/flags.rs | 63 +++++++++++++++++++++++++++++++++++++ gdk4/src/auto/mod.rs | 1 + gdk4/src/auto/toplevel.rs | 13 +++++--- gtk4/Gir.toml | 1 + gtk4/src/auto/flags.rs | 64 ++++++++++++++++++++++++++++++++++++++ gtk4/src/auto/functions.rs | 17 ++++++---- gtk4/src/auto/mod.rs | 1 + 8 files changed, 151 insertions(+), 10 deletions(-) diff --git a/gdk4/Gir.toml b/gdk4/Gir.toml index 308a73ed4b03..cda4c40a9647 100644 --- a/gdk4/Gir.toml +++ b/gdk4/Gir.toml @@ -65,6 +65,7 @@ generate = [ "Gdk.Texture", "Gdk.Toplevel", "Gdk.ToplevelLayout", + "Gdk.ToplevelState", "Gdk.TouchEvent", "Gdk.TouchpadEvent", "Gdk.TouchpadGesturePhase", diff --git a/gdk4/src/auto/flags.rs b/gdk4/src/auto/flags.rs index aa801eb3fae5..8ac8b9cd58f4 100644 --- a/gdk4/src/auto/flags.rs +++ b/gdk4/src/auto/flags.rs @@ -387,3 +387,66 @@ impl SetValue for SeatCapabilities { gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) } } + +bitflags! { + pub struct ToplevelState: u32 { + const WITHDRAWN = 1; + const MINIMIZED = 2; + const MAXIMIZED = 4; + const STICKY = 8; + const FULLSCREEN = 16; + const ABOVE = 32; + const BELOW = 64; + const FOCUSED = 128; + const TILED = 256; + const TOP_TILED = 512; + const TOP_RESIZABLE = 1024; + const RIGHT_TILED = 2048; + const RIGHT_RESIZABLE = 4096; + const BOTTOM_TILED = 8192; + const BOTTOM_RESIZABLE = 16384; + const LEFT_TILED = 32768; + const LEFT_RESIZABLE = 65536; + } +} + +#[doc(hidden)] +impl ToGlib for ToplevelState { + type GlibType = gdk_sys::GdkToplevelState; + + fn to_glib(&self) -> gdk_sys::GdkToplevelState { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for ToplevelState { + fn from_glib(value: gdk_sys::GdkToplevelState) -> ToplevelState { + skip_assert_initialized!(); + ToplevelState::from_bits_truncate(value) + } +} + +impl StaticType for ToplevelState { + fn static_type() -> Type { + unsafe { from_glib(gdk_sys::gdk_toplevel_state_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for ToplevelState { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for ToplevelState { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for ToplevelState { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} diff --git a/gdk4/src/auto/mod.rs b/gdk4/src/auto/mod.rs index cc034c30f4dc..784ce2be1109 100644 --- a/gdk4/src/auto/mod.rs +++ b/gdk4/src/auto/mod.rs @@ -198,6 +198,7 @@ pub use self::flags::FrameClockPhase; pub use self::flags::ModifierType; pub use self::flags::PaintableFlags; pub use self::flags::SeatCapabilities; +pub use self::flags::ToplevelState; pub mod functions; diff --git a/gdk4/src/auto/toplevel.rs b/gdk4/src/auto/toplevel.rs index 9e35458af0fd..1ccd81b1b94e 100644 --- a/gdk4/src/auto/toplevel.rs +++ b/gdk4/src/auto/toplevel.rs @@ -23,6 +23,7 @@ use Surface; use SurfaceEdge; use Texture; use ToplevelLayout; +use ToplevelState; glib_wrapper! { pub struct Toplevel(Interface) @requires Surface; @@ -49,7 +50,7 @@ pub trait ToplevelExt: 'static { fn focus(&self, timestamp: u32); - //fn get_state(&self) -> /*Ignored*/ToplevelState; + fn get_state(&self) -> ToplevelState; fn inhibit_system_shortcuts>(&self, event: Option<&P>); @@ -173,9 +174,13 @@ impl> ToplevelExt for O { } } - //fn get_state(&self) -> /*Ignored*/ToplevelState { - // unsafe { TODO: call gdk_sys:gdk_toplevel_get_state() } - //} + fn get_state(&self) -> ToplevelState { + unsafe { + from_glib(gdk_sys::gdk_toplevel_get_state( + self.as_ref().to_glib_none().0, + )) + } + } fn inhibit_system_shortcuts>(&self, event: Option<&P>) { unsafe { diff --git a/gtk4/Gir.toml b/gtk4/Gir.toml index fe4f1d9eab34..b4e9dae8d790 100644 --- a/gtk4/Gir.toml +++ b/gtk4/Gir.toml @@ -74,6 +74,7 @@ generate = [ "Gtk.CustomLayout", "Gtk.CustomSorter", "Gtk.DebugFlag", + "Gtk.DebugFlags", "Gtk.DeleteType", "Gtk.DialogFlags", "Gtk.DirectionType", diff --git a/gtk4/src/auto/flags.rs b/gtk4/src/auto/flags.rs index 2fe251465be5..3992a2a821f0 100644 --- a/gtk4/src/auto/flags.rs +++ b/gtk4/src/auto/flags.rs @@ -162,6 +162,70 @@ impl SetValue for CellRendererState { } } +bitflags! { + pub struct DebugFlags: u32 { + const TEXT = 1; + const TREE = 2; + const KEYBINDINGS = 4; + const MODULES = 8; + const GEOMETRY = 16; + const ICONTHEME = 32; + const PRINTING = 64; + const BUILDER = 128; + const SIZE_REQUEST = 256; + const NO_CSS_CACHE = 512; + const INTERACTIVE = 1024; + const TOUCHSCREEN = 2048; + const ACTIONS = 4096; + const LAYOUT = 8192; + const SNAPSHOT = 16384; + const CONSTRAINTS = 32768; + const BUILDER_OBJECTS = 65536; + const A11Y = 131072; + } +} + +#[doc(hidden)] +impl ToGlib for DebugFlags { + type GlibType = gtk_sys::GtkDebugFlags; + + fn to_glib(&self) -> gtk_sys::GtkDebugFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for DebugFlags { + fn from_glib(value: gtk_sys::GtkDebugFlags) -> DebugFlags { + skip_assert_initialized!(); + DebugFlags::from_bits_truncate(value) + } +} + +impl StaticType for DebugFlags { + fn static_type() -> Type { + unsafe { from_glib(gtk_sys::gtk_debug_flags_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for DebugFlags { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for DebugFlags { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for DebugFlags { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} + bitflags! { pub struct DialogFlags: u32 { const MODAL = 1; diff --git a/gtk4/src/auto/functions.rs b/gtk4/src/auto/functions.rs index 84d0dda2d806..9c06dcca8b91 100644 --- a/gtk4/src/auto/functions.rs +++ b/gtk4/src/auto/functions.rs @@ -18,6 +18,7 @@ use AccessibleProperty; use AccessibleRelation; use AccessibleRole; use AccessibleState; +use DebugFlags; use PageSetup; use PrintSettings; use StyleContext; @@ -137,9 +138,10 @@ pub fn disable_setlocale() { // unsafe { TODO: call gtk_sys:gtk_distribute_natural_allocation() } //} -//pub fn get_debug_flags() -> /*Ignored*/DebugFlags { -// unsafe { TODO: call gtk_sys:gtk_get_debug_flags() } -//} +pub fn get_debug_flags() -> DebugFlags { + assert_initialized_main_thread!(); + unsafe { from_glib(gtk_sys::gtk_get_debug_flags()) } +} pub fn get_default_language() -> Option { assert_initialized_main_thread!(); @@ -511,9 +513,12 @@ pub fn rgb_to_hsv(r: f32, g: f32, b: f32) -> (f32, f32, f32) { } } -//pub fn set_debug_flags(flags: /*Ignored*/DebugFlags) { -// unsafe { TODO: call gtk_sys:gtk_set_debug_flags() } -//} +pub fn set_debug_flags(flags: DebugFlags) { + assert_initialized_main_thread!(); + unsafe { + gtk_sys::gtk_set_debug_flags(flags.to_glib()); + } +} //pub fn show_about_dialog>(parent: Option<&P>, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call gtk_sys:gtk_show_about_dialog() } diff --git a/gtk4/src/auto/mod.rs b/gtk4/src/auto/mod.rs index 837db8c22c41..a94aabaab7a3 100644 --- a/gtk4/src/auto/mod.rs +++ b/gtk4/src/auto/mod.rs @@ -1234,6 +1234,7 @@ mod flags; pub use self::flags::ApplicationInhibitFlags; pub use self::flags::BuilderClosureFlags; pub use self::flags::CellRendererState; +pub use self::flags::DebugFlags; pub use self::flags::DialogFlags; pub use self::flags::EventControllerScrollFlags; pub use self::flags::FontChooserLevel; From c91cddb748219d8acf9415fcccf0cfec0ff71b45 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 5 Nov 2020 12:25:32 +0100 Subject: [PATCH 3/3] gtk4: generate snapshot_append_*_gradient manually same as append_linear_gradient & append_repeating_linear_gradient --- gtk4/Gir.toml | 8 ++++++ gtk4/src/auto/snapshot.rs | 52 --------------------------------------- gtk4/src/snapshot.rs | 52 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 52 deletions(-) diff --git a/gtk4/Gir.toml b/gtk4/Gir.toml index b4e9dae8d790..752cceaa6faa 100644 --- a/gtk4/Gir.toml +++ b/gtk4/Gir.toml @@ -1649,9 +1649,17 @@ status = "generate" #manual ignore = true [[object.function]] + name = "append_radial_gradient" + #manual + ignore = true + [[object.function]] name = "append_repeating_linear_gradient" #manual ignore = true + [[object.function]] + name = "append_repeating_radial_gradient" + #manual + ignore = true [[object]] name = "Gtk.SortListModel" diff --git a/gtk4/src/auto/snapshot.rs b/gtk4/src/auto/snapshot.rs index 10674fe23f11..d2ab13110966 100644 --- a/gtk4/src/auto/snapshot.rs +++ b/gtk4/src/auto/snapshot.rs @@ -113,58 +113,6 @@ impl Snapshot { } } - pub fn append_radial_gradient( - &self, - bounds: &graphene::Rect, - center: &graphene::Point, - hradius: f32, - vradius: f32, - start: f32, - end: f32, - stops: &[&gsk::ColorStop], - ) { - let n_stops = stops.len() as usize; - unsafe { - gtk_sys::gtk_snapshot_append_radial_gradient( - self.to_glib_none().0, - bounds.to_glib_none().0, - center.to_glib_none().0, - hradius, - vradius, - start, - end, - stops.to_glib_none().0, - n_stops, - ); - } - } - - pub fn append_repeating_radial_gradient( - &self, - bounds: &graphene::Rect, - center: &graphene::Point, - hradius: f32, - vradius: f32, - start: f32, - end: f32, - stops: &[&gsk::ColorStop], - ) { - let n_stops = stops.len() as usize; - unsafe { - gtk_sys::gtk_snapshot_append_repeating_radial_gradient( - self.to_glib_none().0, - bounds.to_glib_none().0, - center.to_glib_none().0, - hradius, - vradius, - start, - end, - stops.to_glib_none().0, - n_stops, - ); - } - } - pub fn append_texture>(&self, texture: &P, bounds: &graphene::Rect) { unsafe { gtk_sys::gtk_snapshot_append_texture( diff --git a/gtk4/src/snapshot.rs b/gtk4/src/snapshot.rs index 6491ab60fb53..a2e8ca39d066 100644 --- a/gtk4/src/snapshot.rs +++ b/gtk4/src/snapshot.rs @@ -29,6 +29,58 @@ impl Snapshot { } } + pub fn append_radial_gradient( + &self, + bounds: &graphene::Rect, + center: &graphene::Point, + hradius: f32, + vradius: f32, + start: f32, + end: f32, + stops: &[gsk::ColorStop], + ) { + let n_stops = stops.len() as usize; + unsafe { + gtk_sys::gtk_snapshot_append_radial_gradient( + self.to_glib_none().0, + bounds.to_glib_none().0, + center.to_glib_none().0, + hradius, + vradius, + start, + end, + stops.to_glib_none().0, + n_stops, + ); + } + } + + pub fn append_repeating_radial_gradient( + &self, + bounds: &graphene::Rect, + center: &graphene::Point, + hradius: f32, + vradius: f32, + start: f32, + end: f32, + stops: &[gsk::ColorStop], + ) { + let n_stops = stops.len() as usize; + unsafe { + gtk_sys::gtk_snapshot_append_repeating_radial_gradient( + self.to_glib_none().0, + bounds.to_glib_none().0, + center.to_glib_none().0, + hradius, + vradius, + start, + end, + stops.to_glib_none().0, + n_stops, + ); + } + } + pub fn append_repeating_linear_gradient( &self, bounds: &Rect,