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
#![allow(unused_imports)]
#![allow(deprecated)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::trivially_copy_pass_by_ref))]
#![allow(
    clippy::too_many_arguments,
    clippy::let_and_return,
    clippy::from_over_into,
    clippy::upper_case_acronyms,
    clippy::new_ret_no_self,
    clippy::wrong_self_convention
)]

use std::ptr;

#[macro_use]
extern crate glib;
#[macro_use]
extern crate bitflags;

#[macro_use]
mod rt;

#[macro_use]
mod macros;

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

pub mod prelude;
pub use auto::*;

pub use self::rt::set_initialized;

pub type ActorCreateChildFunc = ffi::ClutterActorCreateChildFunc;
pub type BindingActionFunc = ffi::ClutterBindingActionFunc;
// pub type ScriptConnectFunc = ffi::ClutterScriptConnectFunc;

pub fn init() {
    assert_not_initialized!();
    unsafe {
        ffi::clutter_init(ptr::null_mut(), ptr::null_mut());
        set_initialized();
    }
}

pub fn run() {
    assert_initialized_main_thread!();
    unsafe {
        ffi::clutter_main();
        set_initialized();
    }
}

pub fn quit() {
    assert_initialized_main_thread!();
    unsafe {
        ffi::clutter_main_quit();
    }
}