Skip to content

Commit bc56ee2

Browse files
Generate new 4.16 types
1 parent f092499 commit bc56ee2

File tree

13 files changed

+692
-57
lines changed

13 files changed

+692
-57
lines changed

gdk4/Gir.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ generate = [
1919
"Gdk.AxisFlags",
2020
"Gdk.ButtonEvent",
2121
"Gdk.CairoContext",
22+
"Gdk.CicpParams",
23+
"Gdk.CicpRange",
24+
"Gdk.ColorState",
2225
"Gdk.CrossingEvent",
2326
"Gdk.CrossingMode",
2427
"Gdk.DeleteEvent",

gdk4/src/auto/cicp_params.rs

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
use crate::{ffi, CicpRange, ColorState};
6+
use glib::{
7+
prelude::*,
8+
signal::{connect_raw, SignalHandlerId},
9+
translate::*,
10+
};
11+
use std::boxed::Box as Box_;
12+
13+
glib::wrapper! {
14+
#[doc(alias = "GdkCicpParams")]
15+
pub struct CicpParams(Object<ffi::GdkCicpParams, ffi::GdkCicpParamsClass>);
16+
17+
match fn {
18+
type_ => || ffi::gdk_cicp_params_get_type(),
19+
}
20+
}
21+
22+
impl CicpParams {
23+
#[doc(alias = "gdk_cicp_params_new")]
24+
pub fn new() -> CicpParams {
25+
assert_initialized_main_thread!();
26+
unsafe { from_glib_full(ffi::gdk_cicp_params_new()) }
27+
}
28+
29+
#[doc(alias = "gdk_cicp_params_build_color_state")]
30+
pub fn build_color_state(&self) -> Result<Option<ColorState>, glib::Error> {
31+
unsafe {
32+
let mut error = std::ptr::null_mut();
33+
let ret = ffi::gdk_cicp_params_build_color_state(self.to_glib_none().0, &mut error);
34+
if error.is_null() {
35+
Ok(from_glib_full(ret))
36+
} else {
37+
Err(from_glib_full(error))
38+
}
39+
}
40+
}
41+
42+
#[doc(alias = "gdk_cicp_params_get_color_primaries")]
43+
#[doc(alias = "get_color_primaries")]
44+
#[doc(alias = "color-primaries")]
45+
pub fn color_primaries(&self) -> u32 {
46+
unsafe { ffi::gdk_cicp_params_get_color_primaries(self.to_glib_none().0) }
47+
}
48+
49+
#[doc(alias = "gdk_cicp_params_get_matrix_coefficients")]
50+
#[doc(alias = "get_matrix_coefficients")]
51+
#[doc(alias = "matrix-coefficients")]
52+
pub fn matrix_coefficients(&self) -> u32 {
53+
unsafe { ffi::gdk_cicp_params_get_matrix_coefficients(self.to_glib_none().0) }
54+
}
55+
56+
#[doc(alias = "gdk_cicp_params_get_range")]
57+
#[doc(alias = "get_range")]
58+
pub fn range(&self) -> CicpRange {
59+
unsafe { from_glib(ffi::gdk_cicp_params_get_range(self.to_glib_none().0)) }
60+
}
61+
62+
#[doc(alias = "gdk_cicp_params_get_transfer_function")]
63+
#[doc(alias = "get_transfer_function")]
64+
#[doc(alias = "transfer-function")]
65+
pub fn transfer_function(&self) -> u32 {
66+
unsafe { ffi::gdk_cicp_params_get_transfer_function(self.to_glib_none().0) }
67+
}
68+
69+
#[doc(alias = "gdk_cicp_params_set_color_primaries")]
70+
#[doc(alias = "color-primaries")]
71+
pub fn set_color_primaries(&self, color_primaries: u32) {
72+
unsafe {
73+
ffi::gdk_cicp_params_set_color_primaries(self.to_glib_none().0, color_primaries);
74+
}
75+
}
76+
77+
#[doc(alias = "gdk_cicp_params_set_matrix_coefficients")]
78+
#[doc(alias = "matrix-coefficients")]
79+
pub fn set_matrix_coefficients(&self, matrix_coefficients: u32) {
80+
unsafe {
81+
ffi::gdk_cicp_params_set_matrix_coefficients(
82+
self.to_glib_none().0,
83+
matrix_coefficients,
84+
);
85+
}
86+
}
87+
88+
#[doc(alias = "gdk_cicp_params_set_range")]
89+
#[doc(alias = "range")]
90+
pub fn set_range(&self, range: CicpRange) {
91+
unsafe {
92+
ffi::gdk_cicp_params_set_range(self.to_glib_none().0, range.into_glib());
93+
}
94+
}
95+
96+
#[doc(alias = "gdk_cicp_params_set_transfer_function")]
97+
#[doc(alias = "transfer-function")]
98+
pub fn set_transfer_function(&self, transfer_function: u32) {
99+
unsafe {
100+
ffi::gdk_cicp_params_set_transfer_function(self.to_glib_none().0, transfer_function);
101+
}
102+
}
103+
104+
#[cfg(feature = "v4_16")]
105+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
106+
#[doc(alias = "color-primaries")]
107+
pub fn connect_color_primaries_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
108+
unsafe extern "C" fn notify_color_primaries_trampoline<F: Fn(&CicpParams) + 'static>(
109+
this: *mut ffi::GdkCicpParams,
110+
_param_spec: glib::ffi::gpointer,
111+
f: glib::ffi::gpointer,
112+
) {
113+
let f: &F = &*(f as *const F);
114+
f(&from_glib_borrow(this))
115+
}
116+
unsafe {
117+
let f: Box_<F> = Box_::new(f);
118+
connect_raw(
119+
self.as_ptr() as *mut _,
120+
b"notify::color-primaries\0".as_ptr() as *const _,
121+
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
122+
notify_color_primaries_trampoline::<F> as *const (),
123+
)),
124+
Box_::into_raw(f),
125+
)
126+
}
127+
}
128+
129+
#[cfg(feature = "v4_16")]
130+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
131+
#[doc(alias = "matrix-coefficients")]
132+
pub fn connect_matrix_coefficients_notify<F: Fn(&Self) + 'static>(
133+
&self,
134+
f: F,
135+
) -> SignalHandlerId {
136+
unsafe extern "C" fn notify_matrix_coefficients_trampoline<F: Fn(&CicpParams) + 'static>(
137+
this: *mut ffi::GdkCicpParams,
138+
_param_spec: glib::ffi::gpointer,
139+
f: glib::ffi::gpointer,
140+
) {
141+
let f: &F = &*(f as *const F);
142+
f(&from_glib_borrow(this))
143+
}
144+
unsafe {
145+
let f: Box_<F> = Box_::new(f);
146+
connect_raw(
147+
self.as_ptr() as *mut _,
148+
b"notify::matrix-coefficients\0".as_ptr() as *const _,
149+
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
150+
notify_matrix_coefficients_trampoline::<F> as *const (),
151+
)),
152+
Box_::into_raw(f),
153+
)
154+
}
155+
}
156+
157+
#[cfg(feature = "v4_16")]
158+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
159+
#[doc(alias = "range")]
160+
pub fn connect_range_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
161+
unsafe extern "C" fn notify_range_trampoline<F: Fn(&CicpParams) + 'static>(
162+
this: *mut ffi::GdkCicpParams,
163+
_param_spec: glib::ffi::gpointer,
164+
f: glib::ffi::gpointer,
165+
) {
166+
let f: &F = &*(f as *const F);
167+
f(&from_glib_borrow(this))
168+
}
169+
unsafe {
170+
let f: Box_<F> = Box_::new(f);
171+
connect_raw(
172+
self.as_ptr() as *mut _,
173+
b"notify::range\0".as_ptr() as *const _,
174+
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
175+
notify_range_trampoline::<F> as *const (),
176+
)),
177+
Box_::into_raw(f),
178+
)
179+
}
180+
}
181+
182+
#[cfg(feature = "v4_16")]
183+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
184+
#[doc(alias = "transfer-function")]
185+
pub fn connect_transfer_function_notify<F: Fn(&Self) + 'static>(
186+
&self,
187+
f: F,
188+
) -> SignalHandlerId {
189+
unsafe extern "C" fn notify_transfer_function_trampoline<F: Fn(&CicpParams) + 'static>(
190+
this: *mut ffi::GdkCicpParams,
191+
_param_spec: glib::ffi::gpointer,
192+
f: glib::ffi::gpointer,
193+
) {
194+
let f: &F = &*(f as *const F);
195+
f(&from_glib_borrow(this))
196+
}
197+
unsafe {
198+
let f: Box_<F> = Box_::new(f);
199+
connect_raw(
200+
self.as_ptr() as *mut _,
201+
b"notify::transfer-function\0".as_ptr() as *const _,
202+
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
203+
notify_transfer_function_trampoline::<F> as *const (),
204+
)),
205+
Box_::into_raw(f),
206+
)
207+
}
208+
}
209+
}
210+
211+
#[cfg(feature = "v4_16")]
212+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
213+
impl Default for CicpParams {
214+
fn default() -> Self {
215+
Self::new()
216+
}
217+
}

