From f9929fab2f3178cdbb5cd8bfb7492f942b766bbc Mon Sep 17 00:00:00 2001 From: Adam Badawy Date: Tue, 27 Oct 2015 03:07:37 -0400 Subject: Use mode when switching to fullscreen --- src/api/x11/window.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/api') 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 -- cgit v1.2.3