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
///
/// Global application options.
///
pub struct ApplicationOptions {
pub title: String,
pub opengl_share_contexts: bool,
pub opengl_stencil_bits: i32,
pub opengl_depth_bits: i32,
pub force_xwayland: bool,
}
impl Default for ApplicationOptions {
fn default() -> Self {
Self::new()
}
}
impl ApplicationOptions {
///
/// Creates new builder.
///
pub fn new() -> Self {
Self {
title: "".to_string(),
opengl_share_contexts: false,
opengl_stencil_bits: 0,
opengl_depth_bits: 0,
force_xwayland: false,
}
}
///
/// Sets the application title.
///
pub fn with_title(mut self, title: &str) -> Self {
self.title = title.to_string();
self
}
///
/// Enables automatically created shared contexts between windows.
///
pub fn with_opengl_share_contexts(mut self, share: bool) -> Self {
self.opengl_share_contexts = share;
self
}
///
/// Sets bits of the the stencil buffer.
/// 0 - disables stencil buffer, 8 - standard stencil buffer.
///
pub fn with_opengl_stencil_bits(mut self, bits: i32) -> Self {
self.opengl_stencil_bits = bits;
self
}
///
/// Sets bits of the the depth buffer.
/// 0 - disables depth buffer, 24 - standard depth buffer.
///
pub fn with_opengl_depth_bits(mut self, bits: i32) -> Self {
self.opengl_depth_bits = bits;
self
}
///
/// Forces the window to be opened on XWayland (xcb) under Wayland.
///
pub fn with_force_xwayland(mut self, force: bool) -> Self {
self.force_xwayland = force;
self
}
}