aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 09:15:53 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 12:03:55 +0200
commit48fe9b26442662517b1590cb98ab81d79b059953 (patch)
treee2043b1941d340090fa7c7e9590bf2f3e7c81b47 /src/lib.rs
parentc244f8c033f100a6e0f3e0b2b408f6ddc1006d47 (diff)
downloadglutin-48fe9b26442662517b1590cb98ab81d79b059953.tar.gz
glutin-48fe9b26442662517b1590cb98ab81d79b059953.zip
Extract WindowAttributes from the BuilderAttribs
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs77
1 files changed, 56 insertions, 21 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 82d0f3b..438938a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -371,10 +371,6 @@ pub struct BuilderAttribs<'a> {
#[allow(dead_code)]
headless: bool,
strict: bool,
- dimensions: Option<(u32, u32)>,
- title: String,
- monitor: Option<platform::MonitorID>,
- visible: bool,
multisampling: Option<u16>,
depth_bits: Option<u8>,
stencil_bits: Option<u8>,
@@ -382,9 +378,7 @@ pub struct BuilderAttribs<'a> {
alpha_bits: Option<u8>,
stereoscopy: bool,
srgb: Option<bool>,
- transparent: bool,
- decorations: bool,
- multitouch: bool,
+ window: WindowAttributes,
opengl: GlAttributes<&'a platform::Window>,
}
@@ -393,10 +387,6 @@ impl BuilderAttribs<'static> {
BuilderAttribs {
headless: false,
strict: false,
- dimensions: None,
- title: "glutin window".to_string(),
- monitor: None,
- visible: true,
multisampling: None,
depth_bits: None,
stencil_bits: None,
@@ -404,9 +394,7 @@ impl BuilderAttribs<'static> {
alpha_bits: None,
stereoscopy: false,
srgb: None,
- transparent: false,
- decorations: true,
- multitouch: false,
+ window: Default::default(),
opengl: Default::default(),
}
}
@@ -420,10 +408,6 @@ impl<'a> BuilderAttribs<'a> {
let new_attribs = BuilderAttribs {
headless: self.headless,
strict: self.strict,
- dimensions: self.dimensions,
- title: self.title,
- monitor: self.monitor,
- visible: self.visible,
multisampling: self.multisampling,
depth_bits: self.depth_bits,
stencil_bits: self.stencil_bits,
@@ -431,9 +415,7 @@ impl<'a> BuilderAttribs<'a> {
alpha_bits: self.alpha_bits,
stereoscopy: self.stereoscopy,
srgb: self.srgb,
- transparent: self.transparent,
- decorations: self.decorations,
- multitouch: self.multitouch,
+ window: self.window,
opengl: GlAttributes {
sharing: None,
version: self.opengl.version,
@@ -547,6 +529,59 @@ impl<'a> BuilderAttribs<'a> {
}
}
+/// Attributes to use when creating a window.
+#[derive(Clone)]
+pub struct WindowAttributes {
+ /// The dimensions of the window. If this is `None`, some platform-specific dimensions will be
+ /// used.
+ ///
+ /// The default is `None`.
+ pub dimensions: Option<(u32, u32)>,
+
+ /// If `Some`, the window will be in fullscreen mode with the given monitor.
+ ///
+ /// The default is `None`.
+ pub monitor: Option<platform::MonitorID>,
+
+ /// The title of the window in the title bar.
+ ///
+ /// The default is `"glutin window"`.
+ pub title: String,
+
+ /// Whether the window should be immediately visible upon creation.
+ ///
+ /// The default is `true`.
+ pub visible: bool,
+
+ /// Whether the the window should be transparent. If this is true, writing colors
+ /// with alpha values different than `1.0` will produce a transparent window.
+ ///
+ /// The default is `false`.
+ pub transparent: bool,
+
+ /// Whether the window should have borders and bars.
+ ///
+ /// The default is `true`.
+ pub decorations: bool,
+
+ /// ??? TODO: document me
+ pub multitouch: bool,
+}
+
+impl Default for WindowAttributes {
+ fn default() -> WindowAttributes {
+ WindowAttributes {
+ dimensions: None,
+ monitor: None,
+ title: "glutin window".to_owned(),
+ visible: true,
+ transparent: false,
+ decorations: true,
+ multitouch: false,
+ }
+ }
+}
+
/// Attributes to use when creating an OpenGL context.
#[derive(Clone)]
pub struct GlAttributes<S> {