1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
#![cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::trivially_copy_pass_by_ref))]

use glib::translate::*;

#[macro_use]
extern crate glib;

#[macro_use]
extern crate bitflags;

#[cfg_attr(feature = "cargo-clippy", allow(clippy::type_complexity))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]
mod auto;
pub use auto::*;

mod debug_object_type_info;
pub use debug_object_type_info::DebugObjectTypeInfo;

mod depth_state;
pub use depth_state::DepthState;

mod fence_closure;
pub use fence_closure::FenceClosure;

mod fence;
pub use fence::Fence;

mod gles2_vtable;
pub use gles2_vtable::GLES2Vtable;

mod gtype_object;
pub use gtype_object::GtypeObject;

mod handle;
pub use handle::Handle;

mod kms_crtc;
pub use kms_crtc::KmsCrtc;

mod material;
pub use material::Material;

mod material_layer;
pub use material_layer::MaterialLayer;

mod onscreen_dirty_info;
pub use onscreen_dirty_info::OnscreenDirtyInfo;

mod poll_fd;
pub use poll_fd::PollFD;

mod texture_vertex;
pub use texture_vertex::TextureVertex;

mod user_data_key;
pub use user_data_key::UserDataKey;

mod vertex_p2;
pub use vertex_p2::VertexP2;

mod vertex_p2c4;
pub use vertex_p2c4::VertexP2C4;

mod vertex_p2t2;
pub use vertex_p2t2::VertexP2T2;

mod vertex_p2t2c4;
pub use vertex_p2t2c4::VertexP2T2C4;

mod vertex_p3;
pub use vertex_p3::VertexP3;

mod vertex_p3c4;
pub use vertex_p3c4::VertexP3C4;

mod vertex_p3t2;
pub use vertex_p3t2::VertexP3T2;

mod vertex_p3t2c4;
pub use vertex_p3t2c4::VertexP3T2C4;

pub(crate) const TRUE: i32 = ::glib_sys::GTRUE;
// pub(crate) const FALSE:i32 = ::glib_sys::GFALSE;

pub fn source_new(context: &Context, priority: glib::Priority) -> glib::Source {
    unsafe {
        let source = ffi::cogl_glib_source_new(context.to_glib_none().0, priority.to_glib());
        from_glib_full(source)
    }
}

// let source = glib_sys::g_timeout_source_new(interval);
// glib_sys::g_source_set_callback(
//     source,
//     Some(trampoline::<F>),
//     into_raw(func),
//     Some(destroy_closure::<F>),
// );
// glib_sys::g_source_set_priority(source, priority.to_glib());

// if let Some(name) = name {
//     glib_sys::g_source_set_name(source, name.to_glib_none().0);
// }

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}