Skip to content

Commit 29a1c7a

Browse files
Merge pull request #38 from gtk-rs/bilelmoussaoui/update
Regenerate with gtk 3.99.3
2 parents 327a60f + c91cddb commit 29a1c7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1486
-1958
lines changed

gdk4/Gir.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ generate = [
6565
"Gdk.Texture",
6666
"Gdk.Toplevel",
6767
"Gdk.ToplevelLayout",
68+
"Gdk.ToplevelState",
6869
"Gdk.TouchEvent",
6970
"Gdk.TouchpadEvent",
7071
"Gdk.TouchpadGesturePhase",

gdk4/src/auto/content_formats.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ impl ContentFormats {
121121
pub fn union_deserialize_gtypes(&self) -> Option<ContentFormats> {
122122
unsafe {
123123
from_glib_full(gdk_sys::gdk_content_formats_union_deserialize_gtypes(
124-
self.to_glib_none().0,
124+
self.to_glib_full(),
125125
))
126126
}
127127
}
128128

129129
pub fn union_deserialize_mime_types(&self) -> Option<ContentFormats> {
130130
unsafe {
131131
from_glib_full(gdk_sys::gdk_content_formats_union_deserialize_mime_types(
132-
self.to_glib_none().0,
132+
self.to_glib_full(),
133133
))
134134
}
135135
}

gdk4/src/auto/enums.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,7 @@ impl SetValue for KeyMatch {
11201120
pub enum MemoryFormat {
11211121
B8g8r8a8Premultiplied,
11221122
A8r8g8b8Premultiplied,
1123+
R8g8b8a8Premultiplied,
11231124
B8g8r8a8,
11241125
A8r8g8b8,
11251126
R8g8b8a8,
@@ -1139,6 +1140,7 @@ impl fmt::Display for MemoryFormat {
11391140
match *self {
11401141
MemoryFormat::B8g8r8a8Premultiplied => "B8g8r8a8Premultiplied",
11411142
MemoryFormat::A8r8g8b8Premultiplied => "A8r8g8b8Premultiplied",
1143+
MemoryFormat::R8g8b8a8Premultiplied => "R8g8b8a8Premultiplied",
11421144
MemoryFormat::B8g8r8a8 => "B8g8r8a8",
11431145
MemoryFormat::A8r8g8b8 => "A8r8g8b8",
11441146
MemoryFormat::R8g8b8a8 => "R8g8b8a8",
@@ -1160,6 +1162,7 @@ impl ToGlib for MemoryFormat {
11601162
match *self {
11611163
MemoryFormat::B8g8r8a8Premultiplied => gdk_sys::GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
11621164
MemoryFormat::A8r8g8b8Premultiplied => gdk_sys::GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
1165+
MemoryFormat::R8g8b8a8Premultiplied => gdk_sys::GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
11631166
MemoryFormat::B8g8r8a8 => gdk_sys::GDK_MEMORY_B8G8R8A8,
11641167
MemoryFormat::A8r8g8b8 => gdk_sys::GDK_MEMORY_A8R8G8B8,
11651168
MemoryFormat::R8g8b8a8 => gdk_sys::GDK_MEMORY_R8G8B8A8,
@@ -1179,13 +1182,14 @@ impl FromGlib<gdk_sys::GdkMemoryFormat> for MemoryFormat {
11791182
match value {
11801183
0 => MemoryFormat::B8g8r8a8Premultiplied,
11811184
1 => MemoryFormat::A8r8g8b8Premultiplied,
1182-
2 => MemoryFormat::B8g8r8a8,
1183-
3 => MemoryFormat::A8r8g8b8,
1184-
4 => MemoryFormat::R8g8b8a8,
1185-
5 => MemoryFormat::A8b8g8r8,
1186-
6 => MemoryFormat::R8g8b8,
1187-
7 => MemoryFormat::B8g8r8,
1188-
8 => MemoryFormat::NFormats,
1185+
2 => MemoryFormat::R8g8b8a8Premultiplied,
1186+
3 => MemoryFormat::B8g8r8a8,
1187+
4 => MemoryFormat::A8r8g8b8,
1188+
5 => MemoryFormat::R8g8b8a8,
1189+
6 => MemoryFormat::A8b8g8r8,
1190+
7 => MemoryFormat::R8g8b8,
1191+
8 => MemoryFormat::B8g8r8,
1192+
9 => MemoryFormat::NFormats,
11891193
value => MemoryFormat::__Unknown(value),
11901194
}
11911195
}

gdk4/src/auto/flags.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl SetValue for SeatCapabilities {
389389
}
390390

391391
bitflags! {
392-
pub struct SurfaceState: u32 {
392+
pub struct ToplevelState: u32 {
393393
const WITHDRAWN = 1;
394394
const MINIMIZED = 2;
395395
const MAXIMIZED = 4;
@@ -411,41 +411,41 @@ bitflags! {
411411
}
412412

413413
#[doc(hidden)]
414-
impl ToGlib for SurfaceState {
415-
type GlibType = gdk_sys::GdkSurfaceState;
414+
impl ToGlib for ToplevelState {
415+
type GlibType = gdk_sys::GdkToplevelState;
416416

417-
fn to_glib(&self) -> gdk_sys::GdkSurfaceState {
417+
fn to_glib(&self) -> gdk_sys::GdkToplevelState {
418418
self.bits()
419419
}
420420
}
421421

422422
#[doc(hidden)]
423-
impl FromGlib<gdk_sys::GdkSurfaceState> for SurfaceState {
424-
fn from_glib(value: gdk_sys::GdkSurfaceState) -> SurfaceState {
423+
impl FromGlib<gdk_sys::GdkToplevelState> for ToplevelState {
424+
fn from_glib(value: gdk_sys::GdkToplevelState) -> ToplevelState {
425425
skip_assert_initialized!();
426-
SurfaceState::from_bits_truncate(value)
426+
ToplevelState::from_bits_truncate(value)
427427
}
428428
}
429429

430-
impl StaticType for SurfaceState {
430+
impl StaticType for ToplevelState {
431431
fn static_type() -> Type {
432-
unsafe { from_glib(gdk_sys::gdk_surface_state_get_type()) }
432+
unsafe { from_glib(gdk_sys::gdk_toplevel_state_get_type()) }
433433
}
434434
}
435435

436-
impl<'a> FromValueOptional<'a> for SurfaceState {
436+
impl<'a> FromValueOptional<'a> for ToplevelState {
437437
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
438438
Some(FromValue::from_value(value))
439439
}
440440
}
441441

442-
impl<'a> FromValue<'a> for SurfaceState {
442+
impl<'a> FromValue<'a> for ToplevelState {
443443
unsafe fn from_value(value: &Value) -> Self {
444444
from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
445445
}
446446
}
447447

448-
impl SetValue for SurfaceState {
448+
impl SetValue for ToplevelState {
449449
unsafe fn set_value(value: &mut Value, this: &Self) {
450450
gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
451451
}

gdk4/src/auto/frame_clock.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ impl FrameClock {
4444
}
4545
}
4646

47+
pub fn get_fps(&self) -> f64 {
48+
unsafe { gdk_sys::gdk_frame_clock_get_fps(self.to_glib_none().0) }
49+
}
50+
4751
pub fn get_frame_counter(&self) -> i64 {
4852
unsafe { gdk_sys::gdk_frame_clock_get_frame_counter(self.to_glib_none().0) }
4953
}

gdk4/src/auto/functions.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use cairo;
66
use gdk_pixbuf;
77
use gdk_sys;
8+
use glib;
89
use glib::object::IsA;
910
use glib::translate::*;
1011
use glib::GString;
@@ -159,6 +160,11 @@ pub fn set_allowed_backends(backends: &str) {
159160
}
160161
}
161162

163+
pub fn toplevel_size_get_type() -> glib::types::Type {
164+
assert_initialized_main_thread!();
165+
unsafe { from_glib(gdk_sys::gdk_toplevel_size_get_type()) }
166+
}
167+
162168
pub fn unicode_to_keyval(wc: u32) -> u32 {
163169
assert_initialized_main_thread!();
164170
unsafe { gdk_sys::gdk_unicode_to_keyval(wc) }

gdk4/src/auto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub use self::flags::FrameClockPhase;
198198
pub use self::flags::ModifierType;
199199
pub use self::flags::PaintableFlags;
200200
pub use self::flags::SeatCapabilities;
201-
pub use self::flags::SurfaceState;
201+
pub use self::flags::ToplevelState;
202202

203203
pub mod functions;
204204

gdk4/src/auto/popup.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
// DO NOT EDIT
44

55
use gdk_sys;
6+
use glib::object::Cast;
67
use glib::object::IsA;
8+
use glib::signal::connect_raw;
9+
use glib::signal::SignalHandlerId;
710
use glib::translate::*;
11+
use glib_sys;
12+
use std::boxed::Box as Box_;
813
use std::fmt;
14+
use std::mem::transmute;
915
use Gravity;
1016
use PopupLayout;
1117
use Surface;
@@ -34,6 +40,8 @@ pub trait PopupExt: 'static {
3440
fn get_surface_anchor(&self) -> Gravity;
3541

3642
fn present(&self, width: i32, height: i32, layout: &PopupLayout) -> bool;
43+
44+
fn connect_popup_layout_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
3745
}
3846

3947
impl<O: IsA<Popup>> PopupExt for O {
@@ -87,6 +95,29 @@ impl<O: IsA<Popup>> PopupExt for O {
8795
))
8896
}
8997
}
98+
99+
fn connect_popup_layout_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
100+
unsafe extern "C" fn popup_layout_changed_trampoline<P, F: Fn(&P) + 'static>(
101+
this: *mut gdk_sys::GdkPopup,
102+
f: glib_sys::gpointer,
103+
) where
104+
P: IsA<Popup>,
105+
{
106+
let f: &F = &*(f as *const F);
107+
f(&Popup::from_glib_borrow(this).unsafe_cast_ref())
108+
}
109+
unsafe {
110+
let f: Box_<F> = Box_::new(f);
111+
connect_raw(
112+
self.as_ptr() as *mut _,
113+
b"popup-layout-changed\0".as_ptr() as *const _,
114+
Some(transmute::<_, unsafe extern "C" fn()>(
115+
popup_layout_changed_trampoline::<Self, F> as *const (),
116+
)),
117+
Box_::into_raw(f),
118+
)
119+
}
120+
}
90121
}
91122

92123
impl fmt::Display for Popup {

gdk4/src/auto/surface.rs

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,9 @@ impl Surface {
4747
}
4848
}
4949

50-
pub fn new_toplevel(display: &Display, width: i32, height: i32) -> Surface {
50+
pub fn new_toplevel(display: &Display) -> Surface {
5151
skip_assert_initialized!();
52-
unsafe {
53-
from_glib_full(gdk_sys::gdk_surface_new_toplevel(
54-
display.to_glib_none().0,
55-
width,
56-
height,
57-
))
58-
}
52+
unsafe { from_glib_full(gdk_sys::gdk_surface_new_toplevel(display.to_glib_none().0)) }
5953
}
6054

6155
pub fn beep(&self) {
@@ -115,22 +109,26 @@ impl Surface {
115109
}
116110
}
117111

118-
pub fn get_device_position(&self, device: &Device) -> (f64, f64, ModifierType) {
112+
pub fn get_device_position(&self, device: &Device) -> Option<(f64, f64, ModifierType)> {
119113
unsafe {
120114
let mut x = mem::MaybeUninit::uninit();
121115
let mut y = mem::MaybeUninit::uninit();
122116
let mut mask = mem::MaybeUninit::uninit();
123-
gdk_sys::gdk_surface_get_device_position(
117+
let ret = from_glib(gdk_sys::gdk_surface_get_device_position(
124118
self.to_glib_none().0,
125119
device.to_glib_none().0,
126120
x.as_mut_ptr(),
127121
y.as_mut_ptr(),
128122
mask.as_mut_ptr(),
129-
);
123+
));
130124
let x = x.assume_init();
131125
let y = y.assume_init();
132126
let mask = mask.assume_init();
133-
(x, y, from_glib(mask))
127+
if ret {
128+
Some((x, y, from_glib(mask)))
129+
} else {
130+
None
131+
}
134132
}
135133
}
136134

@@ -289,27 +287,6 @@ impl Surface {
289287
}
290288
}
291289

292-
pub fn connect_popup_layout_changed<F: Fn(&Surface) + 'static>(&self, f: F) -> SignalHandlerId {
293-
unsafe extern "C" fn popup_layout_changed_trampoline<F: Fn(&Surface) + 'static>(
294-
this: *mut gdk_sys::GdkSurface,
295-
f: glib_sys::gpointer,
296-
) {
297-
let f: &F = &*(f as *const F);
298-
f(&from_glib_borrow(this))
299-
}
300-
unsafe {
301-
let f: Box_<F> = Box_::new(f);
302-
connect_raw(
303-
self.as_ptr() as *mut _,
304-
b"popup-layout-changed\0".as_ptr() as *const _,
305-
Some(transmute::<_, unsafe extern "C" fn()>(
306-
popup_layout_changed_trampoline::<F> as *const (),
307-
)),
308-
Box_::into_raw(f),
309-
)
310-
}
311-
}
312-
313290
pub fn connect_render<F: Fn(&Surface, &cairo::Region) -> bool + 'static>(
314291
&self,
315292
f: F,
@@ -388,6 +365,31 @@ impl Surface {
388365
}
389366
}
390367

368+
pub fn connect_property_height_notify<F: Fn(&Surface) + 'static>(
369+
&self,
370+
f: F,
371+
) -> SignalHandlerId {
372+
unsafe extern "C" fn notify_height_trampoline<F: Fn(&Surface) + 'static>(
373+
this: *mut gdk_sys::GdkSurface,
374+
_param_spec: glib_sys::gpointer,
375+
f: glib_sys::gpointer,
376+
) {
377+
let f: &F = &*(f as *const F);
378+
f(&from_glib_borrow(this))
379+
}
380+
unsafe {
381+
let f: Box_<F> = Box_::new(f);
382+
connect_raw(
383+
self.as_ptr() as *mut _,
384+
b"notify::height\0".as_ptr() as *const _,
385+
Some(transmute::<_, unsafe extern "C" fn()>(
386+
notify_height_trampoline::<F> as *const (),
387+
)),
388+
Box_::into_raw(f),
389+
)
390+
}
391+
}
392+
391393
pub fn connect_property_mapped_notify<F: Fn(&Surface) + 'static>(
392394
&self,
393395
f: F,
@@ -412,6 +414,31 @@ impl Surface {
412414
)
413415
}
414416
}
417+
418+
pub fn connect_property_width_notify<F: Fn(&Surface) + 'static>(
419+
&self,
420+
f: F,
421+
) -> SignalHandlerId {
422+
unsafe extern "C" fn notify_width_trampoline<F: Fn(&Surface) + 'static>(
423+
this: *mut gdk_sys::GdkSurface,
424+
_param_spec: glib_sys::gpointer,
425+
f: glib_sys::gpointer,
426+
) {
427+
let f: &F = &*(f as *const F);
428+
f(&from_glib_borrow(this))
429+
}
430+
unsafe {
431+
let f: Box_<F> = Box_::new(f);
432+
connect_raw(
433+
self.as_ptr() as *mut _,
434+
b"notify::width\0".as_ptr() as *const _,
435+
Some(transmute::<_, unsafe extern "C" fn()>(
436+
notify_width_trampoline::<F> as *const (),
437+
)),
438+
Box_::into_raw(f),
439+
)
440+
}
441+
}
415442
}
416443

417444
impl fmt::Display for Surface {

0 commit comments

Comments
 (0)