diff options
author | Adam Badawy <adambada@buffalo.edu> | 2015-10-27 03:07:37 -0400 |
---|---|---|
committer | Adam Badawy <adambada@buffalo.edu> | 2015-10-27 03:07:37 -0400 |
commit | f9929fab2f3178cdbb5cd8bfb7492f942b766bbc (patch) | |
tree | 0c3406f226848ad64b2bc23de81f3f2b58f7ac17 | |
parent | 4f8095816ee43e99fc131375817033bd75c7288e (diff) | |
download | glutin-f9929fab2f3178cdbb5cd8bfb7492f942b766bbc.tar.gz glutin-f9929fab2f3178cdbb5cd8bfb7492f942b766bbc.zip |
Use mode when switching to fullscreen
-rw-r--r-- | src/api/x11/window.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs index c8c0bf7..3da4e7b 100644 --- a/src/api/x11/window.rs +++ b/src/api/x11/window.rs @@ -435,16 +435,6 @@ impl Window { window_attributes |= ffi::CWBackPixel; } - // switching to fullscreen - // if let Some(mut mode_to_switch_to) = mode_to_switch_to { - // window_attributes |= ffi::CWOverrideRedirect; - // unsafe { - // (display.xf86vmode.XF86VidModeSwitchToMode)(display.display, screen_id, &mut mode_to_switch_to); - // (display.xf86vmode.XF86VidModeSetViewPort)(display.display, screen_id, 0, 0); - // set_win_attr.override_redirect = 1; - // } - // } - // finally creating the window let window = unsafe { let win = (display.xlib.XCreateWindow)(display.display, root, 0, 0, dimensions.0 as libc::c_uint, @@ -571,6 +561,22 @@ impl Window { &mut x_event as *mut _ ); } + + if let Some(mut mode_to_switch_to) = mode_to_switch_to { + unsafe { + (display.xf86vmode.XF86VidModeSwitchToMode)( + display.display, + screen_id, + &mut mode_to_switch_to + ); + } + } + else { + println!("[glutin] Unexpected state: `mode` is None creating fullscreen window"); + } + unsafe { + (display.xf86vmode.XF86VidModeSetViewPort)(display.display, screen_id, 0, 0); + } } // finish creating the OpenGL context |