aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/win32/mod.rs
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 14:42:05 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-09-23 13:11:47 +0200
commitaa9cb99929ee1893699184ded888b2586455f016 (patch)
treeb16503dbfe2248beeed0f7d82b150e64e6453043 /src/api/win32/mod.rs
parent3820d307a3f23828790e8a46a9c46849592104d6 (diff)
downloadglutin-aa9cb99929ee1893699184ded888b2586455f016.tar.gz
glutin-aa9cb99929ee1893699184ded888b2586455f016.zip
Add #[inline] attributes
Diffstat (limited to 'src/api/win32/mod.rs')
-rw-r--r--src/api/win32/mod.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/api/win32/mod.rs b/src/api/win32/mod.rs
index 235fa2f..0bc36a7 100644
--- a/src/api/win32/mod.rs
+++ b/src/api/win32/mod.rs
@@ -71,6 +71,7 @@ enum Context {
pub struct WindowWrapper(pub winapi::HWND, pub winapi::HDC);
impl Drop for WindowWrapper {
+ #[inline]
fn drop(&mut self) {
unsafe {
user32::DestroyWindow(self.0);
@@ -84,6 +85,7 @@ pub struct WindowProxy {
}
impl WindowProxy {
+ #[inline]
pub fn wakeup_event_loop(&self) {
unsafe {
user32::PostMessageA(self.hwnd, *WAKEUP_MSG_ID, 0, 0);
@@ -119,12 +121,14 @@ impl Window {
}
}
+ #[inline]
pub fn show(&self) {
unsafe {
user32::ShowWindow(self.window.0, winapi::SW_SHOW);
}
}
+ #[inline]
pub fn hide(&self) {
unsafe {
user32::ShowWindow(self.window.0, winapi::SW_HIDE);
@@ -158,6 +162,7 @@ impl Window {
}
/// See the docs in the crate root file.
+ #[inline]
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
let mut rect: winapi::RECT = unsafe { mem::uninitialized() };
@@ -172,6 +177,7 @@ impl Window {
}
/// See the docs in the crate root file.
+ #[inline]
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
let mut rect: winapi::RECT = unsafe { mem::uninitialized() };
@@ -196,11 +202,13 @@ impl Window {
}
}
+ #[inline]
pub fn create_window_proxy(&self) -> WindowProxy {
WindowProxy { hwnd: self.window.0 }
}
/// See the docs in the crate root file.
+ #[inline]
pub fn poll_events(&self) -> PollEventsIterator {
PollEventsIterator {
window: self,
@@ -208,12 +216,14 @@ impl Window {
}
/// See the docs in the crate root file.
+ #[inline]
pub fn wait_events(&self) -> WaitEventsIterator {
WaitEventsIterator {
window: self,
}
}
+ #[inline]
pub fn platform_display(&self) -> *mut libc::c_void {
// What should this return on win32?
// It could be GetDC(NULL), but that requires a ReleaseDC()
@@ -221,13 +231,16 @@ impl Window {
ptr::null_mut()
}
+ #[inline]
pub fn platform_window(&self) -> *mut libc::c_void {
self.window.0 as *mut libc::c_void
}
+ #[inline]
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
+ #[inline]
pub fn set_cursor(&self, _cursor: MouseCursor) {
unimplemented!()
}
@@ -297,6 +310,7 @@ impl Window {
res
}
+ #[inline]
pub fn hidpi_factor(&self) -> f32 {
1.0
}
@@ -322,6 +336,7 @@ impl Window {
}
impl GlContext for Window {
+ #[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
match self.context {
Context::Wgl(ref c) => c.make_current(),
@@ -329,6 +344,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn is_current(&self) -> bool {
match self.context {
Context::Wgl(ref c) => c.is_current(),
@@ -336,6 +352,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
match self.context {
Context::Wgl(ref c) => c.get_proc_address(addr),
@@ -343,6 +360,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn swap_buffers(&self) -> Result<(), ContextError> {
match self.context {
Context::Wgl(ref c) => c.swap_buffers(),
@@ -350,6 +368,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn get_api(&self) -> Api {
match self.context {
Context::Wgl(ref c) => c.get_api(),
@@ -357,6 +376,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn get_pixel_format(&self) -> PixelFormat {
match self.context {
Context::Wgl(ref c) => c.get_pixel_format(),
@@ -372,6 +392,7 @@ pub struct PollEventsIterator<'a> {
impl<'a> Iterator for PollEventsIterator<'a> {
type Item = Event;
+ #[inline]
fn next(&mut self) -> Option<Event> {
self.window.events_receiver.try_recv().ok()
}
@@ -384,12 +405,14 @@ pub struct WaitEventsIterator<'a> {
impl<'a> Iterator for WaitEventsIterator<'a> {
type Item = Event;
+ #[inline]
fn next(&mut self) -> Option<Event> {
self.window.events_receiver.recv().ok()
}
}
impl Drop for Window {
+ #[inline]
fn drop(&mut self) {
unsafe {
// we don't call MakeCurrent(0, 0) because we are not sure that the context