gdk4/src/auto/color_state.rs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
use crate::{ffi, CicpParams};
6+
use glib::translate::*;
7+
8+
glib::wrapper! {
9+
#[derive(Debug, PartialOrd, Ord, Hash)]
10+
pub struct ColorState(Shared<ffi::GdkColorState>);
11+
12+
match fn {
13+
ref => |ptr| ffi::gdk_color_state_ref(ptr),
14+
unref => |ptr| ffi::gdk_color_state_unref(ptr),
15+
type_ => || ffi::gdk_color_state_get_type(),
16+
}
17+
}
18+
19+
impl ColorState {
20+
#[doc(alias = "gdk_color_state_create_cicp_params")]
21+
pub fn create_cicp_params(&self) -> Option<CicpParams> {
22+
unsafe {
23+
from_glib_full(ffi::gdk_color_state_create_cicp_params(
24+
self.to_glib_none().0,
25+
))
26+
}
27+
}
28+
29+
#[doc(alias = "gdk_color_state_equal")]
30+
fn equal(&self, other: &ColorState) -> bool {
31+
unsafe {
32+
from_glib(ffi::gdk_color_state_equal(
33+
self.to_glib_none().0,
34+
other.to_glib_none().0,
35+
))
36+
}
37+
}
38+
39+
#[doc(alias = "gdk_color_state_get_oklab")]
40+
#[doc(alias = "get_oklab")]
41+
pub fn oklab() -> ColorState {
42+
assert_initialized_main_thread!();
43+
unsafe { from_glib_full(ffi::gdk_color_state_get_oklab()) }
44+
}
45+
46+
#[doc(alias = "gdk_color_state_get_oklch")]
47+
#[doc(alias = "get_oklch")]
48+
pub fn oklch() -> ColorState {
49+
assert_initialized_main_thread!();
50+
unsafe { from_glib_full(ffi::gdk_color_state_get_oklch()) }
51+
}
52+
53+
#[doc(alias = "gdk_color_state_get_rec2100_linear")]
54+
#[doc(alias = "get_rec2100_linear")]
55+
pub fn rec2100_linear() -> ColorState {
56+
assert_initialized_main_thread!();
57+
unsafe { from_glib_full(ffi::gdk_color_state_get_rec2100_linear()) }
58+
}
59+
60+
#[doc(alias = "gdk_color_state_get_rec2100_pq")]
61+
#[doc(alias = "get_rec2100_pq")]
62+
pub fn rec2100_pq() -> ColorState {
63+
assert_initialized_main_thread!();
64+
unsafe { from_glib_full(ffi::gdk_color_state_get_rec2100_pq()) }
65+
}
66+
67+
#[doc(alias = "gdk_color_state_get_srgb")]
68+
#[doc(alias = "get_srgb")]
69+
pub fn srgb() -> ColorState {
70+
assert_initialized_main_thread!();
71+
unsafe { from_glib_full(ffi::gdk_color_state_get_srgb()) }
72+
}
73+
74+
#[doc(alias = "gdk_color_state_get_srgb_linear")]
75+
#[doc(alias = "get_srgb_linear")]
76+
pub fn srgb_linear() -> ColorState {
77+
assert_initialized_main_thread!();
78+
unsafe { from_glib_full(ffi::gdk_color_state_get_srgb_linear()) }
79+
}
80+
}
81+
82+
impl PartialEq for ColorState {
83+
#[inline]
84+
fn eq(&self, other: &Self) -> bool {
85+
self.equal(other)
86+
}
87+
}
88+
89+
impl Eq for ColorState {}

