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

Backport #840 #841

Merged
merged 4 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions atk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ v2_30 = ["ffi/v2_30"]
v2_32 = ["v2_30", "ffi/v2_32"]
v2_34 = ["v2_32", "ffi/v2_34"]
v2_38 = ["v2_34", "ffi/v2_38"]
v2_46 = ["v2_38", "ffi/v2_46"]
v2_50 = ["v2_46", "ffi/v2_50"]

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
Expand Down
5 changes: 5 additions & 0 deletions atk/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ name = "Atk.Image"
status = "generate"
trait_name = "AtkImageExt" # duplicate with gtk

[[object]]
name = "Atk.Live"
status = "generate"
version = "2.50"

[[object]]
name = "Atk.Misc"
status = "generate"
Expand Down
134 changes: 134 additions & 0 deletions atk/src/auto/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,140 @@ impl From<Layer> for glib::Value {
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkLive")]
pub enum Live {
#[doc(alias = "ATK_LIVE_NONE")]
None,
#[doc(alias = "ATK_LIVE_POLITE")]
Polite,
#[doc(alias = "ATK_LIVE_ASSERTIVE")]
Assertive,
#[doc(hidden)]
__Unknown(i32),
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
impl fmt::Display for Live {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"Live::{}",
match *self {
Self::None => "None",
Self::Polite => "Polite",
Self::Assertive => "Assertive",
_ => "Unknown",
}
)
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
#[doc(hidden)]
impl IntoGlib for Live {
type GlibType = ffi::AtkLive;

#[inline]
fn into_glib(self) -> ffi::AtkLive {
match self {
Self::None => ffi::ATK_LIVE_NONE,
Self::Polite => ffi::ATK_LIVE_POLITE,
Self::Assertive => ffi::ATK_LIVE_ASSERTIVE,
Self::__Unknown(value) => value,
}
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
#[doc(hidden)]
impl FromGlib<ffi::AtkLive> for Live {
#[inline]
unsafe fn from_glib(value: ffi::AtkLive) -> Self {
skip_assert_initialized!();

match value {
ffi::ATK_LIVE_NONE => Self::None,
ffi::ATK_LIVE_POLITE => Self::Polite,
ffi::ATK_LIVE_ASSERTIVE => Self::Assertive,
value => Self::__Unknown(value),
}
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
impl StaticType for Live {
#[inline]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::atk_live_get_type()) }
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
impl glib::HasParamSpec for Live {
type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

fn param_spec_builder() -> Self::BuilderFn {
|name, default_value| Self::ParamSpec::builder_with_default(name, default_value)
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
impl glib::value::ValueType for Live {
type Type = Self;
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
unsafe impl<'a> glib::value::FromValue<'a> for Live {
type Checker = glib::value::GenericValueTypeChecker<Self>;

#[inline]
unsafe fn from_value(value: &'a glib::Value) -> Self {
skip_assert_initialized!();
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
impl ToValue for Live {
#[inline]
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
}
value
}

#[inline]
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
impl From<Live> for glib::Value {
#[inline]
fn from(v: Live) -> Self {
skip_assert_initialized!();
ToValue::to_value(&v)
}
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AtkRelationType")]
Expand Down
3 changes: 3 additions & 0 deletions atk/src/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ pub use self::text_range::TextRange;
mod enums;
pub use self::enums::CoordType;
pub use self::enums::Layer;
#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
pub use self::enums::Live;
pub use self::enums::RelationType;
pub use self::enums::Role;
#[cfg(feature = "v2_30")]
Expand Down
33 changes: 33 additions & 0 deletions atk/src/auto/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,39 @@ pub trait AtkObjectExt: IsA<Object> + sealed::Sealed + 'static {
}
}

#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
#[doc(alias = "notification")]
fn connect_notification<F: Fn(&Self, &str, i32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notification_trampoline<
P: IsA<Object>,
F: Fn(&P, &str, i32) + 'static,
>(
this: *mut ffi::AtkObject,
arg1: *mut libc::c_char,
arg2: libc::c_int,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
Object::from_glib_borrow(this).unsafe_cast_ref(),
&glib::GString::from_glib_borrow(arg1),
arg2,
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notification\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notification_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}

//#[doc(alias = "property-change")]
//fn connect_property_change<Unsupported or ignored types>(&self, detail: Option<&str>, f: F) -> SignalHandlerId {
// Ignored arg1: Atk.PropertyValues
Expand Down
4 changes: 2 additions & 2 deletions atk/src/auto/state_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub trait StateSetExt: IsA<StateSet> + sealed::Sealed + 'static {
}

//#[doc(alias = "atk_state_set_add_states")]
//fn add_states(&self, types: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 68 }) {
//fn add_states(&self, types: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 69 }) {
// unsafe { TODO: call ffi:atk_state_set_add_states() }
//}

Expand Down Expand Up @@ -81,7 +81,7 @@ pub trait StateSetExt: IsA<StateSet> + sealed::Sealed + 'static {
}

//#[doc(alias = "atk_state_set_contains_states")]
//fn contains_states(&self, types: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 68 }) -> bool {
//fn contains_states(&self, types: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 69 }) -> bool {
// unsafe { TODO: call ffi:atk_state_set_contains_states() }
//}

Expand Down
4 changes: 2 additions & 2 deletions atk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
5 changes: 5 additions & 0 deletions atk/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ v2_32 = ["v2_30"]
v2_34 = ["v2_32"]
v2_38 = ["v2_34"]
v2_46 = ["v2_38"]
v2_50 = ["v2_46"]

[lib]
name = "atk_sys"
Expand All @@ -47,6 +48,7 @@ rust-version = "1.70"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = []
rustc-args = ["--cfg", "docsrs"]

[package.metadata.system-deps.atk]
name = "atk"
Expand All @@ -66,3 +68,6 @@ version = "2.38"

[package.metadata.system-deps.atk.v2_46]
version = "2.46"

[package.metadata.system-deps.atk.v2_50]
version = "2.50"
5 changes: 5 additions & 0 deletions atk/sys/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ extra_versions = [
"2.38"
]

[[object]]
name = "Atk.Live"
status = "generate"
version = "2.50"

[[object]]
name = "Atk.StateType"
status = "generate"
Expand Down
12 changes: 12 additions & 0 deletions atk/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ pub const ATK_LAYER_POPUP: AtkLayer = 5;
pub const ATK_LAYER_OVERLAY: AtkLayer = 6;
pub const ATK_LAYER_WINDOW: AtkLayer = 7;

pub type AtkLive = c_int;
pub const ATK_LIVE_NONE: AtkLive = 0;
pub const ATK_LIVE_POLITE: AtkLive = 1;
pub const ATK_LIVE_ASSERTIVE: AtkLive = 2;

pub type AtkRelationType = c_int;
pub const ATK_RELATION_NULL: AtkRelationType = 0;
pub const ATK_RELATION_CONTROLLED_BY: AtkRelationType = 1;
Expand Down Expand Up @@ -1819,6 +1824,13 @@ extern "C" {
//=========================================================================
pub fn atk_layer_get_type() -> GType;

//=========================================================================
// AtkLive
//=========================================================================
#[cfg(feature = "v2_50")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
pub fn atk_live_get_type() -> GType;

//=========================================================================
// AtkRelationType
//=========================================================================
Expand Down
10 changes: 10 additions & 0 deletions atk/sys/tests/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[
alignment: align_of::<AtkLayer>(),
},
),
(
"AtkLive",
Layout {
size: size_of::<AtkLive>(),
alignment: align_of::<AtkLive>(),
},
),
(
"AtkMisc",
Layout {
Expand Down Expand Up @@ -653,6 +660,9 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) ATK_LAYER_POPUP", "5"),
("(gint) ATK_LAYER_WIDGET", "3"),
("(gint) ATK_LAYER_WINDOW", "7"),
("(gint) ATK_LIVE_ASSERTIVE", "2"),
("(gint) ATK_LIVE_NONE", "0"),
("(gint) ATK_LIVE_POLITE", "1"),
("(gint) ATK_RELATION_CONTROLLED_BY", "1"),
("(gint) ATK_RELATION_CONTROLLER_FOR", "2"),
("(gint) ATK_RELATION_DESCRIBED_BY", "14"),
Expand Down
3 changes: 3 additions & 0 deletions atk/sys/tests/constant.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ int main() {
PRINT_CONSTANT((gint) ATK_LAYER_POPUP);
PRINT_CONSTANT((gint) ATK_LAYER_WIDGET);
PRINT_CONSTANT((gint) ATK_LAYER_WINDOW);
PRINT_CONSTANT((gint) ATK_LIVE_ASSERTIVE);
PRINT_CONSTANT((gint) ATK_LIVE_NONE);
PRINT_CONSTANT((gint) ATK_LIVE_POLITE);
PRINT_CONSTANT((gint) ATK_RELATION_CONTROLLED_BY);
PRINT_CONSTANT((gint) ATK_RELATION_CONTROLLER_FOR);
PRINT_CONSTANT((gint) ATK_RELATION_DESCRIBED_BY);
Expand Down
1 change: 1 addition & 0 deletions atk/sys/tests/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ int main() {
printf("%s;%zu;%zu\n", "AtkKeyEventStruct", sizeof(AtkKeyEventStruct), alignof(AtkKeyEventStruct));
printf("%s;%zu;%zu\n", "AtkKeyEventType", sizeof(AtkKeyEventType), alignof(AtkKeyEventType));
printf("%s;%zu;%zu\n", "AtkLayer", sizeof(AtkLayer), alignof(AtkLayer));
printf("%s;%zu;%zu\n", "AtkLive", sizeof(AtkLive), alignof(AtkLive));
printf("%s;%zu;%zu\n", "AtkMisc", sizeof(AtkMisc), alignof(AtkMisc));
printf("%s;%zu;%zu\n", "AtkMiscClass", sizeof(AtkMiscClass), alignof(AtkMiscClass));
printf("%s;%zu;%zu\n", "AtkNoOpObject", sizeof(AtkNoOpObject), alignof(AtkNoOpObject));
Expand Down
4 changes: 2 additions & 2 deletions atk/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
4 changes: 2 additions & 2 deletions gdk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
1 change: 1 addition & 0 deletions gdk/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ rust-version = "1.70"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = []
rustc-args = ["--cfg", "docsrs"]

[package.metadata.system-deps.gdk_3_0]
name = "gdk-3.0"
Expand Down
4 changes: 2 additions & 2 deletions gdk/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
4 changes: 2 additions & 2 deletions gdkx11/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
1 change: 1 addition & 0 deletions gdkx11/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rust-version = "1.70"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = []
rustc-args = ["--cfg", "docsrs"]

[package.metadata.system-deps.gdk_x11_3_0]
name = "gdk-x11-3.0"
Expand Down
4 changes: 2 additions & 2 deletions gdkx11/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
4 changes: 2 additions & 2 deletions gtk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b)
from gir-files (https://github.com/gtk-rs/gir-files @ 1dc6c3826666)
Generated by gir (https://github.com/gtk-rs/gir @ 76bbe9b90aaa)
from gir-files (https://github.com/gtk-rs/gir-files @ 307566e1ab58)
1 change: 1 addition & 0 deletions gtk/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rust-version = "1.70"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = []
rustc-args = ["--cfg", "docsrs"]

[package.metadata.system-deps."gtk+_3_0"]
name = "gtk+-3.0"
Expand Down
Loading
Loading