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
//! Raw bindings into the javascript API.
//!
//! For using those functions, prefer `api::callbacks` instead.

use crate::types;
use crate::wasm_bindgen;

/// Spawn a new overlay.
///
/// This is private/hidden for safety. See `spawn_overlay` for more info.
///
/// Returns an uid.
#[wasm_bindgen(js_name = SpawnOverlayOvrtSysCallback)]
pub fn spawn_overlay(uid: i32) {
    super::spawn_overlay(types::Uid(uid))
}

/// Returns a list of open windows and their handles.
/// (If user has this option enabled).
///
/// Returns `windowTitles`.
#[wasm_bindgen(js_name = GetWindowTitlesOvrtSysCallback)]
// TODO: check accordingly to reference.
// reference: window.GetWindowTitles("completeIntervalWinTitles");
// window.GetWindowTitles("ovrtWinTitles");
pub fn get_window_titles(window_titles: String) {
    super::get_window_titles(window_titles)
}

/// (Used for SetContents monitorId).
///
/// Returns `monitorCount` (how many monitors are connected).
#[wasm_bindgen(js_name = GetMonitorCountOvrtSysCallback)]
// TODO: check accordingly to reference.
// reference: GetMonitorCount("ovrtMonitorTotal");
// window.GetMonitorCount(callback, data);
pub fn get_monitor_count(monitor_count: i32) {
    use std::convert::TryInto;
    super::get_monitor_count(
        monitor_count
            .try_into()
            .expect("unexpected negative monitor_count"),
    )
}

/// Get `OVROverlayTransform` of a specified overlay.
///
/// Returns `transformInfo`.
// https://github.com/swfsql/ovrt-sys/issues/2
#[wasm_bindgen(js_name = GetOverlayTransformOvrtSysCallback)]
// TODO: check accordingly to reference.
// reference: window.GetOverlayTransform(String(uid), "ovrtWinDetailed");
pub fn get_overlay_transform(transform_info: String) {
    let data =
        serde_json::from_str::<types::OVROverlayTransform>(
            &transform_info,
        )
        .expect("failed to deserialize");
    super::get_overlay_transform(data)
}

/// Get type of overlay.
/// (Browser, window capture, desktop capture).
///
/// Returns `type`.
#[wasm_bindgen(js_name = GetOverlayTypeOvrtSysCallback)]
// TODO: check accordingly to reference.
// reference: window.GetOverlayType(uid, callback);
pub fn get_overlay_type(type_: i32) {
    super::get_overlay_type(type_)
}

/// Get bounds of overlay bounding box.
/// (Refer to Unity documentation 'Bounds' section).
///
/// Returns `bounds`.
#[wasm_bindgen(js_name = GetOverlayBoundsOvrtSysCallback)]
// TODO: check accordingly to reference.
// reference: window.GetOverlayBounds(uid, callback);
pub fn get_overlay_bounds(bounds: String) {
    super::get_overlay_bounds(bounds)
}

/// Get finger curl positions.
///
/// Returns `curls`.
/// (Returns 0 for all values if user is in Simulator Mode).
#[wasm_bindgen(js_name = GetFingerCurlsOvrtSysCallback)]
// TODO: check accordingly to reference.
// reference: window.GetFingerCurls("completeFingerCurls");
pub fn get_finger_curls(curls: String) {
    super::get_finger_curls(curls)
}