use libc;
extern "C" {
    pub type wl_display;
    /* Generated by wayland-scanner 1.17.0 */
    pub type wl_client;
    pub type wl_global;
    pub type xkb_keymap;
    pub type xkb_state;
    pub type wlr_keyboard_impl;
    pub type wlr_keyboard_group;
    pub type wlr_texture;
    pub type wlr_renderer;
    pub type wlr_data_source;
    pub type wlr_drag;
    pub type wlr_primary_selection_source;
    #[no_mangle]
    fn __assert_fail(__assertion: *const libc::c_char,
                     __file: *const libc::c_char, __line: libc::c_uint,
                     __function: *const libc::c_char) -> !;
    #[no_mangle]
    fn strdup(__s: *const libc::c_char) -> *mut libc::c_char;
    #[no_mangle]
    fn wl_list_remove(elm: *mut wl_list);
    #[no_mangle]
    fn wl_list_insert(list: *mut wl_list, elm: *mut wl_list);
    #[no_mangle]
    fn wl_list_init(list: *mut wl_list);
    #[no_mangle]
    fn calloc(_: libc::c_ulong, _: libc::c_ulong) -> *mut libc::c_void;
    #[no_mangle]
    fn free(__ptr: *mut libc::c_void);
    #[no_mangle]
    fn wl_display_add_destroy_listener(display: *mut wl_display,
                                       listener: *mut wl_listener);
    #[no_mangle]
    fn wl_global_create(display: *mut wl_display,
                        interface: *const wl_interface, version: libc::c_int,
                        data: *mut libc::c_void, bind: wl_global_bind_func_t)
     -> *mut wl_global;
    #[no_mangle]
    fn wl_global_destroy(global: *mut wl_global);
    #[no_mangle]
    fn wl_client_post_no_memory(client: *mut wl_client);
    #[no_mangle]
    fn wl_resource_post_event(resource: *mut wl_resource, opcode: uint32_t,
                              _: ...);
    #[no_mangle]
    fn wl_resource_create(client: *mut wl_client,
                          interface: *const wl_interface,
                          version: libc::c_int, id: uint32_t)
     -> *mut wl_resource;
    #[no_mangle]
    fn wl_resource_set_implementation(resource: *mut wl_resource,
                                      implementation: *const libc::c_void,
                                      data: *mut libc::c_void,
                                      destroy: wl_resource_destroy_func_t);
    #[no_mangle]
    fn wl_resource_destroy(resource: *mut wl_resource);
    #[no_mangle]
    fn wl_resource_get_link(resource: *mut wl_resource) -> *mut wl_list;
    #[no_mangle]
    fn wl_resource_set_user_data(resource: *mut wl_resource,
                                 data: *mut libc::c_void);
    #[no_mangle]
    fn wl_resource_get_user_data(resource: *mut wl_resource)
     -> *mut libc::c_void;
    #[no_mangle]
    fn wl_resource_get_version(resource: *mut wl_resource) -> libc::c_int;
    #[no_mangle]
    fn wl_resource_instance_of(resource: *mut wl_resource,
                               interface: *const wl_interface,
                               implementation: *const libc::c_void)
     -> libc::c_int;
    #[no_mangle]
    fn wlr_seat_client_from_resource(resource: *mut wl_resource)
     -> *mut wlr_seat_client;
    #[no_mangle]
    fn _wlr_log(verbosity: wlr_log_importance, format: *const libc::c_char,
                _: ...);
    /* *
 * @page page_iface_zwp_input_method_v2 zwp_input_method_v2
 * @section page_iface_zwp_input_method_v2_desc Description
 *
 * An input method object allows for clients to compose text.
 *
 * The objects connects the client to a text input in an application, and
 * lets the client to serve as an input method for a seat.
 *
 * The zwp_input_method_v2 object can occupy two distinct states: active and
 * inactive. In the active state, the object is associated to and
 * communicates with a text input. In the inactive state, there is no
 * associated text input, and the only communication is with the compositor.
 * Initially, the input method is in the inactive state.
 *
 * Requests issued in the inactive state must be accepted by the compositor.
 * Because of the serial mechanism, and the state reset on activate event,
 * they will not have any effect on the state of the next text input.
 *
 * There must be no more than one input method object per seat.
 * @section page_iface_zwp_input_method_v2_api API
 * See @ref iface_zwp_input_method_v2.
 */
/* *
 * @defgroup iface_zwp_input_method_v2 The zwp_input_method_v2 interface
 *
 * An input method object allows for clients to compose text.
 *
 * The objects connects the client to a text input in an application, and
 * lets the client to serve as an input method for a seat.
 *
 * The zwp_input_method_v2 object can occupy two distinct states: active and
 * inactive. In the active state, the object is associated to and
 * communicates with a text input. In the inactive state, there is no
 * associated text input, and the only communication is with the compositor.
 * Initially, the input method is in the inactive state.
 *
 * Requests issued in the inactive state must be accepted by the compositor.
 * Because of the serial mechanism, and the state reset on activate event,
 * they will not have any effect on the state of the next text input.
 *
 * There must be no more than one input method object per seat.
 */
    #[no_mangle]
    static zwp_input_method_v2_interface: wl_interface;
    /* *
 * @page page_iface_zwp_input_method_manager_v2 zwp_input_method_manager_v2
 * @section page_iface_zwp_input_method_manager_v2_desc Description
 *
 * The input method manager allows the client to become the input method on
 * a chosen seat.
 *
 * No more than one input method must be associated with any seat at any
 * given time.
 * @section page_iface_zwp_input_method_manager_v2_api API
 * See @ref iface_zwp_input_method_manager_v2.
 */
/* *
 * @defgroup iface_zwp_input_method_manager_v2 The zwp_input_method_manager_v2 interface
 *
 * The input method manager allows the client to become the input method on
 * a chosen seat.
 *
 * No more than one input method must be associated with any seat at any
 * given time.
 */
    #[no_mangle]
    static zwp_input_method_manager_v2_interface: wl_interface;
    #[no_mangle]
    fn wlr_signal_emit_safe(signal: *mut wl_signal, data: *mut libc::c_void);
}
pub type size_t = libc::c_ulong;
pub type __int32_t = libc::c_int;
pub type __uint32_t = libc::c_uint;
pub type __time_t = libc::c_long;
pub type __syscall_slong_t = libc::c_long;
pub type int32_t = __int32_t;
pub type uint32_t = __uint32_t;

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_object {
    pub interface: *const wl_interface,
    pub implementation: *const libc::c_void,
    pub id: uint32_t,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_interface {
    pub name: *const libc::c_char,
    pub version: libc::c_int,
    pub method_count: libc::c_int,
    pub methods: *const wl_message,
    pub event_count: libc::c_int,
    pub events: *const wl_message,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_message {
    pub name: *const libc::c_char,
    pub signature: *const libc::c_char,
    pub types: *mut *const wl_interface,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_list {
    pub prev: *mut wl_list,
    pub next: *mut wl_list,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_listener {
    pub link: wl_list,
    pub notify: wl_notify_func_t,
}
pub type wl_notify_func_t
    =
    Option<unsafe extern "C" fn(_: *mut wl_listener, _: *mut libc::c_void)
               -> ()>;
pub type wl_global_bind_func_t
    =
    Option<unsafe extern "C" fn(_: *mut wl_client, _: *mut libc::c_void,
                                _: uint32_t, _: uint32_t) -> ()>;

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_resource {
    pub object: wl_object,
    pub destroy: wl_resource_destroy_func_t,
    pub link: wl_list,
    pub destroy_signal: wl_signal,
    pub client: *mut wl_client,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wl_signal {
    pub listener_list: wl_list,
}
pub type wl_resource_destroy_func_t
    =
    Option<unsafe extern "C" fn(_: *mut wl_resource) -> ()>;

#[repr(C)]#[derive(Copy, Clone)]
pub struct timespec {
    pub tv_sec: __time_t,
    pub tv_nsec: __syscall_slong_t,
}
/*
 * This an unstable interface of wlroots. No guarantees are made regarding the
 * future consistency of this API.
 */
pub type wlr_button_state = libc::c_uint;
pub const WLR_BUTTON_PRESSED: wlr_button_state = 1;
pub const WLR_BUTTON_RELEASED: wlr_button_state = 0;
pub type xkb_mod_index_t = uint32_t;
pub type xkb_mod_mask_t = uint32_t;
pub type xkb_led_index_t = uint32_t;

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_keyboard_modifiers {
    pub depressed: xkb_mod_mask_t,
    pub latched: xkb_mod_mask_t,
    pub locked: xkb_mod_mask_t,
    pub group: xkb_mod_mask_t,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_keyboard {
    pub impl_0: *const crate::src::backend::headless::input_device::wlr_keyboard_impl,
    pub group: *mut crate::src::types::wlr_keyboard_group::wlr_keyboard_group,
    pub keymap_string: *mut libc::c_char,
    pub keymap_size: size_t,
    pub keymap: *mut xkb_keymap,
    pub xkb_state: *mut xkb_state,
    pub led_indexes: [xkb_led_index_t; 3],
    pub mod_indexes: [xkb_mod_index_t; 8],
    pub keycodes: [uint32_t; 32],
    pub num_keycodes: size_t,
    pub modifiers: wlr_keyboard_modifiers,
    pub repeat_info: C2RustUnnamed_0,
    pub events: C2RustUnnamed,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed {
    pub key: wl_signal,
    pub modifiers: wl_signal,
    pub keymap: wl_signal,
    pub repeat_info: wl_signal,
    pub destroy: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_0 {
    pub rate: int32_t,
    pub delay: int32_t,
}
pub type wlr_axis_source = libc::c_uint;
pub const WLR_AXIS_SOURCE_WHEEL_TILT: wlr_axis_source = 3;
pub const WLR_AXIS_SOURCE_CONTINUOUS: wlr_axis_source = 2;
pub const WLR_AXIS_SOURCE_FINGER: wlr_axis_source = 1;
pub const WLR_AXIS_SOURCE_WHEEL: wlr_axis_source = 0;
pub type wlr_axis_orientation = libc::c_uint;
pub const WLR_AXIS_ORIENTATION_HORIZONTAL: wlr_axis_orientation = 1;
pub const WLR_AXIS_ORIENTATION_VERTICAL: wlr_axis_orientation = 0;

#[repr(C)]#[derive(Copy, Clone)]
pub struct pixman_region32_data {
    pub size: libc::c_long,
    pub numRects: libc::c_long,
}
pub type pixman_region32_data_t = pixman_region32_data;

#[repr(C)]#[derive(Copy, Clone)]
pub struct pixman_box32 {
    pub x1: int32_t,
    pub y1: int32_t,
    pub x2: int32_t,
    pub y2: int32_t,
}
pub type pixman_box32_t = pixman_box32;

#[repr(C)]#[derive(Copy, Clone)]
pub struct pixman_region32 {
    pub extents: pixman_box32_t,
    pub data: *mut pixman_region32_data_t,
}
pub type pixman_region32_t = pixman_region32;
pub type wl_output_transform = libc::c_uint;
pub const WL_OUTPUT_TRANSFORM_FLIPPED_270: wl_output_transform = 7;
pub const WL_OUTPUT_TRANSFORM_FLIPPED_180: wl_output_transform = 6;
pub const WL_OUTPUT_TRANSFORM_FLIPPED_90: wl_output_transform = 5;
pub const WL_OUTPUT_TRANSFORM_FLIPPED: wl_output_transform = 4;
pub const WL_OUTPUT_TRANSFORM_270: wl_output_transform = 3;
pub const WL_OUTPUT_TRANSFORM_180: wl_output_transform = 2;
pub const WL_OUTPUT_TRANSFORM_90: wl_output_transform = 1;
pub const WL_OUTPUT_TRANSFORM_NORMAL: wl_output_transform = 0;

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_buffer {
    pub resource: *mut wl_resource,
    pub texture: *mut crate::src::backend::drm::atomic::wlr_texture,
    pub released: bool,
    pub n_refs: size_t,
    pub resource_destroy: wl_listener,
}
/*
 * This an unstable interface of wlroots. No guarantees are made regarding the
 * future consistency of this API.
 */
// mHz
// only when using a software cursor without a surface
// only when using a cursor surface

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_surface {
    pub resource: *mut wl_resource,
    pub renderer: *mut crate::src::backend::drm::atomic::wlr_renderer,
    pub buffer: *mut wlr_buffer,
    pub sx: libc::c_int,
    pub sy: libc::c_int,
    pub buffer_damage: pixman_region32_t,
    pub opaque_region: pixman_region32_t,
    pub input_region: pixman_region32_t,
    pub current: wlr_surface_state,
    pub pending: wlr_surface_state,
    pub previous: wlr_surface_state,
    pub role: *const wlr_surface_role,
    pub role_data: *mut libc::c_void,
    pub events: C2RustUnnamed_1,
    pub subsurfaces: wl_list,
    pub subsurface_pending_list: wl_list,
    pub renderer_destroy: wl_listener,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_1 {
    pub commit: wl_signal,
    pub new_subsurface: wl_signal,
    pub destroy: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_surface_role {
    pub name: *const libc::c_char,
    pub commit: Option<unsafe extern "C" fn(_: *mut wlr_surface) -> ()>,
    pub precommit: Option<unsafe extern "C" fn(_: *mut wlr_surface) -> ()>,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_surface_state {
    pub committed: uint32_t,
    pub buffer_resource: *mut wl_resource,
    pub dx: int32_t,
    pub dy: int32_t,
    pub surface_damage: pixman_region32_t,
    pub buffer_damage: pixman_region32_t,
    pub opaque: pixman_region32_t,
    pub input: pixman_region32_t,
    pub transform: wl_output_transform,
    pub scale: int32_t,
    pub frame_callback_list: wl_list,
    pub width: libc::c_int,
    pub height: libc::c_int,
    pub buffer_width: libc::c_int,
    pub buffer_height: libc::c_int,
    pub buffer_destroy: wl_listener,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_serial_range {
    pub min_incl: uint32_t,
    pub max_incl: uint32_t,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_serial_ringset {
    pub data: [wlr_serial_range; 128],
    pub end: libc::c_int,
    pub count: libc::c_int,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_client {
    pub client: *mut wl_client,
    pub seat: *mut wlr_seat,
    pub link: wl_list,
    pub resources: wl_list,
    pub pointers: wl_list,
    pub keyboards: wl_list,
    pub touches: wl_list,
    pub data_devices: wl_list,
    pub events: C2RustUnnamed_2,
    pub serials: wlr_serial_ringset,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_2 {
    pub destroy: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat {
    pub global: *mut wl_global,
    pub display: *mut wl_display,
    pub clients: wl_list,
    pub name: *mut libc::c_char,
    pub capabilities: uint32_t,
    pub last_event: timespec,
    pub selection_source: *mut crate::src::types::data_device::wlr_data_device::wlr_data_source,
    pub selection_serial: uint32_t,
    pub selection_offers: wl_list,
    pub primary_selection_source: *mut crate::src::types::wlr_data_control_v1::wlr_primary_selection_source,
    pub primary_selection_serial: uint32_t,
    pub drag: *mut crate::src::types::data_device::wlr_data_device::wlr_drag,
    pub drag_source: *mut crate::src::types::data_device::wlr_data_device::wlr_data_source,
    pub drag_serial: uint32_t,
    pub drag_offers: wl_list,
    pub pointer_state: wlr_seat_pointer_state,
    pub keyboard_state: wlr_seat_keyboard_state,
    pub touch_state: wlr_seat_touch_state,
    pub display_destroy: wl_listener,
    pub selection_source_destroy: wl_listener,
    pub primary_selection_source_destroy: wl_listener,
    pub drag_source_destroy: wl_listener,
    pub events: C2RustUnnamed_3,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_3 {
    pub pointer_grab_begin: wl_signal,
    pub pointer_grab_end: wl_signal,
    pub keyboard_grab_begin: wl_signal,
    pub keyboard_grab_end: wl_signal,
    pub touch_grab_begin: wl_signal,
    pub touch_grab_end: wl_signal,
    pub request_set_cursor: wl_signal,
    pub request_set_selection: wl_signal,
    pub set_selection: wl_signal,
    pub request_set_primary_selection: wl_signal,
    pub set_primary_selection: wl_signal,
    pub request_start_drag: wl_signal,
    pub start_drag: wl_signal,
    pub destroy: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_touch_state {
    pub seat: *mut wlr_seat,
    pub touch_points: wl_list,
    pub grab_serial: uint32_t,
    pub grab_id: uint32_t,
    pub grab: *mut wlr_seat_touch_grab,
    pub default_grab: *mut wlr_seat_touch_grab,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_touch_grab {
    pub interface: *const wlr_touch_grab_interface,
    pub seat: *mut wlr_seat,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_touch_grab_interface {
    pub down: Option<unsafe extern "C" fn(_: *mut wlr_seat_touch_grab,
                                          _: uint32_t,
                                          _: *mut wlr_touch_point)
                         -> uint32_t>,
    pub up: Option<unsafe extern "C" fn(_: *mut wlr_seat_touch_grab,
                                        _: uint32_t, _: *mut wlr_touch_point)
                       -> ()>,
    pub motion: Option<unsafe extern "C" fn(_: *mut wlr_seat_touch_grab,
                                            _: uint32_t,
                                            _: *mut wlr_touch_point) -> ()>,
    pub enter: Option<unsafe extern "C" fn(_: *mut wlr_seat_touch_grab,
                                           _: uint32_t,
                                           _: *mut wlr_touch_point) -> ()>,
    pub cancel: Option<unsafe extern "C" fn(_: *mut wlr_seat_touch_grab)
                           -> ()>,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_touch_point {
    pub touch_id: int32_t,
    pub surface: *mut wlr_surface,
    pub client: *mut wlr_seat_client,
    pub focus_surface: *mut wlr_surface,
    pub focus_client: *mut wlr_seat_client,
    pub sx: libc::c_double,
    pub sy: libc::c_double,
    pub surface_destroy: wl_listener,
    pub focus_surface_destroy: wl_listener,
    pub client_destroy: wl_listener,
    pub events: C2RustUnnamed_4,
    pub link: wl_list,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_4 {
    pub destroy: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_keyboard_state {
    pub seat: *mut wlr_seat,
    pub keyboard: *mut wlr_keyboard,
    pub focused_client: *mut wlr_seat_client,
    pub focused_surface: *mut wlr_surface,
    pub keyboard_destroy: wl_listener,
    pub keyboard_keymap: wl_listener,
    pub keyboard_repeat_info: wl_listener,
    pub surface_destroy: wl_listener,
    pub grab: *mut wlr_seat_keyboard_grab,
    pub default_grab: *mut wlr_seat_keyboard_grab,
    pub events: C2RustUnnamed_5,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_5 {
    pub focus_change: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_keyboard_grab {
    pub interface: *const wlr_keyboard_grab_interface,
    pub seat: *mut wlr_seat,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_keyboard_grab_interface {
    pub enter: Option<unsafe extern "C" fn(_: *mut wlr_seat_keyboard_grab,
                                           _: *mut wlr_surface,
                                           _: *mut uint32_t, _: size_t,
                                           _: *mut wlr_keyboard_modifiers)
                          -> ()>,
    pub key: Option<unsafe extern "C" fn(_: *mut wlr_seat_keyboard_grab,
                                         _: uint32_t, _: uint32_t,
                                         _: uint32_t) -> ()>,
    pub modifiers: Option<unsafe extern "C" fn(_: *mut wlr_seat_keyboard_grab,
                                               _: *mut wlr_keyboard_modifiers)
                              -> ()>,
    pub cancel: Option<unsafe extern "C" fn(_: *mut wlr_seat_keyboard_grab)
                           -> ()>,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_pointer_state {
    pub seat: *mut wlr_seat,
    pub focused_client: *mut wlr_seat_client,
    pub focused_surface: *mut wlr_surface,
    pub sx: libc::c_double,
    pub sy: libc::c_double,
    pub grab: *mut wlr_seat_pointer_grab,
    pub default_grab: *mut wlr_seat_pointer_grab,
    pub buttons: [uint32_t; 16],
    pub button_count: size_t,
    pub grab_button: uint32_t,
    pub grab_serial: uint32_t,
    pub grab_time: uint32_t,
    pub surface_destroy: wl_listener,
    pub events: C2RustUnnamed_6,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_6 {
    pub focus_change: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_seat_pointer_grab {
    pub interface: *const wlr_pointer_grab_interface,
    pub seat: *mut wlr_seat,
    pub data: *mut libc::c_void,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_pointer_grab_interface {
    pub enter: Option<unsafe extern "C" fn(_: *mut wlr_seat_pointer_grab,
                                           _: *mut wlr_surface,
                                           _: libc::c_double,
                                           _: libc::c_double) -> ()>,
    pub motion: Option<unsafe extern "C" fn(_: *mut wlr_seat_pointer_grab,
                                            _: uint32_t, _: libc::c_double,
                                            _: libc::c_double) -> ()>,
    pub button: Option<unsafe extern "C" fn(_: *mut wlr_seat_pointer_grab,
                                            _: uint32_t, _: uint32_t,
                                            _: wlr_button_state) -> uint32_t>,
    pub axis: Option<unsafe extern "C" fn(_: *mut wlr_seat_pointer_grab,
                                          _: uint32_t,
                                          _: wlr_axis_orientation,
                                          _: libc::c_double, _: int32_t,
                                          _: wlr_axis_source) -> ()>,
    pub frame: Option<unsafe extern "C" fn(_: *mut wlr_seat_pointer_grab)
                          -> ()>,
    pub cancel: Option<unsafe extern "C" fn(_: *mut wlr_seat_pointer_grab)
                           -> ()>,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_input_method_v2_preedit_string {
    pub text: *mut libc::c_char,
    pub cursor_begin: int32_t,
    pub cursor_end: int32_t,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_input_method_v2_delete_surrounding_text {
    pub before_length: uint32_t,
    pub after_length: uint32_t,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_input_method_v2_state {
    pub preedit: wlr_input_method_v2_preedit_string,
    pub commit_text: *mut libc::c_char,
    pub delete: wlr_input_method_v2_delete_surrounding_text,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_input_method_v2 {
    pub resource: *mut wl_resource,
    pub seat: *mut wlr_seat,
    pub pending: wlr_input_method_v2_state,
    pub current: wlr_input_method_v2_state,
    pub active: bool,
    pub client_active: bool,
    pub current_serial: uint32_t,
    pub link: wl_list,
    pub seat_destroy: wl_listener,
    pub events: C2RustUnnamed_7,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_7 {
    pub commit: wl_signal,
    pub destroy: wl_signal,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct wlr_input_method_manager_v2 {
    pub global: *mut wl_global,
    pub input_methods: wl_list,
    pub display_destroy: wl_listener,
    pub events: C2RustUnnamed_8,
}

#[repr(C)]#[derive(Copy, Clone)]
pub struct C2RustUnnamed_8 {
    pub input_method: wl_signal,
    pub destroy: wl_signal,
}
/* *
 * @ingroup iface_zwp_input_method_manager_v2
 * @struct zwp_input_method_manager_v2_interface
 */

#[repr(C)]#[derive(Copy, Clone)]
pub struct zwp_input_method_manager_v2_interface {
    pub get_input_method: Option<unsafe extern "C" fn(_: *mut wl_client,
                                                      _: *mut wl_resource,
                                                      _: *mut wl_resource,
                                                      _: uint32_t) -> ()>,
    pub destroy: Option<unsafe extern "C" fn(_: *mut wl_client,
                                             _: *mut wl_resource) -> ()>,
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * @struct zwp_input_method_v2_interface
 */

#[repr(C)]#[derive(Copy, Clone)]
pub struct zwp_input_method_v2_interface {
    pub commit_string: Option<unsafe extern "C" fn(_: *mut wl_client,
                                                   _: *mut wl_resource,
                                                   _: *const libc::c_char)
                                  -> ()>,
    pub set_preedit_string: Option<unsafe extern "C" fn(_: *mut wl_client,
                                                        _: *mut wl_resource,
                                                        _:
                                                            *const libc::c_char,
                                                        _: int32_t,
                                                        _: int32_t) -> ()>,
    pub delete_surrounding_text: Option<unsafe extern "C" fn(_:
                                                                 *mut wl_client,
                                                             _:
                                                                 *mut wl_resource,
                                                             _: uint32_t,
                                                             _: uint32_t)
                                            -> ()>,
    pub commit: Option<unsafe extern "C" fn(_: *mut wl_client,
                                            _: *mut wl_resource, _: uint32_t)
                           -> ()>,
    pub get_input_popup_surface: Option<unsafe extern "C" fn(_:
                                                                 *mut wl_client,
                                                             _:
                                                                 *mut wl_resource,
                                                             _: uint32_t,
                                                             _:
                                                                 *mut wl_resource)
                                            -> ()>,
    pub grab_keyboard: Option<unsafe extern "C" fn(_: *mut wl_client,
                                                   _: *mut wl_resource,
                                                   _: uint32_t) -> ()>,
    pub destroy: Option<unsafe extern "C" fn(_: *mut wl_client,
                                             _: *mut wl_resource) -> ()>,
}
/*
 * This is a stable interface of wlroots. Future changes will be limited to:
 *
 * - New functions
 * - New struct members
 * - New enum members
 *
 * Note that wlroots does not make an ABI compatibility promise - in the future,
 * the layout and size of structs used by wlroots may change, requiring code
 * depending on this header to be recompiled (but not edited).
 *
 * Breaking changes are announced by email and follow a 1-year deprecation
 * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht
 * to receive these announcements.
 */
pub type wlr_log_importance = libc::c_uint;
pub const WLR_LOG_IMPORTANCE_LAST: wlr_log_importance = 4;
pub const WLR_DEBUG: wlr_log_importance = 3;
pub const WLR_INFO: wlr_log_importance = 2;
pub const WLR_ERROR: wlr_log_importance = 1;
pub const WLR_SILENT: wlr_log_importance = 0;
#[inline]
unsafe extern "C" fn wl_signal_init(mut signal: *mut wl_signal) {
    wl_list_init(&mut (*signal).listener_list);
}
#[inline]
unsafe extern "C" fn wl_signal_add(mut signal: *mut wl_signal,
                                   mut listener: *mut wl_listener) {
    wl_list_insert((*signal).listener_list.prev, &mut (*listener).link);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 */
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an activate event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_activate(mut resource_:
                                                           *mut wl_resource) {
    wl_resource_post_event(resource_, 0i32 as uint32_t);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an deactivate event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_deactivate(mut resource_:
                                                             *mut wl_resource) {
    wl_resource_post_event(resource_, 1i32 as uint32_t);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an surrounding_text event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_surrounding_text(mut resource_:
                                                                   *mut wl_resource,
                                                               mut text:
                                                                   *const libc::c_char,
                                                               mut cursor:
                                                                   uint32_t,
                                                               mut anchor:
                                                                   uint32_t) {
    wl_resource_post_event(resource_, 2i32 as uint32_t, text, cursor, anchor);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an text_change_cause event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_text_change_cause(mut resource_:
                                                                    *mut wl_resource,
                                                                mut cause:
                                                                    uint32_t) {
    wl_resource_post_event(resource_, 3i32 as uint32_t, cause);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an content_type event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_content_type(mut resource_:
                                                               *mut wl_resource,
                                                           mut hint: uint32_t,
                                                           mut purpose:
                                                               uint32_t) {
    wl_resource_post_event(resource_, 4i32 as uint32_t, hint, purpose);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an done event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_done(mut resource_:
                                                       *mut wl_resource) {
    wl_resource_post_event(resource_, 5i32 as uint32_t);
}
/* *
 * @ingroup iface_zwp_input_method_v2
 * Sends an unavailable event to the client owning the resource.
 * @param resource_ The client's resource
 */
#[inline]
unsafe extern "C" fn zwp_input_method_v2_send_unavailable(mut resource_:
                                                              *mut wl_resource) {
    wl_resource_post_event(resource_, 6i32 as uint32_t);
}
unsafe extern "C" fn input_method_from_resource(mut resource:
                                                    *mut wl_resource)
 -> *mut wlr_input_method_v2 {
    if wl_resource_instance_of(resource, &zwp_input_method_v2_interface,
                               &input_method_impl as
                                   *const zwp_input_method_v2_interface as
                                   *const libc::c_void) != 0 {
    } else {
        __assert_fail(b"wl_resource_instance_of(resource, &zwp_input_method_v2_interface, &input_method_impl)\x00"
                          as *const u8 as *const libc::c_char,
                      b"../types/wlr_input_method_v2.c\x00" as *const u8 as
                          *const libc::c_char, 19i32 as libc::c_uint,
                      (*::std::mem::transmute::<&[u8; 77],
                                                &[libc::c_char; 77]>(b"struct wlr_input_method_v2 *input_method_from_resource(struct wl_resource *)\x00")).as_ptr());
    };
    return wl_resource_get_user_data(resource) as *mut wlr_input_method_v2;
}
unsafe extern "C" fn input_method_destroy(mut input_method:
                                              *mut wlr_input_method_v2) {
    wlr_signal_emit_safe(&mut (*input_method).events.destroy,
                         input_method as *mut libc::c_void);
    wl_list_remove(wl_resource_get_link((*input_method).resource));
    wl_list_remove(&mut (*input_method).seat_destroy.link);
    free((*input_method).pending.commit_text as *mut libc::c_void);
    free((*input_method).pending.preedit.text as *mut libc::c_void);
    free((*input_method).current.commit_text as *mut libc::c_void);
    free((*input_method).current.preedit.text as *mut libc::c_void);
    free(input_method as *mut libc::c_void);
}
unsafe extern "C" fn input_method_resource_destroy(mut resource:
                                                       *mut wl_resource) {
    let mut input_method: *mut wlr_input_method_v2 =
        input_method_from_resource(resource);
    if input_method.is_null() { return }
    input_method_destroy(input_method);
}
unsafe extern "C" fn im_destroy(mut client: *mut wl_client,
                                mut resource: *mut wl_resource) {
    wl_resource_destroy(resource);
}
unsafe extern "C" fn im_commit(mut client: *mut wl_client,
                               mut resource: *mut wl_resource,
                               mut serial: uint32_t) {
    let mut input_method: *mut wlr_input_method_v2 =
        input_method_from_resource(resource);
    if input_method.is_null() { return }
    (*input_method).current = (*input_method).pending;
    (*input_method).current_serial = serial;
    let mut default_state: wlr_input_method_v2_state =
        {
            let mut init =
                wlr_input_method_v2_state{preedit:
                                              {
                                                  let mut init =
                                                      wlr_input_method_v2_preedit_string{text:
                                                                                             0
                                                                                                 as
                                                                                                 *mut libc::c_char,
                                                                                         cursor_begin:
                                                                                             0,
                                                                                         cursor_end:
                                                                                             0,};
                                                  init
                                              },
                                          commit_text: 0 as *mut libc::c_char,
                                          delete:
                                              wlr_input_method_v2_delete_surrounding_text{before_length:
                                                                                              0,
                                                                                          after_length:
                                                                                              0,},};
            init
        };
    (*input_method).pending = default_state;
    wlr_signal_emit_safe(&mut (*input_method).events.commit,
                         input_method as *mut libc::c_void);
}
unsafe extern "C" fn im_commit_string(mut client: *mut wl_client,
                                      mut resource: *mut wl_resource,
                                      mut text: *const libc::c_char) {
    let mut input_method: *mut wlr_input_method_v2 =
        input_method_from_resource(resource);
    if input_method.is_null() { return }
    free((*input_method).pending.commit_text as *mut libc::c_void);
    (*input_method).pending.commit_text = strdup(text);
}
unsafe extern "C" fn im_set_preedit_string(mut client: *mut wl_client,
                                           mut resource: *mut wl_resource,
                                           mut text: *const libc::c_char,
                                           mut cursor_begin: int32_t,
                                           mut cursor_end: int32_t) {
    let mut input_method: *mut wlr_input_method_v2 =
        input_method_from_resource(resource);
    if input_method.is_null() { return }
    (*input_method).pending.preedit.cursor_begin = cursor_begin;
    (*input_method).pending.preedit.cursor_end = cursor_end;
    free((*input_method).pending.preedit.text as *mut libc::c_void);
    (*input_method).pending.preedit.text = strdup(text);
}
unsafe extern "C" fn im_delete_surrounding_text(mut client: *mut wl_client,
                                                mut resource:
                                                    *mut wl_resource,
                                                mut before_length: uint32_t,
                                                mut after_length: uint32_t) {
    let mut input_method: *mut wlr_input_method_v2 =
        input_method_from_resource(resource);
    if input_method.is_null() { return }
    (*input_method).pending.delete.before_length = before_length;
    (*input_method).pending.delete.after_length = after_length;
}
unsafe extern "C" fn im_get_input_popup_surface(mut client: *mut wl_client,
                                                mut resource:
                                                    *mut wl_resource,
                                                mut id: uint32_t,
                                                mut surface:
                                                    *mut wl_resource) {
    _wlr_log(WLR_INFO,
             b"[%s:%d] Stub: zwp_input_method_v2::get_input_popup_surface\x00"
                 as *const u8 as *const libc::c_char,
             b"../types/wlr_input_method_v2.c\x00" as *const u8 as
                 *const libc::c_char, 101i32);
}
unsafe extern "C" fn im_grab_keyboard(mut client: *mut wl_client,
                                      mut resource: *mut wl_resource,
                                      mut keyboard: uint32_t) {
    _wlr_log(WLR_INFO,
             b"[%s:%d] Stub: zwp_input_method_v2::grab_keyboard\x00" as
                 *const u8 as *const libc::c_char,
             b"../types/wlr_input_method_v2.c\x00" as *const u8 as
                 *const libc::c_char, 107i32);
}
static mut input_method_impl: zwp_input_method_v2_interface =
    {
    
        {
            let mut init =
                zwp_input_method_v2_interface{commit_string:
                                                  Some(im_commit_string as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource,
                                                                                _:
                                                                                    *const libc::c_char)
                                                               -> ()),
                                              set_preedit_string:
                                                  Some(im_set_preedit_string
                                                           as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource,
                                                                                _:
                                                                                    *const libc::c_char,
                                                                                _:
                                                                                    int32_t,
                                                                                _:
                                                                                    int32_t)
                                                               -> ()),
                                              delete_surrounding_text:
                                                  Some(im_delete_surrounding_text
                                                           as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource,
                                                                                _:
                                                                                    uint32_t,
                                                                                _:
                                                                                    uint32_t)
                                                               -> ()),
                                              commit:
                                                  Some(im_commit as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource,
                                                                                _:
                                                                                    uint32_t)
                                                               -> ()),
                                              get_input_popup_surface:
                                                  Some(im_get_input_popup_surface
                                                           as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource,
                                                                                _:
                                                                                    uint32_t,
                                                                                _:
                                                                                    *mut wl_resource)
                                                               -> ()),
                                              grab_keyboard:
                                                  Some(im_grab_keyboard as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource,
                                                                                _:
                                                                                    uint32_t)
                                                               -> ()),
                                              destroy:
                                                  Some(im_destroy as
                                                           unsafe extern "C" fn(_:
                                                                                    *mut wl_client,
                                                                                _:
                                                                                    *mut wl_resource)
                                                               -> ()),};
            init
        }
};
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_activate(mut input_method:
                                                               *mut wlr_input_method_v2) {
    zwp_input_method_v2_send_activate((*input_method).resource);
    (*input_method).active = 1i32 != 0;
}
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_deactivate(mut input_method:
                                                                 *mut wlr_input_method_v2) {
    zwp_input_method_v2_send_deactivate((*input_method).resource);
    (*input_method).active = 0i32 != 0;
}
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_surrounding_text(mut input_method:
                                                                       *mut wlr_input_method_v2,
                                                                   mut text:
                                                                       *const libc::c_char,
                                                                   mut cursor:
                                                                       uint32_t,
                                                                   mut anchor:
                                                                       uint32_t) {
    let mut send_text: *const libc::c_char = text;
    if send_text.is_null() {
        send_text = b"\x00" as *const u8 as *const libc::c_char
    }
    zwp_input_method_v2_send_surrounding_text((*input_method).resource,
                                              send_text, cursor, anchor);
}
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_text_change_cause(mut input_method:
                                                                        *mut wlr_input_method_v2,
                                                                    mut cause:
                                                                        uint32_t) {
    zwp_input_method_v2_send_text_change_cause((*input_method).resource,
                                               cause);
}
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_content_type(mut input_method:
                                                                   *mut wlr_input_method_v2,
                                                               mut hint:
                                                                   uint32_t,
                                                               mut purpose:
                                                                   uint32_t) {
    zwp_input_method_v2_send_content_type((*input_method).resource, hint,
                                          purpose);
}
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_done(mut input_method:
                                                           *mut wlr_input_method_v2) {
    zwp_input_method_v2_send_done((*input_method).resource);
    (*input_method).client_active = (*input_method).active;
    (*input_method).current_serial =
        (*input_method).current_serial.wrapping_add(1);
}
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_v2_send_unavailable(mut input_method:
                                                                  *mut wlr_input_method_v2) {
    zwp_input_method_v2_send_unavailable((*input_method).resource);
    let mut resource: *mut wl_resource = (*input_method).resource;
    input_method_destroy(input_method);
    wl_resource_set_user_data(resource, 0 as *mut libc::c_void);
}
unsafe extern "C" fn input_method_manager_from_resource(mut resource:
                                                            *mut wl_resource)
 -> *mut wlr_input_method_manager_v2 {
    if wl_resource_instance_of(resource,
                               &zwp_input_method_manager_v2_interface,
                               &input_method_manager_impl as
                                   *const zwp_input_method_manager_v2_interface
                                   as *const libc::c_void) != 0 {
    } else {
        __assert_fail(b"wl_resource_instance_of(resource, &zwp_input_method_manager_v2_interface, &input_method_manager_impl)\x00"
                          as *const u8 as *const libc::c_char,
                      b"../types/wlr_input_method_v2.c\x00" as *const u8 as
                          *const libc::c_char, 175i32 as libc::c_uint,
                      (*::std::mem::transmute::<&[u8; 93],
                                                &[libc::c_char; 93]>(b"struct wlr_input_method_manager_v2 *input_method_manager_from_resource(struct wl_resource *)\x00")).as_ptr());
    };
    return wl_resource_get_user_data(resource) as
               *mut wlr_input_method_manager_v2;
}
unsafe extern "C" fn input_method_handle_seat_destroy(mut listener:
                                                          *mut wl_listener,
                                                      mut data:
                                                          *mut libc::c_void) {
    let mut input_method: *mut wlr_input_method_v2 =
        (listener as *mut libc::c_char).offset(-104) as
            *mut wlr_input_method_v2;
    wlr_input_method_v2_send_unavailable(input_method);
}
unsafe extern "C" fn manager_get_input_method(mut client: *mut wl_client,
                                              mut resource: *mut wl_resource,
                                              mut seat: *mut wl_resource,
                                              mut input_method_id: uint32_t) {
    let mut im_manager: *mut wlr_input_method_manager_v2 =
        input_method_manager_from_resource(resource);
    let mut input_method: *mut wlr_input_method_v2 =
        calloc(1i32 as libc::c_ulong,
               ::std::mem::size_of::<wlr_input_method_v2>() as libc::c_ulong)
            as *mut wlr_input_method_v2;
    if input_method.is_null() { wl_client_post_no_memory(client); return }
    wl_signal_init(&mut (*input_method).events.commit);
    wl_signal_init(&mut (*input_method).events.destroy);
    let mut version: libc::c_int = wl_resource_get_version(resource);
    let mut im_resource: *mut wl_resource =
        wl_resource_create(client, &zwp_input_method_v2_interface, version,
                           input_method_id);
    if im_resource.is_null() {
        free(input_method as *mut libc::c_void);
        wl_client_post_no_memory(client);
        return
    }
    wl_resource_set_implementation(im_resource,
                                   &input_method_impl as
                                       *const zwp_input_method_v2_interface as
                                       *const libc::c_void,
                                   input_method as *mut libc::c_void,
                                   Some(input_method_resource_destroy as
                                            unsafe extern "C" fn(_:
                                                                     *mut wl_resource)
                                                -> ()));
    let mut seat_client: *mut wlr_seat_client =
        wlr_seat_client_from_resource(seat);
    wl_signal_add(&mut (*seat_client).events.destroy,
                  &mut (*input_method).seat_destroy);
    (*input_method).seat_destroy.notify =
        Some(input_method_handle_seat_destroy as
                 unsafe extern "C" fn(_: *mut wl_listener,
                                      _: *mut libc::c_void) -> ());
    (*input_method).resource = im_resource;
    (*input_method).seat = (*seat_client).seat;
    wl_list_insert(&mut (*im_manager).input_methods,
                   wl_resource_get_link((*input_method).resource));
    wlr_signal_emit_safe(&mut (*im_manager).events.input_method,
                         input_method as *mut libc::c_void);
}
unsafe extern "C" fn manager_destroy(mut client: *mut wl_client,
                                     mut resource: *mut wl_resource) {
    wl_resource_destroy(resource);
}
static mut input_method_manager_impl: zwp_input_method_manager_v2_interface =
    {
    
        {
            let mut init =
                zwp_input_method_manager_v2_interface{get_input_method:
                                                          Some(manager_get_input_method
                                                                   as
                                                                   unsafe extern "C" fn(_:
                                                                                            *mut wl_client,
                                                                                        _:
                                                                                            *mut wl_resource,
                                                                                        _:
                                                                                            *mut wl_resource,
                                                                                        _:
                                                                                            uint32_t)
                                                                       -> ()),
                                                      destroy:
                                                          Some(manager_destroy
                                                                   as
                                                                   unsafe extern "C" fn(_:
                                                                                            *mut wl_client,
                                                                                        _:
                                                                                            *mut wl_resource)
                                                                       ->
                                                                           ()),};
            init
        }
};
unsafe extern "C" fn input_method_manager_bind(mut wl_client: *mut wl_client,
                                               mut data: *mut libc::c_void,
                                               mut version: uint32_t,
                                               mut id: uint32_t) {
    if !wl_client.is_null() {
    } else {
        __assert_fail(b"wl_client\x00" as *const u8 as *const libc::c_char,
                      b"../types/wlr_input_method_v2.c\x00" as *const u8 as
                          *const libc::c_char, 237i32 as libc::c_uint,
                      (*::std::mem::transmute::<&[u8; 79],
                                                &[libc::c_char; 79]>(b"void input_method_manager_bind(struct wl_client *, void *, uint32_t, uint32_t)\x00")).as_ptr());
    };
    let mut im_manager: *mut wlr_input_method_manager_v2 =
        data as *mut wlr_input_method_manager_v2;
    let mut bound_resource: *mut wl_resource =
        wl_resource_create(wl_client, &zwp_input_method_manager_v2_interface,
                           version as libc::c_int, id);
    if bound_resource.is_null() {
        wl_client_post_no_memory(wl_client);
        return
    }
    wl_resource_set_implementation(bound_resource,
                                   &input_method_manager_impl as
                                       *const zwp_input_method_manager_v2_interface
                                       as *const libc::c_void,
                                   im_manager as *mut libc::c_void, None);
}
unsafe extern "C" fn handle_display_destroy(mut listener: *mut wl_listener,
                                            mut data: *mut libc::c_void) {
    let mut manager: *mut wlr_input_method_manager_v2 =
        (listener as *mut libc::c_char).offset(-24) as
            *mut wlr_input_method_manager_v2;
    wlr_signal_emit_safe(&mut (*manager).events.destroy,
                         manager as *mut libc::c_void);
    wl_list_remove(&mut (*manager).display_destroy.link);
    wl_global_destroy((*manager).global);
    free(manager as *mut libc::c_void);
}
/*
 * This an unstable interface of wlroots. No guarantees are made regarding the
 * future consistency of this API.
 */
// pending compositor-side state
// state known to the client
// received in last commit call
// (struct wlr_input_method_v2*)
// (struct wlr_input_method_v2*)
// struct wlr_input_method_v2*::link
// (struct wlr_input_method_v2*)
// (struct wlr_input_method_manager_v2*)
#[no_mangle]
pub unsafe extern "C" fn wlr_input_method_manager_v2_create(mut display:
                                                                *mut wl_display)
 -> *mut wlr_input_method_manager_v2 {
    let mut im_manager: *mut wlr_input_method_manager_v2 =
        calloc(1i32 as libc::c_ulong,
               ::std::mem::size_of::<wlr_input_method_manager_v2>() as
                   libc::c_ulong) as *mut wlr_input_method_manager_v2;
    if im_manager.is_null() { return 0 as *mut wlr_input_method_manager_v2 }
    wl_signal_init(&mut (*im_manager).events.input_method);
    wl_signal_init(&mut (*im_manager).events.destroy);
    wl_list_init(&mut (*im_manager).input_methods);
    (*im_manager).global =
        wl_global_create(display, &zwp_input_method_manager_v2_interface,
                         1i32, im_manager as *mut libc::c_void,
                         Some(input_method_manager_bind as
                                  unsafe extern "C" fn(_: *mut wl_client,
                                                       _: *mut libc::c_void,
                                                       _: uint32_t,
                                                       _: uint32_t) -> ()));
    if (*im_manager).global.is_null() {
        free(im_manager as *mut libc::c_void);
        return 0 as *mut wlr_input_method_manager_v2
    }
    (*im_manager).display_destroy.notify =
        Some(handle_display_destroy as
                 unsafe extern "C" fn(_: *mut wl_listener,
                                      _: *mut libc::c_void) -> ());
    wl_display_add_destroy_listener(display,
                                    &mut (*im_manager).display_destroy);
    return im_manager;
}
