forked from rust-windowing/glutin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to make the new blur-behind functionality of winit work.
- Loading branch information
Showing
5 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
extern crate glutin; | ||
|
||
mod support; | ||
|
||
use glutin::{GlContext, dpi::LogicalSize}; | ||
use glutin::os::macos::{WindowExt, BlurMaterial}; | ||
|
||
fn main() { | ||
let mut events_loop = glutin::EventsLoop::new(); | ||
let window = glutin::WindowBuilder::new() | ||
.with_title("A fantastic window!") | ||
//.with_decorations(false) | ||
.with_blur(true); | ||
let context = glutin::ContextBuilder::new(); | ||
let gl_window = glutin::GlWindow::new(window, context, &events_loop).unwrap(); | ||
gl_window.set_blur_material(BlurMaterial::Dark); | ||
|
||
let _ = unsafe { gl_window.make_current() }; | ||
|
||
println!("Pixel format of the window's GL context: {:?}", gl_window.get_pixel_format()); | ||
|
||
let gl = support::load(&gl_window); | ||
|
||
events_loop.run_forever(|event| { | ||
println!("{:?}", event); | ||
match event { | ||
glutin::Event::WindowEvent { event, .. } => match event { | ||
glutin::WindowEvent::CloseRequested => return glutin::ControlFlow::Break, | ||
glutin::WindowEvent::Resized(LogicalSize { width: w, height: h }) => gl_window.resize(w as u32, h as u32), | ||
_ => (), | ||
}, | ||
_ => (), | ||
} | ||
|
||
gl.draw_frame([0.0, 0.0, 0.0, 0.0]); | ||
let _ = gl_window.swap_buffers(); | ||
glutin::ControlFlow::Continue | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,8 @@ pub use winit::{ | |
WindowId, | ||
}; | ||
|
||
pub use winit::dpi; | ||
|
||
use std::io; | ||
|
||
mod api; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters