Skip to content

Regenerate with gtk 3.99.3 #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 5, 2020
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
1 change: 1 addition & 0 deletions gdk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ generate = [
"Gdk.Texture",
"Gdk.Toplevel",
"Gdk.ToplevelLayout",
"Gdk.ToplevelState",
"Gdk.TouchEvent",
"Gdk.TouchpadEvent",
"Gdk.TouchpadGesturePhase",
Expand Down
4 changes: 2 additions & 2 deletions gdk4/src/auto/content_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ impl ContentFormats {
pub fn union_deserialize_gtypes(&self) -> Option<ContentFormats> {
unsafe {
from_glib_full(gdk_sys::gdk_content_formats_union_deserialize_gtypes(
self.to_glib_none().0,
self.to_glib_full(),
))
}
}

pub fn union_deserialize_mime_types(&self) -> Option<ContentFormats> {
unsafe {
from_glib_full(gdk_sys::gdk_content_formats_union_deserialize_mime_types(
self.to_glib_none().0,
self.to_glib_full(),
))
}
}
Expand Down
18 changes: 11 additions & 7 deletions gdk4/src/auto/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ impl SetValue for KeyMatch {
pub enum MemoryFormat {
B8g8r8a8Premultiplied,
A8r8g8b8Premultiplied,
R8g8b8a8Premultiplied,
B8g8r8a8,
A8r8g8b8,
R8g8b8a8,
Expand All @@ -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",
Expand All @@ -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,
Expand All @@ -1179,13 +1182,14 @@ impl FromGlib<gdk_sys::GdkMemoryFormat> 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),
}
}
Expand Down
24 changes: 12 additions & 12 deletions gdk4/src/auto/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl SetValue for SeatCapabilities {
}

bitflags! {
pub struct SurfaceState: u32 {
pub struct ToplevelState: u32 {
const WITHDRAWN = 1;
const MINIMIZED = 2;
const MAXIMIZED = 4;
Expand All @@ -411,41 +411,41 @@ bitflags! {
}

#[doc(hidden)]
impl ToGlib for SurfaceState {
type GlibType = gdk_sys::GdkSurfaceState;
impl ToGlib for ToplevelState {
type GlibType = gdk_sys::GdkToplevelState;

fn to_glib(&self) -> gdk_sys::GdkSurfaceState {
fn to_glib(&self) -> gdk_sys::GdkToplevelState {
self.bits()
}
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkSurfaceState> for SurfaceState {
fn from_glib(value: gdk_sys::GdkSurfaceState) -> SurfaceState {
impl FromGlib<gdk_sys::GdkToplevelState> for ToplevelState {
fn from_glib(value: gdk_sys::GdkToplevelState) -> ToplevelState {
skip_assert_initialized!();
SurfaceState::from_bits_truncate(value)
ToplevelState::from_bits_truncate(value)
}
}

impl StaticType for SurfaceState {
impl StaticType for ToplevelState {
fn static_type() -> Type {
unsafe { from_glib(gdk_sys::gdk_surface_state_get_type()) }
unsafe { from_glib(gdk_sys::gdk_toplevel_state_get_type()) }
}
}

impl<'a> FromValueOptional<'a> for SurfaceState {
impl<'a> FromValueOptional<'a> for ToplevelState {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}

impl<'a> FromValue<'a> for SurfaceState {
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 SurfaceState {
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())
}
Expand Down
4 changes: 4 additions & 0 deletions gdk4/src/auto/frame_clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
Expand Down
6 changes: 6 additions & 0 deletions gdk4/src/auto/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use cairo;
use gdk_pixbuf;
use gdk_sys;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib::GString;
Expand Down Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +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::SurfaceState;
pub use self::flags::ToplevelState;

pub mod functions;

Expand Down
31 changes: 31 additions & 0 deletions gdk4/src/auto/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}

impl<O: IsA<Popup>> PopupExt for O {
Expand Down Expand Up @@ -87,6 +95,29 @@ impl<O: IsA<Popup>> PopupExt for O {
))
}
}

fn connect_popup_layout_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn popup_layout_changed_trampoline<P, F: Fn(&P) + 'static>(
this: *mut gdk_sys::GdkPopup,
f: glib_sys::gpointer,
) where
P: IsA<Popup>,
{
let f: &F = &*(f as *const F);
f(&Popup::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = 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::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

impl fmt::Display for Popup {
Expand Down
93 changes: 60 additions & 33 deletions gdk4/src/auto/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
}
}

Expand Down Expand Up @@ -289,27 +287,6 @@ impl Surface {
}
}

pub fn connect_popup_layout_changed<F: Fn(&Surface) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn popup_layout_changed_trampoline<F: Fn(&Surface) + 'static>(
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_<F> = 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::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}

pub fn connect_render<F: Fn(&Surface, &cairo::Region) -> bool + 'static>(
&self,
f: F,
Expand Down Expand Up @@ -388,6 +365,31 @@ impl Surface {
}
}

pub fn connect_property_height_notify<F: Fn(&Surface) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_height_trampoline<F: Fn(&Surface) + 'static>(
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_<F> = 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::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}

pub fn connect_property_mapped_notify<F: Fn(&Surface) + 'static>(
&self,
f: F,
Expand All @@ -412,6 +414,31 @@ impl Surface {
)
}
}

pub fn connect_property_width_notify<F: Fn(&Surface) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_width_trampoline<F: Fn(&Surface) + 'static>(
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_<F> = 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::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

impl fmt::Display for Surface {
Expand Down
Loading