gdk4/src/auto/dmabuf_texture_builder.rs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// from gir-files (https://github.com/gtk-rs/gir-files)
33
// DO NOT EDIT
44

5+
#[cfg(feature = "v4_16")]
6+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
7+
use crate::ColorState;
58
use crate::{ffi, Display, Texture};
69
use glib::{
710
prelude::*,
@@ -26,14 +29,18 @@ impl DmabufTextureBuilder {
2629
unsafe { from_glib_full(ffi::gdk_dmabuf_texture_builder_new()) }
2730
}
2831

29-
//#[cfg(feature = "v4_16")]
30-
//#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
31-
//#[doc(alias = "gdk_dmabuf_texture_builder_get_color_state")]
32-
//#[doc(alias = "get_color_state")]
33-
//#[doc(alias = "color-state")]
34-
//pub fn color_state(&self) -> /*Ignored*/Option<ColorState> {
35-
// unsafe { TODO: call ffi:gdk_dmabuf_texture_builder_get_color_state() }
36-
//}
32+
#[cfg(feature = "v4_16")]
33+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
34+
#[doc(alias = "gdk_dmabuf_texture_builder_get_color_state")]
35+
#[doc(alias = "get_color_state")]
36+
#[doc(alias = "color-state")]
37+
pub fn color_state(&self) -> Option<ColorState> {
38+
unsafe {
39+
from_glib_full(ffi::gdk_dmabuf_texture_builder_get_color_state(
40+
self.to_glib_none().0,
41+
))
42+
}
43+
}
3744

3845
#[doc(alias = "gdk_dmabuf_texture_builder_get_display")]
3946
#[doc(alias = "get_display")]
@@ -127,13 +134,18 @@ impl DmabufTextureBuilder {
127134
unsafe { ffi::gdk_dmabuf_texture_builder_get_width(self.to_glib_none().0) }
128135
}
129136

130-
//#[cfg(feature = "v4_16")]
131-
//#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
132-
//#[doc(alias = "gdk_dmabuf_texture_builder_set_color_state")]
133-
//#[doc(alias = "color-state")]
134-
//pub fn set_color_state(&self, color_state: /*Ignored*/Option<&ColorState>) {
135-
// unsafe { TODO: call ffi:gdk_dmabuf_texture_builder_set_color_state() }
136-
//}
137+
#[cfg(feature = "v4_16")]
138+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
139+
#[doc(alias = "gdk_dmabuf_texture_builder_set_color_state")]
140+
#[doc(alias = "color-state")]
141+
pub fn set_color_state(&self, color_state: Option<&ColorState>) {
142+
unsafe {
143+
ffi::gdk_dmabuf_texture_builder_set_color_state(
144+
self.to_glib_none().0,
145+
color_state.to_glib_none().0,
146+
);
147+
}
148+
}
137149

138150
#[doc(alias = "gdk_dmabuf_texture_builder_set_display")]
139151
#[doc(alias = "display")]

0 commit comments

Comments
 (0)