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
//! Core interfaces of the protocol
//!
//! This module contains hard-coded interfaces for `wl_display`, `wl_registry` and `wl_callback`.
//! These interfaces are frozen in the protocol and can never change. They are the only interfaces
//! which the backends need to be aware of in particular.

use crate::protocol::{AllowNull, ArgumentType, Interface, MessageDesc, ANONYMOUS_INTERFACE};

/// Interface `wl_display`
pub static WL_DISPLAY_INTERFACE: Interface = Interface {
    name: "wl_display",
    version: 1,
    requests: &[
        MessageDesc {
            name: "sync",
            since: 1,
            is_destructor: false,
            signature: &[ArgumentType::NewId],
            child_interface: Some(&WL_CALLBACK_INTERFACE),
            arg_interfaces: &[],
        },
        MessageDesc {
            name: "get_registry",
            since: 1,
            is_destructor: false,
            signature: &[ArgumentType::NewId],
            child_interface: Some(&WL_REGISTRY_INTERFACE),
            arg_interfaces: &[],
        },
    ],
    events: &[
        MessageDesc {
            name: "error",
            since: 1,
            is_destructor: false,
            signature: &[
                ArgumentType::Object(AllowNull::No),
                ArgumentType::Uint,
                ArgumentType::Str(AllowNull::No),
            ],
            child_interface: None,
            arg_interfaces: &[&ANONYMOUS_INTERFACE],
        },
        MessageDesc {
            name: "delete_id",
            since: 1,
            is_destructor: false,
            signature: &[ArgumentType::Uint],
            child_interface: None,
            arg_interfaces: &[],
        },
    ],
    c_ptr: None,
};

/// Interface `wl_registry`
pub static WL_REGISTRY_INTERFACE: Interface = Interface {
    name: "wl_registry",
    version: 1,
    requests: &[MessageDesc {
        name: "bind",
        since: 1,
        is_destructor: false,
        signature: &[
            ArgumentType::Uint,
            ArgumentType::Str(AllowNull::No),
            ArgumentType::Uint,
            ArgumentType::NewId,
        ],
        child_interface: None,
        arg_interfaces: &[],
    }],
    events: &[
        MessageDesc {
            name: "global",
            since: 1,
            is_destructor: false,
            signature: &[ArgumentType::Uint, ArgumentType::Str(AllowNull::No), ArgumentType::Uint],
            child_interface: None,
            arg_interfaces: &[],
        },
        MessageDesc {
            name: "global_remove",
            since: 1,
            is_destructor: false,
            signature: &[ArgumentType::Uint],
            child_interface: None,
            arg_interfaces: &[],
        },
    ],
    c_ptr: None,
};

/// Interface `wl_callback`
pub static WL_CALLBACK_INTERFACE: Interface = Interface {
    name: "wl_callback",
    version: 1,
    requests: &[],
    events: &[MessageDesc {
        name: "done",
        since: 1,
        is_destructor: true,
        signature: &[ArgumentType::Uint],
        child_interface: None,
        arg_interfaces: &[],
    }],
    c_ptr: None,
};