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
use crate::{
    class::BrowserWindow,
    interface::{Display, Point, Rectangle},
};
use wasm_bindgen::prelude::*;

#[wasm_bindgen(module = "electron")]
extern {
    #[wasm_bindgen]
    pub type Screen;

    pub static screen: Screen;

    // FIXME: event overloads

    #[wasm_bindgen(method, js_name = "dipToScreenPoint")]
    pub fn dip_to_screen_point(this: &Screen, point: Point) -> Point;

    #[wasm_bindgen(method, js_name = "dipToScreenPoint")]
    pub fn dip_to_screen_rect(this: &Screen, window: BrowserWindow, rect: Rectangle) -> Rectangle;

    #[wasm_bindgen(method, js_name = "getCursorScreenPoint")]
    pub fn get_all_displays(this: &Screen) -> Box<[JsValue]>;

    #[wasm_bindgen(method, js_name = "getDisplayMatching")]
    pub fn get_display_matching(this: &Screen, rect: Rectangle) -> Display;

    #[wasm_bindgen(method, js_name = "getDisplayNearestPoint")]
    pub fn get_display_nearest_point(this: &Screen, point: Point) -> Display;

    #[wasm_bindgen(method, js_name = "getPrimaryDisplay")]
    pub fn get_primary_display(this: &Screen) -> Display;

    #[wasm_bindgen(method, js_name = "screen_to_dip_point")]
    pub fn screen_to_dip_point(this: &Screen, point: Point) -> Point;

    #[wasm_bindgen(method, js_name = "screen_to_dip_rect")]
    pub fn screen_to_dip_rect(this: &Screen, rect: Rectangle) -> Rectangle;
}