Struct fltk::app::Screen

source ·
pub struct Screen {
    pub n: i32,
}
Expand description

An available screen

Unlike the standalone functions, it automatically checks the provided coordinates and screen numbers are currently valid and inside boundaries.

Fields

n: i32

The screen number

Implementations

Returns a vector containing all the Screens, ordered by screen number

Examples found in repository?
examples/screens_info.rs (line 8)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the Screen associated with the given screen number

Returns an error if the provided number is not a valid screen number.

Returns the Screen that contains the specified screen position

Returns an error if the provided coordinates are out of bounds.

Examples found in repository?
examples/screens_info.rs (line 24)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the Screen which intersects the most with the provided rectangle

Returns an error if any coordinates on the provided retangle are out of bounds.

Examples found in repository?
examples/screens_info.rs (line 25)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns true if scaling factors are supported by this platform, wether shared by all screens, or each screen having its own value

Examples found in repository?
examples/screens_info.rs (line 13)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns true if each screen can have its own scaling factor value

Examples found in repository?
examples/screens_info.rs (line 14)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the number of available screens

Examples found in repository?
examples/screens_info.rs (line 10)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the screen number of the screen that contains the specified screen position coordinates

Returns an error if the provided coordinates are out of bounds.

Returns the bounding rectangle of the work area of the screen that contains the specified screen position coordinates

Returns an error if the provided coordinates are out of bounds.

Examples found in repository?
examples/screens_info.rs (line 28)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the bounding rectangle of the work area of the screen currently under the mouse pointer coordinates

Examples found in repository?
examples/screens_info.rs (line 29)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the bounding rectangle of the work area with the provided screen number

Returns an error if the provided number is not a valid screen number.

Returns the bounding rectangle of the screen that contains the specified screen position coordinates

Returns an error if the provided coordinates are out of bounds.

Examples found in repository?
examples/screens_info.rs (line 32)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the bounding rectangle of the screen that contains the specified screen position coordinates

Returns an error if the provided coordinates are out of bounds.

Examples found in repository?
examples/screens_info.rs (line 33)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Gets the bounding rectangle of the screen currently under the mouse pointer coordinates

Examples found in repository?
examples/screens_info.rs (line 34)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the bounding rectangle of the screen with the provided screen number

Returns an error if the provided number is not a valid screen number.

Controls the possibility to scale all windows by ctrl/+/-/0/ or cmd/+/-/0/

This function should be called before app::open_display runs. If it is not called, the default is to handle these keys for window scaling.

Pass a value of false to stop recognition of ctrl/+/-/0/ (or cmd/+/-/0/ under macOS) keys as window scaling.

Returns true if the current screen’s number corresponds to a currently connected screen, or false otherwise.

Returns the current screen (vertical, horizontal) resolution in dots-per-inch

Examples found in repository?
examples/screens_info.rs (line 40)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Sets the value of the GUI scaling factor for the current screen

Returns the value of the GUI scaling factor for the current screen

Examples found in repository?
examples/screens_info.rs (line 41)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the the work area of the current screen

Examples found in repository?
examples/screens_info.rs (line 39)
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
fn main() {
    let screens = Screen::all_screens();
    println!("Number of detected screens = {}\n", screens.len());
    assert_eq![screens.len(), Screen::count() as usize];

    println!("Is scaling supported:");
    println!("- at all = {}", Screen::scaling_supported());
    println!("- separately = {}", Screen::scaling_supported_separately());

    let coord: Coord = [100, 100].into();
    let rect: Rect = [100, 100, 100, 100].into();

    // uncomment these lines to see out-of-boundaries errors:
    // let coord: Coord = [-100, 10_000].into();
    // let rect: Rect = [-100, 100, 10_000, 10_000].into();

    println!("\nScreen found:");
    println!("- at {coord:?} = {:?}", Screen::new_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::new_inside(rect));

    println!("\nWork area:");
    println!("- at {coord:?} = {:?}", Screen::work_area_at(coord));
    println!("- under the mouse = {:?}", Screen::work_area_mouse());

    println!("\nXYWH:");
    println!("- at {coord:?} = {:?}", Screen::xywh_at(coord));
    println!("- inside {rect:?} = {:?}", Screen::xywh_inside(rect));
    println!("- under the mouse = {:?}", Screen::xywh_mouse());

    println!("\nFor each screen:");
    for s in screens {
        println!("+ {s:?}");
        println!("  - work area = {:?}:", s.work_area());
        println!("  - dpi = {:?}", s.dpi());
        println!("  - scale = {:?}", s.scale());
    }
}

Returns the topmost y coordinate of the current screen’s work area

Returns the bottom-right x coordinate of the current screen’s work area

Returns the width in pixels of the current screen’s work area

Returns the height in pixels of the current screen’s work area

Returns the top-left x,y coordinates of the current screen’s work area

Returns the bottom-right x+w, y+h coordinates of the current screen’s work area

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.