diff options
author | David Partouche <contact@manateedev.com> | 2014-09-04 11:38:33 +0200 |
---|---|---|
committer | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-09-19 20:29:28 +0200 |
commit | 55ebd4935ec649083e281cf2fa1abdcf224b7faa (patch) | |
tree | eae18a57a964bbf3b4856ac048fb1e8967f33bb2 | |
parent | ac74db979c9e1daa73c5f232e9a144e9f355990a (diff) | |
download | glutin-55ebd4935ec649083e281cf2fa1abdcf224b7faa.tar.gz glutin-55ebd4935ec649083e281cf2fa1abdcf224b7faa.zip |
Added fullscreen support for X11
-rw-r--r-- | src/lib.rs | 3 | ||||
-rw-r--r-- | src/x11/mod.rs | 6 |
2 files changed, 6 insertions, 3 deletions
@@ -58,6 +58,7 @@ pub struct WindowBuilder { title: String, monitor: Option<winimpl::MonitorID>, gl_version: Option<(uint, uint)>, + is_fullscreen: bool, } impl WindowBuilder { @@ -68,6 +69,7 @@ impl WindowBuilder { title: "gl-init-rs window".to_string(), monitor: None, gl_version: None, + is_fullscreen: false, } } @@ -91,6 +93,7 @@ impl WindowBuilder { pub fn with_fullscreen(mut self, monitor: MonitorID) -> WindowBuilder { let MonitorID(monitor) = monitor; self.monitor = Some(monitor); + self.is_fullscreen = true; self } diff --git a/src/x11/mod.rs b/src/x11/mod.rs index 0f5f557..97552b0 100644 --- a/src/x11/mod.rs +++ b/src/x11/mod.rs @@ -129,7 +129,7 @@ impl Window { }; let mut window_attributes = ffi::CWBorderPixel | ffi::CWColormap | ffi:: CWEventMask; - if builder.monitor.is_some() { + if builder.is_fullscreen { window_attributes |= ffi::CWOverrideRedirect; unsafe { ffi::XF86VidModeSwitchToMode(display, screen_id, *modes.offset(best_mode as int)); @@ -140,7 +140,7 @@ impl Window { // finally creating the window let window = unsafe { - let win = ffi::XCreateWindow(display, root, 0, 0, dimensions.val0() as libc::c_uint, + let win = ffi::XCreateWindow(display, root, 50, 50, dimensions.val0() as libc::c_uint, dimensions.val1() as libc::c_uint, 0, visual_infos.depth, ffi::InputOutput, visual_infos.visual, window_attributes, &mut set_win_attr); @@ -251,7 +251,7 @@ impl Window { wm_delete_window: wm_delete_window, xf86_desk_mode: xf86_desk_mode, screen_id: screen_id, - is_fullscreen: builder.monitor.is_some(), + is_fullscreen: builder.is_fullscreen, }; // calling glViewport |