aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-04-12 19:44:12 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-04-12 19:44:12 +0200
commitd5138d2708f2448ecda64fc20c00bc9b0a758a36 (patch)
tree26fbaabee48a2f050412733e6586983f678555dc
parent253a27d3069b8eb3bdb250a0596dc350996caf89 (diff)
parent1e94d85d35eca41e2e54ed4880d62ec7473105f0 (diff)
downloadglutin-d5138d2708f2448ecda64fc20c00bc9b0a758a36.tar.gz
glutin-d5138d2708f2448ecda64fc20c00bc9b0a758a36.zip
Merge pull request #371 from tomaka/get-pixel-format
Adds get_pixel_format() to Window
-rw-r--r--src/android/mod.rs5
-rw-r--r--src/cocoa/mod.rs5
-rw-r--r--src/win32/init.rs8
-rw-r--r--src/win32/mod.rs8
-rw-r--r--src/window.rs6
-rw-r--r--src/x11/window/mod.rs5
6 files changed, 34 insertions, 3 deletions
diff --git a/src/android/mod.rs b/src/android/mod.rs
index 5c7096c..5e71aed 100644
--- a/src/android/mod.rs
+++ b/src/android/mod.rs
@@ -15,6 +15,7 @@ use Api;
use BuilderAttribs;
use CursorState;
use GlRequest;
+use PixelFormat;
use native_monitor::NativeMonitorId;
pub struct Window {
@@ -353,6 +354,10 @@ impl Window {
::Api::OpenGlEs
}
+ pub fn get_pixel_format(&self) -> PixelFormat {
+ unimplemented!();
+ }
+
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs
index 6b97964..101bd6c 100644
--- a/src/cocoa/mod.rs
+++ b/src/cocoa/mod.rs
@@ -8,6 +8,7 @@ use libc;
use Api;
use BuilderAttribs;
use GlRequest;
+use PixelFormat;
use native_monitor::NativeMonitorId;
use objc::runtime::{Class, Object, Sel, BOOL, YES, NO};
@@ -616,6 +617,10 @@ impl Window {
::Api::OpenGl
}
+ pub fn get_pixel_format(&self) -> PixelFormat {
+ unimplemented!();
+ }
+
pub fn set_window_resize_callback(&mut self, callback: Option<fn(u32, u32)>) {
self.delegate.state.resize_handler = callback;
}
diff --git a/src/win32/init.rs b/src/win32/init.rs
index 743508e..5cdd6b8 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -203,16 +203,17 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
};
// calling SetPixelFormat
- {
+ let pixel_format = {
let formats = if extra_functions.GetPixelFormatAttribivARB.is_loaded() {
enumerate_arb_pixel_formats(&extra_functions, &real_window)
} else {
enumerate_native_pixel_formats(&real_window)
};
- let (id, _) = try!(builder.choose_pixel_format(formats.into_iter().map(|(a, b)| (b, a))));
+ let (id, f) = try!(builder.choose_pixel_format(formats.into_iter().map(|(a, b)| (b, a))));
try!(set_pixel_format(&real_window, id));
- }
+ f
+ };
// creating the OpenGL context
let context = try!(create_context(Some((&extra_functions, &builder)), &real_window,
@@ -263,6 +264,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
events_receiver: events_receiver,
is_closed: AtomicBool::new(false),
cursor_state: cursor_state,
+ pixel_format: pixel_format,
})
}
diff --git a/src/win32/mod.rs b/src/win32/mod.rs
index 1f5f3c0..4a9dcbf 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -13,6 +13,7 @@ use libc;
use {CreationError, Event, MouseCursor};
use CursorState;
+use PixelFormat;
use BuilderAttribs;
pub use self::headless::HeadlessContext;
@@ -53,6 +54,9 @@ pub struct Window {
/// The current cursor state.
cursor_state: Arc<Mutex<CursorState>>,
+
+ /// The pixel format that has been used to create this window.
+ pixel_format: PixelFormat,
}
unsafe impl Send for Window {}
@@ -258,6 +262,10 @@ impl Window {
::Api::OpenGl
}
+ pub fn get_pixel_format(&self) -> PixelFormat {
+ self.pixel_format.clone()
+ }
+
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
diff --git a/src/window.rs b/src/window.rs
index bf040b0..dee4ce5 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -8,6 +8,7 @@ use CursorState;
use Event;
use GlRequest;
use MouseCursor;
+use PixelFormat;
use native_monitor::NativeMonitorId;
use gl_common;
@@ -388,6 +389,11 @@ impl Window {
self.window.get_api()
}
+ /// Returns the pixel format of this window.
+ pub fn get_pixel_format(&self) -> PixelFormat {
+ self.window.get_pixel_format()
+ }
+
/// Create a window proxy for this window, that can be freely
/// passed to different threads.
#[inline]
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index d58b2d2..db24312 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -12,6 +12,7 @@ use std::sync::{Arc, Mutex, Once, ONCE_INIT};
use Api;
use CursorState;
use GlRequest;
+use PixelFormat;
pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor};
@@ -732,6 +733,10 @@ impl Window {
::Api::OpenGl
}
+ pub fn get_pixel_format(&self) -> PixelFormat {
+ unimplemented!();
+ }
+
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}